Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 65c4a2b

Browse filesBrowse files
pganssleYhg1s
authored andcommitted
GH-84976: Move Lib/datetime.py to Lib/_pydatetime
This breaks the tests, but we are keeping it as a separate commit so that the move operation and editing of the moved files are separate, for a cleaner history.
1 parent 8d34031 commit 65c4a2b
Copy full SHA for 65c4a2b

File tree

Expand file treeCollapse file tree

4 files changed

+14
-5
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+14
-5
lines changed
File renamed without changes.

‎Lib/test/datetimetester.py

Copy file name to clipboardExpand all lines: Lib/test/datetimetester.py
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939

4040
# Needed by test_datetime
4141
import _strptime
42+
try:
43+
import _pydatetime
44+
except ImportError:
45+
pass
4246
#
4347

4448
pickle_loads = {pickle.loads, pickle._loads}
@@ -92,7 +96,7 @@ def test_divide_and_round(self):
9296
if '_Fast' in self.__class__.__name__:
9397
self.skipTest('Only run for Pure Python implementation')
9498

95-
dar = datetime_module._divide_and_round
99+
dar = _pydatetime._divide_and_round
96100

97101
self.assertEqual(dar(-10, -3), 3)
98102
self.assertEqual(dar(5, -2), -2)

‎Lib/test/test_datetime.py

Copy file name to clipboardExpand all lines: Lib/test/test_datetime.py
+8-4Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88

99
def load_tests(loader, tests, pattern):
1010
try:
11-
pure_tests = import_fresh_module(TESTS, fresh=['datetime', '_strptime'],
12-
blocked=['_datetime'])
13-
fast_tests = import_fresh_module(TESTS, fresh=['datetime',
14-
'_datetime', '_strptime'])
11+
pure_tests = import_fresh_module(TESTS,
12+
fresh=['datetime', '_pydatetime', '_strptime'],
13+
blocked=['_datetime'])
14+
fast_tests = import_fresh_module(TESTS,
15+
fresh=['datetime', '_strptime'],
16+
blocked=['_pydatetime'])
1517
finally:
1618
# XXX: import_fresh_module() is supposed to leave sys.module cache untouched,
1719
# XXX: but it does not, so we have to cleanup ourselves.
@@ -42,6 +44,8 @@ def setUpClass(cls_, module=module):
4244
cls_._save_sys_modules = sys.modules.copy()
4345
sys.modules[TESTS] = module
4446
sys.modules['datetime'] = module.datetime_module
47+
if hasattr(module, '_pydatetime'):
48+
sys.modules['_pydatetime'] = module._pydatetime
4549
sys.modules['_strptime'] = module._strptime
4650
@classmethod
4751
def tearDownClass(cls_):

‎Python/stdlib_module_names.h

Copy file name to clipboardExpand all lines: Python/stdlib_module_names.h
+1Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.