bpo-44409: Fix error location in tokenizer errors that happen during initialization (GH-26712)
(cherry picked from commit 507ed6fa1d6661e0f8e6d3282764aa9625a99594)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
diff --git a/Parser/pegen.c b/Parser/pegen.c
index 1941244..615047c 100644
--- a/Parser/pegen.c
+++ b/Parser/pegen.c
@@ -283,6 +283,7 @@
raise_tokenizer_init_error(PyObject *filename)
{
if (!(PyErr_ExceptionMatches(PyExc_LookupError)
+ || PyErr_ExceptionMatches(PyExc_SyntaxError)
|| PyErr_ExceptionMatches(PyExc_ValueError)
|| PyErr_ExceptionMatches(PyExc_UnicodeDecodeError))) {
return;