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:
Gregory P. Smith 2019-09-13 17:13:51 +01:00 committed by GitHub
parent 2ccb50cf77
commit 5b9ff7a0dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View file

@ -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))