Construct FunctionCreationGeneratorClosure

Performance Diagrams

Construct FunctionCreationGeneratorClosure 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)5075028088.95192307692307257.0CPython 2.712800239242.31730769230768441.7879258574458Nuitka (master)12450190395.6826923076923443.49239907945037Nuitka (develop)12450207549.0480769230769443.49231630233976Nuitka (factory)Construct FunctionCreationGeneratorClosureTicks Construct FunctionCreationGeneratorClosure 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)5659287388.95192307692307257.0CPython 3.515101809242.31730769230768438.1726405630889Nuitka (master)14552625395.6826923076923440.57067777502925Nuitka (develop)14552854549.0480769230769440.56967783598964Nuitka (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_ae1a301fb77ceb46baf7c691d0537610; 35 static PyObject *const_str_digest_ae1a301fb77ceb46baf7c691d0537610;
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( &constant_bin[ 0 ], 9, 1 ); 63     const_str_plain_itertools = UNSTREAM_STRING( &constant_bin[ 0 ], 9, 1 );
65     const_str_digest_ae1a301fb77ceb46baf7c691d0537610 = UNSTREAM_STRING( &constant_bin[ 9 ], 90, 0 ); 64     const_str_digest_ae1a301fb77ceb46baf7c691d0537610 = UNSTREAM_STRING( &constant_bin[ 9 ], 90, 0 );
n 66     const_tuple_str_plain_closure_var_tuple = PyTuple_New( 1 ); n 65     const_str_plain_module_var = UNSTREAM_STRING( &constant_bin[ 99 ], 10, 1 );
67     const_str_plain_closure_var = UNSTREAM_STRING( &constant_bin[ 99 ], 11, 1 ); 66     const_str_plain_closure_var = UNSTREAM_STRING( &constant_bin[ 109 ], 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( &constant_bin[ 110 ], 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( &constant_bin[ 120 ], 5, 1 ); 69     const_str_plain_empty = UNSTREAM_STRING( &constant_bin[ 120 ], 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( &constant_bin[ 125 ], 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( &constant_bin[ 156 ], 3, 0 ); n 73     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 125 ], 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( &constant_bin[ 125 ], 16, 1 ); n 75     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 128 ], 16, 1 );
80     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 159 ], 8, 0 ); 76     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 144 ], 8, 0 );
81     const_str_plain_None = UNSTREAM_STRING( &constant_bin[ 167 ], 4, 1 ); 77     const_str_plain_None = UNSTREAM_STRING( &constant_bin[ 152 ], 4, 1 );
82     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 34 ], 1, 1 ); 78     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 34 ], 1, 1 );
n 83     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 171 ], 6, 1 ); n 79     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 156 ], 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_708cb316395452f553811076f4ab8893; 98 static PyCodeObject *codeobj_708cb316395452f553811076f4ab8893;
103 static PyCodeObject *codeobj_9994ef4bd03cd2eaa60e31adfb1dd330; 99 static PyCodeObject *codeobj_9994ef4bd03cd2eaa60e31adfb1dd330;
n 104 static PyCodeObject *codeobj_8e8997a9db18c1dbec7dbed8f3ae40bf; 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_ae1a301fb77ceb46baf7c691d0537610; 105     module_filename_obj = const_str_digest_ae1a301fb77ceb46baf7c691d0537610;
111     codeobj_708cb316395452f553811076f4ab8893 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE ); 106     codeobj_708cb316395452f553811076f4ab8893 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE );
112     codeobj_main = codeobj_708cb316395452f553811076f4ab8893; 107     codeobj_main = codeobj_708cb316395452f553811076f4ab8893;
113     codeobj_9994ef4bd03cd2eaa60e31adfb1dd330 = 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_9994ef4bd03cd2eaa60e31adfb1dd330 = 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_8e8997a9db18c1dbec7dbed8f3ae40bf = 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_9994ef4bd03cd2eaa60e31adfb1dd330; 125     struct Nuitka_FrameObject *frame_9994ef4bd03cd2eaa60e31adfb1dd330;
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;
179         exception_tb = NULL; 166         exception_tb = NULL;
180         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 167         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
181         CHAIN_EXCEPTION( exception_value ); 168         CHAIN_EXCEPTION( exception_value );
182 169
183         exception_lineno = 25; 170         exception_lineno = 25;
n 184         type_description_1 = "co"; n 171         type_description_1 = "oN";
185         goto frame_exception_exit_1; 172         goto frame_exception_exit_1;
186     } 173     }
187 174
n 188     assert( PyCell_GET( var_closure_var == NULL ); n 175     assert( var_closure_var == NULL );
189     Py_INCREF( tmp_assign_source_1 ); 176     Py_INCREF( tmp_assign_source_1 );
n 190     PyCell_SET( var_closure_var, tmp_assign_source_1 ); n 177     var_closure_var = tmp_assign_source_1;
191 178
192     } 179     }
193 180
194 #if 0 181 #if 0
195     RESTORE_FRAME_EXCEPTION( frame_9994ef4bd03cd2eaa60e31adfb1dd330 ); 182     RESTORE_FRAME_EXCEPTION( frame_9994ef4bd03cd2eaa60e31adfb1dd330 );
218     // Attachs locals to frame if any. 205     // Attachs locals to frame if any.
219     Nuitka_Frame_AttachLocals( 206     Nuitka_Frame_AttachLocals(
220         (struct Nuitka_FrameObject *)frame_9994ef4bd03cd2eaa60e31adfb1dd330, 207         (struct Nuitka_FrameObject *)frame_9994ef4bd03cd2eaa60e31adfb1dd330,
221         type_description_1, 208         type_description_1,
222         var_closure_var, 209         var_closure_var,
n 223         var_empty n 210         NULL
224     ); 211     );
225 212
226 213
227     // Release cached frame. 214     // Release cached frame.
228     if ( frame_9994ef4bd03cd2eaa60e31adfb1dd330 == cache_frame_9994ef4bd03cd2eaa60e31adfb1dd330 ) 215     if ( frame_9994ef4bd03cd2eaa60e31adfb1dd330 == cache_frame_9994ef4bd03cd2eaa60e31adfb1dd330 )
240     goto try_except_handler_1; 227     goto try_except_handler_1;
241 228
242     frame_no_exception_1:; 229     frame_no_exception_1:;
243 230
244     { 231     {
n 245     PyObject *tmp_assign_source_2; n
246     tmp_assign_source_2 = MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty(  );
247  
248     ((struct Nuitka_FunctionObject *)tmp_assign_source_2)->m_closure[0] = var_closure_var;
249     Py_INCREF( ((struct Nuitka_FunctionObject *)tmp_assign_source_2)->m_closure[0] );
250  
251  
252     assert( var_empty == NULL );
253     var_empty = tmp_assign_source_2;
254  
255     }
256     {
257     PyObject *tmp_tuple_element_1; 232     PyObject *tmp_tuple_element_1;
n 258     tmp_tuple_element_1 = var_empty; n 233     tmp_tuple_element_1 = const_int_pos_1;
259  
260     CHECK_OBJECT( tmp_tuple_element_1 );
261     tmp_return_value = PyTuple_New( 2 ); 234     tmp_return_value = PyTuple_New( 2 );
262     Py_INCREF( tmp_tuple_element_1 ); 235     Py_INCREF( tmp_tuple_element_1 );
263     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 ); 236     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
n 264     if ( var_closure_var == NULL ) n
265     {
266         tmp_tuple_element_1 = NULL;
267     }
268     else
269     {
270         tmp_tuple_element_1 = PyCell_GET( var_closure_var ); 237     tmp_tuple_element_1 = var_closure_var;
271     }
272 238
273     CHECK_OBJECT( tmp_tuple_element_1 ); 239     CHECK_OBJECT( tmp_tuple_element_1 );
274     Py_INCREF( tmp_tuple_element_1 ); 240     Py_INCREF( tmp_tuple_element_1 );
275     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 ); 241     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
276     goto try_return_handler_1; 242     goto try_return_handler_1;
282     try_return_handler_1:; 248     try_return_handler_1:;
283     { 249     {
284     CHECK_OBJECT( (PyObject *)var_closure_var ); 250     CHECK_OBJECT( (PyObject *)var_closure_var );
285     Py_DECREF( var_closure_var ); 251     Py_DECREF( var_closure_var );
286     var_closure_var = NULL; 252     var_closure_var = NULL;
n 287   n
288     }
289     {
290     Py_XDECREF( var_empty );
291     var_empty = NULL;
292 253
293     } 254     }
294     { 255     {
295     goto function_return_exit; 256     goto function_return_exit;
296     } 257     }
333 return tmp_return_value; 294 return tmp_return_value;
334 295
335 } 296 }
336 297
337 298
n 338 static PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_empty( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) n
339 {
340     // Preserve error status for checks
341 #ifndef __NUITKA_NO_ASSERT__
342     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
343 #endif
344  
345     // Local variable declarations.
346     PyObject *tmp_return_value = NULL;
347  
348     // Actual function code.
349     {
350     tmp_return_value = __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_maker();
351  
352     ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] = self->m_closure[0];
353     Py_INCREF( ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] );
354  
355  
356     goto function_return_exit;
357     }
358  
359     // Return statement must have exited already.
360     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_empty );
361     return NULL;
362  
363 function_return_exit:
364  
365 CHECK_OBJECT( tmp_return_value );
366 assert( had_error || !ERROR_OCCURRED() );
367 return tmp_return_value;
368  
369 }
370  
371  
372  
373 struct __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_locals {
374  
375 };
376  
377 #if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
378 static PyObject *__main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value )
379 #else
380 static void __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context( struct Nuitka_GeneratorObject *generator )
381 #endif
382 {
383     CHECK_OBJECT( (PyObject *)generator );
384     assert( Nuitka_Generator_Check( (PyObject *)generator ) );
385  
386     // Heap access if used.
387  
388  
389     // Dispatch to yield based on return label index:
390  
391  
392     // Local variable initialization
393     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
394     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
395     PyObject *exception_type = NULL;
396     PyObject *exception_value = NULL;
397     PyTracebackObject *exception_tb = NULL;
398     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
399     static struct Nuitka_FrameObject *cache_m_frame = NULL;
400  
401     // Actual function code.
402     MAKE_OR_REUSE_FRAME( cache_m_frame, codeobj_8e8997a9db18c1dbec7dbed8f3ae40bf, module___main__, sizeof(void *) );
403     generator->m_frame = cache_m_frame;
404  
405     // Mark the frame object as in use, ref count 1 will be up for reuse.
406     Py_INCREF( generator->m_frame );
407     assert( Py_REFCNT( generator->m_frame ) == 2 ); // Frame stack
408  
409 #if PYTHON_VERSION >= 340
410     generator->m_frame->m_frame.f_gen = (PyObject *)generator;
411 #endif
412  
413     Py_CLEAR( generator->m_frame->m_frame.f_back );
414  
415     generator->m_frame->m_frame.f_back = PyThreadState_GET()->frame;
416     Py_INCREF( generator->m_frame->m_frame.f_back );
417  
418     PyThreadState_GET()->frame = &generator->m_frame->m_frame;
419     Py_INCREF( generator->m_frame );
420  
421     Nuitka_Frame_MarkAsExecuting( generator->m_frame );
422  
423 #if PYTHON_VERSION >= 300
424     // Accept currently existing exception as the one to publish again when we
425     // yield or yield from.
426  
427     PyThreadState *thread_state = PyThreadState_GET();
428  
429 #if PYTHON_VERSION < 370
430     generator->m_frame->m_frame.f_exc_type = EXC_TYPE( thread_state );
431     if ( generator->m_frame->m_frame.f_exc_type == Py_None ) generator->m_frame->m_frame.f_exc_type = NULL;
432     Py_XINCREF( generator->m_frame->m_frame.f_exc_type );
433     generator->m_frame->m_frame.f_exc_value = EXC_VALUE( thread_state );
434     Py_XINCREF( generator->m_frame->m_frame.f_exc_value );
435     generator->m_frame->m_frame.f_exc_traceback = EXC_TRACEBACK( thread_state );
436     Py_XINCREF( generator->m_frame->m_frame.f_exc_traceback );
437 #else
438     generator->m_exc_state.exc_type = EXC_TYPE( thread_state );
439     if ( generator->m_exc_state.exc_type == Py_None ) generator->m_exc_state.exc_type = NULL;
440     Py_XINCREF( generator->m_exc_state.exc_type );
441     generator->m_exc_state.exc_value = EXC_VALUE( thread_state );
442     Py_XINCREF( generator->m_exc_state.exc_value );
443     generator->m_exc_state.exc_traceback = EXC_TRACEBACK( thread_state );
444     Py_XINCREF( generator->m_exc_state.exc_traceback );
445  
446 #endif
447  
448 #endif
449  
450     // Framed code:
451     {
452     PyObject *tmp_expression_name_1;
453     if ( generator->m_closure[0] == NULL )
454     {
455         tmp_expression_name_1 = NULL;
456     }
457     else
458     {
459         tmp_expression_name_1 = PyCell_GET( generator->m_closure[0] );
460     }
461  
462     if ( tmp_expression_name_1 == NULL )
463     {
464  
465         exception_type = PyExc_NameError;
466         Py_INCREF( exception_type );
467         exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "closure_var" );
468         exception_tb = NULL;
469         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
470         CHAIN_EXCEPTION( exception_value );
471  
472         exception_lineno = 29;
473         type_description_1 = "c";
474         goto frame_exception_exit_1;
475     }
476  
477     Py_INCREF( tmp_expression_name_1 );
478     tmp_unused = GENERATOR_YIELD( generator, tmp_expression_name_1 );
479     if ( tmp_unused == NULL )
480     {
481         assert( ERROR_OCCURRED() );
482  
483         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
484  
485  
486         exception_lineno = 29;
487         type_description_1 = "c";
488         goto frame_exception_exit_1;
489     }
490     }
491  
492     Nuitka_Frame_MarkAsNotExecuting( generator->m_frame );
493  
494 #if PYTHON_VERSION >= 370
495     Py_CLEAR( generator->m_exc_state.exc_type );
496     Py_CLEAR( generator->m_exc_state.exc_value );
497     Py_CLEAR( generator->m_exc_state.exc_traceback );
498 #elif PYTHON_VERSION >= 300
499     Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
500     Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
501     Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
502 #endif
503  
504     // Allow re-use of the frame again.
505     Py_DECREF( generator->m_frame );
506     goto frame_no_exception_1;
507  
508     frame_exception_exit_1:;
509  
510     // If it's not an exit exception, consider and create a traceback for it.
511     if ( !EXCEPTION_MATCH_GENERATOR( exception_type ) )
512     {
513         if ( exception_tb == NULL )
514         {
515             exception_tb = MAKE_TRACEBACK( generator->m_frame, exception_lineno );
516         }
517         else if ( exception_tb->tb_frame != &generator->m_frame->m_frame )
518         {
519             exception_tb = ADD_TRACEBACK( exception_tb, generator->m_frame, exception_lineno );
520         }
521  
522         Nuitka_Frame_AttachLocals(
523             (struct Nuitka_FrameObject *)generator->m_frame,
524             type_description_1,
525             generator->m_closure[0]
526         );
527  
528  
529         // Release cached frame.
530         if ( generator->m_frame == cache_m_frame )
531         {
532             Py_DECREF( generator->m_frame );
533         }
534         cache_m_frame = NULL;
535  
536         assertFrameObject( generator->m_frame );
537     }
538  
539 #if PYTHON_VERSION >= 370
540     Py_CLEAR( generator->m_exc_state.exc_type );
541     Py_CLEAR( generator->m_exc_state.exc_value );
542     Py_CLEAR( generator->m_exc_state.exc_traceback );
543 #elif PYTHON_VERSION >= 300
544     Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
545     Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
546     Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
547 #endif
548  
549     Py_DECREF( generator->m_frame );
550     // Return the error.
551     goto function_exception_exit;
552  
553     frame_no_exception_1:;
554  
555  
556  
557 #if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
558     return NULL;
559 #else
560     generator->m_yielded = NULL;
561     return;
562 #endif
563  
564     function_exception_exit:
565     assert( exception_type );
566     RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
567  
568 #if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
569     return NULL;
570 #else
571     generator->m_yielded = NULL;
572     return;
573 #endif
574  
575 }
576  
577 static PyObject *__main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_maker( void )
578 {
579     return Nuitka_Generator_New(
580         __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context,
581         module___main__,
582         const_str_plain_empty,
583 #if PYTHON_VERSION >= 350
584         const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd,
585 #endif
586         codeobj_8e8997a9db18c1dbec7dbed8f3ae40bf,
587         1,
588         sizeof(struct __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_locals)
589     );
590 }
591  
592  
593 299
594 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ) 300 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  )
595 { 301 {
596     struct Nuitka_FunctionObject *result = Nuitka_Function_New( 302     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
597         impl___main__$$$function_1_calledRepeatedly, 303         impl___main__$$$function_1_calledRepeatedly,
606         NULL, 312         NULL,
607 #endif 313 #endif
608         module___main__, 314         module___main__,
609         NULL, 315         NULL,
610         0 316         0
t 611     ); t
612  
613     return (PyObject *)result;
614 }
615  
616  
617  
618 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty(  )
619 {
620     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
621         impl___main__$$$function_1_calledRepeatedly$$$function_1_empty,
622         const_str_plain_empty,
623 #if PYTHON_VERSION >= 300
624         const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd,
625 #endif
626         codeobj_8e8997a9db18c1dbec7dbed8f3ae40bf,
627         NULL,
628 #if PYTHON_VERSION >= 300
629         NULL,
630         NULL,
631 #endif
632         module___main__,
633         NULL,
634         1
635     ); 317     );
636 318
637     return (PyObject *)result; 319     return (PyObject *)result;
638 } 320 }
639 321