Construct FunctionCreationGeneratorClosure

Performance Diagrams

Construct FunctionCreationGeneratorClosure 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)5030159888.95192307692307257.0CPython 2.712500751242.31730769230768442.7032622540602Nuitka (master)12501321395.6826923076923442.700462029518Nuitka (develop)12500428549.0480769230769442.7048490479674Nuitka (factory)Construct FunctionCreationGeneratorClosureTicks Construct FunctionCreationGeneratorClosure 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)5684294988.95192307692307257.0CPython 3.514552019242.31730769230768440.8528721071862Nuitka (master)14551908395.6826923076923440.853354661455Nuitka (develop)14557531549.0480769230769440.82890959250386Nuitka (factory)Construct FunctionCreationGeneratorClosureTicks

Source Code with Construct

module_var = None

def calledRepeatedly():
    # We measure making a local function that will remain unused.
    closure_var = module_var

# construct_begin
    def empty():
        yield closure_var

# construct_alternative



    return empty, closure_var


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

print("OK.")

Source Code without Construct

module_var = None

def calledRepeatedly():
    # We measure making a local function that will remain unused.
    closure_var = module_var

# construct_begin



# construct_alternative
    empty = 1
# construct_end

    return empty, closure_var


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

print("OK.")

Context Diff of Source Code


Construct
Baseline
23 def calledRepeatedly(): 23 def calledRepeatedly():
24     # We measure making a local function that will remain unused. 24     # We measure making a local function that will remain unused.
25     closure_var = module_var 25     closure_var = module_var
26 26
27 # construct_begin 27 # construct_begin
n 28     def empty(): n 28  
29         yield closure_var 29  
30 30
31 # construct_alternative 31 # construct_alternative
t 32   t 32     empty = 1
33   33 # construct_end
34 34
35     return empty, closure_var 35     return empty, closure_var
36 36
37 37
38 import itertools 38 import itertools

Context Diff of Generated Code


