Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Closed
Description
Bug report
Bug description:
./pythonPython3.14.0a0 (heads/main-dirty:55402d3232,Jun82024,11:03:56) [GCC13.2.0]onlinuxType"help","copyright","credits"or"license"formoreinformation.>>>import_datetime>>>_datetime.date.fromtimestamp(None)Traceback (mostrecentcalllast):File"<python-input-1>",line1,in<module>_datetime.date.fromtimestamp(None)~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^TypeError:'NoneType'objectcannotbeinterpretedasaninteger>>>import_pydatetime>>>_pydatetime.date.fromtimestamp(None)datetime.date(2024,6,8)>>>
This happens because the_pydatetime.date.fromtimestamp is usingtime.localtime which is acceptsNone as a valid argument while_datetime.date.fromtimestamp is trying to convertNone to an integer.
I would prefer to change the Python implementation, as the documentaion fordatetime.date.fromtimestamp doesn't mention that it can acceptNone 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