Construct FunctionCreationGeneratorClosure

Performance Diagrams

Construct FunctionCreationGeneratorClosure 001000000010000000200000002000000030000000300000004000000040000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)4496823973.61538461538461275.4744343090871CPython 2.748601721196.30769230769232257.0Nuitka (historic)12652455319.0000000000001439.78399429992965Nuitka (master)12652423441.69230769230774439.7841570038863Nuitka (develop)12603574564.3846153846155440.0325296782423Nuitka (factory)Construct FunctionCreationGeneratorClosureTicks Construct FunctionCreationGeneratorClosure 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)5639723473.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)15812212319.0000000000001434.8311206034297Nuitka (master)15804008441.69230769230774434.86706801559154Nuitka (develop)15803660564.3846153846155434.8685928448739Nuitka (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


for x in xrange(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


for x in xrange(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 for x in xrange(50000): 38 for x in xrange(50000):

Context Diff of Generated Code


Construct
Baseline
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_xrange_0_50000; 42 static PyObject *const_xrange_0_50000;
43 static PyObject *const_str_plain_empty; 43 static PyObject *const_str_plain_empty;
44 extern PyObject *const_str_plain_print; 44 extern PyObject *const_str_plain_print;
n 45 static PyObject *const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd; n
46 static PyObject *const_int_pos_50000; 45 static PyObject *const_int_pos_50000;
47 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 46 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
48 static PyObject *const_str_plain_calledRepeatedly; 47 static PyObject *const_str_plain_calledRepeatedly;
49 static PyObject *const_str_angle_module; 48 static PyObject *const_str_angle_module;
50 static PyObject *const_str_plain_x; 49 static PyObject *const_str_plain_x;
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 ); 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 );
69     const_str_plain_empty = UNSTREAM_STRING( &constant_bin[ 32 ], 5, 1 ); 68     const_str_plain_empty = UNSTREAM_STRING( &constant_bin[ 32 ], 5, 1 );
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 ); 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 );
71     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 70     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
72     const_xrange_0_50000 = BUILTIN_XRANGE3( const_int_0, const_int_pos_50000, const_int_pos_1 ); 71     const_xrange_0_50000 = BUILTIN_XRANGE3( const_int_0, const_int_pos_50000, const_int_pos_1 );
n 73     const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd = UNSTREAM_STRING( &constant_bin[ 37 ], 31, 0 ); n
74     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 72     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
n 75     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 68 ], 3, 0 ); n 73     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 37 ], 3, 0 );
76     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 77     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 37 ], 16, 1 ); n 75     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 40 ], 16, 1 );
78     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 71 ], 8, 0 ); 76     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 56 ], 8, 0 );
79     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 79 ], 1, 1 ); 77     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 64 ], 1, 1 );
80     const_str_digest_ab3f438c4718a8dd00c3dc4d69f53d55 = UNSTREAM_STRING( &constant_bin[ 80 ], 90, 0 ); 78     const_str_digest_ab3f438c4718a8dd00c3dc4d69f53d55 = UNSTREAM_STRING( &constant_bin[ 65 ], 90, 0 );
81 79
82     constants_created = true; 80     constants_created = true;
83 } 81 }
84 82
85 #ifndef __NUITKA_NO_ASSERT__ 83 #ifndef __NUITKA_NO_ASSERT__
93 #endif 91 #endif
94 92
95 // The module code objects. 93 // The module code objects.
96 static PyCodeObject *codeobj_04787a85da4904e01a5b155ed2275c79; 94 static PyCodeObject *codeobj_04787a85da4904e01a5b155ed2275c79;
97 static PyCodeObject *codeobj_69f781ca6945cea09a357f2f34b0bcbd; 95 static PyCodeObject *codeobj_69f781ca6945cea09a357f2f34b0bcbd;
n 98 static PyCodeObject *codeobj_3021208bd94d9dae7aca89fe19525f7a; n
99 static PyCodeObject *codeobj_4c2f8f7d20e957c2f9731cab51898857;
100 /* For use in MainProgram.cpp. */ 96 /* For use in MainProgram.cpp. */
101 PyCodeObject *codeobj_main = NULL; 97 PyCodeObject *codeobj_main = NULL;
102 98
103 static void createModuleCodeObjects(void) 99 static void createModuleCodeObjects(void)
104 { 100 {
105     module_filename_obj = const_str_digest_ab3f438c4718a8dd00c3dc4d69f53d55; 101     module_filename_obj = const_str_digest_ab3f438c4718a8dd00c3dc4d69f53d55;
106     codeobj_04787a85da4904e01a5b155ed2275c79 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE ); 102     codeobj_04787a85da4904e01a5b155ed2275c79 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE );
107     codeobj_main = codeobj_04787a85da4904e01a5b155ed2275c79; 103     codeobj_main = codeobj_04787a85da4904e01a5b155ed2275c79;
108     codeobj_69f781ca6945cea09a357f2f34b0bcbd = 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 ); 104     codeobj_69f781ca6945cea09a357f2f34b0bcbd = 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 109     codeobj_3021208bd94d9dae7aca89fe19525f7a = MAKE_CODEOBJ( module_filename_obj, const_str_plain_empty, 28, const_tuple_empty, 0, 0, CO_GENERATOR | CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE ); n
110     codeobj_4c2f8f7d20e957c2f9731cab51898857 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_empty, 28, const_tuple_empty, 0, 0, CO_GENERATOR | CO_OPTIMIZED | CO_NEWLOCALS );
111 } 105 }
112 106
113 // The module function declarations. 107 // The module function declarations.
n 114 static void __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context( struct Nuitka_GeneratorObject *generator ); n
115  
116  
117 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ); 108 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  );
n 118   n
119  
120 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty( struct Nuitka_CellObject *closure_closure_var );
121 109
122 110
123 // The module function definitions. 111 // The module function definitions.
124 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) 112 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
125 { 113 {
127 #ifndef __NUITKA_NO_ASSERT__ 115 #ifndef __NUITKA_NO_ASSERT__
128     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED(); 116     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
129 #endif 117 #endif
130 118
131     // Local variable declarations. 119     // Local variable declarations.
n 132     struct Nuitka_CellObject *var_closure_var = PyCell_EMPTY(); n
133     PyObject *var_empty = NULL; 120     PyObject *var_closure_var = NULL;
134     PyObject *exception_type = NULL, *exception_value = NULL; 121     PyObject *exception_type = NULL, *exception_value = NULL;
135     PyTracebackObject *exception_tb = NULL; 122     PyTracebackObject *exception_tb = NULL;
136     NUITKA_MAY_BE_UNUSED int exception_lineno = -1; 123     NUITKA_MAY_BE_UNUSED int exception_lineno = -1;
137     PyObject *exception_keeper_type_1; 124     PyObject *exception_keeper_type_1;
138     PyObject *exception_keeper_value_1; 125     PyObject *exception_keeper_value_1;
139     PyTracebackObject *exception_keeper_tb_1; 126     PyTracebackObject *exception_keeper_tb_1;
140     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 127     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
141     PyObject *tmp_assign_source_1; 128     PyObject *tmp_assign_source_1;
n 142     PyObject *tmp_assign_source_2; n
143     PyObject *tmp_frame_locals; 129     PyObject *tmp_frame_locals;
144     PyObject *tmp_return_value; 130     PyObject *tmp_return_value;
145     PyObject *tmp_tuple_element_1; 131     PyObject *tmp_tuple_element_1;
146     static PyFrameObject *cache_frame_function = NULL; 132     static PyFrameObject *cache_frame_function = NULL;
147 133
185 171
186         exception_lineno = 25; 172         exception_lineno = 25;
187         goto frame_exception_exit_1; 173         goto frame_exception_exit_1;
188     } 174     }
189 175
n 190     { n 176     assert( var_closure_var == NULL );
191         PyObject *old = PyCell_GET( var_closure_var );
192         PyCell_SET( var_closure_var, tmp_assign_source_1 );
193         Py_INCREF( tmp_assign_source_1 ); 177     Py_INCREF( tmp_assign_source_1 );
194         Py_XDECREF( old );
195     }
196  
197     tmp_assign_source_2 = MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty( var_closure_var );
198     assert( var_empty == NULL );
199     var_empty = tmp_assign_source_2; 178     var_closure_var = tmp_assign_source_1;
200 179
n 201     tmp_return_value = PyTuple_New( 2 ); n
202     tmp_tuple_element_1 = var_empty;
203  
204     Py_INCREF( tmp_tuple_element_1 );
205     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
206     tmp_tuple_element_1 = PyCell_GET( var_closure_var );
207  
208     if ( tmp_tuple_element_1 == NULL )
209     {
210         Py_DECREF( tmp_return_value );
211         exception_type = PyExc_UnboundLocalError;
212         Py_INCREF( exception_type );
213         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "closure_var" );
214         exception_tb = NULL;
215         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
216         CHAIN_EXCEPTION( exception_value );
217  
218         exception_lineno = 35;
219         goto frame_exception_exit_1;
220     }
221  
222     Py_INCREF( tmp_tuple_element_1 );
223     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
224     goto frame_return_exit_1;
225 180
226 #if 0 181 #if 0
227     RESTORE_FRAME_EXCEPTION( frame_function ); 182     RESTORE_FRAME_EXCEPTION( frame_function );
228 #endif 183 #endif
229     // Put the previous frame back on top. 184     // Put the previous frame back on top.
231 #if PYTHON_VERSION >= 340 186 #if PYTHON_VERSION >= 340
232     frame_function->f_executing -= 1; 187     frame_function->f_executing -= 1;
233 #endif 188 #endif
234     Py_DECREF( frame_function ); 189     Py_DECREF( frame_function );
235     goto frame_no_exception_1; 190     goto frame_no_exception_1;
n 236   n
237     frame_return_exit_1:;
238 #if 0
239     RESTORE_FRAME_EXCEPTION( frame_function );
240 #endif
241     popFrameStack();
242 #if PYTHON_VERSION >= 340
243     frame_function->f_executing -= 1;
244 #endif
245     Py_DECREF( frame_function );
246     goto try_return_handler_1;
247 191
248     frame_exception_exit_1:; 192     frame_exception_exit_1:;
249 #if 0 193 #if 0
250     RESTORE_FRAME_EXCEPTION( frame_function ); 194     RESTORE_FRAME_EXCEPTION( frame_function );
251 #endif 195 #endif
269 213
270         if (needs_detach) 214         if (needs_detach)
271         { 215         {
272 216
273             tmp_frame_locals = PyDict_New(); 217             tmp_frame_locals = PyDict_New();
n 274             if ( var_closure_var->ob_ref ) n 218             if ( var_closure_var )
275             { 219             {
276                 int res = PyDict_SetItem( 220                 int res = PyDict_SetItem(
277                     tmp_frame_locals, 221                     tmp_frame_locals,
278                     const_str_plain_closure_var, 222                     const_str_plain_closure_var,
n 279                     var_closure_var->ob_ref n 223                     var_closure_var
280                 ); 224                 );
281 225
282                 assert( res == 0 ); 226                 assert( res == 0 );
283             } 227             }
284 228
n 285             if ( var_empty ) n
286             {
287                 int res = PyDict_SetItem(
288                     tmp_frame_locals,
289                     const_str_plain_empty,
290                     var_empty
291                 );
292  
293                 assert( res == 0 );
294             }
295  
296 229
297 230
298             detachFrame( exception_tb, tmp_frame_locals ); 231             detachFrame( exception_tb, tmp_frame_locals );
299         } 232         }
300     } 233     }
309     // Return the error. 242     // Return the error.
310     goto try_except_handler_1; 243     goto try_except_handler_1;
311 244
312     frame_no_exception_1:; 245     frame_no_exception_1:;
313 246
n n 247     tmp_return_value = PyTuple_New( 2 );
248     tmp_tuple_element_1 = const_int_pos_1;
249     Py_INCREF( tmp_tuple_element_1 );
250     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
251     tmp_tuple_element_1 = var_closure_var;
252  
253     Py_INCREF( tmp_tuple_element_1 );
254     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
255     goto try_return_handler_1;
314     // tried codes exits in all cases 256     // tried codes exits in all cases
315     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 257     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
316     return NULL; 258     return NULL;
317     // Return handler code: 259     // Return handler code:
318     try_return_handler_1:; 260     try_return_handler_1:;
319     CHECK_OBJECT( (PyObject *)var_closure_var ); 261     CHECK_OBJECT( (PyObject *)var_closure_var );
320     Py_DECREF( var_closure_var ); 262     Py_DECREF( var_closure_var );
321     var_closure_var = NULL; 263     var_closure_var = NULL;
n 322   n
323     Py_XDECREF( var_empty );
324     var_empty = NULL;
325 264
326     goto function_return_exit; 265     goto function_return_exit;
327     // Exception handler code: 266     // Exception handler code:
328     try_except_handler_1:; 267     try_except_handler_1:;
329     exception_keeper_type_1 = exception_type; 268     exception_keeper_type_1 = exception_type;
333     exception_type = NULL; 272     exception_type = NULL;
334     exception_value = NULL; 273     exception_value = NULL;
335     exception_tb = NULL; 274     exception_tb = NULL;
336     exception_lineno = -1; 275     exception_lineno = -1;
337 276
n 338     CHECK_OBJECT( (PyObject *)var_closure_var ); n
339     Py_DECREF( var_closure_var );
340     var_closure_var = NULL;
341  
342     Py_XDECREF( var_empty );
343     var_empty = NULL;
344  
345     // Re-raise. 277     // Re-raise.
346     exception_type = exception_keeper_type_1; 278     exception_type = exception_keeper_type_1;
347     exception_value = exception_keeper_value_1; 279     exception_value = exception_keeper_value_1;
348     exception_tb = exception_keeper_tb_1; 280     exception_tb = exception_keeper_tb_1;
349     exception_lineno = exception_keeper_lineno_1; 281     exception_lineno = exception_keeper_lineno_1;
364 296
365     CHECK_OBJECT( tmp_return_value ); 297     CHECK_OBJECT( tmp_return_value );
366     assert( had_error || !ERROR_OCCURRED() ); 298     assert( had_error || !ERROR_OCCURRED() );
367     return tmp_return_value; 299     return tmp_return_value;
368 300
n 369 } n
370  
371  
372 static PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_empty( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
373 {
374     // Preserve error status for checks
375 #ifndef __NUITKA_NO_ASSERT__
376     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
377 #endif
378  
379     // Local variable declarations.
380     PyObject *tmp_return_value;
381     tmp_return_value = NULL;
382  
383     // Actual function code.
384     tmp_return_value = Nuitka_Generator_New(
385         __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context,
386         module___main__,
387         self->m_name,
388 #if PYTHON_VERSION >= 350
389         self->m_qualname,
390 #endif
391         codeobj_4c2f8f7d20e957c2f9731cab51898857,
392         1
393     );
394  
395     ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] = self->m_closure[0];
396     Py_INCREF( ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] );
397  
398  
399     goto function_return_exit;
400  
401     // Return statement must have exited already.
402     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_empty );
403     return NULL;
404  
405     function_return_exit:
406  
407     CHECK_OBJECT( tmp_return_value );
408     assert( had_error || !ERROR_OCCURRED() );
409     return tmp_return_value;
410  
411 }
412  
413  
414  
415 static void __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context( struct Nuitka_GeneratorObject *generator )
416 {
417     CHECK_OBJECT( (PyObject *)generator );
418     assert( Nuitka_Generator_Check( (PyObject *)generator ) );
419  
420     // Local variable initialization
421     PyObject *exception_type = NULL, *exception_value = NULL;
422     PyTracebackObject *exception_tb = NULL;
423     NUITKA_MAY_BE_UNUSED int exception_lineno = -1;
424     PyObject *tmp_expression_name_1;
425     PyObject *tmp_frame_locals;
426     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
427     static PyFrameObject *cache_frame_generator = NULL;
428  
429  
430     // Actual function code.
431     MAKE_OR_REUSE_FRAME( cache_frame_generator, codeobj_3021208bd94d9dae7aca89fe19525f7a, module___main__ );
432     generator->m_frame = cache_frame_generator;
433     Py_INCREF( generator->m_frame );
434  
435 #if PYTHON_VERSION >= 340
436     generator->m_frame->f_gen = (PyObject *)generator;
437 #endif
438  
439     Py_CLEAR( generator->m_frame->f_back );
440  
441     generator->m_frame->f_back = PyThreadState_GET()->frame;
442     Py_INCREF( generator->m_frame->f_back );
443  
444     PyThreadState_GET()->frame = generator->m_frame;
445     Py_INCREF( generator->m_frame );
446  
447 #if PYTHON_VERSION >= 340
448     generator->m_frame->f_executing += 1;
449 #endif
450  
451 #if PYTHON_VERSION >= 300
452     // Accept currently existing exception as the one to publish again when we
453     // yield or yield from.
454  
455     PyThreadState *thread_state = PyThreadState_GET();
456  
457     generator->m_frame->f_exc_type = thread_state->exc_type;
458     if ( generator->m_frame->f_exc_type == Py_None ) generator->m_frame->f_exc_type = NULL;
459     Py_XINCREF( generator->m_frame->f_exc_type );
460     generator->m_frame->f_exc_value = thread_state->exc_value;
461     Py_XINCREF( generator->m_frame->f_exc_value );
462     generator->m_frame->f_exc_traceback = thread_state->exc_traceback;
463     Py_XINCREF( generator->m_frame->f_exc_traceback );
464 #endif
465  
466     // Framed code:
467     tmp_expression_name_1 = PyCell_GET( generator->m_closure[0] );
468  
469     if ( tmp_expression_name_1 == NULL )
470     {
471  
472         exception_type = PyExc_NameError;
473         Py_INCREF( exception_type );
474         exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "closure_var" );
475         exception_tb = NULL;
476         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
477         CHAIN_EXCEPTION( exception_value );
478  
479         exception_lineno = 29;
480         goto frame_exception_exit_1;
481     }
482  
483     tmp_unused = GENERATOR_YIELD( generator, INCREASE_REFCOUNT( tmp_expression_name_1 ) );
484     if ( tmp_unused == NULL )
485     {
486         assert( ERROR_OCCURRED() );
487  
488         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
489  
490  
491         exception_lineno = 29;
492         goto frame_exception_exit_1;
493     }
494  
495 #if PYTHON_VERSION >= 340
496     generator->m_frame->f_executing -= 1;
497 #endif
498  
499 #if PYTHON_VERSION >= 300
500     Py_CLEAR( generator->m_frame->f_exc_type );
501     Py_CLEAR( generator->m_frame->f_exc_value );
502     Py_CLEAR( generator->m_frame->f_exc_traceback );
503 #endif
504  
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         int needs_detach = false;
514  
515         if ( exception_tb == NULL )
516         {
517             exception_tb = MAKE_TRACEBACK( generator->m_frame, exception_lineno );
518             needs_detach = true;
519         }
520         else if ( exception_tb->tb_frame != generator->m_frame )
521         {
522             PyTracebackObject *traceback_new = MAKE_TRACEBACK( generator->m_frame, exception_lineno );
523             traceback_new->tb_next = exception_tb;
524             exception_tb = traceback_new;
525  
526             needs_detach = true;
527         }
528  
529         if (needs_detach)
530         {
531  
532             tmp_frame_locals = PyDict_New();
533             if ( generator->m_closure[0]->ob_ref )
534             {
535                 int res = PyDict_SetItem(
536                     tmp_frame_locals,
537                     const_str_plain_closure_var,
538                     generator->m_closure[0]->ob_ref
539                 );
540  
541                 assert( res == 0 );
542             }
543  
544  
545  
546             detachFrame( exception_tb, tmp_frame_locals );
547         }
548     }
549  
550 #if PYTHON_VERSION >= 300
551     Py_CLEAR( generator->m_frame->f_exc_type );
552     Py_CLEAR( generator->m_frame->f_exc_value );
553     Py_CLEAR( generator->m_frame->f_exc_traceback );
554 #endif
555  
556     Py_DECREF( generator->m_frame );
557     // Return the error.
558     goto function_exception_exit;
559  
560     frame_no_exception_1:;
561  
562  
563     generator->m_yielded = NULL;
564     return;
565  
566     function_exception_exit:
567     assert( exception_type );
568     RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
569     generator->m_yielded = NULL;
570     return;
571 } 301 }
572 302
573 303
574 304
575 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ) 305 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  )
589         module___main__, 319         module___main__,
590         Py_None, 320         Py_None,
591         0 321         0
592     ); 322     );
593 323
t 594   t
595     return (PyObject *)result;
596 }
597  
598  
599  
600 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty( struct Nuitka_CellObject *closure_closure_var )
601 {
602     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
603         impl___main__$$$function_1_calledRepeatedly$$$function_1_empty,
604         const_str_plain_empty,
605 #if PYTHON_VERSION >= 330
606         const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd,
607 #endif
608         codeobj_4c2f8f7d20e957c2f9731cab51898857,
609         NULL,
610 #if PYTHON_VERSION >= 300
611         NULL,
612         const_dict_empty,
613 #endif
614         module___main__,
615         Py_None,
616         1
617     );
618  
619 result->m_closure[0] = closure_closure_var;
620 Py_INCREF( result->m_closure[0] );
621 324
622     return (PyObject *)result; 325     return (PyObject *)result;
623 } 326 }
624 327
625 328