Construct FunctionCreationGeneratorClosure

Performance Diagrams

Construct FunctionCreationGeneratorClosure 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)5075028088.95192307692307257.0CPython 2.712451303242.31730769230768443.4869796133296Nuitka (master)12500867395.6826923076923443.2456405128739Nuitka (develop)12500929549.0480769230769443.24533861988243Nuitka (factory)Construct FunctionCreationGeneratorClosureTicks Construct FunctionCreationGeneratorClosure 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)5659287388.95192307692307257.0CPython 3.514550945242.31730769230768440.5780135723505Nuitka (master)14553886395.6826923076923440.56517156049233Nuitka (develop)14555693549.0480769230769440.55728121182597Nuitka (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
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;
35 static PyObject *const_str_digest_1f103914590beb6b541e7340b7d9db39; 35 static PyObject *const_str_digest_1f103914590beb6b541e7340b7d9db39;
n 36 static PyObject *const_tuple_str_plain_closure_var_tuple; n
37 static PyObject *const_str_plain_module_var; 36 static PyObject *const_str_plain_module_var;
n n 37 extern PyObject *const_int_pos_1;
38 extern PyObject *const_str_plain___file__; 38 extern PyObject *const_str_plain___file__;
39 static PyObject *const_str_plain_closure_var; 39 static PyObject *const_str_plain_closure_var;
40 extern PyObject *const_int_0; 40 extern PyObject *const_int_0;
41 static PyObject *const_tuple_str_plain_closure_var_str_plain_empty_tuple; 41 static PyObject *const_tuple_str_plain_closure_var_str_plain_empty_tuple;
42 static PyObject *const_str_plain_empty; 42 static PyObject *const_str_plain_empty;
n 43 static PyObject *const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd; n
44 extern PyObject *const_str_plain_print; 43 extern PyObject *const_str_plain_print;
45 static PyObject *const_int_pos_50000; 44 static PyObject *const_int_pos_50000;
46 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 45 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
47 static PyObject *const_str_plain_calledRepeatedly; 46 static PyObject *const_str_plain_calledRepeatedly;
48 static PyObject *const_str_angle_module; 47 static PyObject *const_str_angle_module;
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 );
65     const_str_digest_1f103914590beb6b541e7340b7d9db39 = UNSTREAM_STRING_ASCII( &constant_bin[ 9 ], 83, 0 ); 64     const_str_digest_1f103914590beb6b541e7340b7d9db39 = UNSTREAM_STRING_ASCII( &constant_bin[ 9 ], 83, 0 );
n 66     const_tuple_str_plain_closure_var_tuple = PyTuple_New( 1 ); n 65     const_str_plain_module_var = UNSTREAM_STRING_ASCII( &constant_bin[ 92 ], 10, 1 );
67     const_str_plain_closure_var = UNSTREAM_STRING_ASCII( &constant_bin[ 92 ], 11, 1 ); 66     const_str_plain_closure_var = UNSTREAM_STRING_ASCII( &constant_bin[ 102 ], 11, 1 );
68     PyTuple_SET_ITEM( const_tuple_str_plain_closure_var_tuple, 0, const_str_plain_closure_var ); Py_INCREF( const_str_plain_closure_var );
69     const_str_plain_module_var = UNSTREAM_STRING_ASCII( &constant_bin[ 103 ], 10, 1 );
70     const_tuple_str_plain_closure_var_str_plain_empty_tuple = PyTuple_New( 2 ); 67     const_tuple_str_plain_closure_var_str_plain_empty_tuple = PyTuple_New( 2 );
71     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 ); 68     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 );
72     const_str_plain_empty = UNSTREAM_STRING_ASCII( &constant_bin[ 113 ], 5, 1 ); 69     const_str_plain_empty = UNSTREAM_STRING_ASCII( &constant_bin[ 113 ], 5, 1 );
73     PyTuple_SET_ITEM( const_tuple_str_plain_closure_var_str_plain_empty_tuple, 1, const_str_plain_empty ); Py_INCREF( const_str_plain_empty ); 70     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 74     const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd = UNSTREAM_STRING_ASCII( &constant_bin[ 118 ], 31, 0 ); n
75     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 71     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
76     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 72     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
n 77     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 149 ], 3, 0 ); n 73     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 118 ], 3, 0 );
78     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 74     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
n 79     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 118 ], 16, 1 ); n 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[ 34 ], 1, 1 ); 78     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 34 ], 1, 1 );
n 83     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 164 ], 6, 1 ); n 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_c05272d4c1c58b8e10b22c76a34c4549; 98 static PyCodeObject *codeobj_c05272d4c1c58b8e10b22c76a34c4549;
103 static PyCodeObject *codeobj_3baa7e394fb83854e8a9f222f6bd03db; 99 static PyCodeObject *codeobj_3baa7e394fb83854e8a9f222f6bd03db;
n 104 static PyCodeObject *codeobj_adbaf4cd7b499dd9db12069d5b6e39a7; 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_1f103914590beb6b541e7340b7d9db39; 105     module_filename_obj = const_str_digest_1f103914590beb6b541e7340b7d9db39;
111     codeobj_c05272d4c1c58b8e10b22c76a34c4549 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE ); 106     codeobj_c05272d4c1c58b8e10b22c76a34c4549 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE );
112     codeobj_main = codeobj_c05272d4c1c58b8e10b22c76a34c4549; 107     codeobj_main = codeobj_c05272d4c1c58b8e10b22c76a34c4549;
113     codeobj_3baa7e394fb83854e8a9f222f6bd03db = 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_3baa7e394fb83854e8a9f222f6bd03db = 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_adbaf4cd7b499dd9db12069d5b6e39a7 = 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_3baa7e394fb83854e8a9f222f6bd03db; 125     struct Nuitka_FrameObject *frame_3baa7e394fb83854e8a9f222f6bd03db;
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_3baa7e394fb83854e8a9f222f6bd03db ); 184     RESTORE_FRAME_EXCEPTION( frame_3baa7e394fb83854e8a9f222f6bd03db );
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_3baa7e394fb83854e8a9f222f6bd03db, 209         (struct Nuitka_FrameObject *)frame_3baa7e394fb83854e8a9f222f6bd03db,
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_3baa7e394fb83854e8a9f222f6bd03db == cache_frame_3baa7e394fb83854e8a9f222f6bd03db ) 217     if ( frame_3baa7e394fb83854e8a9f222f6bd03db == cache_frame_3baa7e394fb83854e8a9f222f6bd03db )
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     CHECK_OBJECT( (PyObject *)var_empty );
283     Py_DECREF( var_empty );
284     var_empty = NULL;
285 253
286     } 254     }
287     { 255     {
288     goto function_return_exit; 256     goto function_return_exit;
289     } 257     }
326 return tmp_return_value; 294 return tmp_return_value;
327 295
328 } 296 }
329 297
330 298
n 331 static PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_empty( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) n
332 {
333     // Preserve error status for checks
334 #ifndef __NUITKA_NO_ASSERT__
335     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
336 #endif
337  
338     // Local variable declarations.
339     PyObject *tmp_return_value = NULL;
340  
341     // Actual function code.
342     {
343     tmp_return_value = __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_maker();
344  
345     ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] = self->m_closure[0];
346     Py_INCREF( ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] );
347  
348  
349     goto function_return_exit;
350     }
351  
352     // Return statement must have exited already.
353     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_empty );
354     return NULL;
355  
356 function_return_exit:
357  
358 CHECK_OBJECT( tmp_return_value );
359 assert( had_error || !ERROR_OCCURRED() );
360 return tmp_return_value;
361  
362 }
363  
364  
365  
366 struct __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_locals {
367     char const *type_description_1;
368     PyObject *exception_type;
369     PyObject *exception_value;
370     PyTracebackObject *exception_tb;
371     int exception_lineno;
372 };
373  
374 static PyObject *__main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value )
375 {
376     CHECK_OBJECT( (PyObject *)generator );
377     assert( Nuitka_Generator_Check( (PyObject *)generator ) );
378  
379     // Heap access if used.
380     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;
381  
382     // Dispatch to yield based on return label index:
383     switch(generator->m_yield_return_index) {
384     case 1: goto yield_return_1;
385     }
386  
387     // Local variable initialization
388     static struct Nuitka_FrameObject *cache_m_frame = NULL;
389     generator_heap->type_description_1 = NULL;
390     generator_heap->exception_type = NULL;
391     generator_heap->exception_value = NULL;
392     generator_heap->exception_tb = NULL;
393     generator_heap->exception_lineno = 0;
394  
395     // Actual function code.
396     MAKE_OR_REUSE_FRAME( cache_m_frame, codeobj_adbaf4cd7b499dd9db12069d5b6e39a7, module___main__, sizeof(void *) );
397     generator->m_frame = cache_m_frame;
398  
399     // Mark the frame object as in use, ref count 1 will be up for reuse.
400     Py_INCREF( generator->m_frame );
401     assert( Py_REFCNT( generator->m_frame ) == 2 ); // Frame stack
402  
403 #if PYTHON_VERSION >= 340
404     generator->m_frame->m_frame.f_gen = (PyObject *)generator;
405 #endif
406  
407     Py_CLEAR( generator->m_frame->m_frame.f_back );
408  
409     generator->m_frame->m_frame.f_back = PyThreadState_GET()->frame;
410     Py_INCREF( generator->m_frame->m_frame.f_back );
411  
412     PyThreadState_GET()->frame = &generator->m_frame->m_frame;
413     Py_INCREF( generator->m_frame );
414  
415     Nuitka_Frame_MarkAsExecuting( generator->m_frame );
416  
417 #if PYTHON_VERSION >= 300
418     // Accept currently existing exception as the one to publish again when we
419     // yield or yield from.
420     {
421         PyThreadState *thread_state = PyThreadState_GET();
422  
423 #if PYTHON_VERSION < 370
424         generator->m_frame->m_frame.f_exc_type = EXC_TYPE( thread_state );
425     if ( generator->m_frame->m_frame.f_exc_type == Py_None ) generator->m_frame->m_frame.f_exc_type = NULL;
426         Py_XINCREF( generator->m_frame->m_frame.f_exc_type );
427     generator->m_frame->m_frame.f_exc_value = EXC_VALUE( thread_state );
428         Py_XINCREF( generator->m_frame->m_frame.f_exc_value );
429     generator->m_frame->m_frame.f_exc_traceback = EXC_TRACEBACK( thread_state );
430         Py_XINCREF( generator->m_frame->m_frame.f_exc_traceback );
431 #else
432         generator->m_exc_state.exc_type = EXC_TYPE( thread_state );
433         if ( generator->m_exc_state.exc_type == Py_None ) generator->m_exc_state.exc_type = NULL;
434         Py_XINCREF( generator->m_exc_state.exc_type );
435         generator->m_exc_state.exc_value = EXC_VALUE( thread_state );
436         Py_XINCREF( generator->m_exc_state.exc_value );
437         generator->m_exc_state.exc_traceback = EXC_TRACEBACK( thread_state );
438         Py_XINCREF( generator->m_exc_state.exc_traceback );
439 #endif
440     }
441  
442 #endif
443  
444     // Framed code:
445     {
446     PyObject *tmp_expression_name_1;
447     NUITKA_MAY_BE_UNUSED PyObject *tmp_yield_result_1;
448     if ( PyCell_GET( generator->m_closure[0] ) == NULL )
449     {
450  
451         generator_heap->exception_type = PyExc_NameError;
452         Py_INCREF( generator_heap->exception_type );
453         generator_heap->exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "closure_var" );
454         generator_heap->exception_tb = NULL;
455         NORMALIZE_EXCEPTION( &generator_heap->exception_type, &generator_heap->exception_value, &generator_heap->exception_tb );
456         CHAIN_EXCEPTION( generator_heap->exception_value );
457  
458         generator_heap->exception_lineno = 29;
459         generator_heap->type_description_1 = "c";
460         goto frame_exception_exit_1;
461     }
462  
463     tmp_expression_name_1 = PyCell_GET( generator->m_closure[0] );
464     Py_INCREF( tmp_expression_name_1 );
465     generator->m_yield_return_index = 1;
466     return tmp_expression_name_1;
467     yield_return_1:
468     if ( yield_return_value == NULL )
469     {
470         assert( ERROR_OCCURRED() );
471  
472         FETCH_ERROR_OCCURRED( &generator_heap->exception_type, &generator_heap->exception_value, &generator_heap->exception_tb );
473  
474  
475         generator_heap->exception_lineno = 29;
476         generator_heap->type_description_1 = "c";
477         goto frame_exception_exit_1;
478     }
479     tmp_yield_result_1 = yield_return_value;
480     }
481  
482     Nuitka_Frame_MarkAsNotExecuting( generator->m_frame );
483  
484 #if PYTHON_VERSION >= 370
485     Py_CLEAR( generator->m_exc_state.exc_type );
486     Py_CLEAR( generator->m_exc_state.exc_value );
487     Py_CLEAR( generator->m_exc_state.exc_traceback );
488 #elif PYTHON_VERSION >= 300
489     Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
490     Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
491     Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
492 #endif
493  
494     // Allow re-use of the frame again.
495     Py_DECREF( generator->m_frame );
496     goto frame_no_exception_1;
497  
498     frame_exception_exit_1:;
499  
500     // If it's not an exit exception, consider and create a traceback for it.
501     if ( !EXCEPTION_MATCH_GENERATOR( generator_heap->exception_type ) )
502     {
503         if ( generator_heap->exception_tb == NULL )
504         {
505             generator_heap->exception_tb = MAKE_TRACEBACK( generator->m_frame, generator_heap->exception_lineno );
506         }
507         else if ( generator_heap->exception_tb->tb_frame != &generator->m_frame->m_frame )
508         {
509             generator_heap->exception_tb = ADD_TRACEBACK( generator_heap->exception_tb, generator->m_frame, generator_heap->exception_lineno );
510         }
511  
512         Nuitka_Frame_AttachLocals(
513             (struct Nuitka_FrameObject *)generator->m_frame,
514             generator_heap->type_description_1,
515             generator->m_closure[0]
516         );
517  
518  
519         // Release cached frame.
520         if ( generator->m_frame == cache_m_frame )
521         {
522             Py_DECREF( generator->m_frame );
523         }
524         cache_m_frame = NULL;
525  
526         assertFrameObject( generator->m_frame );
527     }
528  
529 #if PYTHON_VERSION >= 370
530     Py_CLEAR( generator->m_exc_state.exc_type );
531     Py_CLEAR( generator->m_exc_state.exc_value );
532     Py_CLEAR( generator->m_exc_state.exc_traceback );
533 #elif PYTHON_VERSION >= 300
534     Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
535     Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
536     Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
537 #endif
538  
539     Py_DECREF( generator->m_frame );
540  
541     // Return the error.
542     goto function_exception_exit;
543  
544     frame_no_exception_1:;
545  
546  
547     return NULL;
548  
549     function_exception_exit:
550     assert( generator_heap->exception_type );
551     RESTORE_ERROR_OCCURRED( generator_heap->exception_type, generator_heap->exception_value, generator_heap->exception_tb );
552  
553     return NULL;
554  
555 }
556  
557 static PyObject *__main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_maker( void )
558 {
559     return Nuitka_Generator_New(
560         __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context,
561         module___main__,
562         const_str_plain_empty,
563 #if PYTHON_VERSION >= 350
564         const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd,
565 #endif
566         codeobj_adbaf4cd7b499dd9db12069d5b6e39a7,
567         1,
568         sizeof(struct __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_locals)
569     );
570 }
571  
572  
573 299
574 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ) 300 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  )
575 { 301 {
576     struct Nuitka_FunctionObject *result = Nuitka_Function_New( 302     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
577         impl___main__$$$function_1_calledRepeatedly, 303         impl___main__$$$function_1_calledRepeatedly,
586         NULL, 312         NULL,
587 #endif 313 #endif
588         module___main__, 314         module___main__,
589         NULL, 315         NULL,
590         0 316         0
t 591     ); t
592  
593     return (PyObject *)result;
594 }
595  
596  
597  
598 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty(  )
599 {
600     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
601         impl___main__$$$function_1_calledRepeatedly$$$function_1_empty,
602         const_str_plain_empty,
603 #if PYTHON_VERSION >= 300
604         const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd,
605 #endif
606         codeobj_adbaf4cd7b499dd9db12069d5b6e39a7,
607         NULL,
608 #if PYTHON_VERSION >= 300
609         NULL,
610         NULL,
611 #endif
612         module___main__,
613         NULL,
614         1
615     ); 317     );
616 318
617     return (PyObject *)result; 319     return (PyObject *)result;
618 } 320 }
619 321