diff options
author | Zackery Spytz <zspytz@gmail.com> | 2019-03-22 07:30:32 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2019-03-22 07:30:32 (GMT) |
commit | 97f5de01adf993aee17dcd26e22ae421d013f372 (patch) | |
tree | da5766b9189901a823066b34cf09fee9d7c7c877 /Python/compile.c | |
parent | 93e8012f2cabd84f30b52e19fd3dc557efa9f8af (diff) | |
download | cpython-97f5de01adf993aee17dcd26e22ae421d013f372.zip cpython-97f5de01adf993aee17dcd26e22ae421d013f372.tar.gz cpython-97f5de01adf993aee17dcd26e22ae421d013f372.tar.bz2 |
bpo-35284: Fix the error handling in the compiler's compiler_call(). (GH-10625)
compiler_call() needs to check if an error occurred during the
maybe_optimize_method_call() call.
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/compile.c b/Python/compile.c index 3656a7e..a992e4b 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3879,6 +3879,7 @@ check_index(struct compiler *c, expr_ty e, slice_ty s) } } +// Return 1 if the method call was optimized, -1 if not, and 0 on error. static int maybe_optimize_method_call(struct compiler *c, expr_ty e) { @@ -3912,8 +3913,10 @@ maybe_optimize_method_call(struct compiler *c, expr_ty e) static int compiler_call(struct compiler *c, expr_ty e) { - if (maybe_optimize_method_call(c, e) > 0) - return 1; + int ret = maybe_optimize_method_call(c, e); + if (ret >= 0) { + return ret; + } if (!check_caller(c, e->v.Call.func)) { return 0; } |