Skip to content

Commit d8f36d8

Browse files
committed
pythongh-126876: Fix test_socket.testLargeTimeout() for missing _testcapi (python#127517)
(cherry picked from commit c46acd3)
1 parent baa96b9 commit d8f36d8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Lib/test/test_socket.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -5130,7 +5130,10 @@ def testLargeTimeout(self):
51305130
# gh-126876: Check that a timeout larger than INT_MAX is replaced with
51315131
# INT_MAX in the poll() code path. The following assertion must not
51325132
# fail: assert(INT_MIN <= ms && ms <= INT_MAX).
5133-
large_timeout = _testcapi.INT_MAX + 1
5133+
if _testcapi is not None:
5134+
large_timeout = _testcapi.INT_MAX + 1
5135+
else:
5136+
large_timeout = 2147483648
51345137

51355138
# test recv() with large timeout
51365139
conn, addr = self.serv.accept()
@@ -5145,7 +5148,10 @@ def testLargeTimeout(self):
51455148

51465149
def _testLargeTimeout(self):
51475150
# test sendall() with large timeout
5148-
large_timeout = _testcapi.INT_MAX + 1
5151+
if _testcapi is not None:
5152+
large_timeout = _testcapi.INT_MAX + 1
5153+
else:
5154+
large_timeout = 2147483648
51495155
self.cli.connect((HOST, self.port))
51505156
try:
51515157
self.cli.settimeout(large_timeout)

0 commit comments

Comments
 (0)