mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-45494: Fix parser crash when reporting errors involving invalid continuation characters (GH-28993)
There are two errors that this commit fixes: * The parser was not correctly computing the offset and the string source for E_LINECONT errors due to the incorrect usage of strtok(). * The parser was not correctly unwinding the call stack when a tokenizer exception happened in rules involving optionals ('?', [...]) as we always make them return valid results by using the comma operator. We need to check first if we don't have an error before continuing.
This commit is contained in:
parent
bda69abe84
commit
a106343f63
5 changed files with 137 additions and 123 deletions
|
@ -88,7 +88,7 @@ class FunctionCall:
|
|||
if self.arguments:
|
||||
parts.append(f"({', '.join(map(str, self.arguments))})")
|
||||
if self.force_true:
|
||||
parts.append(", 1")
|
||||
parts.append(", !p->error_indicator")
|
||||
if self.assigned_variable:
|
||||
if self.assigned_variable_type:
|
||||
parts = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue