Closed
Description
Bug report
Bug description:
./python
Python 3.14.0a0 (heads/main-dirty:55402d3232, Jun 8 2024, 11:03:56) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import _datetime
>>> _datetime.date.fromtimestamp(None)
Traceback (most recent call last):
File "<python-input-1>", line 1, in <module>
_datetime.date.fromtimestamp(None)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
TypeError: 'NoneType' object cannot be interpreted as an integer
>>> import _pydatetime
>>> _pydatetime.date.fromtimestamp(None)
datetime.date(2024, 6, 8)
>>>
This happens because the _pydatetime.date.fromtimestamp
is using time.localtime
which is accepts None
as a valid argument while _datetime.date.fromtimestamp
is trying to convert None
to an integer.
I would prefer to change the Python implementation, as the documentaion for datetime.date.fromtimestamp
doesn't mention that it can accept None
as a valid argument.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status
Done