Skip to content

Commit d2c9368

Browse files
committed
Issue #21932: Skip test_os.test_large_read() on 32-bit system
1 parent 71cdf46 commit d2c9368

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Lib/test/test_os.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
except ImportError:
4545
_winapi = None
4646
try:
47-
from _testcapi import INT_MAX
47+
from _testcapi import INT_MAX, PY_SSIZE_T_MAX
4848
except ImportError:
49-
INT_MAX = 2 ** 31 - 1
49+
INT_MAX = PY_SSIZE_T_MAX = sys.maxsize
5050

5151
from test.script_helper import assert_python_ok
5252

@@ -124,6 +124,10 @@ def test_read(self):
124124
self.assertEqual(s, b"spam")
125125

126126
@support.cpython_only
127+
# Skip the test on 32-bit platforms: the number of bytes must fit in a
128+
# Py_ssize_t type
129+
@unittest.skipUnless(INT_MAX < PY_SSIZE_T_MAX,
130+
"needs INT_MAX < PY_SSIZE_T_MAX")
127131
@support.bigmemtest(size=INT_MAX + 10, memuse=1, dry_run=False)
128132
def test_large_read(self, size):
129133
with open(support.TESTFN, "wb") as fp:

0 commit comments

Comments
 (0)