[issue20308] inspect.Signature doesn't support user classes without __init__ or __new__
Larry Hastings
report at bugs.python.org
Sun Jan 19 22:52:39 CET 2014
New submission from Larry Hastings:
Boy was I surprised by this:
>>> class C: pass
...
>>> import inspect
>>> inspect.signature(C)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/larry/src/python/clinic_c_types_hacking/Lib/inspect.py", line 1557, in signature
raise ValueError('callable {!r} is not supported by signature'.format(obj))
ValueError: callable <class '__main__.C'> is not supported by signature
Why not? C is a callable object. If you can't find a __new__ or an __init__ in the class, its signature should be pretty predictable.
(It returns a signature if you add either a __new__, an __init__, or both.)
----------
components: Library (Lib)
messages: 208502
nosy: brett.cannon, larry, ncoghlan, yselivanov
priority: normal
severity: normal
stage: needs patch
status: open
title: inspect.Signature doesn't support user classes without __init__ or __new__
type: behavior
versions: Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20308>
_______________________________________
More information about the Python-bugs-list
mailing list