Skip to content

Commit c46acd3

Browse files
authored
gh-126876: Fix test_socket.testLargeTimeout() for missing _testcapi (#127517)
1 parent 7c2bd9b commit c46acd3

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
@@ -5136,7 +5136,10 @@ def testLargeTimeout(self):
51365136
# gh-126876: Check that a timeout larger than INT_MAX is replaced with
51375137
# INT_MAX in the poll() code path. The following assertion must not
51385138
# fail: assert(INT_MIN <= ms && ms <= INT_MAX).
5139-
large_timeout = _testcapi.INT_MAX + 1
5139+
if _testcapi is not None:
5140+
large_timeout = _testcapi.INT_MAX + 1
5141+
else:
5142+
large_timeout = 2147483648
51405143

51415144
# test recv() with large timeout
51425145
conn, addr = self.serv.accept()
@@ -5151,7 +5154,10 @@ def testLargeTimeout(self):
51515154

51525155
def _testLargeTimeout(self):
51535156
# test sendall() with large timeout
5154-
large_timeout = _testcapi.INT_MAX + 1
5157+
if _testcapi is not None:
5158+
large_timeout = _testcapi.INT_MAX + 1
5159+
else:
5160+
large_timeout = 2147483648
51555161
self.cli.connect((HOST, self.port))
51565162
try:
51575163
self.cli.settimeout(large_timeout)

0 commit comments

Comments
 (0)