Skip to content

Commit

Permalink
Fix testLargeTimeout()
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner committed Dec 3, 2024
1 parent db50895 commit 6cec07e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Lib/test/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -5059,14 +5059,13 @@ def _testRecv(self):
# send data: recv() will no longer block
self.cli.sendall(MSG)

@support.cpython_only
def testLargeTimeout(self):
# 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).
if _testcapi is not None:
large_timeout = _testcapi.INT_MAX + 1
else:
large_timeout = 2147483648
import _testcapi
large_timeout = _testcapi.INT_MAX + 1

# test recv() with large timeout
conn, addr = self.serv.accept()
Expand All @@ -5081,10 +5080,8 @@ def testLargeTimeout(self):

def _testLargeTimeout(self):
# test sendall() with large timeout
if _testcapi is not None:
large_timeout = _testcapi.INT_MAX + 1
else:
large_timeout = 2147483648
import _testcapi
large_timeout = _testcapi.INT_MAX + 1
self.cli.connect((HOST, self.port))
try:
self.cli.settimeout(large_timeout)
Expand Down

0 comments on commit 6cec07e

Please sign in to comment.