This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mauvilsa
Recipients FFY00, ezyang, gvanrossum, hongweipeng, jonathan.slenders, mauvilsa, ralf.gommers, serhiy.storchaka, yselivanov
Date 2021-07-10.12:45:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1625921129.3.0.809934040551.issue40897@roundup.psfhosted.org>
In-reply-to
Content
I think this is affecting me or it is a new similar issue. And it is not only for python 3.9, but also from 3.6 up. I am working on making code configurable based on signatures (see https://jsonargparse.readthedocs.io/en/stable/#classes-methods-and-functions). Now we need this to work for datetime.timedelta which defines parameters in __new__ instead of __init__. The following happens:

>>> from datetime import timedelta
>>> import inspect
>>> inspect.signature(timedelta.__new__)
<Signature (*args, **kwargs)>
>>> inspect.signature(timedelta.__init__)
<Signature (self, /, *args, **kwargs)>
>>> inspect.signature(timedelta)
...
ValueError: no signature found for builtin type <class 'datetime.timedelta'>

I am expecting to get parameters for days, seconds, microseconds, milliseconds, minutes, hours and weeks, see https://github.com/python/cpython/blob/bfe544d2f2c2e7a7c03a764bed3276a1e27a0f5c/Lib/datetime.py#L461-L462.

Hopefully this gives some insight into what should be done. Independent from the fix, I would like to know if currently there is any way I can get the signature for __new__ that I could use until there is a proper fix for it.
History
Date User Action Args
2021-07-10 12:45:29mauvilsasetrecipients: + mauvilsa, gvanrossum, ezyang, serhiy.storchaka, yselivanov, ralf.gommers, jonathan.slenders, hongweipeng, FFY00
2021-07-10 12:45:29mauvilsasetmessageid: <1625921129.3.0.809934040551.issue40897@roundup.psfhosted.org>
2021-07-10 12:45:29mauvilsalinkissue40897 messages
2021-07-10 12:45:29mauvilsacreate