Skip to content

Commit 9f71f16

Browse files
committed
tweaks from review
1 parent a217fc4 commit 9f71f16

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

Lib/opcode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
_intrinsic_1_descs = _opcode.get_intrinsic1_descs()
4040
_intrinsic_2_descs = _opcode.get_intrinsic2_descs()
4141
_special_method_names = _opcode.get_special_method_names()
42-
_common_constants = [AssertionError, NotImplementedError,
42+
_common_constants = [builtins.AssertionError, builtins.NotImplementedError,
4343
builtins.tuple, builtins.all, builtins.any]
4444
_nb_ops = _opcode.get_nb_ops()
4545

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Compiler emits optimised code for builtin any/all/tuple calls over a generator expression.
1+
Compiler emits optimized code for builtin any/all/tuple calls over a generator expression.

Python/codegen.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3738,12 +3738,6 @@ maybe_optimize_function_call(compiler *c, expr_ty e, jump_target_label end)
37383738
return 0;
37393739
}
37403740

3741-
expr_ty generator_exp = asdl_seq_GET(args, 0);
3742-
3743-
if (asdl_seq_LEN(generator_exp->v.GeneratorExp.generators) != 1) {
3744-
return 0;
3745-
}
3746-
37473741
location loc = LOC(func);
37483742

37493743
int optimized = 0;
@@ -3777,6 +3771,7 @@ maybe_optimize_function_call(compiler *c, expr_ty e, jump_target_label end)
37773771
else {
37783772
ADDOP_LOAD_CONST(c, loc, initial_res);
37793773
}
3774+
expr_ty generator_exp = asdl_seq_GET(args, 0);
37803775
VISIT(c, expr, generator_exp);
37813776

37823777
NEW_JUMP_TARGET_LABEL(c, loop);

0 commit comments

Comments
 (0)