forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pythonGH-84976: Re-introduce
datetime.py
and fix reprs
Without the change to the reprs, pure-python classes would have a repr of `datetime._pydatetime.time`, etc.
- Loading branch information
Showing
3 changed files
with
27 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
try: | ||
from _datetime import * | ||
from _datetime import __doc__ | ||
except ImportError: | ||
from _pydatetime import * | ||
from _pydatetime import __doc__ | ||
|
||
__all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo", | ||
"MINYEAR", "MAXYEAR") |
5 changes: 5 additions & 0 deletions
5
Misc/NEWS.d/next/Library/2023-04-19-16-08-53.gh-issue-84976.HwbzlD.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Create a new ``Lib/_pydatetime.py`` file that defines the Python version of | ||
the ``datetime`` module, and make ``datetime`` import the contents of the | ||
new library only if the C implementation is missing. Currently, the full | ||
Python implementation is defined and then deleted if the C implementation is | ||
not available, slowing down ``import datetime`` unnecessarily. |