Skip to content

Commit e4a059e

Browse files
committed
Address more feedback
1 parent c8433ca commit e4a059e

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Lib/test/test_exceptions.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Python test set -- part 5, built-in exceptions
22

33
import copy
4-
import ctypes
54
import os
65
import sys
76
import unittest
@@ -10,7 +9,7 @@
109
import errno
1110
from textwrap import dedent
1211

13-
from _testcapi import INT_MAX
12+
from _testcapi import INT_MAX, PY_SSIZE_T_MAX
1413
from test.support import (captured_stderr, check_impl_detail,
1514
cpython_only, gc_collect,
1615
no_tracing, script_helper,
@@ -320,19 +319,15 @@ def baz():
320319
check('(yield i) = 2', 1, 2)
321320
check('def f(*):\n pass', 1, 7)
322321

323-
@unittest.skipIf(ctypes.sizeof(ctypes.c_int) >= ctypes.sizeof(ctypes.c_ssize_t),
324-
"Downcasting to int is safe for col_offset")
322+
@unittest.skipIf(INT_MAX >= PY_SSIZE_T_MAX, "Downcasting to int is safe for col_offset")
325323
@support.requires_resource('cpu')
326324
@support.bigmemtest(INT_MAX, memuse=2, dry_run=False)
327325
def testMemoryErrorBigSource(self, size):
328326
padding_needed = INT_MAX-len("pass")
329327
if size < padding_needed:
330328
self.skipTest('Not enough memory for overflow to occur')
331329

332-
# Construct buffer to hold just enough characters so that the tokenizer offset overflows.
333-
# This makes sure that we don't overflow in the string creation itself
334330
src = f"if True:\n{' ' * padding_needed}pass"
335-
336331
with self.assertRaisesRegex(OverflowError, "Parser column offset overflow"):
337332
compile(src, '<fragment>', 'exec')
338333

0 commit comments

Comments
 (0)