prompt-toolkit / prompt-toolkit/python-prompt-toolkit

Cannot get_param_names from "CompiledInstance"

Open
#1,072 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

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'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the NumPy vectorize example in the issue and trace the failure through ptpython/python_input.py, jedi/api/classes.py, and jedi/inference/signature.py. Confirm which dependency or integration boundary produces the CompiledInstance error, then verify that the interactive traceback no longer occurs for this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.