bpo-35284: Fix the error handling in the compiler's compiler_call(). … · python/cpython@97f5de0

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

}