[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

hongweipeng report at bugs.python.org
Fri Jul 16 05:25:23 EDT 2021


hongweipeng <hongweichen8888 at sina.com> added the comment:

>>> from datetime import timedelta as a
>>> from _datetime import timedelta as b
>>> a is b
True
>>>

`timedelta` is a C-level class, so inspect.signature(timedelta) is the same with inspect.signature(int).

But `signature` allow C-level function such as `inspect.signature(len)`, I think one way to improve is to use the C-level function when the python-level function cannot be found.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40897>
_______________________________________


More information about the Python-bugs-list mailing list