diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2020-04-22 22:29:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-22 22:29:27 (GMT) |
commit | c5fc15685202cda73f7c3f5c6f299b0945f58508 (patch) | |
tree | 7624ae45b95f2812e801c5879bdbdcb796f570a6 /Python/ast_opt.c | |
parent | a81849b0315277bb3937271174aaaa5059c0b445 (diff) | |
download | cpython-c5fc15685202cda73f7c3f5c6f299b0945f58508.zip cpython-c5fc15685202cda73f7c3f5c6f299b0945f58508.tar.gz cpython-c5fc15685202cda73f7c3f5c6f299b0945f58508.tar.bz2 |
bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503)
Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Diffstat (limited to 'Python/ast_opt.c')
-rw-r--r-- | Python/ast_opt.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 1766321..ff786d6 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -563,7 +563,8 @@ astfold_expr(expr_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) CALL(fold_tuple, expr_ty, node_); break; case Name_kind: - if (_PyUnicode_EqualToASCIIString(node_->v.Name.id, "__debug__")) { + if (node_->v.Name.ctx == Load && + _PyUnicode_EqualToASCIIString(node_->v.Name.id, "__debug__")) { return make_const(node_, PyBool_FromLong(!state->optimize), ctx_); } break; |