Mauricio Villegas <mauricio_vi...@yahoo.com> added the comment:

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.

----------
nosy: +mauvilsa

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40897>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to