Construct
Baseline
30 PyObject *module___main__; 30 PyObject *module___main__;
31 PyDictObject *moduledict___main__; 31 PyDictObject *moduledict___main__;
32 32
33 /* The declarations of module constants used, if any. */ 33 /* The declarations of module constants used, if any. */
34 static PyObject *const_str_plain_itertools; 34 static PyObject *const_str_plain_itertools;
n 35 static PyObject *const_tuple_str_plain_closure_var_tuple; n
36 static PyObject *const_str_plain_module_var; 35 static PyObject *const_str_plain_module_var;
n n 36 extern PyObject *const_int_pos_1;
37 extern PyObject *const_str_plain___file__; 37 extern PyObject *const_str_plain___file__;
38 static PyObject *const_str_plain_closure_var; 38 static PyObject *const_str_plain_closure_var;
39 extern PyObject *const_int_0; 39 extern PyObject *const_int_0;
40 static PyObject *const_tuple_str_plain_closure_var_str_plain_empty_tuple; 40 static PyObject *const_tuple_str_plain_closure_var_str_plain_empty_tuple;
41 static PyObject *const_str_plain_empty; 41 static PyObject *const_str_plain_empty;
n 42 static PyObject *const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd; n
43 extern PyObject *const_str_plain_print; 42 extern PyObject *const_str_plain_print;
44 static PyObject *const_int_pos_50000; 43 static PyObject *const_int_pos_50000;
45 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 44 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
46 static PyObject *const_str_plain_calledRepeatedly; 45 static PyObject *const_str_plain_calledRepeatedly;
47 static PyObject *const_str_angle_module; 46 static PyObject *const_str_angle_module;
62 61
63 /* Function to create module private constants. */ 62 /* Function to create module private constants. */
64 static void createModuleConstants( void ) 63 static void createModuleConstants( void )
65 { 64 {
66     const_str_plain_itertools = UNSTREAM_STRING_ASCII( &constant_bin[ 0 ], 9, 1 ); 65     const_str_plain_itertools = UNSTREAM_STRING_ASCII( &constant_bin[ 0 ], 9, 1 );
n 67     const_tuple_str_plain_closure_var_tuple = PyTuple_New( 1 ); n 66     const_str_plain_module_var = UNSTREAM_STRING_ASCII( &constant_bin[ 9 ], 10, 1 );
68     const_str_plain_closure_var = UNSTREAM_STRING_ASCII( &constant_bin[ 9 ], 11, 1 ); 67     const_str_plain_closure_var = UNSTREAM_STRING_ASCII( &constant_bin[ 19 ], 11, 1 );
69     PyTuple_SET_ITEM( const_tuple_str_plain_closure_var_tuple, 0, const_str_plain_closure_var ); Py_INCREF( const_str_plain_closure_var );
70     const_str_plain_module_var = UNSTREAM_STRING_ASCII( &constant_bin[ 20 ], 10, 1 );
71     const_tuple_str_plain_closure_var_str_plain_empty_tuple = PyTuple_New( 2 ); 68     const_tuple_str_plain_closure_var_str_plain_empty_tuple = PyTuple_New( 2 );
72     PyTuple_SET_ITEM( const_tuple_str_plain_closure_var_str_plain_empty_tuple, 0, const_str_plain_closure_var ); Py_INCREF( const_str_plain_closure_var ); 69     PyTuple_SET_ITEM( const_tuple_str_plain_closure_var_str_plain_empty_tuple, 0, const_str_plain_closure_var ); Py_INCREF( const_str_plain_closure_var );
73     const_str_plain_empty = UNSTREAM_STRING_ASCII( &constant_bin[ 30 ], 5, 1 ); 70     const_str_plain_empty = UNSTREAM_STRING_ASCII( &constant_bin[ 30 ], 5, 1 );
74     PyTuple_SET_ITEM( const_tuple_str_plain_closure_var_str_plain_empty_tuple, 1, const_str_plain_empty ); Py_INCREF( const_str_plain_empty ); 71     PyTuple_SET_ITEM( const_tuple_str_plain_closure_var_str_plain_empty_tuple, 1, const_str_plain_empty ); Py_INCREF( const_str_plain_empty );
n 75     const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd = UNSTREAM_STRING_ASCII( &constant_bin[ 35 ], 31, 0 ); n
76     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 72     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
77     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 73     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
n 78     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 66 ], 3, 0 ); n 74     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 35 ], 3, 0 );
79     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 75     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
n 80     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 35 ], 16, 1 ); n 76     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 38 ], 16, 1 );
81     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 69 ], 8, 0 ); 77     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 54 ], 8, 0 );
82     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 77 ], 4, 1 ); 78     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 62 ], 4, 1 );
83     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 81 ], 1, 1 ); 79     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 66 ], 1, 1 );
84     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 82 ], 6, 1 ); 80     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 67 ], 6, 1 );
85     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 81     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
86     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 82     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
87     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 83     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
n 88     const_str_digest_50efd4c6e05fe96d3256fd58f059c269 = UNSTREAM_STRING_ASCII( &constant_bin[ 88 ], 83, 0 ); n 84     const_str_digest_50efd4c6e05fe96d3256fd58f059c269 = UNSTREAM_STRING_ASCII( &constant_bin[ 73 ], 83, 0 );
89 85
90     constants_created = true; 86     constants_created = true;
91 } 87 }
92 88
93 /* Function to verify module private constants for non-corruption. */ 89 /* Function to verify module private constants for non-corruption. */
102 #endif 98 #endif
103 99
104 // The module code objects. 100 // The module code objects.
105 static PyCodeObject *codeobj_704155f2258c6082f724ca2aa3ab24d8; 101 static PyCodeObject *codeobj_704155f2258c6082f724ca2aa3ab24d8;
106 static PyCodeObject *codeobj_f39275ce73abef73f63edd79a0382378; 102 static PyCodeObject *codeobj_f39275ce73abef73f63edd79a0382378;
n 107 static PyCodeObject *codeobj_b054f2cc9cf2b01cd5ecb0b1a63516e5; n
108 /* For use in "MainProgram.c". */ 103 /* For use in "MainProgram.c". */
109 PyCodeObject *codeobj_main = NULL; 104 PyCodeObject *codeobj_main = NULL;
110 105
111 static void createModuleCodeObjects(void) 106 static void createModuleCodeObjects(void)
112 { 107 {
113     module_filename_obj = const_str_digest_50efd4c6e05fe96d3256fd58f059c269; 108     module_filename_obj = const_str_digest_50efd4c6e05fe96d3256fd58f059c269;
114     codeobj_704155f2258c6082f724ca2aa3ab24d8 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE ); 109     codeobj_704155f2258c6082f724ca2aa3ab24d8 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE );
115     codeobj_main = codeobj_704155f2258c6082f724ca2aa3ab24d8; 110     codeobj_main = codeobj_704155f2258c6082f724ca2aa3ab24d8;
116     codeobj_f39275ce73abef73f63edd79a0382378 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 23, const_tuple_str_plain_closure_var_str_plain_empty_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE ); 111     codeobj_f39275ce73abef73f63edd79a0382378 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 23, const_tuple_str_plain_closure_var_str_plain_empty_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
n 117     codeobj_b054f2cc9cf2b01cd5ecb0b1a63516e5 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_empty, 28, const_tuple_str_plain_closure_var_tuple, 0, 0, CO_GENERATOR | CO_OPTIMIZED | CO_NEWLOCALS ); n
118 } 112 }
119 113
120 // The module function declarations. 114 // The module function declarations.
n 121 static PyObject *__main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_maker( void ); n
122  
123  
124 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ); 115 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  );
n 125   n
126  
127 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty(  );
128 116
129 117
130 // The module function definitions. 118 // The module function definitions.
131 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) 119 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
132 { 120 {
134 #ifndef __NUITKA_NO_ASSERT__ 122 #ifndef __NUITKA_NO_ASSERT__
135     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED(); 123     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
136 #endif 124 #endif
137 125
138     // Local variable declarations. 126     // Local variable declarations.
n 139     struct Nuitka_CellObject *var_closure_var = PyCell_EMPTY(); n
140     PyObject *var_empty = NULL; 127     PyObject *var_closure_var = NULL;
141     struct Nuitka_FrameObject *frame_f39275ce73abef73f63edd79a0382378; 128     struct Nuitka_FrameObject *frame_f39275ce73abef73f63edd79a0382378;
142     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 129     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
143     PyObject *exception_type = NULL; 130     PyObject *exception_type = NULL;
144     PyObject *exception_value = NULL; 131     PyObject *exception_value = NULL;
145     PyTracebackObject *exception_tb = NULL; 132     PyTracebackObject *exception_tb = NULL;
182             exception_tb = NULL; 169             exception_tb = NULL;
183             NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 170             NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
184             CHAIN_EXCEPTION( exception_value ); 171             CHAIN_EXCEPTION( exception_value );
185 172
186             exception_lineno = 25; 173             exception_lineno = 25;
n 187             type_description_1 = "co"; n 174             type_description_1 = "oN";
188             goto frame_exception_exit_1; 175             goto frame_exception_exit_1;
189         } 176         }
190 177
191         tmp_assign_source_1 = tmp_mvar_value_1; 178         tmp_assign_source_1 = tmp_mvar_value_1;
n 192         assert( PyCell_GET( var_closure_var == NULL ); n 179         assert( var_closure_var == NULL );
193         Py_INCREF( tmp_assign_source_1 ); 180         Py_INCREF( tmp_assign_source_1 );
n 194         PyCell_SET( var_closure_var, tmp_assign_source_1 ); n 181         var_closure_var = tmp_assign_source_1;
195  
196     } 182     }
197 183
198 #if 0 184 #if 0
199     RESTORE_FRAME_EXCEPTION( frame_f39275ce73abef73f63edd79a0382378 ); 185     RESTORE_FRAME_EXCEPTION( frame_f39275ce73abef73f63edd79a0382378 );
200 #endif 186 #endif
222     // Attachs locals to frame if any. 208     // Attachs locals to frame if any.
223     Nuitka_Frame_AttachLocals( 209     Nuitka_Frame_AttachLocals(
224         (struct Nuitka_FrameObject *)frame_f39275ce73abef73f63edd79a0382378, 210         (struct Nuitka_FrameObject *)frame_f39275ce73abef73f63edd79a0382378,
225         type_description_1, 211         type_description_1,
226         var_closure_var, 212         var_closure_var,
n 227         var_empty n 213         NULL
228     ); 214     );
229 215
230 216
231     // Release cached frame. 217     // Release cached frame.
232     if ( frame_f39275ce73abef73f63edd79a0382378 == cache_frame_f39275ce73abef73f63edd79a0382378 ) 218     if ( frame_f39275ce73abef73f63edd79a0382378 == cache_frame_f39275ce73abef73f63edd79a0382378 )
243     // Return the error. 229     // Return the error.
244     goto try_except_handler_1; 230     goto try_except_handler_1;
245 231
246     frame_no_exception_1:; 232     frame_no_exception_1:;
247     { 233     {
n 248         PyObject *tmp_assign_source_2; n
249         tmp_assign_source_2 = MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty(  );
250  
251         ((struct Nuitka_FunctionObject *)tmp_assign_source_2)->m_closure[0] = var_closure_var;
252         Py_INCREF( ((struct Nuitka_FunctionObject *)tmp_assign_source_2)->m_closure[0] );
253  
254  
255         assert( var_empty == NULL );
256         var_empty = tmp_assign_source_2;
257     }
258     {
259         PyObject *tmp_tuple_element_1; 234         PyObject *tmp_tuple_element_1;
n 260         CHECK_OBJECT( var_empty ); n
261         tmp_tuple_element_1 = var_empty; 235         tmp_tuple_element_1 = const_int_pos_1;
262         tmp_return_value = PyTuple_New( 2 ); 236         tmp_return_value = PyTuple_New( 2 );
263         Py_INCREF( tmp_tuple_element_1 ); 237         Py_INCREF( tmp_tuple_element_1 );
264         PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 ); 238         PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
n 265         CHECK_OBJECT( PyCell_GET( var_closure_var ); n 239         CHECK_OBJECT( var_closure_var );
266         tmp_tuple_element_1 = PyCell_GET( var_closure_var ); 240         tmp_tuple_element_1 = var_closure_var;
267         Py_INCREF( tmp_tuple_element_1 ); 241         Py_INCREF( tmp_tuple_element_1 );
268         PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 ); 242         PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
269         goto try_return_handler_1; 243         goto try_return_handler_1;
270     } 244     }
271     // tried codes exits in all cases 245     // tried codes exits in all cases
274     // Return handler code: 248     // Return handler code:
275     try_return_handler_1:; 249     try_return_handler_1:;
276     CHECK_OBJECT( (PyObject *)var_closure_var ); 250     CHECK_OBJECT( (PyObject *)var_closure_var );
277     Py_DECREF( var_closure_var ); 251     Py_DECREF( var_closure_var );
278     var_closure_var = NULL; 252     var_closure_var = NULL;
n 279   n
280     CHECK_OBJECT( (PyObject *)var_empty );
281     Py_DECREF( var_empty );
282     var_empty = NULL;
283 253
284     goto function_return_exit; 254     goto function_return_exit;
285     // Exception handler code: 255     // Exception handler code:
286     try_except_handler_1:; 256     try_except_handler_1:;
287     exception_keeper_type_1 = exception_type; 257     exception_keeper_type_1 = exception_type;
322    assert( had_error || !ERROR_OCCURRED() ); 292    assert( had_error || !ERROR_OCCURRED() );
323    return tmp_return_value; 293    return tmp_return_value;
324 } 294 }
325 295
326 296
n 327 static PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_empty( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) n
328 {
329     // Preserve error status for checks
330 #ifndef __NUITKA_NO_ASSERT__
331     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
332 #endif
333  
334     // Local variable declarations.
335     PyObject *tmp_return_value = NULL;
336  
337     // Actual function body.
338     tmp_return_value = __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_maker();
339  
340     ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] = self->m_closure[0];
341     Py_INCREF( ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] );
342  
343  
344     goto function_return_exit;
345  
346     // Return statement must have exited already.
347     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_empty );
348     return NULL;
349  
350  
351 function_return_exit:
352    // Function cleanup code if any.
353  
354  
355    // Actual function exit with return value, making sure we did not make
356    // the error status worse despite non-NULL return.
357    CHECK_OBJECT( tmp_return_value );
358    assert( had_error || !ERROR_OCCURRED() );
359    return tmp_return_value;
360 }
361  
362  
363  
364 struct __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_locals {
365     char const *type_description_1;
366     PyObject *exception_type;
367     PyObject *exception_value;
368     PyTracebackObject *exception_tb;
369     int exception_lineno;
370 };
371  
372 static PyObject *__main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value )
373 {
374     CHECK_OBJECT( (PyObject *)generator );
375     assert( Nuitka_Generator_Check( (PyObject *)generator ) );
376  
377     // Heap access if used.
378     struct __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_locals *generator_heap = (struct __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_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     static struct Nuitka_FrameObject *cache_m_frame = NULL;
387     generator_heap->type_description_1 = NULL;
388     generator_heap->exception_type = NULL;
389     generator_heap->exception_value = NULL;
390     generator_heap->exception_tb = NULL;
391     generator_heap->exception_lineno = 0;
392  
393     // Actual generator function body.
394     MAKE_OR_REUSE_FRAME( cache_m_frame, codeobj_b054f2cc9cf2b01cd5ecb0b1a63516e5, module___main__, sizeof(void *) );
395     generator->m_frame = cache_m_frame;
396  
397     // Mark the frame object as in use, ref count 1 will be up for reuse.
398     Py_INCREF( generator->m_frame );
399     assert( Py_REFCNT( generator->m_frame ) == 2 ); // Frame stack
400  
401 #if PYTHON_VERSION >= 340
402     generator->m_frame->m_frame.f_gen = (PyObject *)generator;
403 #endif
404  
405     Py_CLEAR( generator->m_frame->m_frame.f_back );
406  
407     generator->m_frame->m_frame.f_back = PyThreadState_GET()->frame;
408     Py_INCREF( generator->m_frame->m_frame.f_back );
409  
410     PyThreadState_GET()->frame = &generator->m_frame->m_frame;
411     Py_INCREF( generator->m_frame );
412  
413     Nuitka_Frame_MarkAsExecuting( generator->m_frame );
414  
415 #if PYTHON_VERSION >= 300
416     // Accept currently existing exception as the one to publish again when we
417     // yield or yield from.
418     {
419         PyThreadState *thread_state = PyThreadState_GET();
420  
421 #if PYTHON_VERSION < 370
422         generator->m_frame->m_frame.f_exc_type = EXC_TYPE( thread_state );
423     if ( generator->m_frame->m_frame.f_exc_type == Py_None ) generator->m_frame->m_frame.f_exc_type = NULL;
424         Py_XINCREF( generator->m_frame->m_frame.f_exc_type );
425     generator->m_frame->m_frame.f_exc_value = EXC_VALUE( thread_state );
426         Py_XINCREF( generator->m_frame->m_frame.f_exc_value );
427     generator->m_frame->m_frame.f_exc_traceback = EXC_TRACEBACK( thread_state );
428         Py_XINCREF( generator->m_frame->m_frame.f_exc_traceback );
429 #else
430         generator->m_exc_state.exc_type = EXC_TYPE( thread_state );
431         if ( generator->m_exc_state.exc_type == Py_None ) generator->m_exc_state.exc_type = NULL;
432         Py_XINCREF( generator->m_exc_state.exc_type );
433         generator->m_exc_state.exc_value = EXC_VALUE( thread_state );
434         Py_XINCREF( generator->m_exc_state.exc_value );
435         generator->m_exc_state.exc_traceback = EXC_TRACEBACK( thread_state );
436         Py_XINCREF( generator->m_exc_state.exc_traceback );
437 #endif
438     }
439  
440 #endif
441  
442     // Framed code:
443     {
444         PyObject *tmp_expression_name_1;
445         NUITKA_MAY_BE_UNUSED PyObject *tmp_yield_result_1;
446         if ( PyCell_GET( generator->m_closure[0] ) == NULL )
447         {
448  
449             generator_heap->exception_type = PyExc_NameError;
450             Py_INCREF( generator_heap->exception_type );
451             generator_heap->exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "closure_var" );
452             generator_heap->exception_tb = NULL;
453             NORMALIZE_EXCEPTION( &generator_heap->exception_type, &generator_heap->exception_value, &generator_heap->exception_tb );
454             CHAIN_EXCEPTION( generator_heap->exception_value );
455  
456             generator_heap->exception_lineno = 29;
457             generator_heap->type_description_1 = "c";
458             goto frame_exception_exit_1;
459         }
460  
461         tmp_expression_name_1 = PyCell_GET( generator->m_closure[0] );
462         Py_INCREF( tmp_expression_name_1 );
463         generator->m_yield_return_index = 1;
464         return tmp_expression_name_1;
465         yield_return_1:
466         if ( yield_return_value == NULL )
467         {
468             assert( ERROR_OCCURRED() );
469  
470             FETCH_ERROR_OCCURRED( &generator_heap->exception_type, &generator_heap->exception_value, &generator_heap->exception_tb );
471  
472  
473             generator_heap->exception_lineno = 29;
474             generator_heap->type_description_1 = "c";
475             goto frame_exception_exit_1;
476         }
477         tmp_yield_result_1 = yield_return_value;
478     }
479  
480     Nuitka_Frame_MarkAsNotExecuting( generator->m_frame );
481  
482 #if PYTHON_VERSION >= 370
483     Py_CLEAR( generator->m_exc_state.exc_type );
484     Py_CLEAR( generator->m_exc_state.exc_value );
485     Py_CLEAR( generator->m_exc_state.exc_traceback );
486 #elif PYTHON_VERSION >= 300
487     Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
488     Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
489     Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
490 #endif
491  
492     // Allow re-use of the frame again.
493     Py_DECREF( generator->m_frame );
494     goto frame_no_exception_1;
495  
496     frame_exception_exit_1:;
497  
498     // If it's not an exit exception, consider and create a traceback for it.
499     if ( !EXCEPTION_MATCH_GENERATOR( generator_heap->exception_type ) )
500     {
501         if ( generator_heap->exception_tb == NULL )
502         {
503             generator_heap->exception_tb = MAKE_TRACEBACK( generator->m_frame, generator_heap->exception_lineno );
504         }
505         else if ( generator_heap->exception_tb->tb_frame != &generator->m_frame->m_frame )
506         {
507             generator_heap->exception_tb = ADD_TRACEBACK( generator_heap->exception_tb, generator->m_frame, generator_heap->exception_lineno );
508         }
509  
510         Nuitka_Frame_AttachLocals(
511             (struct Nuitka_FrameObject *)generator->m_frame,
512             generator_heap->type_description_1,
513             generator->m_closure[0]
514         );
515  
516  
517         // Release cached frame.
518         if ( generator->m_frame == cache_m_frame )
519         {
520             Py_DECREF( generator->m_frame );
521         }
522         cache_m_frame = NULL;
523  
524         assertFrameObject( generator->m_frame );
525     }
526  
527 #if PYTHON_VERSION >= 370
528     Py_CLEAR( generator->m_exc_state.exc_type );
529     Py_CLEAR( generator->m_exc_state.exc_value );
530     Py_CLEAR( generator->m_exc_state.exc_traceback );
531 #elif PYTHON_VERSION >= 300
532     Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
533     Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
534     Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
535 #endif
536  
537     Py_DECREF( generator->m_frame );
538  
539     // Return the error.
540     goto function_exception_exit;
541  
542     frame_no_exception_1:;
543  
544  
545     return NULL;
546  
547     function_exception_exit:
548     assert( generator_heap->exception_type );
549     RESTORE_ERROR_OCCURRED( generator_heap->exception_type, generator_heap->exception_value, generator_heap->exception_tb );
550  
551     return NULL;
552  
553 }
554  
555 static PyObject *__main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_maker( void )
556 {
557     return Nuitka_Generator_New(
558         __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context,
559         module___main__,
560         const_str_plain_empty,
561 #if PYTHON_VERSION >= 350
562         const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd,
563 #endif
564         codeobj_b054f2cc9cf2b01cd5ecb0b1a63516e5,
565         1,
566         sizeof(struct __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_locals)
567     );
568 }
569  
570  
571 297
572 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ) 298 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  )
573 { 299 {
574     struct Nuitka_FunctionObject *result = Nuitka_Function_New( 300     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
575         impl___main__$$$function_1_calledRepeatedly, 301         impl___main__$$$function_1_calledRepeatedly,
584         NULL, 310         NULL,
585 #endif 311 #endif
586         module___main__, 312         module___main__,
587         NULL, 313         NULL,
588         0 314         0
t 589     ); t
590  
591     return (PyObject *)result;
592 }
593  
594  
595  
596 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty(  )
597 {
598     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
599         impl___main__$$$function_1_calledRepeatedly$$$function_1_empty,
600         const_str_plain_empty,
601 #if PYTHON_VERSION >= 300
602         const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd,
603 #endif
604         codeobj_b054f2cc9cf2b01cd5ecb0b1a63516e5,
605         NULL,
606 #if PYTHON_VERSION >= 300
607         NULL,
608         NULL,
609 #endif
610         module___main__,
611         NULL,
612         1
613     ); 315     );
614 316
615     return (PyObject *)result; 317     return (PyObject *)result;
616 } 318 }
617 319