Construct FunctionCreationGeneratorClosure

Performance Diagrams

Construct FunctionCreationGeneratorClosure 001000000010000000200000002000000030000000300000004000000040000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)4565700788.95192307692307257.0CPython 2.712201923242.31730769230768438.07332243657584Nuitka (master)12252036395.6826923076923437.80208929881826Nuitka (develop)12252031549.0480769230769437.8021163609716Nuitka (factory)Construct FunctionCreationGeneratorClosureTicks Construct FunctionCreationGeneratorClosure 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)5609399788.95192307692307257.0CPython 3.513752916242.31730769230768443.5285605578464Nuitka (master)13852980395.6826923076923443.0877405919211Nuitka (develop)13852291549.0480769230769443.0907758988899Nuitka (factory)Construct FunctionCreationGeneratorClosureTicks

Source Code with Construct

module_var = None

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

# construct_begin
    def empty():
        yield closure_var

# construct_alternative



    return empty, closure_var


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

print("OK.")

Source Code without Construct

module_var = None

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

# construct_begin



# construct_alternative
    empty = 1
# construct_end

    return empty, closure_var


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

print("OK.")

Context Diff of Source Code


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

Context Diff of Generated Code


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