]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-45494: Fix parser crash when reporting errors involving invalid continuation...
authorPablo Galindo Salgado <Pablogsal@gmail.com>
Tue, 19 Oct 2021 19:24:12 +0000 (20:24 +0100)
committerGitHub <noreply@github.com>
Tue, 19 Oct 2021 19:24:12 +0000 (21:24 +0200)
commita106343f632a99c8ebb0136fa140cf189b4a6a57
treeff125fecd7da936de3a41375ecdcf5e30ec09b4a
parentbda69abe849b37467350d3750ae24d356230c940
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.
Lib/test/test_exceptions.py
Misc/NEWS.d/next/Core and Builtins/2021-10-16-17-27-48.bpo-45494.vMt1g4.rst [new file with mode: 0644]
Parser/parser.c
Parser/pegen.c
Tools/peg_generator/pegen/c_generator.py