Jedi: Error since 0.15.2: TypeError: py__call__() missing 1 required positional argument: 'arguments'

Created on 6 Jan 2020  路  7Comments  路  Source: davidhalter/jedi

import os
import time
import jedi
print(jedi.__version__)
from jedi import Script
source = r"""
#!/usr/bin/env python3

import numpy as np
a = np.array(3)
b = []
b.""".strip()
lines = source.strip().split('\n')

ret = Script(source, len(lines), len(lines[-1]), None).completions()
y = [[x.name, x.type, x.docstring(), x.module_path, x.line] for x in ret]
print(y)

throws:

Traceback (most recent call last):
  File "x.py", line 19, in <module>
    y = [[x.name, x.type, x.docstring(), x.module_path, x.line] for x in ret]
  File "x.py", line 19, in <listcomp>
    y = [[x.name, x.type, x.docstring(), x.module_path, x.line] for x in ret]
  File "/home/USER/.local/lib/python3.8/site-packages/jedi/api/classes.py", line 588, in docstring
    return super(Completion, self).docstring(raw=raw, fast=fast)
  File "/home/USER/.local/lib/python3.8/site-packages/jedi/api/classes.py", line 249, in docstring
    signature_text = self._get_docstring_signature()
  File "/home/USER/.local/lib/python3.8/site-packages/jedi/api/classes.py", line 606, in _get_docstring_signature
    return super(Completion, self)._get_docstring_signature()
  File "/home/USER/.local/lib/python3.8/site-packages/jedi/api/classes.py", line 261, in _get_docstring_signature
    for signature in self._get_signatures(for_docstring=True)
  File "/home/USER/.local/lib/python3.8/site-packages/jedi/api/classes.py", line 501, in _get_signatures
    return [sig for name in names for sig in name.infer().get_signatures()]
  File "/home/USER/.local/lib/python3.8/site-packages/jedi/api/classes.py", line 501, in <listcomp>
    return [sig for name in names for sig in name.infer().get_signatures()]
  File "/home/USER/.local/lib/python3.8/site-packages/jedi/inference/base_value.py", line 411, in get_signatures
    return [sig for c in self._set for sig in c.get_signatures()]
  File "/home/USER/.local/lib/python3.8/site-packages/jedi/inference/base_value.py", line 411, in <listcomp>
    return [sig for c in self._set for sig in c.get_signatures()]
  File "/home/USER/.local/lib/python3.8/site-packages/jedi/inference/value/klass.py", line 218, in get_signatures
    init_funcs = self.py__call__().py__getattribute__('__init__')
TypeError: py__call__() missing 1 required positional argument: 'arguments'

in github master and 0.15.2.
The error does not exist in 0.15.1.

bug

All 7 comments

Thanks for finding and reporting this!

Thanks for the quick fix!

Is it possible to merge this fix back into the 15.x release? It causes a crash with python language server, which depends on 15.2 still.

There's not really a reason to do that. They can just update to 0.16.x or 0.17.x. There's almost no changes that affect the API, it's mostly new features.

Just a thought -- given that #1551 affects 0.17.0 sufficiently to actually make the upgrade to 0.17.0 breaking for some use-cases, maybe it's worth putting out a 0.17.1 which includes both the fix to this issue and also the fix to #1551? That would provide a route for upgrades which is a little bit easier.

I don't know what other changes have happened since 0.15 though, so this may be moot if there are other changes anyway.

I'm very happy to put out a 0.17.1 very soon. Wanted to do it anyway. The only thing I want to implement (or sombody else can also do it) is Django signature support.

I've created #1587 to record that the signature support is outstanding.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DonJayamanne picture DonJayamanne  路  6Comments

blueyed picture blueyed  路  4Comments

KyleMoser picture KyleMoser  路  6Comments

dpavlic picture dpavlic  路  7Comments

zero323 picture zero323  路  7Comments