Skip to content

Commit 66d94be

Browse files
committed
More feedback
1 parent 5d7c5a6 commit 66d94be

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Lib/test/test_exceptions.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import errno
1010
from textwrap import dedent
1111

12-
from _testcapi import INT_MAX, PY_SSIZE_T_MAX
1312
from test.support import (captured_stderr, check_impl_detail,
1413
cpython_only, gc_collect,
1514
no_tracing, script_helper,
@@ -19,6 +18,12 @@
1918
from test.support.warnings_helper import check_warnings
2019
from test import support
2120

21+
try:
22+
from _testcapi import INT_MAX
23+
except ImportError:
24+
INT_MAX = 2**31 - 1
25+
26+
2227

2328
class NaiveException(Exception):
2429
def __init__(self, x):
@@ -319,14 +324,11 @@ def baz():
319324
check('(yield i) = 2', 1, 2)
320325
check('def f(*):\n pass', 1, 7)
321326

322-
@unittest.skipIf(INT_MAX >= PY_SSIZE_T_MAX, "Downcasting to int is safe for col_offset")
327+
@unittest.skipIf(INT_MAX >= sys.maxsize, "Downcasting to int is safe for col_offset")
323328
@support.requires_resource('cpu')
324329
@support.bigmemtest(INT_MAX, memuse=2, dry_run=False)
325330
def testMemoryErrorBigSource(self, size):
326331
padding_needed = INT_MAX - len("pass")
327-
if size < padding_needed:
328-
self.skipTest('Not enough memory for overflow to occur')
329-
330332
src = f"if True:\n{' ' * padding_needed}pass"
331333
with self.assertRaisesRegex(OverflowError, "Parser column offset overflow"):
332334
compile(src, '<fragment>', 'exec')

0 commit comments

Comments
 (0)