[3.12] gh-107450: Raise OverflowError when parser column offset overflows (GH-110754) (#110762)

(cherry picked from commit fb7843ee89)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
This commit is contained in:
Miss Islington (bot) 2023-10-12 12:03:09 +02:00 committed by GitHub
parent e8d04190c6
commit ea3ac56a05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -318,6 +318,10 @@ class ExceptionTests(unittest.TestCase):
check('(yield i) = 2', 1, 2)
check('def f(*):\n pass', 1, 7)
def testMemoryErrorBigSource(self):
with self.assertRaisesRegex(OverflowError, "column offset overflow"):
exec(f"if True:\n {' ' * 2**31}print('hello world')")
@cpython_only
def testSettingException(self):
# test that setting an exception at the C level works even if the