Skip to content

Commit 97f5de0

Browse files
ZackerySpytzserhiy-storchaka
authored andcommitted
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.
1 parent 93e8012 commit 97f5de0

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Python/compile.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3879,6 +3879,7 @@ check_index(struct compiler *c, expr_ty e, slice_ty s)
38793879
}
38803880
}
38813881

3882+
// Return 1 if the method call was optimized, -1 if not, and 0 on error.
38823883
static int
38833884
maybe_optimize_method_call(struct compiler *c, expr_ty e)
38843885
{
@@ -3912,8 +3913,10 @@ maybe_optimize_method_call(struct compiler *c, expr_ty e)
39123913
static int
39133914
compiler_call(struct compiler *c, expr_ty e)
39143915
{
3915-
if (maybe_optimize_method_call(c, e) > 0)
3916-
return 1;
3916+
int ret = maybe_optimize_method_call(c, e);
3917+
if (ret >= 0) {
3918+
return ret;
3919+
}
39173920
if (!check_caller(c, e->v.Call.func)) {
39183921
return 0;
39193922
}

0 commit comments

Comments
 (0)