Construct FunctionCreationGeneratorClosure

Performance Diagrams

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