diff options
author | Zackery Spytz <zspytz@gmail.com> | 2019-03-22 07:20:49 -0600 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2019-03-22 15:20:49 +0200 |
commit | bdb9c497e177cdf881892de289b9d8a2b132f138 (patch) | |
tree | 77873fc02b474e215ff648754f77aa9cb77f4211 /Python | |
parent | cb2d71b28e5cac04bbd59b8b6dbec220c4da7beb (diff) | |
download | cpython-git-bdb9c497e177cdf881892de289b9d8a2b132f138.tar.gz |
bpo-35284: Fix the error handling in the compiler's compiler_call(). (GH-10625) (GH-12496)
compiler_call() needs to check if an error occurred during the
maybe_optimize_method_call() call.
(cherry picked from commit 97f5de01adf993aee17dcd26e22ae421d013f372)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/compile.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Python/compile.c b/Python/compile.c index 3564ca2b90..5688ef8479 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3536,6 +3536,7 @@ compiler_compare(struct compiler *c, expr_ty e) return 1; } +// 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) { @@ -3569,9 +3570,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; + } VISIT(c, expr, e->v.Call.func); return compiler_call_helper(c, 0, e->v.Call.args, |