|
9 | 9 | import errno
|
10 | 10 | from textwrap import dedent
|
11 | 11 |
|
12 |
| -from _testcapi import INT_MAX, PY_SSIZE_T_MAX |
13 | 12 | from test.support import (captured_stderr, check_impl_detail,
|
14 | 13 | cpython_only, gc_collect,
|
15 | 14 | no_tracing, script_helper,
|
|
19 | 18 | from test.support.warnings_helper import check_warnings
|
20 | 19 | from test import support
|
21 | 20 |
|
| 21 | +try: |
| 22 | + from _testcapi import INT_MAX |
| 23 | +except ImportError: |
| 24 | + INT_MAX = 2**31 - 1 |
| 25 | + |
| 26 | + |
22 | 27 |
|
23 | 28 | class NaiveException(Exception):
|
24 | 29 | def __init__(self, x):
|
@@ -319,14 +324,11 @@ def baz():
|
319 | 324 | check('(yield i) = 2', 1, 2)
|
320 | 325 | check('def f(*):\n pass', 1, 7)
|
321 | 326 |
|
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") |
323 | 328 | @support.requires_resource('cpu')
|
324 | 329 | @support.bigmemtest(INT_MAX, memuse=2, dry_run=False)
|
325 | 330 | def testMemoryErrorBigSource(self, size):
|
326 | 331 | padding_needed = INT_MAX - len("pass")
|
327 |
| - if size < padding_needed: |
328 |
| - self.skipTest('Not enough memory for overflow to occur') |
329 |
| - |
330 | 332 | src = f"if True:\n{' ' * padding_needed}pass"
|
331 | 333 | with self.assertRaisesRegex(OverflowError, "Parser column offset overflow"):
|
332 | 334 | compile(src, '<fragment>', 'exec')
|
|
0 commit comments