pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/9ed36d533ab8b256f0a589b5be6d7a2fdcf4aff2

97560d244c08.css" /> gh-113602: Bail out when the parser tries to override existing errors… · python/cpython@9ed36d5 · GitHub
Skip to content

Commit 9ed36d5

Browse files
authored
gh-113602: Bail out when the parser tries to override existing errors (#113607)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
1 parent 8ff44f8 commit 9ed36d5

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

Lib/test/test_syntax.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2360,6 +2360,8 @@ def test_error_parenthesis(self):
23602360
"""
23612361
self._check_error(code, "parenthesis '\\)' does not match opening parenthesis '\\['")
23622362

2363+
self._check_error("match y:\n case e(e=v,v,", " was never closed")
2364+
23632365
# Examples with dencodings
23642366
s = b'# coding=latin\n(aaaaaaaaaaaaaaaaa\naaaaaaaaaaa\xb5'
23652367
self._check_error(s, r"'\(' was never closed")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix an error that was causing the parser to try to overwrite existing errors
2+
and crashing in the process. Patch by Pablo Galindo

Parser/pegen_errors.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ _PyPegen_raise_error_known_location(Parser *p, PyObject *errtype,
311311
Py_ssize_t end_lineno, Py_ssize_t end_col_offset,
312312
const char *errmsg, va_list va)
313313
{
314+
// Bail out if we already have an error set.
315+
if (p->error_indicator && PyErr_Occurred()) {
316+
return NULL;
317+
}
314318
PyObject *value = NULL;
315319
PyObject *errstr = NULL;
316320
PyObject *error_line = NULL;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy