Construct FunctionCreationGeneratorClosure

Performance Diagrams

Construct FunctionCreationGeneratorClosure 0040000004000000800000080000001200000012000000160000001600000020000000200000002400000024000000280000002800000032000000320000003600000036000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)3838689688.95192307692307257.0CPython 2.712302540242.31730769230768424.9178661745565Nuitka (master)12101421395.6826923076923426.2125683833118Nuitka (develop)12101421549.0480769230769426.2125683833118Nuitka (factory)Construct FunctionCreationGeneratorClosureTicks Construct FunctionCreationGeneratorClosure 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)5069042388.95192307692307257.0CPython 3.514203466242.31730769230768434.8736076536588Nuitka (master)14151664395.6826923076923435.1261419667744Nuitka (develop)14152533549.0480769230769435.12190559910334Nuitka (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 31
32 PyObject *module___main__; 32 PyObject *module___main__;
33 PyDictObject *moduledict___main__; 33 PyDictObject *moduledict___main__;
34 34
35 /* The declarations of module constants used, if any. */ 35 /* The declarations of module constants used, if any. */
n n 36 extern PyObject *const_str_plain___file__;
37 static PyObject *const_str_plain_repeat;
38 static PyObject *const_tuple_none_int_pos_50000_tuple;
36 static PyObject *const_str_plain_itertools; 39 static PyObject *const_str_plain_itertools;
n 37 static PyObject *const_tuple_str_plain_closure_var_tuple; n
38 static PyObject *const_str_plain_module_var; 40 static PyObject *const_str_plain_calledRepeatedly;
41 static PyObject *const_str_digest_c8f6cdcf12cc7d8c97532a3904e4b446;
39 extern PyObject *const_str_plain___file__; 42 extern PyObject *const_str_plain___cached__;
40 static PyObject *const_str_plain_closure_var; 43 static PyObject *const_str_plain_closure_var;
41 extern PyObject *const_int_0; 44 extern PyObject *const_int_0;
n n 45 static PyObject *const_str_angle_module;
42 static PyObject *const_tuple_str_plain_closure_var_str_plain_empty_tuple; 46 static PyObject *const_tuple_str_plain_closure_var_str_plain_empty_tuple;
n n 47 static PyObject *const_str_plain_x;
48 static PyObject *const_int_pos_50000;
49 extern PyObject *const_str_plain_print;
50 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
51 extern PyObject *const_str_plain___doc__;
52 static PyObject *const_str_plain_module_var;
53 extern PyObject *const_tuple_empty;
43 static PyObject *const_str_plain_empty; 54 static PyObject *const_str_plain_empty;
n 44 static PyObject *const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd; n
45 extern PyObject *const_str_plain_print;
46 static PyObject *const_int_pos_50000;
47 static PyObject *const_str_plain_calledRepeatedly;
48 static PyObject *const_str_digest_c8f6cdcf12cc7d8c97532a3904e4b446;
49 static PyObject *const_str_angle_module;
50 static PyObject *const_str_plain_x;
51 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
52 extern PyObject *const_tuple_empty; 55 extern PyObject *const_int_pos_1;
53 static PyObject *const_str_plain_repeat;
54 static PyObject *const_tuple_none_int_pos_50000_tuple;
55 extern PyObject *const_str_plain___doc__;
56 extern PyObject *const_str_plain___cached__;
57 static PyObject *module_filename_obj; 56 static PyObject *module_filename_obj;
58 57
59 /* Indicator if this modules private constants were created yet. */ 58 /* Indicator if this modules private constants were created yet. */
60 static bool constants_created = false; 59 static bool constants_created = false;
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) {
n n 63     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 70 ], 6, 1);
64     const_tuple_none_int_pos_50000_tuple = PyTuple_New(2);
65     PyTuple_SET_ITEM(const_tuple_none_int_pos_50000_tuple, 0, Py_None); Py_INCREF(Py_None);
66     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul);
67     PyTuple_SET_ITEM(const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000); Py_INCREF(const_int_pos_50000);
64     const_str_plain_itertools = UNSTREAM_STRING_ASCII(&constant_bin[ 70 ], 9, 1); 68     const_str_plain_itertools = UNSTREAM_STRING_ASCII(&constant_bin[ 76 ], 9, 1);
65     const_tuple_str_plain_closure_var_tuple = PyTuple_New(1); 69     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII(&constant_bin[ 38 ], 16, 1);
70     const_str_digest_c8f6cdcf12cc7d8c97532a3904e4b446 = UNSTREAM_STRING_ASCII(&constant_bin[ 85 ], 57, 0);
66     const_str_plain_closure_var = UNSTREAM_STRING_ASCII(&constant_bin[ 79 ], 11, 1); 71     const_str_plain_closure_var = UNSTREAM_STRING_ASCII(&constant_bin[ 142 ], 11, 1);
67     PyTuple_SET_ITEM(const_tuple_str_plain_closure_var_tuple, 0, const_str_plain_closure_var); Py_INCREF(const_str_plain_closure_var);
68     const_str_plain_module_var = UNSTREAM_STRING_ASCII(&constant_bin[ 6 ], 10, 1); 72     const_str_angle_module = UNSTREAM_STRING_ASCII(&constant_bin[ 153 ], 8, 0);
69     const_tuple_str_plain_closure_var_str_plain_empty_tuple = PyTuple_New(2); 73     const_tuple_str_plain_closure_var_str_plain_empty_tuple = PyTuple_New(2);
70     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); 74     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);
n 71     const_str_plain_empty = UNSTREAM_STRING_ASCII(&constant_bin[ 90 ], 5, 1); n 75     const_str_plain_empty = UNSTREAM_STRING_ASCII(&constant_bin[ 161 ], 5, 1);
72     PyTuple_SET_ITEM(const_tuple_str_plain_closure_var_str_plain_empty_tuple, 1, const_str_plain_empty); Py_INCREF(const_str_plain_empty); 76     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 73     const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd = UNSTREAM_STRING_ASCII(&constant_bin[ 95 ], 31, 0); n
74     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul);
75     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII(&constant_bin[ 38 ], 16, 1);
76     const_str_digest_c8f6cdcf12cc7d8c97532a3904e4b446 = UNSTREAM_STRING_ASCII(&constant_bin[ 126 ], 57, 0);
77     const_str_angle_module = UNSTREAM_STRING_ASCII(&constant_bin[ 183 ], 8, 0);
78     const_str_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 191 ], 1, 1); 77     const_str_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 166 ], 1, 1);
79     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII(&constant_bin[ 192 ], 3, 0); 78     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII(&constant_bin[ 167 ], 3, 0);
80     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 195 ], 6, 1); 79     const_str_plain_module_var = UNSTREAM_STRING_ASCII(&constant_bin[ 6 ], 10, 1);
81     const_tuple_none_int_pos_50000_tuple = PyTuple_New(2);
82     PyTuple_SET_ITEM(const_tuple_none_int_pos_50000_tuple, 0, Py_None); Py_INCREF(Py_None);
83     PyTuple_SET_ITEM(const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000); Py_INCREF(const_int_pos_50000);
84 80
85     constants_created = true; 81     constants_created = true;
86 } 82 }
87 83
88 /* Function to verify module private constants for non-corruption. */ 84 /* Function to verify module private constants for non-corruption. */
96 #endif 92 #endif
97 93
98 // The module code objects. 94 // The module code objects.
99 static PyCodeObject *codeobj_460eba4d69ccb1d46b14999cd1656757; 95 static PyCodeObject *codeobj_460eba4d69ccb1d46b14999cd1656757;
100 static PyCodeObject *codeobj_aa5fff3151184f144e2e6652e3b640b3; 96 static PyCodeObject *codeobj_aa5fff3151184f144e2e6652e3b640b3;
n 101 static PyCodeObject *codeobj_6b101e195cf90c9b6815aa59f6b85477; n
102 /* For use in "MainProgram.c". */ 97 /* For use in "MainProgram.c". */
103 PyCodeObject *codeobj_main = NULL; 98 PyCodeObject *codeobj_main = NULL;
104 99
105 static void createModuleCodeObjects(void) { 100 static void createModuleCodeObjects(void) {
106     module_filename_obj = const_str_digest_c8f6cdcf12cc7d8c97532a3904e4b446; 101     module_filename_obj = const_str_digest_c8f6cdcf12cc7d8c97532a3904e4b446;
107     codeobj_460eba4d69ccb1d46b14999cd1656757 = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, const_str_angle_module, const_tuple_empty, 0, 0, 0); 102     codeobj_460eba4d69ccb1d46b14999cd1656757 = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, const_str_angle_module, const_tuple_empty, 0, 0, 0);
108     codeobj_aa5fff3151184f144e2e6652e3b640b3 = MAKE_CODEOBJECT(module_filename_obj, 23, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, const_str_plain_calledRepeatedly, const_tuple_str_plain_closure_var_str_plain_empty_tuple, 0, 0, 0); 103     codeobj_aa5fff3151184f144e2e6652e3b640b3 = MAKE_CODEOBJECT(module_filename_obj, 23, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, const_str_plain_calledRepeatedly, const_tuple_str_plain_closure_var_str_plain_empty_tuple, 0, 0, 0);
n 109     codeobj_6b101e195cf90c9b6815aa59f6b85477 = MAKE_CODEOBJECT(module_filename_obj, 28, CO_GENERATOR | CO_OPTIMIZED | CO_NEWLOCALS, const_str_plain_empty, const_tuple_str_plain_closure_var_tuple, 0, 0, 0); n
110 } 104 }
111 105
112 // The module function declarations. 106 // The module function declarations.
n 113 static PyObject *MAKE_GENERATOR___main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty(struct Nuitka_CellObject **closure); n
114  
115  
116 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(); 107 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly();
n 117   n
118  
119 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty(struct Nuitka_CellObject **closure);
120 108
121 109
122 // The module function definitions. 110 // The module function definitions.
123 static PyObject *impl___main__$$$function_1_calledRepeatedly(struct Nuitka_FunctionObject const *self, PyObject **python_pars) { 111 static PyObject *impl___main__$$$function_1_calledRepeatedly(struct Nuitka_FunctionObject const *self, PyObject **python_pars) {
124     // Preserve error status for checks 112     // Preserve error status for checks
125 #ifndef __NUITKA_NO_ASSERT__ 113 #ifndef __NUITKA_NO_ASSERT__
126     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED(); 114     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
127 #endif 115 #endif
128 116
129     // Local variable declarations. 117     // Local variable declarations.
n 130     struct Nuitka_CellObject *var_closure_var = Nuitka_Cell_Empty(); n
131     PyObject *var_empty = NULL; 118     PyObject *var_closure_var = NULL;
132     struct Nuitka_FrameObject *frame_aa5fff3151184f144e2e6652e3b640b3; 119     struct Nuitka_FrameObject *frame_aa5fff3151184f144e2e6652e3b640b3;
133     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 120     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
134     PyObject *exception_type = NULL; 121     PyObject *exception_type = NULL;
135     PyObject *exception_value = NULL; 122     PyObject *exception_value = NULL;
136     PyTracebackObject *exception_tb = NULL; 123     PyTracebackObject *exception_tb = NULL;
188             exception_tb = NULL; 175             exception_tb = NULL;
189             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb); 176             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
190             CHAIN_EXCEPTION(exception_value); 177             CHAIN_EXCEPTION(exception_value);
191 178
192             exception_lineno = 25; 179             exception_lineno = 25;
n 193             type_description_1 = "co"; n 180             type_description_1 = "oN";
194             goto frame_exception_exit_1; 181             goto frame_exception_exit_1;
195         } 182         }
196 183
197         tmp_assign_source_1 = tmp_mvar_value_1; 184         tmp_assign_source_1 = tmp_mvar_value_1;
n 198         assert(PyCell_GET(var_closure_var) == NULL); n 185         assert(var_closure_var == NULL);
199         Py_INCREF(tmp_assign_source_1); 186         Py_INCREF(tmp_assign_source_1);
n 200         PyCell_SET(var_closure_var, tmp_assign_source_1); n 187         var_closure_var = tmp_assign_source_1;
201  
202     } 188     }
203 189
204 #if 0 190 #if 0
205     RESTORE_FRAME_EXCEPTION(frame_aa5fff3151184f144e2e6652e3b640b3); 191     RESTORE_FRAME_EXCEPTION(frame_aa5fff3151184f144e2e6652e3b640b3);
206 #endif 192 #endif
225     // Attachs locals to frame if any. 211     // Attachs locals to frame if any.
226     Nuitka_Frame_AttachLocals( 212     Nuitka_Frame_AttachLocals(
227         frame_aa5fff3151184f144e2e6652e3b640b3, 213         frame_aa5fff3151184f144e2e6652e3b640b3,
228         type_description_1, 214         type_description_1,
229         var_closure_var, 215         var_closure_var,
n 230         var_empty n 216         NULL
231     ); 217     );
232 218
233 219
234     // Release cached frame. 220     // Release cached frame.
235     if (frame_aa5fff3151184f144e2e6652e3b640b3 == cache_frame_aa5fff3151184f144e2e6652e3b640b3) { 221     if (frame_aa5fff3151184f144e2e6652e3b640b3 == cache_frame_aa5fff3151184f144e2e6652e3b640b3) {
250     // Return the error. 236     // Return the error.
251     goto try_except_handler_1; 237     goto try_except_handler_1;
252 238
253     frame_no_exception_1:; 239     frame_no_exception_1:;
254     { 240     {
n 255         PyObject *tmp_assign_source_2; n
256         struct Nuitka_CellObject *tmp_closure_1[1];
257  
258         tmp_closure_1[0] = var_closure_var;
259         Py_INCREF(tmp_closure_1[0]);
260  
261         tmp_assign_source_2 = MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty(tmp_closure_1);
262  
263         assert(var_empty == NULL);
264         var_empty = tmp_assign_source_2;
265     }
266     {
267         PyObject *tmp_tuple_element_1; 241         PyObject *tmp_tuple_element_1;
n 268         CHECK_OBJECT(var_empty); n
269         tmp_tuple_element_1 = var_empty; 242         tmp_tuple_element_1 = const_int_pos_1;
270         tmp_return_value = PyTuple_New(2); 243         tmp_return_value = PyTuple_New(2);
271         Py_INCREF(tmp_tuple_element_1); 244         Py_INCREF(tmp_tuple_element_1);
272         PyTuple_SET_ITEM(tmp_return_value, 0, tmp_tuple_element_1); 245         PyTuple_SET_ITEM(tmp_return_value, 0, tmp_tuple_element_1);
n 273         CHECK_OBJECT(PyCell_GET(var_closure_var)); n 246         CHECK_OBJECT(var_closure_var);
274         tmp_tuple_element_1 = PyCell_GET(var_closure_var); 247         tmp_tuple_element_1 = var_closure_var;
275         Py_INCREF(tmp_tuple_element_1); 248         Py_INCREF(tmp_tuple_element_1);
276         PyTuple_SET_ITEM(tmp_return_value, 1, tmp_tuple_element_1); 249         PyTuple_SET_ITEM(tmp_return_value, 1, tmp_tuple_element_1);
277         goto try_return_handler_1; 250         goto try_return_handler_1;
278     } 251     }
279     NUITKA_CANNOT_GET_HERE("tried codes exits in all cases"); 252     NUITKA_CANNOT_GET_HERE("tried codes exits in all cases");
281     // Return handler code: 254     // Return handler code:
282     try_return_handler_1:; 255     try_return_handler_1:;
283     CHECK_OBJECT(var_closure_var); 256     CHECK_OBJECT(var_closure_var);
284     Py_DECREF(var_closure_var); 257     Py_DECREF(var_closure_var);
285     var_closure_var = NULL; 258     var_closure_var = NULL;
n 286   n
287     CHECK_OBJECT(var_empty);
288     Py_DECREF(var_empty);
289     var_empty = NULL;
290 259
291     goto function_return_exit; 260     goto function_return_exit;
292     // Exception handler code: 261     // Exception handler code:
293     try_except_handler_1:; 262     try_except_handler_1:;
294     exception_keeper_type_1 = exception_type; 263     exception_keeper_type_1 = exception_type;
328    assert(had_error || !ERROR_OCCURRED()); 297    assert(had_error || !ERROR_OCCURRED());
329    return tmp_return_value; 298    return tmp_return_value;
330 } 299 }
331 300
332 301
n 333 static PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_empty(struct Nuitka_FunctionObject const *self, PyObject **python_pars) { n
334     // Preserve error status for checks
335 #ifndef __NUITKA_NO_ASSERT__
336     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
337 #endif
338  
339     // Local variable declarations.
340     PyObject *tmp_return_value = NULL;
341  
342     // Actual function body.
343     {
344         struct Nuitka_CellObject *tmp_closure_1[1];
345  
346         tmp_closure_1[0] = self->m_closure[0];
347         Py_INCREF(tmp_closure_1[0]);
348  
349         tmp_return_value = MAKE_GENERATOR___main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty(tmp_closure_1);
350  
351         goto function_return_exit;
352     }
353  
354     NUITKA_CANNOT_GET_HERE("Return statement must have exited already.");
355     return NULL;
356  
357  
358 function_return_exit:
359    // Function cleanup code if any.
360  
361  
362    // Actual function exit with return value, making sure we did not make
363    // the error status worse despite non-NULL return.
364    CHECK_OBJECT(tmp_return_value);
365    assert(had_error || !ERROR_OCCURRED());
366    return tmp_return_value;
367 }
368  
369  
370  
371 struct __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_locals {
372     char const *type_description_1;
373     PyObject *exception_type;
374     PyObject *exception_value;
375     PyTracebackObject *exception_tb;
376     int exception_lineno;
377 };
378  
379 static PyObject *__main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context(struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value) {
380     CHECK_OBJECT(generator);
381     assert(Nuitka_Generator_Check((PyObject *)generator));
382     CHECK_OBJECT_X(yield_return_value);
383  
384     // Heap access if used.
385     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;
386  
387     // Dispatch to yield based on return label index:
388     switch(generator->m_yield_return_index) {
389     case 1: goto yield_return_1;
390     }
391  
392     // Local variable initialization
393     NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused;
394     static struct Nuitka_FrameObject *cache_m_frame = NULL;
395     generator_heap->type_description_1 = NULL;
396     generator_heap->exception_type = NULL;
397     generator_heap->exception_value = NULL;
398     generator_heap->exception_tb = NULL;
399     generator_heap->exception_lineno = 0;
400  
401     // Actual generator function body.
402     if (isFrameUnusable(cache_m_frame)) {
403         Py_XDECREF(cache_m_frame);
404  
405 #if _DEBUG_REFCOUNTS
406         if (cache_m_frame == NULL) {
407             count_active_frame_cache_instances += 1;
408         } else {
409             count_released_frame_cache_instances += 1;
410         }
411         count_allocated_frame_cache_instances += 1;
412 #endif
413         cache_m_frame = MAKE_FUNCTION_FRAME(codeobj_6b101e195cf90c9b6815aa59f6b85477, module___main__, sizeof(void *));
414 #if _DEBUG_REFCOUNTS
415     } else {
416         count_hit_frame_cache_instances += 1;
417 #endif
418     }
419     generator->m_frame = cache_m_frame;
420  
421     // Mark the frame object as in use, ref count 1 will be up for reuse.
422     Py_INCREF(generator->m_frame);
423     assert(Py_REFCNT(generator->m_frame) == 2); // Frame stack
424  
425 #if PYTHON_VERSION >= 340
426     generator->m_frame->m_frame.f_gen = (PyObject *)generator;
427 #endif
428  
429     assert(generator->m_frame->m_frame.f_back == NULL);
430     Py_CLEAR(generator->m_frame->m_frame.f_back);
431  
432     generator->m_frame->m_frame.f_back = PyThreadState_GET()->frame;
433     Py_INCREF(generator->m_frame->m_frame.f_back);
434  
435     PyThreadState_GET()->frame = &generator->m_frame->m_frame;
436     Py_INCREF(generator->m_frame);
437  
438     Nuitka_Frame_MarkAsExecuting(generator->m_frame);
439  
440 #if PYTHON_VERSION >= 300
441     // Accept currently existing exception as the one to publish again when we
442     // yield or yield from.
443     {
444         PyThreadState *thread_state = PyThreadState_GET();
445  
446         EXC_TYPE_F(generator) = EXC_TYPE(thread_state);
447         if (EXC_TYPE_F(generator) == Py_None) EXC_TYPE_F(generator) = NULL;
448         Py_XINCREF(EXC_TYPE_F(generator));
449         EXC_VALUE_F(generator) = EXC_VALUE(thread_state);
450         Py_XINCREF(EXC_VALUE_F(generator));
451         EXC_TRACEBACK_F(generator) = EXC_TRACEBACK(thread_state);
452         Py_XINCREF(EXC_TRACEBACK_F(generator));
453     }
454  
455 #endif
456  
457     // Framed code:
458     {
459         PyObject *tmp_expression_name_1;
460         NUITKA_MAY_BE_UNUSED PyObject *tmp_yield_result_1;
461         if (PyCell_GET(generator->m_closure[0]) == NULL) {
462  
463             generator_heap->exception_type = PyExc_NameError;
464             Py_INCREF(generator_heap->exception_type);
465             generator_heap->exception_value = PyUnicode_FromFormat("free variable '%s' referenced before assignment in enclosing scope", "closure_var");
466             generator_heap->exception_tb = NULL;
467             NORMALIZE_EXCEPTION(&generator_heap->exception_type, &generator_heap->exception_value, &generator_heap->exception_tb);
468             CHAIN_EXCEPTION(generator_heap->exception_value);
469  
470             generator_heap->exception_lineno = 29;
471             generator_heap->type_description_1 = "c";
472             goto frame_exception_exit_1;
473         }
474  
475         tmp_expression_name_1 = PyCell_GET(generator->m_closure[0]);
476         Py_INCREF(tmp_expression_name_1);
477         generator->m_yield_return_index = 1;
478         return tmp_expression_name_1;
479         yield_return_1:
480         if (yield_return_value == NULL) {
481             assert(ERROR_OCCURRED());
482  
483             FETCH_ERROR_OCCURRED(&generator_heap->exception_type, &generator_heap->exception_value, &generator_heap->exception_tb);
484  
485  
486             generator_heap->exception_lineno = 29;
487             generator_heap->type_description_1 = "c";
488             goto frame_exception_exit_1;
489         }
490         tmp_yield_result_1 = yield_return_value;
491     }
492  
493     Nuitka_Frame_MarkAsNotExecuting(generator->m_frame);
494  
495 #if PYTHON_VERSION >= 300
496     Py_CLEAR(EXC_TYPE_F(generator));
497     Py_CLEAR(EXC_VALUE_F(generator));
498     Py_CLEAR(EXC_TRACEBACK_F(generator));
499 #endif
500  
501     // Allow re-use of the frame again.
502     Py_DECREF(generator->m_frame);
503     goto frame_no_exception_1;
504  
505     frame_exception_exit_1:;
506  
507     // If it's not an exit exception, consider and create a traceback for it.
508     if (!EXCEPTION_MATCH_GENERATOR(generator_heap->exception_type)) {
509         if (generator_heap->exception_tb == NULL) {
510             generator_heap->exception_tb = MAKE_TRACEBACK(generator->m_frame, generator_heap->exception_lineno);
511         } else if (generator_heap->exception_tb->tb_frame != &generator->m_frame->m_frame) {
512             generator_heap->exception_tb = ADD_TRACEBACK(generator_heap->exception_tb, generator->m_frame, generator_heap->exception_lineno);
513         }
514  
515         Nuitka_Frame_AttachLocals(
516             generator->m_frame,
517             generator_heap->type_description_1,
518             generator->m_closure[0]
519         );
520  
521  
522         // Release cached frame.
523         if (generator->m_frame == cache_m_frame) {
524 #if _DEBUG_REFCOUNTS
525             count_active_frame_cache_instances -= 1;
526             count_released_frame_cache_instances += 1;
527 #endif
528  
529             Py_DECREF(generator->m_frame);
530         }
531         cache_m_frame = NULL;
532  
533         assertFrameObject(generator->m_frame);
534     }
535  
536 #if PYTHON_VERSION >= 300
537     Py_CLEAR(EXC_TYPE_F(generator));
538     Py_CLEAR(EXC_VALUE_F(generator));
539     Py_CLEAR(EXC_TRACEBACK_F(generator));
540 #endif
541  
542     Py_DECREF(generator->m_frame);
543  
544     // Return the error.
545     goto function_exception_exit;
546  
547     frame_no_exception_1:;
548  
549  
550     return NULL;
551  
552     function_exception_exit:
553     assert(generator_heap->exception_type);
554     RESTORE_ERROR_OCCURRED(generator_heap->exception_type, generator_heap->exception_value, generator_heap->exception_tb);
555  
556     return NULL;
557  
558 }
559  
560 static PyObject *MAKE_GENERATOR___main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty(struct Nuitka_CellObject **closure) {
561     return Nuitka_Generator_New(
562         __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context,
563         module___main__,
564         const_str_plain_empty,
565 #if PYTHON_VERSION >= 350
566         const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd,
567 #endif
568         codeobj_6b101e195cf90c9b6815aa59f6b85477,
569         closure,
570         1,
571         sizeof(struct __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_locals)
572     );
573 }
574  
575  
576 302
577 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly() { 303 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly() {
578     struct Nuitka_FunctionObject *result = Nuitka_Function_New( 304     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
579         impl___main__$$$function_1_calledRepeatedly, 305         impl___main__$$$function_1_calledRepeatedly,
580         const_str_plain_calledRepeatedly, 306         const_str_plain_calledRepeatedly,
595 321
596     return (PyObject *)result; 322     return (PyObject *)result;
597 } 323 }
598 324
599 325
n 600   n
601 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty(struct Nuitka_CellObject **closure) {
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 >= 300
606         const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd,
607 #endif
608         codeobj_6b101e195cf90c9b6815aa59f6b85477,
609         NULL,
610 #if PYTHON_VERSION >= 300
611         NULL,
612         NULL,
613 #endif
614         module___main__,
615         NULL,
616         closure,
617         1
618     );
619  
620     return (PyObject *)result;
621 }
622  
623  
624 extern PyObject *const_str_plain___compiled__; 326 extern PyObject *const_str_plain___compiled__;
625 327
626 extern PyObject *const_str_plain___package__; 328 extern PyObject *const_str_plain___package__;
627 extern PyObject *const_str_empty; 329 extern PyObject *const_str_empty;
628 330
648 #ifdef _NUITKA_PLUGIN_DILL_ENABLED 350 #ifdef _NUITKA_PLUGIN_DILL_ENABLED
649 // Provide a way to create find a function via its C code and create it back 351 // Provide a way to create find a function via its C code and create it back
650 // in another process, useful for multiprocessing extensions like dill 352 // in another process, useful for multiprocessing extensions like dill
651 353
652 function_impl_code functable___main__[] = { 354 function_impl_code functable___main__[] = {
t 653     impl___main__$$$function_1_calledRepeatedly$$$function_1_empty, t
654     impl___main__$$$function_1_calledRepeatedly, 355     impl___main__$$$function_1_calledRepeatedly,
655     NULL 356     NULL
656 }; 357 };
657 358
658 static char const *_reduce_compiled_function_argnames[] = { 359 static char const *_reduce_compiled_function_argnames[] = {