| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c461aa9 commit ae53da5
14 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,7 +27,7 @@ int _PyCfg_OptimizeCodeUnit(struct _PyCfgBuilder *g, PyObject *consts, PyObject | |||
| 27 | 27 | struct _PyCfgBuilder* _PyCfg_FromInstructionSequence(_PyInstructionSequence *seq); | |
| 28 | 28 | int _PyCfg_ToInstructionSequence(struct _PyCfgBuilder *g, _PyInstructionSequence *seq); | |
| 29 | 29 | int _PyCfg_OptimizedCfgToInstructionSequence(struct _PyCfgBuilder *g, _PyCompile_CodeUnitMetadata *umd, | |
| 30 | - int code_flags, int *stackdepth, int *nlocalsplus, | ||
| 30 | + int *stackdepth, int *nlocalsplus, | ||
| 31 | 31 | _PyInstructionSequence *seq); | |
| 32 | 32 | ||
| 33 | 33 | PyCodeObject * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -73,6 +73,7 @@ int _PyInstructionSequence_SetAnnotationsCode(_PyInstructionSequence *seq, | |||
| 73 | 73 | _PyInstructionSequence *annotations); | |
| 74 | 74 | int _PyInstructionSequence_AddNested(_PyInstructionSequence *seq, _PyInstructionSequence *nested); | |
| 75 | 75 | void PyInstructionSequence_Fini(_PyInstructionSequence *seq); | |
| 76 | + _PyInstruction _PyInstructionSequence_GetInstruction(_PyInstructionSequence *seq, int pos); | ||
| 76 | 77 | ||
| 77 | 78 | extern PyTypeObject _PyInstructionSequence_Type; | |
| 78 | 79 | #define _PyInstructionSequence_Check(v) Py_IS_TYPE((v), &_PyInstructionSequence_Type) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -290,6 +290,7 @@ Known values: | |||
| 290 | 290 | Python 3.15a4 3657 (Add BINARY_OP_SUBSCR_USTR_INT) | |
| 291 | 291 | Python 3.15a4 3658 (Optimize bytecode for list/set called on genexp) | |
| 292 | 292 | Python 3.15a4 3659 (Add CALL_FUNCTION_EX specialization) | |
| 293 | + Python 3.15a4 3660 (Change generator preamble code) | ||
| 293 | 294 | ||
| 294 | 295 | ||
| 295 | 296 | Python 3.16 will start with 3700 | |
@@ -303,7 +304,7 @@ PC/launcher.c must also be updated. | |||
| 303 | 304 | ||
| 304 | 305 | */ | |
| 305 | 306 | ||
| 306 | - #define PYC_MAGIC_NUMBER 3659 | ||
| 307 | + #define PYC_MAGIC_NUMBER 3660 | ||
| 307 | 308 | /* This is equivalent to converting PYC_MAGIC_NUMBER to 2 bytes | |
| 308 | 309 | (little-endian) and then appending b'\r\n'. */ | |
| 309 | 310 | #define PYC_MAGIC_NUMBER_TOKEN \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1298,7 +1298,7 @@ def return_genexp(): | |||
| 1298 | 1298 | x | |
| 1299 | 1299 | in | |
| 1300 | 1300 | y) | |
| 1301 | - genexp_lines = [0, 4, 2, 0, 4] | ||
| 1301 | + genexp_lines = [4, 0, 4, 2, 0, 4] | ||
| 1302 | 1302 | ||
| 1303 | 1303 | genexp_code = return_genexp.__code__.co_consts[0] | |
| 1304 | 1304 | code_lines = self.get_code_lines(genexp_code) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -875,11 +875,11 @@ def foo(x): | |||
| 875 | 875 | Disassembly of <code object <genexpr> at 0x..., file "%s", line %d>: | |
| 876 | 876 | -- COPY_FREE_VARS 1 | |
| 877 | 877 | ||
| 878 | - %4d RETURN_GENERATOR | ||
| 878 | + %4d LOAD_FAST 0 (.0) | ||
| 879 | + GET_ITER | ||
| 880 | + RETURN_GENERATOR | ||
| 879 | 881 | POP_TOP | |
| 880 | 882 | L1: RESUME 0 | |
| 881 | - LOAD_FAST 0 (.0) | ||
| 882 | - GET_ITER | ||
| 883 | 883 | L2: FOR_ITER 14 (to L3) | |
| 884 | 884 | STORE_FAST 1 (z) | |
| 885 | 885 | LOAD_DEREF 2 (x) | |
@@ -897,7 +897,7 @@ def foo(x): | |||
| 897 | 897 | -- L4: CALL_INTRINSIC_1 3 (INTRINSIC_STOPITERATION_ERROR) | |
| 898 | 898 | RERAISE 1 | |
| 899 | 899 | ExceptionTable: | |
| 900 | - L1 to L4 -> L4 [0] lasti | ||
| 900 | + L1 to L4 -> L4 [2] lasti | ||
| 901 | 901 | """ % (dis_nested_1, | |
| 902 | 902 | __file__, | |
| 903 | 903 | _h.__code__.co_firstlineno + 3, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -357,21 +357,25 @@ def gen(it): | |||
| 357 | 357 | yield x | |
| 358 | 358 | return gen(range(10)) | |
| 359 | 359 | ||
| 360 | - def process_tests(self, get_generator): | ||
| 361 | - for obj in self.iterables: | ||
| 362 | - g_obj = get_generator(obj) | ||
| 363 | - with self.subTest(g_obj=g_obj, obj=obj): | ||
| 364 | - self.assertListEqual(list(g_obj), list(obj)) | ||
| 360 | + def process_tests(self, get_generator, changes_iterable): | ||
| 361 | + if changes_iterable: | ||
| 362 | + for obj in self.iterables: | ||
| 363 | + g_obj = get_generator(obj) | ||
| 364 | + with self.subTest(g_obj=g_obj, obj=obj): | ||
| 365 | + self.assertListEqual(list(g_obj), list(obj)) | ||
| 365 | 366 | ||
| 366 | - g_iter = get_generator(iter(obj)) | ||
| 367 | - with self.subTest(g_iter=g_iter, obj=obj): | ||
| 368 | - self.assertListEqual(list(g_iter), list(obj)) | ||
| 367 | + g_iter = get_generator(iter(obj)) | ||
| 368 | + with self.subTest(g_iter=g_iter, obj=obj): | ||
| 369 | + self.assertListEqual(list(g_iter), list(obj)) | ||
| 369 | 370 | ||
| 370 | 371 | err_regex = "'.*' object is not iterable" | |
| 371 | 372 | for obj in self.non_iterables: | |
| 372 | 373 | g_obj = get_generator(obj) | |
| 373 | 374 | with self.subTest(g_obj=g_obj): | |
| 374 | - self.assertRaisesRegex(TypeError, err_regex, list, g_obj) | ||
| 375 | + if changes_iterable: | ||
| 376 | + self.assertRaisesRegex(TypeError, err_regex, list, g_obj) | ||
| 377 | + else: | ||
| 378 | + next(g_obj) | ||
| 375 | 379 | ||
| 376 | 380 | def test_modify_f_locals(self): | |
| 377 | 381 | def modify_f_locals(g, local, obj): | |
@@ -384,22 +388,22 @@ def get_generator_genexpr(obj): | |||
| 384 | 388 | def get_generator_genfunc(obj): | |
| 385 | 389 | return modify_f_locals(self.genfunc(), 'it', obj) | |
| 386 | 390 | ||
| 387 | - self.process_tests(get_generator_genexpr) | ||
| 388 | - self.process_tests(get_generator_genfunc) | ||
| 391 | + self.process_tests(get_generator_genexpr, False) | ||
| 392 | + self.process_tests(get_generator_genfunc, True) | ||
| 389 | 393 | ||
| 390 | 394 | def test_new_gen_from_gi_code(self): | |
| 391 | 395 | def new_gen_from_gi_code(g, obj): | |
| 392 | 396 | generator_func = types.FunctionType(g.gi_code, {}) | |
| 393 | 397 | return generator_func(obj) | |
| 394 | 398 | ||
| 395 | - def get_generator_genexpr(obj): | ||
| 396 | - return new_gen_from_gi_code(self.genexpr(), obj) | ||
| 399 | + for obj in self.non_iterables: | ||
| 400 | + with self.assertRaises(TypeError): | ||
| 401 | + new_gen_from_gi_code(self.genexpr(), obj) | ||
| 397 | 402 | ||
| 398 | 403 | def get_generator_genfunc(obj): | |
| 399 | 404 | return new_gen_from_gi_code(self.genfunc(), obj) | |
| 400 | 405 | ||
| 401 | - self.process_tests(get_generator_genexpr) | ||
| 402 | - self.process_tests(get_generator_genfunc) | ||
| 406 | + self.process_tests(get_generator_genfunc, True) | ||
| 403 | 407 | ||
| 404 | 408 | ||
| 405 | 409 | class ExceptionTest(unittest.TestCase): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,3 @@ | |||
| 1 | + Generator expressions in 3.15 now conform to the documented behavior when | ||
| 2 | + the iterable does not support iteration. This matches the behavior in 3.14 | ||
| 3 | + and earlier | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3189,14 +3189,15 @@ dummy_func( | |||
| 3189 | 3189 | #ifdef Py_STATS | |
| 3190 | 3190 | _Py_GatherStats_GetIter(iterable); | |
| 3191 | 3191 | #endif | |
| 3192 | - /* before: [obj]; after [getiter(obj)] */ | ||
| 3193 | 3192 | PyTypeObject *tp = PyStackRef_TYPE(iterable); | |
| 3194 | 3193 | if (tp == &PyTuple_Type || tp == &PyList_Type) { | |
| 3194 | + /* Leave iterable on stack and pushed tagged 0 */ | ||
| 3195 | 3195 | iter = iterable; | |
| 3196 | 3196 | DEAD(iterable); | |
| 3197 | 3197 | index_or_null = PyStackRef_TagInt(0); | |
| 3198 | 3198 | } | |
| 3199 | 3199 | else { | |
| 3200 | + /* Pop iterable, and push iterator then NULL */ | ||
| 3200 | 3201 | PyObject *iter_o = PyObject_GetIter(PyStackRef_AsPyObjectBorrow(iterable)); | |
| 3201 | 3202 | PyStackRef_CLOSE(iterable); | |
| 3202 | 3203 | ERROR_IF(iter_o == NULL); | |
@@ -5033,7 +5034,7 @@ dummy_func( | |||
| 5033 | 5034 | PyFunctionObject *func = (PyFunctionObject *)PyStackRef_AsPyObjectBorrow(frame->f_funcobj); | |
| 5034 | 5035 | PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); | |
| 5035 | 5036 | ERROR_IF(gen == NULL); | |
| 5036 | - assert(STACK_LEVEL() == 0); | ||
| 5037 | + assert(STACK_LEVEL() <= 2); | ||
| 5037 | 5038 | SAVE_STACK(); | |
| 5038 | 5039 | _PyInterpreterFrame *gen_frame = &gen->gi_iframe; | |
| 5039 | 5040 | frame->instr_ptr++; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -227,19 +227,25 @@ static int codegen_call_helper(compiler *c, location loc, | |||
| 227 | 227 | static int codegen_try_except(compiler *, stmt_ty); | |
| 228 | 228 | static int codegen_try_star_except(compiler *, stmt_ty); | |
| 229 | 229 | ||
| 230 | + typedef enum { | ||
| 231 | + ITERABLE_IN_LOCAL = 0, | ||
| 232 | + ITERABLE_ON_STACK = 1, | ||
| 233 | + ITERATOR_ON_STACK = 2, | ||
| 234 | + } IterStackPosition; | ||
| 235 | + | ||
| 230 | 236 | static int codegen_sync_comprehension_generator( | |
| 231 | 237 | compiler *c, location loc, | |
| 232 | 238 | asdl_comprehension_seq *generators, int gen_index, | |
| 233 | 239 | int depth, | |
| 234 | 240 | expr_ty elt, expr_ty val, int type, | |
| 235 | - int iter_on_stack); | ||
| 241 | + IterStackPosition iter_pos); | ||
| 236 | 242 | ||
| 237 | 243 | static int codegen_async_comprehension_generator( | |
| 238 | 244 | compiler *c, location loc, | |
| 239 | 245 | asdl_comprehension_seq *generators, int gen_index, | |
| 240 | 246 | int depth, | |
| 241 | 247 | expr_ty elt, expr_ty val, int type, | |
| 242 | - int iter_on_stack); | ||
| 248 | + IterStackPosition iter_pos); | ||
| 243 | 249 | ||
| 244 | 250 | static int codegen_pattern(compiler *, pattern_ty, pattern_context *); | |
| 245 | 251 | static int codegen_match(compiler *, stmt_ty); | |
@@ -665,6 +671,18 @@ codegen_enter_scope(compiler *c, identifier name, int scope_type, | |||
| 665 | 671 | if (scope_type == COMPILE_SCOPE_MODULE) { | |
| 666 | 672 | loc.lineno = 0; | |
| 667 | 673 | } | |
| 674 | + /* Add the generator prefix instructions. */ | ||
| 675 | + | ||
| 676 | + PySTEntryObject *ste = SYMTABLE_ENTRY(c); | ||
| 677 | + if (ste->ste_coroutine || ste->ste_generator) { | ||
| 678 | + /* Note that RETURN_GENERATOR + POP_TOP have a net stack effect | ||
| 679 | + * of 0. This is because RETURN_GENERATOR pushes the generator | ||
| 680 | + before returning. */ | ||
| 681 | + location loc = LOCATION(lineno, lineno, -1, -1); | ||
| 682 | + ADDOP(c, loc, RETURN_GENERATOR); | ||
| 683 | + ADDOP(c, loc, POP_TOP); | ||
| 684 | + } | ||
| 685 | + | ||
| 668 | 686 | ADDOP_I(c, loc, RESUME, RESUME_AT_FUNC_START); | |
| 669 | 687 | if (scope_type == COMPILE_SCOPE_MODULE) { | |
| 670 | 688 | ADDOP(c, loc, ANNOTATIONS_PLACEHOLDER); | |
@@ -1187,10 +1205,15 @@ codegen_wrap_in_stopiteration_handler(compiler *c) | |||
| 1187 | 1205 | { | |
| 1188 | 1206 | NEW_JUMP_TARGET_LABEL(c, handler); | |
| 1189 | 1207 | ||
| 1190 | - /* Insert SETUP_CLEANUP at start */ | ||
| 1208 | + /* Insert SETUP_CLEANUP just before RESUME */ | ||
| 1209 | + instr_sequence *seq = INSTR_SEQUENCE(c); | ||
| 1210 | + int resume = 0; | ||
| 1211 | + while (_PyInstructionSequence_GetInstruction(seq, resume).i_opcode != RESUME) { | ||
| 1212 | + resume++; | ||
| 1213 | + } | ||
| 1191 | 1214 | RETURN_IF_ERROR( | |
| 1192 | 1215 | _PyInstructionSequence_InsertInstruction( | |
| 1193 | - INSTR_SEQUENCE(c), 0, | ||
| 1216 | + seq, resume, | ||
| 1194 | 1217 | SETUP_CLEANUP, handler.id, NO_LOCATION)); | |
| 1195 | 1218 | ||
| 1196 | 1219 | ADDOP_LOAD_CONST(c, NO_LOCATION, Py_None); | |
@@ -4401,18 +4424,18 @@ codegen_comprehension_generator(compiler *c, location loc, | |||
| 4401 | 4424 | asdl_comprehension_seq *generators, int gen_index, | |
| 4402 | 4425 | int depth, | |
| 4403 | 4426 | expr_ty elt, expr_ty val, int type, | |
| 4404 | - int iter_on_stack) | ||
| 4427 | + IterStackPosition iter_pos) | ||
| 4405 | 4428 | { | |
| 4406 | 4429 | comprehension_ty gen; | |
| 4407 | 4430 | gen = (comprehension_ty)asdl_seq_GET(generators, gen_index); | |
| 4408 | 4431 | if (gen->is_async) { | |
| 4409 | 4432 | return codegen_async_comprehension_generator( | |
| 4410 | 4433 | c, loc, generators, gen_index, depth, elt, val, type, | |
| 4411 | - iter_on_stack); | ||
| 4434 | + iter_pos); | ||
| 4412 | 4435 | } else { | |
| 4413 | 4436 | return codegen_sync_comprehension_generator( | |
| 4414 | 4437 | c, loc, generators, gen_index, depth, elt, val, type, | |
| 4415 | - iter_on_stack); | ||
| 4438 | + iter_pos); | ||
| 4416 | 4439 | } | |
| 4417 | 4440 | } | |
| 4418 | 4441 | ||
@@ -4421,7 +4444,7 @@ codegen_sync_comprehension_generator(compiler *c, location loc, | |||
| 4421 | 4444 | asdl_comprehension_seq *generators, | |
| 4422 | 4445 | int gen_index, int depth, | |
| 4423 | 4446 | expr_ty elt, expr_ty val, int type, | |
| 4424 | - int iter_on_stack) | ||
| 4447 | + IterStackPosition iter_pos) | ||
| 4425 | 4448 | { | |
| 4426 | 4449 | /* generate code for the iterator, then each of the ifs, | |
| 4427 | 4450 | and then write to the element */ | |
@@ -4433,7 +4456,7 @@ codegen_sync_comprehension_generator(compiler *c, location loc, | |||
| 4433 | 4456 | comprehension_ty gen = (comprehension_ty)asdl_seq_GET(generators, | |
| 4434 | 4457 | gen_index); | |
| 4435 | 4458 | ||
| 4436 | - if (!iter_on_stack) { | ||
| 4459 | + if (iter_pos == ITERABLE_IN_LOCAL) { | ||
| 4437 | 4460 | if (gen_index == 0) { | |
| 4438 | 4461 | assert(METADATA(c)->u_argcount == 1); | |
| 4439 | 4462 | ADDOP_I(c, loc, LOAD_FAST, 0); | |
@@ -4468,9 +4491,12 @@ codegen_sync_comprehension_generator(compiler *c, location loc, | |||
| 4468 | 4491 | } | |
| 4469 | 4492 | ||
| 4470 | 4493 | if (IS_JUMP_TARGET_LABEL(start)) { | |
| 4471 | - depth += 2; | ||
| 4472 | - ADDOP(c, LOC(gen->iter), GET_ITER); | ||
| 4494 | + if (iter_pos != ITERATOR_ON_STACK) { | ||
| 4495 | + ADDOP(c, LOC(gen->iter), GET_ITER); | ||
| 4496 | + depth += 1; | ||
| 4497 | + } | ||
| 4473 | 4498 | USE_LABEL(c, start); | |
| 4499 | + depth += 1; | ||
| 4474 | 4500 | ADDOP_JUMP(c, LOC(gen->iter), FOR_ITER, anchor); | |
| 4475 | 4501 | } | |
| 4476 | 4502 | VISIT(c, expr, gen->target); | |
@@ -4486,7 +4512,7 @@ codegen_sync_comprehension_generator(compiler *c, location loc, | |||
| 4486 | 4512 | RETURN_IF_ERROR( | |
| 4487 | 4513 | codegen_comprehension_generator(c, loc, | |
| 4488 | 4514 | generators, gen_index, depth, | |
| 4489 | - elt, val, type, 0)); | ||
| 4515 | + elt, val, type, ITERABLE_IN_LOCAL)); | ||
| 4490 | 4516 | } | |
| 4491 | 4517 | ||
| 4492 | 4518 | location elt_loc = LOC(elt); | |
@@ -4545,7 +4571,7 @@ codegen_async_comprehension_generator(compiler *c, location loc, | |||
| 4545 | 4571 | asdl_comprehension_seq *generators, | |
| 4546 | 4572 | int gen_index, int depth, | |
| 4547 | 4573 | expr_ty elt, expr_ty val, int type, | |
| 4548 | - int iter_on_stack) | ||
| 4574 | + IterStackPosition iter_pos) | ||
| 4549 | 4575 | { | |
| 4550 | 4576 | NEW_JUMP_TARGET_LABEL(c, start); | |
| 4551 | 4577 | NEW_JUMP_TARGET_LABEL(c, send); | |
@@ -4555,7 +4581,7 @@ codegen_async_comprehension_generator(compiler *c, location loc, | |||
| 4555 | 4581 | comprehension_ty gen = (comprehension_ty)asdl_seq_GET(generators, | |
| 4556 | 4582 | gen_index); | |
| 4557 | 4583 | ||
| 4558 | - if (!iter_on_stack) { | ||
| 4584 | + if (iter_pos == ITERABLE_IN_LOCAL) { | ||
| 4559 | 4585 | if (gen_index == 0) { | |
| 4560 | 4586 | assert(METADATA(c)->u_argcount == 1); | |
| 4561 | 4587 | ADDOP_I(c, loc, LOAD_FAST, 0); | |
@@ -4565,7 +4591,9 @@ codegen_async_comprehension_generator(compiler *c, location loc, | |||
| 4565 | 4591 | VISIT(c, expr, gen->iter); | |
| 4566 | 4592 | } | |
| 4567 | 4593 | } | |
| 4568 | - ADDOP(c, LOC(gen->iter), GET_AITER); | ||
| 4594 | + if (iter_pos != ITERATOR_ON_STACK) { | ||
| 4595 | + ADDOP(c, LOC(gen->iter), GET_AITER); | ||
| 4596 | + } | ||
| 4569 | 4597 | ||
| 4570 | 4598 | USE_LABEL(c, start); | |
| 4571 | 4599 | /* Runtime will push a block here, so we need to account for that */ | |
@@ -4795,11 +4823,13 @@ codegen_comprehension(compiler *c, expr_ty e, int type, | |||
| 4795 | 4823 | location loc = LOC(e); | |
| 4796 | 4824 | ||
| 4797 | 4825 | outermost = (comprehension_ty) asdl_seq_GET(generators, 0); | |
| 4826 | + IterStackPosition iter_state; | ||
| 4798 | 4827 | if (is_inlined) { | |
| 4799 | 4828 | VISIT(c, expr, outermost->iter); | |
| 4800 | 4829 | if (push_inlined_comprehension_state(c, loc, entry, &inline_state)) { | |
| 4801 | 4830 | goto error; | |
| 4802 | 4831 | } | |
| 4832 | + iter_state = ITERABLE_ON_STACK; | ||
| 4803 | 4833 | } | |
| 4804 | 4834 | else { | |
| 4805 | 4835 | /* Receive outermost iter as an implicit argument */ | |
@@ -4810,6 +4840,23 @@ codegen_comprehension(compiler *c, expr_ty e, int type, | |||
| 4810 | 4840 | (void *)e, e->lineno, NULL, &umd) < 0) { | |
| 4811 | 4841 | goto error; | |
| 4812 | 4842 | } | |
| 4843 | + if (type == COMP_GENEXP) { | ||
| 4844 | + /* Insert GET_ITER before RETURN_GENERATOR. | ||
| 4845 | + https://docs.python.org/3/reference/expressions.html#generator-expressions */ | ||
| 4846 | + RETURN_IF_ERROR( | ||
| 4847 | + _PyInstructionSequence_InsertInstruction( | ||
| 4848 | + INSTR_SEQUENCE(c), 0, | ||
| 4849 | + LOAD_FAST, 0, LOC(outermost->iter))); | ||
| 4850 | + RETURN_IF_ERROR( | ||
| 4851 | + _PyInstructionSequence_InsertInstruction( | ||
| 4852 | + INSTR_SEQUENCE(c), 1, | ||
| 4853 | + outermost->is_async ? GET_AITER : GET_ITER, | ||
| 4854 | + 0, LOC(outermost->iter))); | ||
| 4855 | + iter_state = ITERATOR_ON_STACK; | ||
| 4856 | + } | ||
| 4857 | + else { | ||
| 4858 | + iter_state = ITERABLE_IN_LOCAL; | ||
| 4859 | + } | ||
| 4813 | 4860 | } | |
| 4814 | 4861 | Py_CLEAR(entry); | |
| 4815 | 4862 | ||
@@ -4836,9 +4883,8 @@ codegen_comprehension(compiler *c, expr_ty e, int type, | |||
| 4836 | 4883 | ADDOP_I(c, loc, SWAP, 2); | |
| 4837 | 4884 | } | |
| 4838 | 4885 | } | |
| 4839 | - | ||
| 4840 | 4886 | if (codegen_comprehension_generator(c, loc, generators, 0, 0, | |
| 4841 | - elt, val, type, is_inlined) < 0) { | ||
| 4887 | + elt, val, type, iter_state) < 0) { | ||
| 4842 | 4888 | goto error_in_scope; | |
| 4843 | 4889 | } | |
| 4844 | 4890 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1443,7 +1443,7 @@ optimize_and_assemble_code_unit(struct compiler_unit *u, PyObject *const_cache, | |||
| 1443 | 1443 | ||
| 1444 | 1444 | int stackdepth; | |
| 1445 | 1445 | int nlocalsplus; | |
| 1446 | - if (_PyCfg_OptimizedCfgToInstructionSequence(g, &u->u_metadata, code_flags, | ||
| 1446 | + if (_PyCfg_OptimizedCfgToInstructionSequence(g, &u->u_metadata, | ||
| 1447 | 1447 | &stackdepth, &nlocalsplus, | |
| 1448 | 1448 | &optimized_instrs) < 0) { | |
| 1449 | 1449 | goto error; | |
@@ -1718,7 +1718,7 @@ _PyCompile_Assemble(_PyCompile_CodeUnitMetadata *umd, PyObject *filename, | |||
| 1718 | 1718 | ||
| 1719 | 1719 | int code_flags = 0; | |
| 1720 | 1720 | int stackdepth, nlocalsplus; | |
| 1721 | - if (_PyCfg_OptimizedCfgToInstructionSequence(g, umd, code_flags, | ||
| 1721 | + if (_PyCfg_OptimizedCfgToInstructionSequence(g, umd, | ||
| 1722 | 1722 | &stackdepth, &nlocalsplus, | |
| 1723 | 1723 | &optimized_instrs) < 0) { | |
| 1724 | 1724 | goto error; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments