Construct FunctionCreationGeneratorClosure

Performance Diagrams

Construct FunctionCreationGeneratorClosure 001000000010000000200000002000000030000000300000004000000040000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)4565700788.95192307692307257.0CPython 2.712201942242.31730769230768438.07321960039326Nuitka (master)12252030395.6826923076923437.80212177340223Nuitka (develop)12251896549.0480769230769437.80284703911093Nuitka (factory)Construct FunctionCreationGeneratorClosureTicks Construct FunctionCreationGeneratorClosure 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)5609399788.95192307692307257.0CPython 3.513752119242.31730769230768443.5320716458785Nuitka (master)13852216395.6826923076923443.09110630240605Nuitka (develop)13855680549.0480769230769443.0758460653381Nuitka (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_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 141 ], 1, 1); 78     const_str_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 110 ], 1, 1);
83     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 142 ], 6, 1); 79     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 111 ], 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);
n 87     const_str_digest_153b9b4fe4d27bbb9ba9dee80f38fbaa = UNSTREAM_STRING_ASCII(&constant_bin[ 148 ], 57, 0); n 83     const_str_digest_153b9b4fe4d27bbb9ba9dee80f38fbaa = UNSTREAM_STRING_ASCII(&constant_bin[ 117 ], 57, 0);
88 84
89     constants_created = true; 85     constants_created = true;
90 } 86 }
91 87
92 /* Function to verify module private constants for non-corruption. */ 88 /* Function to verify module private constants for non-corruption. */
101 #endif 97 #endif
102 98
103 // The module code objects. 99 // The module code objects.
104 static PyCodeObject *codeobj_8a63e6486fb03da478dd2c128e40e3ef; 100 static PyCodeObject *codeobj_8a63e6486fb03da478dd2c128e40e3ef;
105 static PyCodeObject *codeobj_e82e2850fdc51831b593a6e6b5b7f915; 101 static PyCodeObject *codeobj_e82e2850fdc51831b593a6e6b5b7f915;
n 106 static PyCodeObject *codeobj_71f48e42c3952265af1d0e2691ab347b; 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_153b9b4fe4d27bbb9ba9dee80f38fbaa; 107     module_filename_obj = const_str_digest_153b9b4fe4d27bbb9ba9dee80f38fbaa;
113     codeobj_8a63e6486fb03da478dd2c128e40e3ef = MAKE_CODEOBJ(module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE); 108     codeobj_8a63e6486fb03da478dd2c128e40e3ef = MAKE_CODEOBJ(module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE);
114     codeobj_e82e2850fdc51831b593a6e6b5b7f915 = 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_e82e2850fdc51831b593a6e6b5b7f915 = 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_71f48e42c3952265af1d0e2691ab347b = 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     // Preserve error status for checks 118     // Preserve error status for checks
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_e82e2850fdc51831b593a6e6b5b7f915; 125     struct Nuitka_FrameObject *frame_e82e2850fdc51831b593a6e6b5b7f915;
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;
177             exception_tb = NULL; 164             exception_tb = NULL;
178             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb); 165             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
179             CHAIN_EXCEPTION(exception_value); 166             CHAIN_EXCEPTION(exception_value);
180 167
181             exception_lineno = 25; 168             exception_lineno = 25;
n 182             type_description_1 = "co"; n 169             type_description_1 = "oN";
183             goto frame_exception_exit_1; 170             goto frame_exception_exit_1;
184         } 171         }
185 172
186         tmp_assign_source_1 = tmp_mvar_value_1; 173         tmp_assign_source_1 = tmp_mvar_value_1;
n 187         assert(PyCell_GET(var_closure_var) == NULL); n 174         assert(var_closure_var == NULL);
188         Py_INCREF(tmp_assign_source_1); 175         Py_INCREF(tmp_assign_source_1);
n 189         PyCell_SET(var_closure_var, tmp_assign_source_1); n 176         var_closure_var = tmp_assign_source_1;
190  
191     } 177     }
192 178
193 #if 0 179 #if 0
194     RESTORE_FRAME_EXCEPTION(frame_e82e2850fdc51831b593a6e6b5b7f915); 180     RESTORE_FRAME_EXCEPTION(frame_e82e2850fdc51831b593a6e6b5b7f915);
195 #endif 181 #endif
215     // Attachs locals to frame if any. 201     // Attachs locals to frame if any.
216     Nuitka_Frame_AttachLocals( 202     Nuitka_Frame_AttachLocals(
217         (struct Nuitka_FrameObject *)frame_e82e2850fdc51831b593a6e6b5b7f915, 203         (struct Nuitka_FrameObject *)frame_e82e2850fdc51831b593a6e6b5b7f915,
218         type_description_1, 204         type_description_1,
219         var_closure_var, 205         var_closure_var,
n 220         var_empty n 206         NULL
221     ); 207     );
222 208
223 209
224     // Release cached frame. 210     // Release cached frame.
225     if (frame_e82e2850fdc51831b593a6e6b5b7f915 == cache_frame_e82e2850fdc51831b593a6e6b5b7f915) { 211     if (frame_e82e2850fdc51831b593a6e6b5b7f915 == cache_frame_e82e2850fdc51831b593a6e6b5b7f915) {
235     // Return the error. 221     // Return the error.
236     goto try_except_handler_1; 222     goto try_except_handler_1;
237 223
238     frame_no_exception_1:; 224     frame_no_exception_1:;
239     { 225     {
n 240         PyObject *tmp_assign_source_2; n
241         tmp_assign_source_2 = MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty();
242  
243         ((struct Nuitka_FunctionObject *)tmp_assign_source_2)->m_closure[0] = var_closure_var;
244         Py_INCREF(((struct Nuitka_FunctionObject *)tmp_assign_source_2)->m_closure[0]);
245  
246  
247         assert(var_empty == NULL);
248         var_empty = tmp_assign_source_2;
249     }
250     {
251         PyObject *tmp_tuple_element_1; 226         PyObject *tmp_tuple_element_1;
n 252         CHECK_OBJECT(var_empty); n
253         tmp_tuple_element_1 = var_empty; 227         tmp_tuple_element_1 = const_int_pos_1;
254         tmp_return_value = PyTuple_New(2); 228         tmp_return_value = PyTuple_New(2);
255         Py_INCREF(tmp_tuple_element_1); 229         Py_INCREF(tmp_tuple_element_1);
256         PyTuple_SET_ITEM(tmp_return_value, 0, tmp_tuple_element_1); 230         PyTuple_SET_ITEM(tmp_return_value, 0, tmp_tuple_element_1);
n 257         CHECK_OBJECT(PyCell_GET(var_closure_var)); n 231         CHECK_OBJECT(var_closure_var);
258         tmp_tuple_element_1 = PyCell_GET(var_closure_var); 232         tmp_tuple_element_1 = var_closure_var;
259         Py_INCREF(tmp_tuple_element_1); 233         Py_INCREF(tmp_tuple_element_1);
260         PyTuple_SET_ITEM(tmp_return_value, 1, tmp_tuple_element_1); 234         PyTuple_SET_ITEM(tmp_return_value, 1, tmp_tuple_element_1);
261         goto try_return_handler_1; 235         goto try_return_handler_1;
262     } 236     }
263     // tried codes exits in all cases 237     // tried codes exits in all cases
266     // Return handler code: 240     // Return handler code:
267     try_return_handler_1:; 241     try_return_handler_1:;
268     CHECK_OBJECT((PyObject *)var_closure_var); 242     CHECK_OBJECT((PyObject *)var_closure_var);
269     Py_DECREF(var_closure_var); 243     Py_DECREF(var_closure_var);
270     var_closure_var = NULL; 244     var_closure_var = NULL;
n 271   n
272     CHECK_OBJECT((PyObject *)var_empty);
273     Py_DECREF(var_empty);
274     var_empty = NULL;
275 245
276     goto function_return_exit; 246     goto function_return_exit;
277     // Exception handler code: 247     // Exception handler code:
278     try_except_handler_1:; 248     try_except_handler_1:;
279     exception_keeper_type_1 = exception_type; 249     exception_keeper_type_1 = exception_type;
314    assert(had_error || !ERROR_OCCURRED()); 284    assert(had_error || !ERROR_OCCURRED());
315    return tmp_return_value; 285    return tmp_return_value;
316 } 286 }
317 287
318 288
n 319 static PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_empty(struct Nuitka_FunctionObject const *self, PyObject **python_pars) { n
320     // Preserve error status for checks
321 #ifndef __NUITKA_NO_ASSERT__
322     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
323 #endif
324  
325     // Local variable declarations.
326     PyObject *tmp_return_value = NULL;
327  
328     // Actual function body.
329     tmp_return_value = __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_maker();
330  
331     ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] = self->m_closure[0];
332     Py_INCREF(((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0]);
333  
334  
335     goto function_return_exit;
336  
337     // Return statement must have exited already.
338     NUITKA_CANNOT_GET_HERE(__main__$$$function_1_calledRepeatedly$$$function_1_empty);
339     return NULL;
340  
341  
342 function_return_exit:
343    // Function cleanup code if any.
344  
345  
346    // Actual function exit with return value, making sure we did not make
347    // the error status worse despite non-NULL return.
348    CHECK_OBJECT(tmp_return_value);
349    assert(had_error || !ERROR_OCCURRED());
350    return tmp_return_value;
351 }
352  
353  
354  
355 struct __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_locals {
356     char const *type_description_1;
357     PyObject *exception_type;
358     PyObject *exception_value;
359     PyTracebackObject *exception_tb;
360     int exception_lineno;
361 };
362  
363 static PyObject *__main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value ) {
364     CHECK_OBJECT((PyObject *)generator);
365     assert(Nuitka_Generator_Check( (PyObject *)generator ));
366  
367     // Heap access if used.
368     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;
369  
370     // Dispatch to yield based on return label index:
371     switch(generator->m_yield_return_index) {
372     case 1: goto yield_return_1;
373     }
374  
375     // Local variable initialization
376     static struct Nuitka_FrameObject *cache_m_frame = NULL;
377     generator_heap->type_description_1 = NULL;
378     generator_heap->exception_type = NULL;
379     generator_heap->exception_value = NULL;
380     generator_heap->exception_tb = NULL;
381     generator_heap->exception_lineno = 0;
382  
383     // Actual generator function body.
384     MAKE_OR_REUSE_FRAME(cache_m_frame, codeobj_71f48e42c3952265af1d0e2691ab347b, module___main__, sizeof(void *));
385     generator->m_frame = cache_m_frame;
386  
387     // Mark the frame object as in use, ref count 1 will be up for reuse.
388     Py_INCREF(generator->m_frame);
389     assert(Py_REFCNT(generator->m_frame) == 2); // Frame stack
390  
391 #if PYTHON_VERSION >= 340
392     generator->m_frame->m_frame.f_gen = (PyObject *)generator;
393 #endif
394  
395     Py_CLEAR(generator->m_frame->m_frame.f_back);
396  
397     generator->m_frame->m_frame.f_back = PyThreadState_GET()->frame;
398     Py_INCREF(generator->m_frame->m_frame.f_back);
399  
400     PyThreadState_GET()->frame = &generator->m_frame->m_frame;
401     Py_INCREF(generator->m_frame);
402  
403     Nuitka_Frame_MarkAsExecuting(generator->m_frame);
404  
405 #if PYTHON_VERSION >= 300
406     // Accept currently existing exception as the one to publish again when we
407     // yield or yield from.
408     {
409         PyThreadState *thread_state = PyThreadState_GET();
410  
411         EXC_TYPE_F(generator) = EXC_TYPE(thread_state);
412         if (EXC_TYPE_F(generator) == Py_None) EXC_TYPE_F(generator) = NULL;
413         Py_XINCREF(EXC_TYPE_F(generator));
414         EXC_VALUE_F(generator) = EXC_VALUE(thread_state);
415         Py_XINCREF(EXC_VALUE_F(generator));
416         EXC_TRACEBACK_F(generator) = EXC_TRACEBACK(thread_state);
417         Py_XINCREF(EXC_TRACEBACK_F(generator));
418     }
419  
420 #endif
421  
422     // Framed code:
423     {
424         PyObject *tmp_expression_name_1;
425         NUITKA_MAY_BE_UNUSED PyObject *tmp_yield_result_1;
426         if (PyCell_GET(generator->m_closure[0]) == NULL) {
427  
428             generator_heap->exception_type = PyExc_NameError;
429             Py_INCREF(generator_heap->exception_type);
430             generator_heap->exception_value = PyUnicode_FromFormat("free variable '%s' referenced before assignment in enclosing scope", "closure_var");
431             generator_heap->exception_tb = NULL;
432             NORMALIZE_EXCEPTION(&generator_heap->exception_type, &generator_heap->exception_value, &generator_heap->exception_tb);
433             CHAIN_EXCEPTION(generator_heap->exception_value);
434  
435             generator_heap->exception_lineno = 29;
436             generator_heap->type_description_1 = "c";
437             goto frame_exception_exit_1;
438         }
439  
440         tmp_expression_name_1 = PyCell_GET(generator->m_closure[0]);
441         Py_INCREF(tmp_expression_name_1);
442         generator->m_yield_return_index = 1;
443         return tmp_expression_name_1;
444         yield_return_1:
445         if (yield_return_value == NULL) {
446             assert(ERROR_OCCURRED());
447  
448             FETCH_ERROR_OCCURRED(&generator_heap->exception_type, &generator_heap->exception_value, &generator_heap->exception_tb);
449  
450  
451             generator_heap->exception_lineno = 29;
452             generator_heap->type_description_1 = "c";
453             goto frame_exception_exit_1;
454         }
455         tmp_yield_result_1 = yield_return_value;
456     }
457  
458     Nuitka_Frame_MarkAsNotExecuting(generator->m_frame);
459  
460 #if PYTHON_VERSION >= 300
461     Py_CLEAR(EXC_TYPE_F(generator));
462     Py_CLEAR(EXC_VALUE_F(generator));
463     Py_CLEAR(EXC_TRACEBACK_F(generator));
464 #endif
465  
466     // Allow re-use of the frame again.
467     Py_DECREF(generator->m_frame);
468     goto frame_no_exception_1;
469  
470     frame_exception_exit_1:;
471  
472     // If it's not an exit exception, consider and create a traceback for it.
473     if (!EXCEPTION_MATCH_GENERATOR(generator_heap->exception_type)) {
474         if (generator_heap->exception_tb == NULL) {
475             generator_heap->exception_tb = MAKE_TRACEBACK(generator->m_frame, generator_heap->exception_lineno);
476         } else if (generator_heap->exception_tb->tb_frame != &generator->m_frame->m_frame) {
477             generator_heap->exception_tb = ADD_TRACEBACK(generator_heap->exception_tb, generator->m_frame, generator_heap->exception_lineno);
478         }
479  
480         Nuitka_Frame_AttachLocals(
481             (struct Nuitka_FrameObject *)generator->m_frame,
482             generator_heap->type_description_1,
483             generator->m_closure[0]
484         );
485  
486  
487         // Release cached frame.
488         if (generator->m_frame == cache_m_frame) {
489             Py_DECREF(generator->m_frame);
490         }
491         cache_m_frame = NULL;
492  
493         assertFrameObject(generator->m_frame);
494     }
495  
496 #if PYTHON_VERSION >= 300
497     Py_CLEAR(EXC_TYPE_F(generator));
498     Py_CLEAR(EXC_VALUE_F(generator));
499     Py_CLEAR(EXC_TRACEBACK_F(generator));
500 #endif
501  
502     Py_DECREF(generator->m_frame);
503  
504     // Return the error.
505     goto function_exception_exit;
506  
507     frame_no_exception_1:;
508  
509  
510     return NULL;
511  
512     function_exception_exit:
513     assert(generator_heap->exception_type);
514     RESTORE_ERROR_OCCURRED(generator_heap->exception_type, generator_heap->exception_value, generator_heap->exception_tb);
515  
516     return NULL;
517  
518 }
519  
520 static PyObject *__main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_maker( void )
521 {
522     return Nuitka_Generator_New(
523         __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context,
524         module___main__,
525         const_str_plain_empty,
526 #if PYTHON_VERSION >= 350
527         const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd,
528 #endif
529         codeobj_71f48e42c3952265af1d0e2691ab347b,
530         1,
531         sizeof(struct __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_locals)
532     );
533 }
534  
535  
536 289
537 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly() { 290 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly() {
538     struct Nuitka_FunctionObject *result = Nuitka_Function_New( 291     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
539         impl___main__$$$function_1_calledRepeatedly, 292         impl___main__$$$function_1_calledRepeatedly,
540         const_str_plain_calledRepeatedly, 293         const_str_plain_calledRepeatedly,
548         NULL, 301         NULL,
549 #endif 302 #endif
550         module___main__, 303         module___main__,
551         NULL, 304         NULL,
552         0 305         0
t 553     ); t
554  
555     return (PyObject *)result;
556 }
557  
558  
559  
560 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty() {
561     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
562         impl___main__$$$function_1_calledRepeatedly$$$function_1_empty,
563         const_str_plain_empty,
564 #if PYTHON_VERSION >= 300
565         const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd,
566 #endif
567         codeobj_71f48e42c3952265af1d0e2691ab347b,
568         NULL,
569 #if PYTHON_VERSION >= 300
570         NULL,
571         NULL,
572 #endif
573         module___main__,
574         NULL,
575         1
576     ); 306     );
577 307
578     return (PyObject *)result; 308     return (PyObject *)result;
579 } 309 }
580 310