Skip to content

gh-126876: Fix test_socket.testLargeTimeout() for missing _testcapi #127517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Lib/test/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -5136,7 +5136,10 @@ 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).
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()
Expand All @@ -5151,7 +5154,10 @@ def testLargeTimeout(self):

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)
Expand Down
Loading