I have noticed that in python-3.x there is a datetime.py file in the python path which is what is included with import datetime
, while there was no such file in python-2.7. At the end of this file an import _datetime
statement imports, what I assume is, a compiled version. If this last import is removed, the basic datetime functionality works (with performance penalty) but if one imports the, new in 3.9, zoneinfo
module a segmentation fault occurs (pytz
continues to work).
My questions are:
- Why this is now included in python-3.x?
- Is
datetime.py
intended as a fully functional equivalent of_datetime
? - Why does
import zoneinfo
crash? Is this a bug, orzoneinfo
needs, by design, the compiled version?
The idea is to modify datetime.py
so as to include some functionality, basically a timedelta.__format__
and stop treating naive datetime objects as local times. Do you think this is feasible?