Construct GeneratorExpressionCreation

Performance Diagrams

Construct GeneratorExpressionCreation 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)17171394688.11538461538461257.0CPython 2.742456783240.03846153846155443.0153720364592Nuitka (master)36802741391.96153846153845451.152164626745Nuitka (develop)36802741543.8846153846154451.152164626745Nuitka (factory)Construct GeneratorExpressionCreationTicks Construct GeneratorExpressionCreation 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000CPython 3.8Nuitka (master)Nuitka (develop)Nuitka (factory)20149733088.11538461538461257.0CPython 3.848910256240.03846153846155444.13207504459814Nuitka (master)48910189391.96153846153845444.1321572130853Nuitka (develop)48911777543.8846153846154444.1302096973005Nuitka (factory)Construct GeneratorExpressionCreationTicks

Source Code with Construct

def calledRepeatedly():
    # We measure making a generator iterator step or not.
# construct_begin
    gen = (x for x in range(3))
# construct_alternative



    x = next(gen)
    next(gen)

    return x

import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

def calledRepeatedly():
    # We measure making a generator iterator step or not.
# construct_begin

# construct_alternative
    gen = iter((1,2,3))
# construct_end

    x = next(gen)
    next(gen)

    return x

import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Context Diff of Source Code


Construct
Baseline
19 # 19 #
20 20
21 def calledRepeatedly(): 21 def calledRepeatedly():
22     # We measure making a generator iterator step or not. 22     # We measure making a generator iterator step or not.
23 # construct_begin 23 # construct_begin
n 24     gen = (x for x in range(3)) n 24  
25 # construct_alternative 25 # construct_alternative
t 26   t 26     gen = iter((1,2,3))
27   27 # construct_end
28 28
29     x = next(gen) 29     x = next(gen)
30     next(gen) 30     next(gen)
31 31
32     return x 32     return x

Context Diff of Generated Code


