[issue33009] inspect.signature crashes on unbound partialmethods
Antony Lee
report at bugs.python.org
Tue Mar 6 02:33:47 EST 2018
New submission from Antony Lee <anntzer.lee at gmail.com>:
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 <report at bugs.python.org>
<https://bugs.python.org/issue33009>
_______________________________________
More information about the Python-bugs-list
mailing list