mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
bpo-34706: Preserve subclassing in inspect.Signature.from_callable (GH-16108)
https://bugs.python.org/issue34706 Specifically in the case of a class that does not override its constructor signature inherited from object. These are Buck Evan @bukzor's changes cherrypicked from GH-9344.
This commit is contained in:
parent
2ccb50cf77
commit
5b9ff7a0dc
3 changed files with 11 additions and 3 deletions
|
|
@ -2367,7 +2367,7 @@ def _signature_from_callable(obj, *,
|
|||
if (obj.__init__ is object.__init__ and
|
||||
obj.__new__ is object.__new__):
|
||||
# Return a signature of 'object' builtin.
|
||||
return signature(object)
|
||||
return sigcls.from_callable(object)
|
||||
else:
|
||||
raise ValueError(
|
||||
'no signature found for builtin type {!r}'.format(obj))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue