https://github.com/python/cpython/commit/6ec94858bc7c3a60db01d3c36d3926c0ec6e89f2
commit: 6ec94858bc7c3a60db01d3c36d3926c0ec6e89f2
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: vstinner <[email protected]>
date: 2026-01-22T11:24:24Z
summary:

[3.14] gh-143959: Make _datetime optional for test_sys (GH-144003) (#144143)

gh-143959: Make _datetime optional for test_sys (GH-144003)
(cherry picked from commit c447d1bc146bcf7707a619779bdcc03651adb5e3)

Co-authored-by: Jeong, YunWon <[email protected]>

files:
M Lib/test/test_sys.py

diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 4aeeac56b1aae3..0db0369500a7c7 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -1,6 +1,5 @@
 import builtins
 import codecs
-import _datetime
 import gc
 import io
 import locale
@@ -1729,7 +1728,12 @@ def delx(self): del self.__x
             x = property(getx, setx, delx, "")
             check(x, size('5Pi'))
         # PyCapsule
-        check(_datetime.datetime_CAPI, size('6P'))
+        try:
+            import _datetime
+        except ModuleNotFoundError:
+            pass
+        else:
+            check(_datetime.datetime_CAPI, size('6P'))
         # rangeiterator
         check(iter(range(1)), size('3l'))
         check(iter(range(2**65)), size('3P'))

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to