Construct
Baseline
31 31
32 PyObject *module___main__; 32 PyObject *module___main__;
33 PyDictObject *moduledict___main__; 33 PyDictObject *moduledict___main__;
34 34
35 /* The declarations of module constants used, if any. */ 35 /* The declarations of module constants used, if any. */
n 36 static PyObject *mod_consts[19]; n 36 static PyObject *mod_consts[16];
37 #ifndef __NUITKA_NO_ASSERT__ 37 #ifndef __NUITKA_NO_ASSERT__
n 38 static Py_hash_t mod_consts_hash[19]; n 38 static Py_hash_t mod_consts_hash[16];
39 #endif 39 #endif
40 40
41 static PyObject *module_filename_obj = NULL; 41 static PyObject *module_filename_obj = NULL;
42 42
43 /* Indicator if this modules private constants were created yet. */ 43 /* Indicator if this modules private constants were created yet. */
48     if (constants_created == false) { 48     if (constants_created == false) {
49         loadConstantsBlob(&mod_consts[0], UNTRANSLATE("__main__")); 49         loadConstantsBlob(&mod_consts[0], UNTRANSLATE("__main__"));
50         constants_created = true; 50         constants_created = true;
51 51
52 #ifndef __NUITKA_NO_ASSERT__ 52 #ifndef __NUITKA_NO_ASSERT__
n 53         for(int i = 0; i < 19; i++) { n 53         for(int i = 0; i < 16; i++) {
54             mod_consts_hash[i] = DEEP_HASH(mod_consts[i]); 54             mod_consts_hash[i] = DEEP_HASH(mod_consts[i]);
55         } 55         }
56 #endif 56 #endif
57     } 57     }
58 } 58 }
68 #ifndef __NUITKA_NO_ASSERT__ 68 #ifndef __NUITKA_NO_ASSERT__
69 void checkModuleConstants___main__(void) { 69 void checkModuleConstants___main__(void) {
70     // The module may not have been used at all, then ignore this. 70     // The module may not have been used at all, then ignore this.
71     if (constants_created == false) return; 71     if (constants_created == false) return;
72 72
n 73     for(int i = 0; i < 19; i++) { n 73     for(int i = 0; i < 16; i++) {
74         assert(mod_consts_hash[i] == DEEP_HASH(mod_consts[i])); 74         assert(mod_consts_hash[i] == DEEP_HASH(mod_consts[i]));
75         CHECK_OBJECT_DEEP(mod_consts[i]); 75         CHECK_OBJECT_DEEP(mod_consts[i]);
76     } 76     }
77 } 77 }
78 #endif 78 #endif
79 79
80 // The module code objects. 80 // The module code objects.
n 81 static PyCodeObject *codeobj_da4e371ea33c22e980ef13686c21c3ea; n
82 static PyCodeObject *codeobj_03b082e6459c7cd69ad4682a29ddc7ff; 81 static PyCodeObject *codeobj_03b082e6459c7cd69ad4682a29ddc7ff;
83 static PyCodeObject *codeobj_d215fa2c8d029b67100568fb1a69041b; 82 static PyCodeObject *codeobj_d215fa2c8d029b67100568fb1a69041b;
84 /* For use in "MainProgram.c". */ 83 /* For use in "MainProgram.c". */
85 PyCodeObject *codeobj_main = NULL; 84 PyCodeObject *codeobj_main = NULL;
86 85
87 static void createModuleCodeObjects(void) { 86 static void createModuleCodeObjects(void) {
n 88     module_filename_obj = mod_consts[4]; CHECK_OBJECT(module_filename_obj); n 87     module_filename_obj = mod_consts[2]; CHECK_OBJECT(module_filename_obj);
89     codeobj_da4e371ea33c22e980ef13686c21c3ea = MAKE_CODEOBJECT(module_filename_obj, 24, CO_GENERATOR | CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[1], mod_consts[16], NULL, 1, 0, 0);
90     codeobj_03b082e6459c7cd69ad4682a29ddc7ff = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[17], NULL, NULL, 0, 0, 0); 88     codeobj_03b082e6459c7cd69ad4682a29ddc7ff = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[14], NULL, NULL, 0, 0, 0);
91     codeobj_d215fa2c8d029b67100568fb1a69041b = MAKE_CODEOBJECT(module_filename_obj, 21, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[8], mod_consts[18], NULL, 0, 0, 0); 89     codeobj_d215fa2c8d029b67100568fb1a69041b = MAKE_CODEOBJECT(module_filename_obj, 21, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[6], mod_consts[15], NULL, 0, 0, 0);
92 } 90 }
93 91
94 // The module function declarations. 92 // The module function declarations.
n 95 static PyObject *MAKE_GENERATOR___main__$$$function__1_calledRepeatedly$$$genexpr__1_genexpr(struct Nuitka_CellObject **closure); n
96  
97  
98 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly(); 93 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly();
99 94
100 95
101 // The module function definitions. 96 // The module function definitions.
102 static PyObject *impl___main__$$$function__1_calledRepeatedly(struct Nuitka_FunctionObject const *self, PyObject **python_pars) { 97 static PyObject *impl___main__$$$function__1_calledRepeatedly(struct Nuitka_FunctionObject const *self, PyObject **python_pars) {
106 #endif 101 #endif
107 102
108     // Local variable declarations. 103     // Local variable declarations.
109     PyObject *var_gen = NULL; 104     PyObject *var_gen = NULL;
110     PyObject *var_x = NULL; 105     PyObject *var_x = NULL;
n 111     PyObject *tmp_genexpr_1__$0 = NULL; n
112     struct Nuitka_FrameObject *frame_d215fa2c8d029b67100568fb1a69041b; 106     struct Nuitka_FrameObject *frame_d215fa2c8d029b67100568fb1a69041b;
113     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 107     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
114     PyObject *exception_type = NULL; 108     PyObject *exception_type = NULL;
115     PyObject *exception_value = NULL; 109     PyObject *exception_value = NULL;
116     PyTracebackObject *exception_tb = NULL; 110     PyTracebackObject *exception_tb = NULL;
124     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 118     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
125 119
126     // Actual function body. 120     // Actual function body.
127     { 121     {
128         PyObject *tmp_assign_source_1; 122         PyObject *tmp_assign_source_1;
n 129         { n
130             PyObject *tmp_assign_source_2;
131             PyObject *tmp_iter_arg_1; 123         PyObject *tmp_iter_arg_1;
132             tmp_iter_arg_1 = mod_consts[0]; 124         tmp_iter_arg_1 = mod_consts[0];
133             tmp_assign_source_2 = MAKE_ITERATOR_INFALLIBLE(tmp_iter_arg_1); 125         tmp_assign_source_1 = MAKE_ITERATOR_INFALLIBLE(tmp_iter_arg_1);
134             assert(!(tmp_assign_source_2 == NULL)); 126         assert(!(tmp_assign_source_1 == NULL));
135             assert(tmp_genexpr_1__$0 == NULL);
136             tmp_genexpr_1__$0 = tmp_assign_source_2;
137         }
138         // Tried code:
139         {
140             struct Nuitka_CellObject *tmp_closure_1[1];
141  
142             tmp_closure_1[0] = Nuitka_Cell_New0(tmp_genexpr_1__$0);
143  
144             tmp_assign_source_1 = MAKE_GENERATOR___main__$$$function__1_calledRepeatedly$$$genexpr__1_genexpr(tmp_closure_1);
145  
146             goto try_return_handler_1;
147         }
148         NUITKA_CANNOT_GET_HERE("tried codes exits in all cases");
149         return NULL;
150         // Return handler code:
151         try_return_handler_1:;
152         CHECK_OBJECT(tmp_genexpr_1__$0);
153         Py_DECREF(tmp_genexpr_1__$0);
154         tmp_genexpr_1__$0 = NULL;
155         goto outline_result_1;
156         // End of try:
157         CHECK_OBJECT(tmp_genexpr_1__$0);
158         Py_DECREF(tmp_genexpr_1__$0);
159         tmp_genexpr_1__$0 = NULL;
160         NUITKA_CANNOT_GET_HERE("Return statement must have exited already.");
161         return NULL;
162         outline_result_1:;
163         assert(var_gen == NULL); 127         assert(var_gen == NULL);
164         var_gen = tmp_assign_source_1; 128         var_gen = tmp_assign_source_1;
165     } 129     }
166     // Tried code: 130     // Tried code:
167     if (isFrameUnusable(cache_frame_d215fa2c8d029b67100568fb1a69041b)) { 131     if (isFrameUnusable(cache_frame_d215fa2c8d029b67100568fb1a69041b)) {
190     // Mark the frame object as in use, ref count 1 will be up for reuse. 154     // Mark the frame object as in use, ref count 1 will be up for reuse.
191     assert(Py_REFCNT(frame_d215fa2c8d029b67100568fb1a69041b) == 2); // Frame stack 155     assert(Py_REFCNT(frame_d215fa2c8d029b67100568fb1a69041b) == 2); // Frame stack
192 156
193     // Framed code: 157     // Framed code:
194     { 158     {
n 195         PyObject *tmp_assign_source_3; n 159         PyObject *tmp_assign_source_2;
196         PyObject *tmp_value_name_1; 160         PyObject *tmp_value_name_1;
197         CHECK_OBJECT(var_gen); 161         CHECK_OBJECT(var_gen);
198         tmp_value_name_1 = var_gen; 162         tmp_value_name_1 = var_gen;
n 199         tmp_assign_source_3 = ITERATOR_NEXT(tmp_value_name_1); n 163         tmp_assign_source_2 = ITERATOR_NEXT(tmp_value_name_1);
200         if (tmp_assign_source_3 == NULL) { 164         if (tmp_assign_source_2 == NULL) {
201             if (!ERROR_OCCURRED()) { 165             if (!ERROR_OCCURRED()) {
202                 exception_type = PyExc_StopIteration; 166                 exception_type = PyExc_StopIteration;
203                 Py_INCREF(exception_type); 167                 Py_INCREF(exception_type);
204                 exception_value = NULL; 168                 exception_value = NULL;
205                 exception_tb = NULL; 169                 exception_tb = NULL;
211             type_description_1 = "oo"; 175             type_description_1 = "oo";
212             exception_lineno = 29; 176             exception_lineno = 29;
213             goto frame_exception_exit_1; 177             goto frame_exception_exit_1;
214         } 178         }
215         assert(var_x == NULL); 179         assert(var_x == NULL);
n 216         var_x = tmp_assign_source_3; n 180         var_x = tmp_assign_source_2;
217     } 181     }
218     { 182     {
219         PyObject *tmp_value_name_2; 183         PyObject *tmp_value_name_2;
220         PyObject *tmp_next_value_1; 184         PyObject *tmp_next_value_1;
221         CHECK_OBJECT(var_gen); 185         CHECK_OBJECT(var_gen);
284 248
285     // Put the previous frame back on top. 249     // Put the previous frame back on top.
286     popFrameStack(); 250     popFrameStack();
287 251
288     // Return the error. 252     // Return the error.
n 289     goto try_except_handler_2; n 253     goto try_except_handler_1;
290 254
291     frame_no_exception_1:; 255     frame_no_exception_1:;
292     CHECK_OBJECT(var_x); 256     CHECK_OBJECT(var_x);
293     tmp_return_value = var_x; 257     tmp_return_value = var_x;
294     Py_INCREF(tmp_return_value); 258     Py_INCREF(tmp_return_value);
n 295     goto try_return_handler_2; n 259     goto try_return_handler_1;
296     NUITKA_CANNOT_GET_HERE("tried codes exits in all cases"); 260     NUITKA_CANNOT_GET_HERE("tried codes exits in all cases");
297     return NULL; 261     return NULL;
298     // Return handler code: 262     // Return handler code:
n 299     try_return_handler_2:; n 263     try_return_handler_1:;
300     CHECK_OBJECT(var_gen); 264     CHECK_OBJECT(var_gen);
301     Py_DECREF(var_gen); 265     Py_DECREF(var_gen);
302     var_gen = NULL; 266     var_gen = NULL;
303     CHECK_OBJECT(var_x); 267     CHECK_OBJECT(var_x);
304     Py_DECREF(var_x); 268     Py_DECREF(var_x);
305     var_x = NULL; 269     var_x = NULL;
306     goto function_return_exit; 270     goto function_return_exit;
307     // Exception handler code: 271     // Exception handler code:
n 308     try_except_handler_2:; n 272     try_except_handler_1:;
309     exception_keeper_type_1 = exception_type; 273     exception_keeper_type_1 = exception_type;
310     exception_keeper_value_1 = exception_value; 274     exception_keeper_value_1 = exception_value;
311     exception_keeper_tb_1 = exception_tb; 275     exception_keeper_tb_1 = exception_tb;
312     exception_keeper_lineno_1 = exception_lineno; 276     exception_keeper_lineno_1 = exception_lineno;
313     exception_type = NULL; 277     exception_type = NULL;
349    return tmp_return_value; 313    return tmp_return_value;
350 } 314 }
351 315
352 316
353 317
n 354 struct __main__$$$function__1_calledRepeatedly$$$genexpr__1_genexpr_locals { n
355     PyObject *var_x;
356     PyObject *tmp_iter_value_0;
357     char const *type_description_1;
358     PyObject *exception_type;
359     PyObject *exception_value;
360     PyTracebackObject *exception_tb;
361     int exception_lineno;
362     PyObject *exception_keeper_type_1;
363     PyObject *exception_keeper_value_1;
364     PyTracebackObject *exception_keeper_tb_1;
365     int exception_keeper_lineno_1;
366     PyObject *exception_keeper_type_2;
367     PyObject *exception_keeper_value_2;
368     PyTracebackObject *exception_keeper_tb_2;
369     int exception_keeper_lineno_2;
370 };
371  
372 static PyObject *__main__$$$function__1_calledRepeatedly$$$genexpr__1_genexpr_context(struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value) {
373     CHECK_OBJECT(generator);
374     assert(Nuitka_Generator_Check((PyObject *)generator));
375     CHECK_OBJECT_X(yield_return_value);
376  
377     // Heap access if used.
378     struct __main__$$$function__1_calledRepeatedly$$$genexpr__1_genexpr_locals *generator_heap = (struct __main__$$$function__1_calledRepeatedly$$$genexpr__1_genexpr_locals *)generator->m_heap_storage;
379  
380     // Dispatch to yield based on return label index:
381     switch(generator->m_yield_return_index) {
382     case 1: goto yield_return_1;
383     }
384  
385     // Local variable initialization
386     NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused;
387     static struct Nuitka_FrameObject *cache_m_frame = NULL;
388     generator_heap->var_x = NULL;
389     generator_heap->tmp_iter_value_0 = NULL;
390     generator_heap->type_description_1 = NULL;
391     generator_heap->exception_type = NULL;
392     generator_heap->exception_value = NULL;
393     generator_heap->exception_tb = NULL;
394     generator_heap->exception_lineno = 0;
395  
396     // Actual generator function body.
397     // Tried code:
398     if (isFrameUnusable(cache_m_frame)) {
399         Py_XDECREF(cache_m_frame);
400  
401 #if _DEBUG_REFCOUNTS
402         if (cache_m_frame == NULL) {
403             count_active_frame_cache_instances += 1;
404         } else {
405             count_released_frame_cache_instances += 1;
406         }
407         count_allocated_frame_cache_instances += 1;
408 #endif
409         cache_m_frame = MAKE_FUNCTION_FRAME(codeobj_da4e371ea33c22e980ef13686c21c3ea, module___main__, sizeof(void *)+sizeof(void *));
410 #if _DEBUG_REFCOUNTS
411     } else {
412         count_hit_frame_cache_instances += 1;
413 #endif
414     }
415     generator->m_frame = cache_m_frame;
416  
417     // Mark the frame object as in use, ref count 1 will be up for reuse.
418     Py_INCREF(generator->m_frame);
419     assert(Py_REFCNT(generator->m_frame) == 2); // Frame stack
420  
421 #if PYTHON_VERSION >= 0x340
422     generator->m_frame->m_frame.f_gen = (PyObject *)generator;
423 #endif
424  
425     assert(generator->m_frame->m_frame.f_back == NULL);
426     Py_CLEAR(generator->m_frame->m_frame.f_back);
427  
428     generator->m_frame->m_frame.f_back = PyThreadState_GET()->frame;
429     Py_INCREF(generator->m_frame->m_frame.f_back);
430  
431     PyThreadState_GET()->frame = &generator->m_frame->m_frame;
432     Py_INCREF(generator->m_frame);
433  
434     Nuitka_Frame_MarkAsExecuting(generator->m_frame);
435  
436 #if PYTHON_VERSION >= 0x300
437     // Accept currently existing exception as the one to publish again when we
438     // yield or yield from.
439     {
440         PyThreadState *thread_state = PyThreadState_GET();
441  
442         EXC_TYPE_F(generator) = EXC_TYPE(thread_state);
443         if (EXC_TYPE_F(generator) == Py_None) EXC_TYPE_F(generator) = NULL;
444         Py_XINCREF(EXC_TYPE_F(generator));
445         EXC_VALUE_F(generator) = EXC_VALUE(thread_state);
446         Py_XINCREF(EXC_VALUE_F(generator));
447         EXC_TRACEBACK_F(generator) = EXC_TRACEBACK(thread_state);
448         Py_XINCREF(EXC_TRACEBACK_F(generator));
449     }
450  
451 #endif
452  
453     // Framed code:
454     // Tried code:
455     loop_start_1:;
456     {
457         PyObject *tmp_next_source_1;
458         PyObject *tmp_assign_source_1;
459         CHECK_OBJECT(Nuitka_Cell_GET(generator->m_closure[0]));
460         tmp_next_source_1 = Nuitka_Cell_GET(generator->m_closure[0]);
461         tmp_assign_source_1 = ITERATOR_NEXT(tmp_next_source_1);
462         if (tmp_assign_source_1 == NULL) {
463             if (CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED()) {
464  
465                 goto loop_end_1;
466             } else {
467  
468                 FETCH_ERROR_OCCURRED(&generator_heap->exception_type, &generator_heap->exception_value, &generator_heap->exception_tb);
469                 generator_heap->type_description_1 = "No";
470                 generator_heap->exception_lineno = 24;
471                 goto try_except_handler_2;
472             }
473         }
474  
475         {
476             PyObject *old = generator_heap->tmp_iter_value_0;
477             generator_heap->tmp_iter_value_0 = tmp_assign_source_1;
478             Py_XDECREF(old);
479         }
480  
481     }
482     {
483         PyObject *tmp_assign_source_2;
484         CHECK_OBJECT(generator_heap->tmp_iter_value_0);
485         tmp_assign_source_2 = generator_heap->tmp_iter_value_0;
486         {
487             PyObject *old = generator_heap->var_x;
488             generator_heap->var_x = tmp_assign_source_2;
489             Py_INCREF(generator_heap->var_x);
490             Py_XDECREF(old);
491         }
492  
493     }
494     {
495         PyObject *tmp_expression_name_1;
496         NUITKA_MAY_BE_UNUSED PyObject *tmp_yield_result_1;
497         CHECK_OBJECT(generator_heap->var_x);
498         tmp_expression_name_1 = generator_heap->var_x;
499         Py_INCREF(tmp_expression_name_1);
500         generator->m_yield_return_index = 1;
501         return tmp_expression_name_1;
502         yield_return_1:
503         if (yield_return_value == NULL) {
504             assert(ERROR_OCCURRED());
505  
506             FETCH_ERROR_OCCURRED(&generator_heap->exception_type, &generator_heap->exception_value, &generator_heap->exception_tb);
507  
508  
509             generator_heap->exception_lineno = 24;
510             generator_heap->type_description_1 = "No";
511             goto try_except_handler_2;
512         }
513         tmp_yield_result_1 = yield_return_value;
514     }
515     if (CONSIDER_THREADING() == false) {
516         assert(ERROR_OCCURRED());
517  
518         FETCH_ERROR_OCCURRED(&generator_heap->exception_type, &generator_heap->exception_value, &generator_heap->exception_tb);
519  
520  
521         generator_heap->exception_lineno = 24;
522         generator_heap->type_description_1 = "No";
523         goto try_except_handler_2;
524     }
525     goto loop_start_1;
526     loop_end_1:;
527     goto try_end_1;
528     // Exception handler code:
529     try_except_handler_2:;
530     generator_heap->exception_keeper_type_1 = generator_heap->exception_type;
531     generator_heap->exception_keeper_value_1 = generator_heap->exception_value;
532     generator_heap->exception_keeper_tb_1 = generator_heap->exception_tb;
533     generator_heap->exception_keeper_lineno_1 = generator_heap->exception_lineno;
534     generator_heap->exception_type = NULL;
535     generator_heap->exception_value = NULL;
536     generator_heap->exception_tb = NULL;
537     generator_heap->exception_lineno = 0;
538  
539     Py_XDECREF(generator_heap->tmp_iter_value_0);
540     generator_heap->tmp_iter_value_0 = NULL;
541     // Re-raise.
542     generator_heap->exception_type = generator_heap->exception_keeper_type_1;
543     generator_heap->exception_value = generator_heap->exception_keeper_value_1;
544     generator_heap->exception_tb = generator_heap->exception_keeper_tb_1;
545     generator_heap->exception_lineno = generator_heap->exception_keeper_lineno_1;
546  
547     goto frame_exception_exit_1;
548     // End of try:
549     try_end_1:;
550  
551     Nuitka_Frame_MarkAsNotExecuting(generator->m_frame);
552  
553 #if PYTHON_VERSION >= 0x300
554     Py_CLEAR(EXC_TYPE_F(generator));
555     Py_CLEAR(EXC_VALUE_F(generator));
556     Py_CLEAR(EXC_TRACEBACK_F(generator));
557 #endif
558  
559     // Allow re-use of the frame again.
560     Py_DECREF(generator->m_frame);
561     goto frame_no_exception_1;
562  
563     frame_exception_exit_1:;
564  
565     // If it's not an exit exception, consider and create a traceback for it.
566     if (!EXCEPTION_MATCH_GENERATOR(generator_heap->exception_type)) {
567         if (generator_heap->exception_tb == NULL) {
568             generator_heap->exception_tb = MAKE_TRACEBACK(generator->m_frame, generator_heap->exception_lineno);
569         } else if (generator_heap->exception_tb->tb_frame != &generator->m_frame->m_frame) {
570             generator_heap->exception_tb = ADD_TRACEBACK(generator_heap->exception_tb, generator->m_frame, generator_heap->exception_lineno);
571         }
572  
573         Nuitka_Frame_AttachLocals(
574             generator->m_frame,
575             generator_heap->type_description_1,
576             NULL,
577             generator_heap->var_x
578         );
579  
580  
581         // Release cached frame if used for exception.
582         if (generator->m_frame == cache_m_frame) {
583 #if _DEBUG_REFCOUNTS
584             count_active_frame_cache_instances -= 1;
585             count_released_frame_cache_instances += 1;
586 #endif
587  
588             Py_DECREF(cache_m_frame);
589             cache_m_frame = NULL;
590         }
591  
592         assertFrameObject(generator->m_frame);
593     }
594  
595 #if PYTHON_VERSION >= 0x300
596     Py_CLEAR(EXC_TYPE_F(generator));
597     Py_CLEAR(EXC_VALUE_F(generator));
598     Py_CLEAR(EXC_TRACEBACK_F(generator));
599 #endif
600  
601     Py_DECREF(generator->m_frame);
602  
603     // Return the error.
604     goto try_except_handler_1;
605  
606     frame_no_exception_1:;
607     goto try_end_2;
608     // Exception handler code:
609     try_except_handler_1:;
610     generator_heap->exception_keeper_type_2 = generator_heap->exception_type;
611     generator_heap->exception_keeper_value_2 = generator_heap->exception_value;
612     generator_heap->exception_keeper_tb_2 = generator_heap->exception_tb;
613     generator_heap->exception_keeper_lineno_2 = generator_heap->exception_lineno;
614     generator_heap->exception_type = NULL;
615     generator_heap->exception_value = NULL;
616     generator_heap->exception_tb = NULL;
617     generator_heap->exception_lineno = 0;
618  
619     Py_XDECREF(generator_heap->var_x);
620     generator_heap->var_x = NULL;
621     // Re-raise.
622     generator_heap->exception_type = generator_heap->exception_keeper_type_2;
623     generator_heap->exception_value = generator_heap->exception_keeper_value_2;
624     generator_heap->exception_tb = generator_heap->exception_keeper_tb_2;
625     generator_heap->exception_lineno = generator_heap->exception_keeper_lineno_2;
626  
627     goto function_exception_exit;
628     // End of try:
629     try_end_2:;
630     Py_XDECREF(generator_heap->tmp_iter_value_0);
631     generator_heap->tmp_iter_value_0 = NULL;
632     Py_XDECREF(generator_heap->var_x);
633     generator_heap->var_x = NULL;
634  
635  
636     return NULL;
637  
638     function_exception_exit:
639     assert(generator_heap->exception_type);
640     RESTORE_ERROR_OCCURRED(generator_heap->exception_type, generator_heap->exception_value, generator_heap->exception_tb);
641  
642     return NULL;
643  
644 }
645  
646 static PyObject *MAKE_GENERATOR___main__$$$function__1_calledRepeatedly$$$genexpr__1_genexpr(struct Nuitka_CellObject **closure) {
647     return Nuitka_Generator_New(
648         __main__$$$function__1_calledRepeatedly$$$genexpr__1_genexpr_context,
649         module___main__,
650         mod_consts[1],
651 #if PYTHON_VERSION >= 0x350
652         mod_consts[2],
653 #endif
654         codeobj_da4e371ea33c22e980ef13686c21c3ea,
655         closure,
656         1,
657         sizeof(struct __main__$$$function__1_calledRepeatedly$$$genexpr__1_genexpr_locals)
658     );
659 }
660  
661  
662  
663 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly() { 318 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly() {
664     struct Nuitka_FunctionObject *result = Nuitka_Function_New( 319     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
665         impl___main__$$$function__1_calledRepeatedly, 320         impl___main__$$$function__1_calledRepeatedly,
n 666         mod_consts[8], n 321         mod_consts[6],
667 #if PYTHON_VERSION >= 0x300 322 #if PYTHON_VERSION >= 0x300
668         NULL, 323         NULL,
669 #endif 324 #endif
670         codeobj_d215fa2c8d029b67100568fb1a69041b, 325         codeobj_d215fa2c8d029b67100568fb1a69041b,
671         NULL, 326         NULL,
1041 696
1042     // Module code. 697     // Module code.
1043     { 698     {
1044         PyObject *tmp_assign_source_1; 699         PyObject *tmp_assign_source_1;
1045         tmp_assign_source_1 = Py_None; 700         tmp_assign_source_1 = Py_None;
n 1046         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_1); n 701         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_1);
1047     } 702     }
1048     { 703     {
1049         PyObject *tmp_assign_source_2; 704         PyObject *tmp_assign_source_2;
n 1050         tmp_assign_source_2 = mod_consts[4]; n 705         tmp_assign_source_2 = mod_consts[2];
1051         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_2); 706         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_2);
1052     } 707     }
1053     { 708     {
1054         PyObject *tmp_assign_source_3; 709         PyObject *tmp_assign_source_3;
1055         tmp_assign_source_3 = Py_None; 710         tmp_assign_source_3 = Py_None;
n 1056         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_3); n 711         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_3);
1057     } 712     }
1058     { 713     {
1059         PyObject *tmp_assign_source_4; 714         PyObject *tmp_assign_source_4;
1060         tmp_assign_source_4 = PyDict_New(); 715         tmp_assign_source_4 = PyDict_New();
n 1061         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[7], tmp_assign_source_4); n 716         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_4);
1062     } 717     }
1063     { 718     {
1064         PyObject *tmp_assign_source_5; 719         PyObject *tmp_assign_source_5;
1065 720
1066 721
1067         tmp_assign_source_5 = MAKE_FUNCTION___main__$$$function__1_calledRepeatedly(); 722         tmp_assign_source_5 = MAKE_FUNCTION___main__$$$function__1_calledRepeatedly();
1068 723
n 1069         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[8], tmp_assign_source_5); n 724         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_5);
1070     } 725     }
1071     { 726     {
1072         PyObject *tmp_assign_source_6; 727         PyObject *tmp_assign_source_6;
1073         PyObject *tmp_name_name_1; 728         PyObject *tmp_name_name_1;
1074         PyObject *tmp_globals_arg_name_1; 729         PyObject *tmp_globals_arg_name_1;
1075         PyObject *tmp_locals_arg_name_1; 730         PyObject *tmp_locals_arg_name_1;
1076         PyObject *tmp_fromlist_name_1; 731         PyObject *tmp_fromlist_name_1;
1077         PyObject *tmp_level_name_1; 732         PyObject *tmp_level_name_1;
n 1078         tmp_name_name_1 = mod_consts[9]; n 733         tmp_name_name_1 = mod_consts[7];
1079         tmp_globals_arg_name_1 = (PyObject *)moduledict___main__; 734         tmp_globals_arg_name_1 = (PyObject *)moduledict___main__;
1080         tmp_locals_arg_name_1 = Py_None; 735         tmp_locals_arg_name_1 = Py_None;
1081         tmp_fromlist_name_1 = Py_None; 736         tmp_fromlist_name_1 = Py_None;
n 1082         tmp_level_name_1 = mod_consts[10]; n 737         tmp_level_name_1 = mod_consts[8];
1083         tmp_assign_source_6 = IMPORT_MODULE5(tmp_name_name_1, tmp_globals_arg_name_1, tmp_locals_arg_name_1, tmp_fromlist_name_1, tmp_level_name_1); 738         tmp_assign_source_6 = IMPORT_MODULE5(tmp_name_name_1, tmp_globals_arg_name_1, tmp_locals_arg_name_1, tmp_fromlist_name_1, tmp_level_name_1);
1084         assert(!(tmp_assign_source_6 == NULL)); 739         assert(!(tmp_assign_source_6 == NULL));
n 1085         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[9], tmp_assign_source_6); n 740         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[7], tmp_assign_source_6);
1086     } 741     }
1087     // Frame without reuse. 742     // Frame without reuse.
1088     frame_03b082e6459c7cd69ad4682a29ddc7ff = MAKE_MODULE_FRAME(codeobj_03b082e6459c7cd69ad4682a29ddc7ff, module___main__); 743     frame_03b082e6459c7cd69ad4682a29ddc7ff = MAKE_MODULE_FRAME(codeobj_03b082e6459c7cd69ad4682a29ddc7ff, module___main__);
1089 744
1090     // Push the new frame as the currently active one, and we should be exclusively 745     // Push the new frame as the currently active one, and we should be exclusively
1095     // Framed code: 750     // Framed code:
1096     { 751     {
1097         PyObject *tmp_assign_source_7; 752         PyObject *tmp_assign_source_7;
1098         PyObject *tmp_iter_arg_1; 753         PyObject *tmp_iter_arg_1;
1099         PyObject *tmp_called_instance_1; 754         PyObject *tmp_called_instance_1;
n 1100         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[9]); n 755         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[7]);
1101 756
1102         if (unlikely(tmp_called_instance_1 == NULL)) { 757         if (unlikely(tmp_called_instance_1 == NULL)) {
n 1103             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[9]); n 758             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[7]);
1104         } 759         }
1105 760
1106         assert(!(tmp_called_instance_1 == NULL)); 761         assert(!(tmp_called_instance_1 == NULL));
1107         frame_03b082e6459c7cd69ad4682a29ddc7ff->m_frame.f_lineno = 35; 762         frame_03b082e6459c7cd69ad4682a29ddc7ff->m_frame.f_lineno = 35;
1108         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2( 763         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2(
1109             tmp_called_instance_1, 764             tmp_called_instance_1,
n 1110             mod_consts[11], n 765             mod_consts[9],
1111             &PyTuple_GET_ITEM(mod_consts[12], 0) 766             &PyTuple_GET_ITEM(mod_consts[10], 0)
1112         ); 767         );
1113 768
1114         if (tmp_iter_arg_1 == NULL) { 769         if (tmp_iter_arg_1 == NULL) {
1115             assert(ERROR_OCCURRED()); 770             assert(ERROR_OCCURRED());
1116 771
1166     } 821     }
1167     { 822     {
1168         PyObject *tmp_assign_source_9; 823         PyObject *tmp_assign_source_9;
1169         CHECK_OBJECT(tmp_for_loop_1__iter_value); 824         CHECK_OBJECT(tmp_for_loop_1__iter_value);
1170         tmp_assign_source_9 = tmp_for_loop_1__iter_value; 825         tmp_assign_source_9 = tmp_for_loop_1__iter_value;
n 1171         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[13], tmp_assign_source_9); n 826         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[11], tmp_assign_source_9);
1172     } 827     }
1173     { 828     {
1174         PyObject *tmp_called_name_1; 829         PyObject *tmp_called_name_1;
1175         PyObject *tmp_call_result_1; 830         PyObject *tmp_call_result_1;
n 1176         tmp_called_name_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[8]); n 831         tmp_called_name_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[6]);
1177 832
1178         if (unlikely(tmp_called_name_1 == NULL)) { 833         if (unlikely(tmp_called_name_1 == NULL)) {
n 1179             tmp_called_name_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[8]); n 834             tmp_called_name_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[6]);
1180         } 835         }
1181 836
1182         if (tmp_called_name_1 == NULL) { 837         if (tmp_called_name_1 == NULL) {
1183             assert(ERROR_OCCURRED()); 838             assert(ERROR_OCCURRED());
1184 839
1247     Py_DECREF(tmp_for_loop_1__for_iterator); 902     Py_DECREF(tmp_for_loop_1__for_iterator);
1248     tmp_for_loop_1__for_iterator = NULL; 903     tmp_for_loop_1__for_iterator = NULL;
1249     { 904     {
1250         PyObject *tmp_called_name_2; 905         PyObject *tmp_called_name_2;
1251         PyObject *tmp_call_result_2; 906         PyObject *tmp_call_result_2;
n 1252         tmp_called_name_2 = LOOKUP_BUILTIN(mod_consts[14]); n 907         tmp_called_name_2 = LOOKUP_BUILTIN(mod_consts[12]);
1253         assert(tmp_called_name_2 != NULL); 908         assert(tmp_called_name_2 != NULL);
1254         frame_03b082e6459c7cd69ad4682a29ddc7ff->m_frame.f_lineno = 38; 909         frame_03b082e6459c7cd69ad4682a29ddc7ff->m_frame.f_lineno = 38;
t 1255         tmp_call_result_2 = CALL_FUNCTION_WITH_POSARGS1(tmp_called_name_2, mod_consts[15]); t 910         tmp_call_result_2 = CALL_FUNCTION_WITH_POSARGS1(tmp_called_name_2, mod_consts[13]);
1256 911
1257         if (tmp_call_result_2 == NULL) { 912         if (tmp_call_result_2 == NULL) {
1258             assert(ERROR_OCCURRED()); 913             assert(ERROR_OCCURRED());
1259 914
1260             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 915             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);