Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyPy3.10: inspect.signature(types.CodeUtil)ValueError: no signature found for builtin type <class 'code'> #4033

Open
gitlab-importer opened this issue Nov 20, 2023 · 6 comments

Comments

@gitlab-importer
Copy link

In Heptapod by @mgorny on Nov 20, 2023, 14:31

Found in the wild in ipyparallel: ipython/ipyparallel#845

$ python3.10 -c 'import inspect, types; inspect.signature(types.CodeType)'
$ pypy3.10 -c 'import inspect, types; inspect.signature(types.CodeType)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/pypy3.10/inspect.py", line 3291, in signature
    return Signature.from_callable(obj, follow_wrapped=follow_wrapped,
  File "/usr/lib/pypy3.10/inspect.py", line 3039, in from_callable
    return _signature_from_callable(obj, sigcls=cls,
  File "/usr/lib/pypy3.10/inspect.py", line 2573, in _signature_from_callable
    raise ValueError(
ValueError: no signature found for builtin type <class 'code'>
@gitlab-importer
Copy link
Author

In Heptapod by @cfbolz on Nov 22, 2023, 09:54

looking into this, thanks for reporting!

@gitlab-importer
Copy link
Author

In Heptapod by @cfbolz on Nov 22, 2023, 10:44

mentioned in commit 21138b66fed08ddd443e159a2a003e627b21bb16

@gitlab-importer
Copy link
Author

In Heptapod by @cfbolz on Nov 22, 2023, 10:46

the above commit should fix the problem (there are other problems in inspect, like the fact that we don't parse the docstring of user-defined classes to build .__text_signature__, but I'd wait until somebody reports those).

@gitlab-importer
Copy link
Author

In Heptapod by @cfbolz on Nov 22, 2023, 10:46

mentioned in commit 9a7c6c8174ce0e2db9ea891f12b6c1eb842510de

@gitlab-importer
Copy link
Author

In Heptapod by @mattip on Nov 23, 2023, 07:43

The commit changed inspect.signature for user defined subclasses. This is causing a new test failure for idlelib. For this class:

class List(list): "List() doc"

inspect.signature used to return

(iterable=(), /)
List() doc

but now returns

<Signature (*args, **keywords)>

@gitlab-importer
Copy link
Author

In Heptapod by @mattip on Dec 24, 2023, 17:15

Here is another issue caused by this chagne pydantic/pydantic#8433

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant