mirror of https://github.com/python/cpython
bpo-44409: Fix error location in tokenizer errors that happen during initialization (GH-26712)
This commit is contained in:
parent
cc8ecf6864
commit
507ed6fa1d
|
@ -246,6 +246,7 @@ class ExceptionTests(unittest.TestCase):
|
|||
check("pass\npass\npass\n(1+)\npass\npass\npass", 4, 4)
|
||||
check("(1+)", 1, 4)
|
||||
check("[interesting\nfoo()\n", 1, 1)
|
||||
check(b"\xef\xbb\xbf#coding: utf8\nprint('\xe6\x88\x91')\n", 0, -1)
|
||||
|
||||
# Errors thrown by symtable.c
|
||||
check('x = [(yield i) for i in range(3)]', 1, 5)
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Fix error location information for tokenizer errors raised on initialization
|
||||
of the tokenizer. Patch by Pablo Galindo.
|
|
@ -283,6 +283,7 @@ static void
|
|||
raise_tokenizer_init_error(PyObject *filename)
|
||||
{
|
||||
if (!(PyErr_ExceptionMatches(PyExc_LookupError)
|
||||
|| PyErr_ExceptionMatches(PyExc_SyntaxError)
|
||||
|| PyErr_ExceptionMatches(PyExc_ValueError)
|
||||
|| PyErr_ExceptionMatches(PyExc_UnicodeDecodeError))) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue