Ipython: unknown crash

Created on 27 Oct 2020  ·  3Comments  ·  Source: ipython/ipython

OS: Ubuntu 20.10 on KDE
Terminal: Konsole
Shell: Zsh
$LANG = en_US.UTF-8
Not appear every time, but seems appear after stay no opertion for a long time

$ ipython3
Python 3.8.6 (default, Sep 25 2020, 09:36:53) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.17.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from functools import wraps

In [2]: def log(func):
   ...:     @wraps
   ...:     def wapper(*args, **kvargs):
   ...:         print('start...')
   ...:         result = func(*args, **kvargs)
   ...:         print('end...')
   ...:         return result
   ...:     return wapper
   ...: 
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/jedi/cache.py", line 109, in wrapper
    return dct[key]
KeyError: ((), frozenset())

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/jedi/cache.py", line 109, in wrapper
    return dct[key]
KeyError: ((), frozenset({('resolve_stars', True)}))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/IPython/terminal/ptutils.py", line 113, in get_completions
    yield from self._get_completions(body, offset, cursor_position, self.ipy_completer)
  File "/usr/lib/python3/dist-packages/IPython/terminal/ptutils.py", line 126, in _get_completions
    for c in completions:
  File "/usr/lib/python3/dist-packages/IPython/core/completer.py", line 438, in _deduplicate_completions
    completions = list(completions)
  File "/usr/lib/python3/dist-packages/IPython/core/completer.py", line 1818, in completions
    for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000):
  File "/usr/lib/python3/dist-packages/IPython/core/completer.py", line 1875, in _completions
    signature = _make_signature(jm)
  File "/usr/lib/python3/dist-packages/IPython/core/completer.py", line 991, in _make_signature
    return '(%s)'% ', '.join([f for f in (_formatparamchildren(p) for p in completion.params) if f])
  File "/usr/lib/python3/dist-packages/jedi/cache.py", line 111, in wrapper
    result = method(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/jedi/api/classes.py", line 482, in params
    for n in signature.get_param_names(resolve_stars=True)
  File "/usr/lib/python3/dist-packages/jedi/cache.py", line 111, in wrapper
    result = method(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/jedi/inference/signature.py", line 96, in get_param_names
    params = process_params(params)
  File "/usr/lib/python3/dist-packages/jedi/inference/utils.py", line 20, in wrapper
    return list(func(*args, **kwargs))
  File "/usr/lib/python3/dist-packages/jedi/inference/star_args.py", line 122, in process_params
    kwarg_callables = list(_iter_nodes_for_param(p))
  File "/usr/lib/python3/dist-packages/jedi/inference/star_args.py", line 41, in _iter_nodes_for_param
    values = _to_callables(context, trailer)
  File "/usr/lib/python3/dist-packages/jedi/inference/star_args.py", line 69, in _to_callables
    values = context.infer_node(atom_expr.children[index])
  File "/usr/lib/python3/dist-packages/jedi/inference/context.py", line 222, in infer_node
    return infer_node(self, node)
  File "/usr/lib/python3/dist-packages/jedi/inference/syntax_tree.py", line 137, in infer_node
    return _infer_node_if_inferred(context, element)
  File "/usr/lib/python3/dist-packages/jedi/inference/syntax_tree.py", line 150, in _infer_node_if_inferred
    return _infer_node_cached(context, element)
  File "/usr/lib/python3/dist-packages/jedi/inference/cache.py", line 43, in wrapper
    rv = function(obj, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/jedi/inference/syntax_tree.py", line 155, in _infer_node_cached
    return _infer_node(context, element)
  File "/usr/lib/python3/dist-packages/jedi/debug.py", line 82, in wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/jedi/inference/syntax_tree.py", line 63, in wrapper
    return func(context, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/jedi/inference/syntax_tree.py", line 165, in _infer_node
    return infer_atom(context, element)
  File "/usr/lib/python3/dist-packages/jedi/inference/syntax_tree.py", line 290, in infer_atom
    return context.py__getattribute__(atom, position=position)
  File "/usr/lib/python3/dist-packages/jedi/inference/context.py", line 75, in py__getattribute__
    values = ValueSet.from_sets(name.infer() for name in names)
  File "/usr/lib/python3/dist-packages/jedi/common/value.py", line 69, in from_sets
    for set_ in sets:
  File "/usr/lib/python3/dist-packages/jedi/inference/context.py", line 75, in <genexpr>
    values = ValueSet.from_sets(name.infer() for name in names)
  File "/usr/lib/python3/dist-packages/jedi/plugins/__init__.py", line 21, in wrapper
    return built_functions[public_name](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/jedi/plugins/pytest.py", line 61, in wrapper
    return func(param_name)
  File "/usr/lib/python3/dist-packages/jedi/inference/names.py", line 511, in infer
    values = dynamic_param_lookup(self.function_value, param.position_index)
  File "/usr/lib/python3/dist-packages/jedi/debug.py", line 82, in wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/jedi/inference/dynamic_params.py", line 47, in wrapper
    return func(function_value, param_index)
  File "/usr/lib/python3/dist-packages/jedi/inference/dynamic_params.py", line 91, in dynamic_param_lookup
    arguments_list = _search_function_arguments(module_context, funcdef, string_name)
  File "/usr/lib/python3/dist-packages/jedi/inference/cache.py", line 43, in wrapper
    rv = function(obj, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/jedi/inference/utils.py", line 20, in wrapper
    return list(func(*args, **kwargs))
  File "/usr/lib/python3/dist-packages/jedi/inference/dynamic_params.py", line 128, in _search_function_arguments
    for for_mod_context in module_contexts:
  File "/usr/lib/python3/dist-packages/jedi/inference/references.py", line 268, in get_module_contexts_containing_name
    for x in search_in_file_ios(inference_state, file_io_iterator, name,
  File "/usr/lib/python3/dist-packages/jedi/inference/references.py", line 279, in search_in_file_ios
    for file_io in file_io_iterator:
  File "/usr/lib/python3/dist-packages/jedi/inference/references.py", line 236, in _find_python_files_in_sys_path
    folder_io = file_io.get_parent_folder()
  File "/usr/lib/python3/dist-packages/jedi/file_io.py", line 62, in get_parent_folder
    return FolderIO(os.path.dirname(self.path))
  File "/usr/lib/python3.8/posixpath.py", line 152, in dirname
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/ipython3", line 11, in <module>
    load_entry_point('ipython==7.17.0', 'console_scripts', 'ipython3')()
  File "/usr/lib/python3/dist-packages/IPython/__init__.py", line 126, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/lib/python3/dist-packages/traitlets/config/application.py", line 664, in launch_instance
    app.start()
  File "/usr/lib/python3/dist-packages/IPython/terminal/ipapp.py", line 356, in start
    self.shell.mainloop()
  File "/usr/lib/python3/dist-packages/IPython/terminal/interactiveshell.py", line 564, in mainloop
    self.interact()
  File "/usr/lib/python3/dist-packages/IPython/terminal/interactiveshell.py", line 547, in interact
    code = self.prompt_for_code()
  File "/usr/lib/python3/dist-packages/IPython/terminal/interactiveshell.py", line 473, in prompt_for_code
    text = self.pt_app.prompt(
  File "/home/qcg/.local/lib/python3.8/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1013, in prompt
    return self.app.run(set_exception_handler=set_exception_handler)
  File "/home/qcg/.local/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 814, in run
    return loop.run_until_complete(
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/qcg/.local/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 781, in run_async
    return await _run_async2()
  File "/home/qcg/.local/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 769, in _run_async2
    await self.cancel_and_wait_for_background_tasks()
  File "/home/qcg/.local/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 870, in cancel_and_wait_for_background_tasks
    await task
  File "/home/qcg/.local/lib/python3.8/site-packages/prompt_toolkit/buffer.py", line 1854, in new_coroutine
    await coroutine(*a, **kw)
  File "/home/qcg/.local/lib/python3.8/site-packages/prompt_toolkit/buffer.py", line 1683, in async_completer
    async for completion in self.completer.get_completions_async(
  File "/home/qcg/.local/lib/python3.8/site-packages/prompt_toolkit/completion/base.py", line 269, in get_completions_async
    async for completion in completer.get_completions_async(
  File "/home/qcg/.local/lib/python3.8/site-packages/prompt_toolkit/completion/base.py", line 196, in get_completions_async
    for item in self.get_completions(document, complete_event):
  File "/usr/lib/python3/dist-packages/IPython/terminal/ptutils.py", line 116, in get_completions
    print_tb(e)
  File "/usr/lib/python3.8/traceback.py", line 53, in print_tb
    print_list(extract_tb(tb, limit=limit), file=file)
  File "/usr/lib/python3.8/traceback.py", line 72, in extract_tb
    return StackSummary.extract(walk_tb(tb), limit=limit)
  File "/usr/lib/python3.8/traceback.py", line 347, in extract
    for f, lineno in frame_gen:
  File "/usr/lib/python3.8/traceback.py", line 312, in walk_tb
    yield tb.tb_frame, tb.tb_lineno
AttributeError: 'TypeError' object has no attribute 'tb_frame'

If you suspect this is an IPython 7.17.0 bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at [email protected]

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True
$

Most helpful comment

I had the same issue - reverting jedi from 0.18.0 to 0.17.2 solved it for me.

All 3 comments

I have the same issue

'TypeError' object has no attribute 'tb_frame'

I had the same issue - reverting jedi from 0.18.0 to 0.17.2 solved it for me.

Possible duplicate of #12740 (or vice-versa)

Was this page helpful?
0 / 5 - 0 ratings