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
col_offset = 0;
} else {
const char* start = p->tok->buf ? p->tok->line_start : p->tok->buf;
+ if (p->tok->cur - start > INT_MAX) {
+ PyErr_SetString(PyExc_OverflowError,
+ "Parser column offset overflow - source line is too big");
+ p->error_indicator = 1;
+ return NULL;
+ }
col_offset = Py_SAFE_DOWNCAST(p->tok->cur - start, intptr_t, int);
}
} else {