]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-41060: Avoid SEGFAULT when calling GET_INVALID_TARGET in the grammar (GH-21020)
authorLysandros Nikolaou <lisandrosnik@gmail.com>
Sun, 21 Jun 2020 02:18:01 +0000 (05:18 +0300)
committerGitHub <noreply@github.com>
Sun, 21 Jun 2020 02:18:01 +0000 (03:18 +0100)
commit6c4e0bd974f2895d42b63d9d004587e74b286c88
tree68e8df81c6375ba0e85e614f6afd92d867a901af
parent3ccb96c9782480e5ce646a4a130569fb92f2965d
bpo-41060: Avoid SEGFAULT when calling GET_INVALID_TARGET in the grammar (GH-21020)

`GET_INVALID_TARGET` might unexpectedly return `NULL`, which if not
caught will cause a SEGFAULT. Therefore, this commit introduces a new
inline function `RAISE_SYNTAX_ERROR_INVALID_TARGET` that always
checks for `GET_INVALID_TARGET` returning NULL and can be used in
the grammar, replacing the long C ternary operation used till now.
Grammar/python.gram
Lib/test/test_syntax.py
Parser/parser.c
Parser/pegen.h