ipython / ipython/ipython

Tab completion Fraction(n,m).denomi<TAB> causes "Exception There are no params defined on this."

未关闭
#11,921 8 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
tab-completion
主要语言
Python
星标
16.8k
派生
4.5k
平均合并
1 天 2 小时
30 天内合并 PR
6

描述

Here is how to reproduce the problem:

```
$ ipython
Python 3.7.3 (default, Jun 11 2019, 18:15:26)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.5.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from fractions import Fraction as fr

In [2]: fr(2,3).denomi
```

Now, at this point press `TAB` and then the `In [2]...` line disappears and we get this:

```
Unhandled exception in event loop:
File "/usr/local/lib/python3.7/site-packages/prompt_toolkit/eventloop/coroutine.py", line 90, in step_next
new_f = coroutine.throw(exc)
File "/usr/local/lib/python3.7/site-packages/prompt_toolkit/buffer.py", line 1648, in new_coroutine
yield From(coroutine(*a, **kw))
File "/usr/local/lib/python3.7/site-packages/prompt_toolkit/eventloop/coroutine.py", line 90, in step_next
new_f = coroutine.throw(exc)
File "/usr/local/lib/python3.7/site-packages/prompt_toolkit/buffer.py", line 1500, in async_completer
cancel=lambda: not proceed()))
File "/usr/local/lib/python3.7/site-packages/prompt_toolkit/eventloop/coroutine.py", line 86, in step_next
new_f = coroutine.send(None)
File "/usr/local/lib/python3.7/site-packages/prompt_toolkit/eventloop/async_generator.py", line 114, in consume_async_generator
item = iterator.send(send)
File "/usr/local/lib/python3.7/site-packages/prompt_toolkit/completion/base.py", line 170, in get_completions_async
for item in self.get_completions(document, complete_event):
File "/usr/local/lib/python3.7/site-packages/IPython/terminal/ptutils.py", line 90, in get_completions
yield from self._get_completions(body, offset, cursor_position, self.ipy_completer)
File "/usr/local/lib/python3.7/site-packages/IPython/terminal/ptutils.py", line 100, in _get_completions
for c in completions:
File "/usr/local/lib/python3.7/site-packages/IPython/core/completer.py", line 445, in _deduplicate_completions
completions = list(completions)
File "/usr/local/lib/python3.7/site-packages/IPython/core/completer.py", line 1820, in completions
for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000):
File "/usr/local/lib/python3.7/site-packages/IPython/core/completer.py", line 1877, in _completions
signature = _make_signature(jm)
File "/usr/local/lib/python3.7/site-packages/IPython/core/completer.py", line 996, in _make_signature
return '(%s)'% ', '.join([f for f in (_formatparamchildren(p) for p in completion.params) if f])
File "/usr/local/lib/python3.7/site-packages/jedi/cache.py", line 143, in wrapper
result = method(self, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/jedi/api/classes.py", line 345, in params
raise AttributeError('There are no params defined on this.')

Exception There are no params defined on this.
Press ENTER to continue...
In [2]: fr(2,3).denomi
```

(The `ENTER` was already pressed, so the `In [2]...` line came back). You can see from the above listing that the version of Python is 3.7.3 and the version of IPython is 7.5.0.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。