diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-06-09 10:23:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-09 17:23:45 +0000 |
commit | 65404930bdfcc3755eee70673ed0f592e5fcb37e (patch) | |
tree | a8ee9c9090b5be1865e5a70a8095840a3cb63ec8 /Python | |
parent | [3.12] gh-105557: Remove duplicate sqlite3 test method (GH-105558) (#105561) (diff) | |
download | cpython-65404930bdfcc3755eee70673ed0f592e5fcb37e.tar.gz cpython-65404930bdfcc3755eee70673ed0f592e5fcb37e.tar.bz2 cpython-65404930bdfcc3755eee70673ed0f592e5fcb37e.zip |
[3.12] gh-105375: Improve error handling in compiler_enter_scope() (GH-105494) (#105581)
(cherry picked from commit 6c832ddcf28187f86100c790afb16a0223d945d0)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Diffstat (limited to 'Python')
-rw-r--r-- | Python/compile.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c index 32eda4d407e..f593e957caa 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1252,8 +1252,12 @@ compiler_enter_scope(struct compiler *c, identifier name, } u->u_metadata.u_name = Py_NewRef(name); u->u_metadata.u_varnames = list2dict(u->u_ste->ste_varnames); + if (!u->u_metadata.u_varnames) { + compiler_unit_free(u); + return ERROR; + } u->u_metadata.u_cellvars = dictbytype(u->u_ste->ste_symbols, CELL, DEF_COMP_CELL, 0); - if (!u->u_metadata.u_varnames || !u->u_metadata.u_cellvars) { + if (!u->u_metadata.u_cellvars) { compiler_unit_free(u); return ERROR; } |