Message397248
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. |
|
Date |
User |
Action |
Args |
2021-07-10 12:45:29 | mauvilsa | set | recipients:
+ mauvilsa, gvanrossum, ezyang, serhiy.storchaka, yselivanov, ralf.gommers, jonathan.slenders, hongweipeng, FFY00 |
2021-07-10 12:45:29 | mauvilsa | set | messageid: <1625921129.3.0.809934040551.issue40897@roundup.psfhosted.org> |
2021-07-10 12:45:29 | mauvilsa | link | issue40897 messages |
2021-07-10 12:45:29 | mauvilsa | create | |
|