Construct FunctionCreationGeneratorClosure

Performance Diagrams

Construct FunctionCreationGeneratorClosure 001000000010000000200000002000000030000000300000004000000040000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)4496878088.95192307692307257.0CPython 2.712602794242.31730769230768434.8596857385536Nuitka (master)12603647395.6826923076923434.8549982770953Nuitka (develop)12603087549.0480769230769434.8580756257667Nuitka (factory)Construct FunctionCreationGeneratorClosureTicks Construct FunctionCreationGeneratorClosure 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)5639617188.95192307692307257.0CPython 3.515851723242.31730769230768434.65668632961734Nuitka (master)15845562395.6826923076923434.68368245112026Nuitka (develop)15854097549.0480769230769434.64628399356025Nuitka (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
32 32
33 /* The module constants used, if any. */ 33 /* The module constants used, if any. */
34 static PyObject *const_str_plain_itertools; 34 static PyObject *const_str_plain_itertools;
35 static PyObject *const_str_plain___package__; 35 static PyObject *const_str_plain___package__;
36 static PyObject *const_str_plain___spec__; 36 static PyObject *const_str_plain___spec__;
n 37 static PyObject *const_tuple_str_plain_closure_var_tuple; n
38 static PyObject *const_str_plain_module_var; 37 static PyObject *const_str_plain_module_var;
n n 38 extern PyObject *const_int_pos_1;
39 extern PyObject *const_dict_empty; 39 extern PyObject *const_dict_empty;
40 extern PyObject *const_str_plain___file__; 40 extern PyObject *const_str_plain___file__;
41 static PyObject *const_str_plain_closure_var; 41 static PyObject *const_str_plain_closure_var;
42 extern PyObject *const_int_0; 42 extern PyObject *const_int_0;
43 static PyObject *const_tuple_str_plain_closure_var_str_plain_empty_tuple; 43 static PyObject *const_tuple_str_plain_closure_var_str_plain_empty_tuple;
44 static PyObject *const_str_plain_empty; 44 static PyObject *const_str_plain_empty;
45 extern PyObject *const_str_plain_print; 45 extern PyObject *const_str_plain_print;
n 46 static PyObject *const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd; n
47 static PyObject *const_int_pos_50000; 46 static PyObject *const_int_pos_50000;
48 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 47 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
49 static PyObject *const_str_plain_calledRepeatedly; 48 static PyObject *const_str_plain_calledRepeatedly;
50 static PyObject *const_str_angle_module; 49 static PyObject *const_str_angle_module;
51 static PyObject *const_str_plain_x; 50 static PyObject *const_str_plain_x;
65 static void createModuleConstants( void ) 64 static void createModuleConstants( void )
66 { 65 {
67     const_str_plain_itertools = UNSTREAM_STRING( &constant_bin[ 0 ], 9, 1 ); 66     const_str_plain_itertools = UNSTREAM_STRING( &constant_bin[ 0 ], 9, 1 );
68     const_str_plain___package__ = UNSTREAM_STRING( &constant_bin[ 9 ], 11, 1 ); 67     const_str_plain___package__ = UNSTREAM_STRING( &constant_bin[ 9 ], 11, 1 );
69     const_str_plain___spec__ = UNSTREAM_STRING( &constant_bin[ 20 ], 8, 1 ); 68     const_str_plain___spec__ = UNSTREAM_STRING( &constant_bin[ 20 ], 8, 1 );
n 70     const_tuple_str_plain_closure_var_tuple = PyTuple_New( 1 ); n 69     const_str_plain_module_var = UNSTREAM_STRING( &constant_bin[ 28 ], 10, 1 );
71     const_str_plain_closure_var = UNSTREAM_STRING( &constant_bin[ 28 ], 11, 1 ); 70     const_str_plain_closure_var = UNSTREAM_STRING( &constant_bin[ 38 ], 11, 1 );
72     PyTuple_SET_ITEM( const_tuple_str_plain_closure_var_tuple, 0, const_str_plain_closure_var ); Py_INCREF( const_str_plain_closure_var );
73     const_str_plain_module_var = UNSTREAM_STRING( &constant_bin[ 39 ], 10, 1 );
74     const_tuple_str_plain_closure_var_str_plain_empty_tuple = PyTuple_New( 2 ); 71     const_tuple_str_plain_closure_var_str_plain_empty_tuple = PyTuple_New( 2 );
75     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     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 );
76     const_str_plain_empty = UNSTREAM_STRING( &constant_bin[ 49 ], 5, 1 ); 73     const_str_plain_empty = UNSTREAM_STRING( &constant_bin[ 49 ], 5, 1 );
77     PyTuple_SET_ITEM( const_tuple_str_plain_closure_var_str_plain_empty_tuple, 1, const_str_plain_empty ); Py_INCREF( const_str_plain_empty ); 74     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 78     const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd = UNSTREAM_STRING( &constant_bin[ 54 ], 31, 0 ); n
79     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 75     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
80     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 76     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
n 81     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 85 ], 3, 0 ); n 77     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 54 ], 3, 0 );
82     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 78     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
n 83     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 54 ], 16, 1 ); n 79     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 57 ], 16, 1 );
84     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 88 ], 8, 0 ); 80     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 73 ], 8, 0 );
85     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 96 ], 1, 1 ); 81     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 81 ], 1, 1 );
86     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 97 ], 6, 1 ); 82     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 82 ], 6, 1 );
87     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 83     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
88     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 84     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
89     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 85     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
n 90     const_str_digest_94198e2553078673970df2e68630a491 = UNSTREAM_STRING( &constant_bin[ 103 ], 90, 0 ); n 86     const_str_digest_94198e2553078673970df2e68630a491 = UNSTREAM_STRING( &constant_bin[ 88 ], 90, 0 );
91 87
92     constants_created = true; 88     constants_created = true;
93 } 89 }
94 90
95 #ifndef __NUITKA_NO_ASSERT__ 91 #ifndef __NUITKA_NO_ASSERT__
103 #endif 99 #endif
104 100
105 // The module code objects. 101 // The module code objects.
106 static PyCodeObject *codeobj_9a0a2cddaaf626d6a46d57519f97bf88; 102 static PyCodeObject *codeobj_9a0a2cddaaf626d6a46d57519f97bf88;
107 static PyCodeObject *codeobj_759a62b3e656894f34f5066be45d91b7; 103 static PyCodeObject *codeobj_759a62b3e656894f34f5066be45d91b7;
n 108 static PyCodeObject *codeobj_f51b39281ddd19db73f2c36174000047; n
109 /* For use in "MainProgram.c". */ 104 /* For use in "MainProgram.c". */
110 PyCodeObject *codeobj_main = NULL; 105 PyCodeObject *codeobj_main = NULL;
111 106
112 static void createModuleCodeObjects(void) 107 static void createModuleCodeObjects(void)
113 { 108 {
114     module_filename_obj = const_str_digest_94198e2553078673970df2e68630a491; 109     module_filename_obj = const_str_digest_94198e2553078673970df2e68630a491;
115     codeobj_9a0a2cddaaf626d6a46d57519f97bf88 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE ); 110     codeobj_9a0a2cddaaf626d6a46d57519f97bf88 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE );
116     codeobj_main = codeobj_9a0a2cddaaf626d6a46d57519f97bf88; 111     codeobj_main = codeobj_9a0a2cddaaf626d6a46d57519f97bf88;
117     codeobj_759a62b3e656894f34f5066be45d91b7 = 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 ); 112     codeobj_759a62b3e656894f34f5066be45d91b7 = 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 118     codeobj_f51b39281ddd19db73f2c36174000047 = 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
119 } 113 }
120 114
121 // The module function declarations. 115 // The module function declarations.
n 122 #if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO n
123 static PyObject *__main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value );
124 #else
125 static void __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context( struct Nuitka_GeneratorObject *generator );
126 #endif
127  
128  
129 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ); 116 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  );
n 130   n
131  
132 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty( struct Nuitka_CellObject *closure_closure_var );
133 117
134 118
135 // The module function definitions. 119 // The module function definitions.
136 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) 120 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
137 { 121 {
139 #ifndef __NUITKA_NO_ASSERT__ 123 #ifndef __NUITKA_NO_ASSERT__
140     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED(); 124     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
141 #endif 125 #endif
142 126
143     // Local variable declarations. 127     // Local variable declarations.
n 144     struct Nuitka_CellObject *var_closure_var = PyCell_EMPTY(); n
145     PyObject *var_empty = NULL; 128     PyObject *var_closure_var = NULL;
146     PyObject *exception_type = NULL; 129     PyObject *exception_type = NULL;
147     PyObject *exception_value = NULL; 130     PyObject *exception_value = NULL;
148     PyTracebackObject *exception_tb = NULL; 131     PyTracebackObject *exception_tb = NULL;
149     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 132     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
150     PyObject *exception_keeper_type_1; 133     PyObject *exception_keeper_type_1;
151     PyObject *exception_keeper_value_1; 134     PyObject *exception_keeper_value_1;
152     PyTracebackObject *exception_keeper_tb_1; 135     PyTracebackObject *exception_keeper_tb_1;
153     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 136     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
154     PyObject *tmp_assign_source_1; 137     PyObject *tmp_assign_source_1;
n 155     PyObject *tmp_assign_source_2; n
156     PyObject *tmp_return_value; 138     PyObject *tmp_return_value;
157     PyObject *tmp_tuple_element_1; 139     PyObject *tmp_tuple_element_1;
158     static struct Nuitka_FrameObject *cache_frame_759a62b3e656894f34f5066be45d91b7 = NULL; 140     static struct Nuitka_FrameObject *cache_frame_759a62b3e656894f34f5066be45d91b7 = NULL;
159 141
160     struct Nuitka_FrameObject *frame_759a62b3e656894f34f5066be45d91b7; 142     struct Nuitka_FrameObject *frame_759a62b3e656894f34f5066be45d91b7;
162     char const *type_description; 144     char const *type_description;
163     tmp_return_value = NULL; 145     tmp_return_value = NULL;
164 146
165     // Actual function code. 147     // Actual function code.
166     // Tried code: 148     // Tried code:
n 167     MAKE_OR_REUSE_FRAME( cache_frame_759a62b3e656894f34f5066be45d91b7, codeobj_759a62b3e656894f34f5066be45d91b7, module___main__, sizeof(struct Nuitka_CellObject *)+sizeof(PyObject *) ); n 149     MAKE_OR_REUSE_FRAME( cache_frame_759a62b3e656894f34f5066be45d91b7, codeobj_759a62b3e656894f34f5066be45d91b7, module___main__, sizeof(void *)+sizeof(PyObject *) );
168     frame_759a62b3e656894f34f5066be45d91b7 = cache_frame_759a62b3e656894f34f5066be45d91b7; 150     frame_759a62b3e656894f34f5066be45d91b7 = cache_frame_759a62b3e656894f34f5066be45d91b7;
169 151
170     // Push the new frame as the currently active one. 152     // Push the new frame as the currently active one.
171     pushFrameStack( frame_759a62b3e656894f34f5066be45d91b7 ); 153     pushFrameStack( frame_759a62b3e656894f34f5066be45d91b7 );
172 154
190         exception_tb = NULL; 172         exception_tb = NULL;
191         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 173         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
192         CHAIN_EXCEPTION( exception_value ); 174         CHAIN_EXCEPTION( exception_value );
193 175
194         exception_lineno = 25; 176         exception_lineno = 25;
n 195         type_description = "co"; n 177         type_description = "oN";
196         goto frame_exception_exit_1; 178         goto frame_exception_exit_1;
197     } 179     }
198 180
n 199     { n 181     assert( var_closure_var == NULL );
200         PyObject *old = PyCell_GET( var_closure_var );
201         PyCell_SET( var_closure_var, tmp_assign_source_1 );
202         Py_INCREF( tmp_assign_source_1 ); 182     Py_INCREF( tmp_assign_source_1 );
203         Py_XDECREF( old ); 183     var_closure_var = tmp_assign_source_1;
184  
185  
186 #if 0
187     RESTORE_FRAME_EXCEPTION( frame_759a62b3e656894f34f5066be45d91b7 );
188 #endif
189  
190     // Put the previous frame back on top.
191     popFrameStack();
192  
193     goto frame_no_exception_1;
194  
195     frame_exception_exit_1:;
196  
197 #if 0
198     RESTORE_FRAME_EXCEPTION( frame_759a62b3e656894f34f5066be45d91b7 );
199 #endif
200  
201     if ( exception_tb == NULL )
204     } 202     {
203         exception_tb = MAKE_TRACEBACK( frame_759a62b3e656894f34f5066be45d91b7, exception_lineno );
204     }
205     else if ( exception_tb->tb_frame != &frame_759a62b3e656894f34f5066be45d91b7->m_frame )
206     {
207         exception_tb = ADD_TRACEBACK( exception_tb, frame_759a62b3e656894f34f5066be45d91b7, exception_lineno );
208     }
205 209
n 206     tmp_assign_source_2 = MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty( var_closure_var ); n 210     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_759a62b3e656894f34f5066be45d91b7, type_description ,var_closure_var, NULL );
207     assert( var_empty == NULL ); 211  
208     var_empty = tmp_assign_source_2; 212     // Release cached frame.
213     if ( frame_759a62b3e656894f34f5066be45d91b7 == cache_frame_759a62b3e656894f34f5066be45d91b7 )
214     {
215         Py_DECREF( frame_759a62b3e656894f34f5066be45d91b7 );
216     }
217     cache_frame_759a62b3e656894f34f5066be45d91b7 = NULL;
218  
219     assertFrameObject( frame_759a62b3e656894f34f5066be45d91b7 );
220  
221  
222     // Put the previous frame back on top.
223     popFrameStack();
224  
225     // Return the error.
226     goto try_except_handler_1;
227  
228     frame_no_exception_1:;
209 229
210     tmp_return_value = PyTuple_New( 2 ); 230     tmp_return_value = PyTuple_New( 2 );
n n 231     tmp_tuple_element_1 = const_int_pos_1;
232     Py_INCREF( tmp_tuple_element_1 );
233     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
211     tmp_tuple_element_1 = var_empty; 234     tmp_tuple_element_1 = var_closure_var;
212 235
213     CHECK_OBJECT( tmp_tuple_element_1 ); 236     CHECK_OBJECT( tmp_tuple_element_1 );
214     Py_INCREF( tmp_tuple_element_1 ); 237     Py_INCREF( tmp_tuple_element_1 );
n 215     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 ); n
216     if ( var_closure_var == NULL )
217     {
218         tmp_tuple_element_1 = NULL;
219     }
220     else
221     {
222         tmp_tuple_element_1 = PyCell_GET( var_closure_var );
223     }
224  
225     if ( tmp_tuple_element_1 == NULL )
226     {
227         Py_DECREF( tmp_return_value );
228         exception_type = PyExc_UnboundLocalError;
229         Py_INCREF( exception_type );
230         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "closure_var" );
231         exception_tb = NULL;
232         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
233         CHAIN_EXCEPTION( exception_value );
234  
235         exception_lineno = 35;
236         type_description = "co";
237         goto frame_exception_exit_1;
238     }
239  
240     Py_INCREF( tmp_tuple_element_1 );
241     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 ); 238     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
n 242     goto frame_return_exit_1; n
243  
244 #if 0
245     RESTORE_FRAME_EXCEPTION( frame_759a62b3e656894f34f5066be45d91b7 );
246 #endif
247  
248     // Put the previous frame back on top.
249     popFrameStack();
250  
251     goto frame_no_exception_1;
252  
253     frame_return_exit_1:;
254 #if 0
255     RESTORE_FRAME_EXCEPTION( frame_759a62b3e656894f34f5066be45d91b7 );
256 #endif
257  
258     // Put the previous frame back on top.
259     popFrameStack();
260  
261     goto try_return_handler_1; 239     goto try_return_handler_1;
n 262   n
263     frame_exception_exit_1:;
264  
265 #if 0
266     RESTORE_FRAME_EXCEPTION( frame_759a62b3e656894f34f5066be45d91b7 );
267 #endif
268  
269     if ( exception_tb == NULL )
270     {
271         exception_tb = MAKE_TRACEBACK( frame_759a62b3e656894f34f5066be45d91b7, exception_lineno );
272     }
273     else if ( exception_tb->tb_frame != &frame_759a62b3e656894f34f5066be45d91b7->m_frame )
274     {
275         exception_tb = ADD_TRACEBACK( exception_tb, frame_759a62b3e656894f34f5066be45d91b7, exception_lineno );
276     }
277  
278     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_759a62b3e656894f34f5066be45d91b7, type_description ,var_closure_var, var_empty );
279  
280     // Release cached frame.
281     if ( frame_759a62b3e656894f34f5066be45d91b7 == cache_frame_759a62b3e656894f34f5066be45d91b7 )
282     {
283         Py_DECREF( frame_759a62b3e656894f34f5066be45d91b7 );
284     }
285     cache_frame_759a62b3e656894f34f5066be45d91b7 = NULL;
286  
287     assertFrameObject( frame_759a62b3e656894f34f5066be45d91b7 );
288  
289  
290     // Put the previous frame back on top.
291     popFrameStack();
292  
293     // Return the error.
294     goto try_except_handler_1;
295  
296     frame_no_exception_1:;
297  
298     // tried codes exits in all cases 240     // tried codes exits in all cases
299     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 241     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
300     return NULL; 242     return NULL;
301     // Return handler code: 243     // Return handler code:
302     try_return_handler_1:; 244     try_return_handler_1:;
303     CHECK_OBJECT( (PyObject *)var_closure_var ); 245     CHECK_OBJECT( (PyObject *)var_closure_var );
304     Py_DECREF( var_closure_var ); 246     Py_DECREF( var_closure_var );
305     var_closure_var = NULL; 247     var_closure_var = NULL;
n 306   n
307     Py_XDECREF( var_empty );
308     var_empty = NULL;
309 248
310     goto function_return_exit; 249     goto function_return_exit;
311     // Exception handler code: 250     // Exception handler code:
312     try_except_handler_1:; 251     try_except_handler_1:;
313     exception_keeper_type_1 = exception_type; 252     exception_keeper_type_1 = exception_type;
317     exception_type = NULL; 256     exception_type = NULL;
318     exception_value = NULL; 257     exception_value = NULL;
319     exception_tb = NULL; 258     exception_tb = NULL;
320     exception_lineno = 0; 259     exception_lineno = 0;
321 260
n 322     CHECK_OBJECT( (PyObject *)var_closure_var ); n
323     Py_DECREF( var_closure_var );
324     var_closure_var = NULL;
325  
326     Py_XDECREF( var_empty );
327     var_empty = NULL;
328  
329     // Re-raise. 261     // Re-raise.
330     exception_type = exception_keeper_type_1; 262     exception_type = exception_keeper_type_1;
331     exception_value = exception_keeper_value_1; 263     exception_value = exception_keeper_value_1;
332     exception_tb = exception_keeper_tb_1; 264     exception_tb = exception_keeper_tb_1;
333     exception_lineno = exception_keeper_lineno_1; 265     exception_lineno = exception_keeper_lineno_1;
347     function_return_exit: 279     function_return_exit:
348 280
349     CHECK_OBJECT( tmp_return_value ); 281     CHECK_OBJECT( tmp_return_value );
350     assert( had_error || !ERROR_OCCURRED() ); 282     assert( had_error || !ERROR_OCCURRED() );
351     return tmp_return_value; 283     return tmp_return_value;
n 352   n
353 }
354  
355  
356 static PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_empty( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
357 {
358     // Preserve error status for checks
359 #ifndef __NUITKA_NO_ASSERT__
360     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
361 #endif
362  
363     // Local variable declarations.
364     PyObject *tmp_return_value;
365     tmp_return_value = NULL;
366  
367     // Actual function code.
368     tmp_return_value = Nuitka_Generator_New(
369         __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context,
370         module___main__,
371         const_str_plain_empty,
372 #if PYTHON_VERSION >= 350
373         const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd,
374 #endif
375         codeobj_f51b39281ddd19db73f2c36174000047,
376         1
377     );
378  
379     ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] = self->m_closure[0];
380     Py_INCREF( ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] );
381     assert( Py_SIZE( tmp_return_value) >= 1 ); 
382  
383  
384     goto function_return_exit;
385  
386     // Return statement must have exited already.
387     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_empty );
388     return NULL;
389  
390     function_return_exit:
391  
392     CHECK_OBJECT( tmp_return_value );
393     assert( had_error || !ERROR_OCCURRED() );
394     return tmp_return_value;
395  
396 }
397  
398  
399  
400 #if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
401 struct __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_locals {
402     PyObject *exception_type
403     PyObject *exception_value
404     PyTracebackObject *exception_tb
405     int exception_lineno
406     PyObject *tmp_expression_name_1;
407 };
408 #endif
409  
410 #if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
411 static PyObject *__main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value )
412 #else
413 static void __main__$$$function_1_calledRepeatedly$$$function_1_empty$$$genobj_1_empty_context( struct Nuitka_GeneratorObject *generator )
414 #endif
415 {
416     CHECK_OBJECT( (PyObject *)generator );
417     assert( Nuitka_Generator_Check( (PyObject *)generator ) );
418  
419     // Local variable initialization
420     PyObject *exception_type = NULL;
421     PyObject *exception_value = NULL;
422     PyTracebackObject *exception_tb = NULL;
423     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
424     PyObject *tmp_expression_name_1;
425     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
426     static struct Nuitka_FrameObject *cache_frame_generator = NULL;
427  
428     char const *type_description;
429  
430     // Dispatch to yield based on return label index:
431  
432  
433     // Actual function code.
434     MAKE_OR_REUSE_FRAME( cache_frame_generator, codeobj_f51b39281ddd19db73f2c36174000047, module___main__, sizeof(struct Nuitka_CellObject *) );
435     generator->m_frame = cache_frame_generator;
436  
437     // Mark the frame object as in use, ref count 1 will be up for reuse.
438     Py_INCREF( generator->m_frame );
439     assert( Py_REFCNT( generator->m_frame ) == 2 ); // Frame stack
440  
441 #if PYTHON_VERSION >= 340
442     generator->m_frame->m_frame.f_gen = (PyObject *)generator;
443 #endif
444  
445     Py_CLEAR( generator->m_frame->m_frame.f_back );
446  
447     generator->m_frame->m_frame.f_back = PyThreadState_GET()->frame;
448     Py_INCREF( generator->m_frame->m_frame.f_back );
449  
450     PyThreadState_GET()->frame = &generator->m_frame->m_frame;
451     Py_INCREF( generator->m_frame );
452  
453     Nuitka_Frame_MarkAsExecuting( generator->m_frame );
454  
455 #if PYTHON_VERSION >= 300
456     // Accept currently existing exception as the one to publish again when we
457     // yield or yield from.
458  
459     PyThreadState *thread_state = PyThreadState_GET();
460  
461     generator->m_frame->m_frame.f_exc_type = thread_state->exc_type;
462     if ( generator->m_frame->m_frame.f_exc_type == Py_None ) generator->m_frame->m_frame.f_exc_type = NULL;
463     Py_XINCREF( generator->m_frame->m_frame.f_exc_type );
464     generator->m_frame->m_frame.f_exc_value = thread_state->exc_value;
465     Py_XINCREF( generator->m_frame->m_frame.f_exc_value );
466     generator->m_frame->m_frame.f_exc_traceback = thread_state->exc_traceback;
467     Py_XINCREF( generator->m_frame->m_frame.f_exc_traceback );
468 #endif
469  
470     // Framed code:
471     if ( generator->m_closure[0] == NULL )
472     {
473         tmp_expression_name_1 = NULL;
474     }
475     else
476     {
477         tmp_expression_name_1 = PyCell_GET( generator->m_closure[0] );
478     }
479  
480     if ( tmp_expression_name_1 == NULL )
481     {
482  
483         exception_type = PyExc_NameError;
484         Py_INCREF( exception_type );
485         exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "closure_var" );
486         exception_tb = NULL;
487         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
488         CHAIN_EXCEPTION( exception_value );
489  
490         exception_lineno = 29;
491         type_description = "c";
492         goto frame_exception_exit_1;
493     }
494  
495     Py_INCREF( tmp_expression_name_1 );
496     tmp_unused = GENERATOR_YIELD( generator, tmp_expression_name_1 );
497     if ( tmp_unused == NULL )
498     {
499         assert( ERROR_OCCURRED() );
500  
501         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
502  
503  
504         exception_lineno = 29;
505         type_description = "c";
506         goto frame_exception_exit_1;
507     }
508  
509     Nuitka_Frame_MarkAsNotExecuting( generator->m_frame );
510  
511 #if PYTHON_VERSION >= 300
512     Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
513     Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
514     Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
515 #endif
516  
517     // Allow re-use of the frame again.
518     Py_DECREF( generator->m_frame );
519     goto frame_no_exception_1;
520  
521     frame_exception_exit_1:;
522  
523     // If it's not an exit exception, consider and create a traceback for it.
524     if ( !EXCEPTION_MATCH_GENERATOR( exception_type ) )
525     {
526         if ( exception_tb == NULL )
527         {
528             exception_tb = MAKE_TRACEBACK( generator->m_frame, exception_lineno );
529         }
530         else if ( exception_tb->tb_frame != &generator->m_frame->m_frame )
531         {
532             exception_tb = ADD_TRACEBACK( exception_tb, generator->m_frame, exception_lineno );
533         }
534  
535         Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)generator->m_frame, type_description ,generator->m_closure[0] );
536  
537         // Release cached frame.
538         if ( generator->m_frame == cache_frame_generator )
539         {
540             Py_DECREF( generator->m_frame );
541         }
542         cache_frame_generator = NULL;
543  
544         assertFrameObject( generator->m_frame );
545     }
546  
547 #if PYTHON_VERSION >= 300
548     Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
549     Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
550     Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
551 #endif
552  
553     Py_DECREF( generator->m_frame );
554     // Return the error.
555     goto function_exception_exit;
556  
557     frame_no_exception_1:;
558  
559  
560 #if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
561     return NULL;
562 #else
563     generator->m_yielded = NULL;
564     return;
565 #endif
566  
567     function_exception_exit:
568     assert( exception_type );
569     RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
570  
571 #if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
572     return NULL;
573 #else
574     generator->m_yielded = NULL;
575     return;
576 #endif
577 284
578 } 285 }
579 286
580 287
581 288
596         module___main__, 303         module___main__,
597         Py_None, 304         Py_None,
598         0 305         0
599     ); 306     );
600 307
t 601   t
602     return (PyObject *)result;
603 }
604  
605  
606  
607 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly$$$function_1_empty( struct Nuitka_CellObject *closure_closure_var )
608 {
609     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
610         impl___main__$$$function_1_calledRepeatedly$$$function_1_empty,
611         const_str_plain_empty,
612 #if PYTHON_VERSION >= 330
613         const_str_digest_30e4724e0d508bc0c811d26a46d4b6cd,
614 #endif
615         codeobj_f51b39281ddd19db73f2c36174000047,
616         NULL,
617 #if PYTHON_VERSION >= 300
618         NULL,
619         const_dict_empty,
620 #endif
621         module___main__,
622         Py_None,
623         1
624     );
625  
626 result->m_closure[0] = closure_closure_var;
627 Py_INCREF( result->m_closure[0] );
628 308
629     return (PyObject *)result; 309     return (PyObject *)result;
630 } 310 }
631 311
632 312