prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.23k stars 715 forks source link

Cannot get_param_names from "CompiledInstance" #1072

Open Peder2911 opened 4 years ago

Peder2911 commented 4 years ago

I think i have encountered a bug.

I am just doing some interactive work testing numpy. When i run the following code:

import numpy as np
def isbigger(x,y):
   if x > y:
      return x
   else:
      return 0

np.vectorize(isbigger)((np.random.rand(100,100)*10)-5), 0)

I get the following exception:

Unhandled exception in event loop:
  File "/home/peder/default_venv/lib/python3.6/site-packages/prompt_toolkit/eventloop/utils.py", line 35, in run
    result = self.target()
  File "/home/peder/default_venv/lib/python3.6/site-packages/ptpython/python_input.py", line 702, in run
    string = signatures[0].docstring()
  File "/home/peder/default_venv/lib/python3.6/site-packages/jedi/api/classes.py", line 240, in docstring
    return _Help(self._name).docstring(fast=fast, raw=raw)
  File "/home/peder/default_venv/lib/python3.6/site-packages/jedi/api/classes.py", line 761, in docstring
    signature_text = _format_signatures(value)
  File "/home/peder/default_venv/lib/python3.6/site-packages/jedi/api/classes.py", line 720, in _format_signatures
    for signature in value.get_signatures()
  File "/home/peder/default_venv/lib/python3.6/site-packages/jedi/api/classes.py", line 720, in <genexpr>
    for signature in value.get_signatures()
  File "/home/peder/default_venv/lib/python3.6/site-packages/jedi/inference/signature.py", line 30, in to_string
    s = self.name.string_name + '(' + ', '.join(param_strings()) + ')'
  File "/home/peder/default_venv/lib/python3.6/site-packages/jedi/inference/signature.py", line 12, in param_strings
    for n in self.get_param_names(resolve_stars=True):
  File "/home/peder/default_venv/lib/python3.6/site-packages/jedi/inference/signature.py", line 51, in get_param_names
    param_names = self._function_value.get_param_names()

Exception 'CompiledInstance' object has no attribute 'get_param_names'
Peder2911 commented 4 years ago

Wow, now the same exception is popping up all of the time. What is going on?

Peder2911 commented 4 years ago

It seems to happen whenever i use np.vectorize. Probably something about not getting the necessary information from the function?