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.
This commit is contained in:
Zackery Spytz 2019-03-22 01:30:32 -06:00 committed by Serhiy Storchaka
parent 93e8012f2c
commit 97f5de01ad
1 changed files with 5 additions and 2 deletions

View File

@ -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;
}