Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3.8.3/traceback.py:312, AttributeError: 'KeyError' object has no attribute 'tb_frame' #85778

Closed
abaelhe mannequin opened this issue Aug 22, 2020 · 2 comments
Closed
Labels
3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@abaelhe
Copy link
Mannequin

abaelhe mannequin commented Aug 22, 2020

BPO 41612
Nosy @abaelhe

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2020-08-22.05:50:20.594>
created_at = <Date 2020-08-22.05:30:15.720>
labels = ['3.8', 'type-bug', 'library']
title = "python3.8.3/traceback.py:312, AttributeError: 'KeyError' object has no attribute 'tb_frame'"
updated_at = <Date 2020-08-22.05:50:20.592>
user = 'https://github.com/abaelhe'

bugs.python.org fields:

activity = <Date 2020-08-22.05:50:20.592>
actor = 'abaelhe'
assignee = 'none'
closed = True
closed_date = <Date 2020-08-22.05:50:20.594>
closer = 'abaelhe'
components = ['Library (Lib)']
creation = <Date 2020-08-22.05:30:15.720>
creator = 'abaelhe'
dependencies = []
files = []
hgrepos = []
issue_num = 41612
keywords = []
message_count = 2.0
messages = ['375783', '375784']
nosy_count = 1.0
nosy_names = ['abaelhe']
pr_nums = []
priority = 'normal'
resolution = 'third party'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue41612'
versions = ['Python 3.8']

@abaelhe
Copy link
Mannequin Author

abaelhe mannequin commented Aug 22, 2020

/opt/conda/lib/python3.8/site-packages/prompt_toolkit/shortcuts/prompt.py in prompt(self, message, editing_mode, refresh_interval, vi_mode, lexer, completer, complete_in_thread, is_password, key_bindings, bottom_toolbar, style, color_depth, include_default_pygments_style, style_transformation, swap_light_and_dark_colors, rprompt, multiline, prompt_continuation, wrap_lines, enable_history_search, search_ignore_case, complete_while_typing, validate_while_typing, complete_style, auto_suggest, validator, clipboard, mouse_support, input_processors, reserve_space_for_menu, enable_system_prompt, enable_suspend, enable_open_in_editor, tempfile_suffix, tempfile, default, accept_default, pre_run, set_exception_handler)
992 return get_event_loop().run_until_complete(self._dumb_prompt(self.message))
993
--> 994 return self.app.run(set_exception_handler=set_exception_handler)
995
996 async def _dumb_prompt(self, message: AnyFormattedText = "") -> _T:

/opt/conda/lib/python3.8/site-packages/prompt_toolkit/application/application.py in run(self, pre_run, set_exception_handler)
809 set_event_loop(loop)
810
--> 811 return loop.run_until_complete(
812 self.run_async(pre_run=pre_run, set_exception_handler=set_exception_handler)
813 )

/opt/conda/lib/python3.8/asyncio/base_events.py in run_until_complete(self, future)
614 raise RuntimeError('Event loop stopped before Future completed.')
615
--> 616 return future.result()
617
618 def stop(self):

/opt/conda/lib/python3.8/site-packages/prompt_toolkit/application/application.py in run_async(self, pre_run, set_exception_handler)
776 loop.set_exception_handler(previous_exc_handler)
777
--> 778 return await _run_async2()
779
780 def run(

/opt/conda/lib/python3.8/site-packages/prompt_toolkit/application/application.py in _run_async2()
764 # KeyboardInterrupt, we still want to wait for the
765 # background tasks.
--> 766 await self.cancel_and_wait_for_background_tasks()
767
768 # Set the _is_running flag to False. Normally this

/opt/conda/lib/python3.8/site-packages/prompt_toolkit/application/application.py in cancel_and_wait_for_background_tasks(self)
865 for task in self.background_tasks:
866 try:
--> 867 await task
868 except CancelledError:
869 pass

/opt/conda/lib/python3.8/site-packages/prompt_toolkit/buffer.py in new_coroutine(*a, **kw)
1852 while True:
1853 try:
-> 1854 await coroutine(*a, **kw)
1855 except _Retry:
1856 continue

/opt/conda/lib/python3.8/site-packages/prompt_toolkit/buffer.py in async_completer(select_first, select_last, insert_common_part, complete_event)
1681 return self.complete_state == complete_state
1682
-> 1683 async for completion in self.completer.get_completions_async(
1684 document, complete_event
1685 ):

/opt/conda/lib/python3.8/site-packages/prompt_toolkit/completion/base.py in get_completions_async(self, document, complete_event)
267 completer = self.get_completer() or DummyCompleter()
268
--> 269 async for completion in completer.get_completions_async(
270 document, complete_event
271 ):

/opt/conda/lib/python3.8/site-packages/prompt_toolkit/completion/base.py in get_completions_async(self, document, complete_event)
194 Asynchronous generator of :class:`.Completion` objects.
195 """
--> 196 for item in self.get_completions(document, complete_event):
197 yield item
198

/opt/conda/lib/python3.8/site-packages/IPython/terminal/ptutils.py in get_completions(self, document, complete_event)
114 except Exception as e:
115 from traceback import print_tb
--> 116 print_tb(e)
117
118 @staticmethod

/opt/conda/lib/python3.8/traceback.py in print_tb(tb, limit, file)
51 method.
52 """
---> 53 print_list(extract_tb(tb, limit=limit), file=file)
54
55 def format_tb(tb, limit=None):

/opt/conda/lib/python3.8/traceback.py in extract_tb(tb, limit)
70 whitespace stripped; if the source is not available it is None.
71 """
---> 72 return StackSummary.extract(walk_tb(tb), limit=limit)
73
74 #

/opt/conda/lib/python3.8/traceback.py in extract(klass, frame_gen, limit, lookup_lines, capture_locals)
345 result = klass()
346 fnames = set()
--> 347 for f, lineno in frame_gen:
348 co = f.f_code
349 filename = co.co_filename

/opt/conda/lib/python3.8/traceback.py in walk_tb(tb)
310 """
311 while tb is not None:
--> 312 yield tb.tb_frame, tb.tb_lineno
313 tb = tb.tb_next
314

AttributeError: 'KeyError' object has no attribute 'tb_frame'

@abaelhe abaelhe mannequin added 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Aug 22, 2020
@abaelhe
Copy link
Mannequin Author

abaelhe mannequin commented Aug 22, 2020

This is a bug caused by IPython:

/opt/conda/lib/python3.8/site-packages/IPython/terminal/ptutils.py in get_completions(self, document, complete_event)
114 except Exception as e:
115 from traceback import print_tb
--> 116 print_tb(e)
117
118 @staticmethod

######################################################################
# Simulation investigation for above KeyError:
In [3]: def fun():
...: try:
...: s = {}
...: k = s['0']
...: except Exception as e:
...: import sys
...: from traceback import print_tb
...: exc_type, exc_value, exc_traceback = sys.exc_info()
...: print_tb(exc_traceback)
...:

In [4]: fun()
File "<ipython-input-3-d3df30294ed8>", line 4, in fun
k = s['0']

@abaelhe abaelhe mannequin closed this as completed Aug 22, 2020
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

0 participants