-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Closed
Closed
Copy link
Labels
3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixesstdlibPython modules in the Lib dirPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
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
lubaskinc0de
Metadata
Metadata
Assignees
Labels
3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixesstdlibPython modules in the Lib dirPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
Done