]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-40334: Improvements to error-handling code in the PEG parser (GH-20003)
authorLysandros Nikolaou <lisandrosnik@gmail.com>
Sun, 17 May 2020 03:19:23 +0000 (06:19 +0300)
committerGitHub <noreply@github.com>
Sun, 17 May 2020 03:19:23 +0000 (04:19 +0100)
commit2c8cd06afe8e0abb52367f85978f19b88e2df53e
treeea90af6b2975c27c85f491e2eda51911c15c3d6f
parent6341fc7257d89d798675ad6e425f7eb0b6f2b4bb
bpo-40334: Improvements to error-handling code in the PEG parser (GH-20003)

The following improvements are implemented in this commit:
- `p->error_indicator` is set, in case malloc or realloc fail.
- Avoid memory leaks in the case that realloc fails.
- Call `PyErr_NoMemory()` instead of `PyErr_Format()`, because it requires no memory.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Parser/pegen/parse.c
Tools/peg_generator/pegen/c_generator.py