Closed ColinDuquesnoy closed 10 years ago
Thank you for the report. I've seen this before, but I might have forgotten about it...
Hi, this seems to be fixed by your last commits, for builtins only:
colin@mint16 ~ $ python3
Python 3.3.2+ (default, Oct 9 2013, 14:56:03)
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information
>>> import jedi
>>> print(jedi.__version__)
0.8.0-alpha1
>>> code = "open("
>>> s = jedi.Script(code)
>>> defs = s.call_signatures()
>>> for call_def in defs:
... for p in call_def.params:
... print(p)
...
<Param: file @48,9>
<Param: mode = 'r' @48,15>
<Param: buffering = -1 @48,25>
<Param: encoding = None @48,39>
<Param: errors = None @48,54>
<Param: newline = None @48,67>
<Param: closefd = True @48,81>
>>>
But that does not work on real compiled module (PyQt4):
colin@mint16 ~ $ python3
Python 3.3.2+ (default, Oct 9 2013, 14:56:03)
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import jedi
>>> print(jedi.__version__)
0.8.0-alpha1
>>> code = "from PyQt4.QtGui import QApplication; QApplication.instance("
>>> s = jedi.Script(code)
>>> defs = s.call_signatures()
>>> for call_def in defs:
... for p in call_def.params:
... print(p)
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/home/colin/Dev/jedi/jedi/api/classes.py", line 560, in params
return sub.params[1:] # ignore self
AttributeError: 'CompiledObject' object has no attribute 'params'
>>>
open
is a "faked" builtin, which means there's a python implementation in evaluate/fake/fake/builtins.pym
. This hasn't been fixed, yet.
Ok I see. If I can find some time this evening, I will try to look into this issue.
Look at evalutate.compiled.CompiledObject._parse_function_doc
. That function returns the parsed params. You probably just have to create a params
property..
Hi,
I have an issue when I try to print the parameters of a call def.
This used to work with Jedi 0.7.0. The error happens with both python 2.7 and python 3.3.
For example, running this script :
leads to the following traceback: