New submission from Antony Lee <[email protected]>:
The following example crashes Python 3.6:
from functools import partialmethod
import inspect
class T:
g = partialmethod((lambda self, x: x), 1)
print(T().g()) # Correctly returns 1.
print(T.g(T())) # Correctly returns 1.
print(inspect.signature(T.g)) # Crashes.
with
File "/usr/lib/python3.6/inspect.py", line 3036, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
File "/usr/lib/python3.6/inspect.py", line 2786, in from_callable
follow_wrapper_chains=follow_wrapped)
File "/usr/lib/python3.6/inspect.py", line 2254, in
_signature_from_callable
assert first_wrapped_param is not sig_params[0]
IndexError: tuple index out of range
----------
components: Library (Lib)
messages: 313309
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: inspect.signature crashes on unbound partialmethods
versions: Python 3.6
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue33009>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com