]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-126876: Fix test_socket.testLargeTimeout() for missing _testcapi (#127517)
authorVictor Stinner <vstinner@python.org>
Mon, 2 Dec 2024 15:51:50 +0000 (16:51 +0100)
committerGitHub <noreply@github.com>
Mon, 2 Dec 2024 15:51:50 +0000 (16:51 +0100)
Lib/test/test_socket.py

index 7b3914f30e5f52d3570c69fb7dff628b68f80614..307d6e886c617fe42642cac137a818cf9bc895f5 100644 (file)
@@ -5136,7 +5136,10 @@ class NonBlockingTCPTests(ThreadedTCPSocketTest):
         # gh-126876: Check that a timeout larger than INT_MAX is replaced with
         # INT_MAX in the poll() code path. The following assertion must not
         # fail: assert(INT_MIN <= ms && ms <= INT_MAX).
-        large_timeout = _testcapi.INT_MAX + 1
+        if _testcapi is not None:
+            large_timeout = _testcapi.INT_MAX + 1
+        else:
+            large_timeout = 2147483648
 
         # test recv() with large timeout
         conn, addr = self.serv.accept()
@@ -5151,7 +5154,10 @@ class NonBlockingTCPTests(ThreadedTCPSocketTest):
 
     def _testLargeTimeout(self):
         # test sendall() with large timeout
-        large_timeout = _testcapi.INT_MAX + 1
+        if _testcapi is not None:
+            large_timeout = _testcapi.INT_MAX + 1
+        else:
+            large_timeout = 2147483648
         self.cli.connect((HOST, self.port))
         try:
             self.cli.settimeout(large_timeout)