Commit 97f5de01 authored by Zackery Spytz's avatar Zackery Spytz Committed by Serhiy Storchaka

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.
parent 93e8012f
...@@ -3879,6 +3879,7 @@ check_index(struct compiler *c, expr_ty e, slice_ty s) ...@@ -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 static int
maybe_optimize_method_call(struct compiler *c, expr_ty e) maybe_optimize_method_call(struct compiler *c, expr_ty e)
{ {
...@@ -3912,8 +3913,10 @@ 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 static int
compiler_call(struct compiler *c, expr_ty e) compiler_call(struct compiler *c, expr_ty e)
{ {
if (maybe_optimize_method_call(c, e) > 0) int ret = maybe_optimize_method_call(c, e);
return 1; if (ret >= 0) {
return ret;
}
if (!check_caller(c, e->v.Call.func)) { if (!check_caller(c, e->v.Call.func)) {
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment