summaryrefslogtreecommitdiffstats
path: root/Parser/pegen/parse_string.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-06-08 01:08:53 (GMT)
committerGitHub <noreply@github.com>2020-06-08 01:08:53 (GMT)
commit64409117361499058b1bf95e6efec31f7bb3c0d0 (patch)
treea0ce15928486f3a6679b1fe40be11496f12e7db8 /Parser/pegen/parse_string.c
parent71f501698d64af6463246bc6efdbbf1b85616102 (diff)
downloadcpython-64409117361499058b1bf95e6efec31f7bb3c0d0.zip
cpython-64409117361499058b1bf95e6efec31f7bb3c0d0.tar.gz
cpython-64409117361499058b1bf95e6efec31f7bb3c0d0.tar.bz2
bpo-40904: Fix segfault in the new parser with f-string containing yield statements with no value (GH-20701)
(cherry picked from commit 972ab0327675e695373fc6272d5ac24e187579ad) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Diffstat (limited to 'Parser/pegen/parse_string.c')
-rw-r--r--Parser/pegen/parse_string.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Parser/pegen/parse_string.c b/Parser/pegen/parse_string.c
index efe82df..94241e1 100644
--- a/Parser/pegen/parse_string.c
+++ b/Parser/pegen/parse_string.c
@@ -278,6 +278,9 @@ static void fstring_shift_argument(expr_ty parent, arg_ty args, int lineno, int
static inline void shift_expr(expr_ty parent, expr_ty n, int line, int col) {
+ if (n == NULL) {
+ return;
+ }
if (parent->lineno < n->lineno) {
col = 0;
}