Construct GeneratorExpressionCreation

Performance Diagrams

Construct GeneratorExpressionCreation 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)20487752072.9230769230769257.0CPython 2.70194.46153846153845504.11538461538464Nuitka (historic)80378430316.0407.16601386826324Nuitka (master)80077504437.53846153846143407.5289792352336Nuitka (develop)80028312559.0769230769231407.58831273360863Nuitka (factory)Construct GeneratorExpressionCreationTicks Construct GeneratorExpressionCreation 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)23979968172.9230769230769257.0CPython 3.50194.46153846153845504.11538461538464Nuitka (historic)91592029316.0409.72910611971616Nuitka (master)90283342437.53846153846143411.0777179693964Nuitka (develop)90284644559.0769230769231411.07637624855084Nuitka (factory)Construct GeneratorExpressionCreationTicks

Source Code with Construct

def calledRepeatedly():
    # We measure making a generator iterator step or not.
# construct_begin
    gen = (x for x in range(3))
# construct_alternative



    x = next(gen)
    next(gen)

    return x

for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

def calledRepeatedly():
    # We measure making a generator iterator step or not.
# construct_begin

# construct_alternative
    gen = iter((1,2,3))
# construct_end

    x = next(gen)
    next(gen)

    return x

for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Context Diff of Source Code


Construct
Baseline
19 # 19 #
20 20
21 def calledRepeatedly(): 21 def calledRepeatedly():
22     # We measure making a generator iterator step or not. 22     # We measure making a generator iterator step or not.
23 # construct_begin 23 # construct_begin
n 24     gen = (x for x in range(3)) n 24  
25 # construct_alternative 25 # construct_alternative
t 26   t 26     gen = iter((1,2,3))
27   27 # construct_end
28 28
29     x = next(gen) 29     x = next(gen)
30     next(gen) 30     next(gen)
31 31
32     return x 32     return x

Context Diff of Generated Code


Construct
Baseline
29 29
30 PyObject *module___main__; 30 PyObject *module___main__;
31 PyDictObject *moduledict___main__; 31 PyDictObject *moduledict___main__;
32 32
33 /* The module constants used, if any. */ 33 /* The module constants used, if any. */
n 34 static PyObject *const_str_digest_57aac74124c55d29a6f122835861daff; n
35 static PyObject *const_str_plain___package__; 34 static PyObject *const_str_plain___package__;
n 36 static PyObject *const_str_angle_genexpr; n
37 static PyObject *const_xrange_0_3;
38 extern PyObject *const_int_pos_1; 35 extern PyObject *const_int_pos_1;
39 extern PyObject *const_dict_empty; 36 extern PyObject *const_dict_empty;
40 extern PyObject *const_str_plain___file__; 37 extern PyObject *const_str_plain___file__;
n 41 static PyObject *const_str_digest_b9c4baf879ebd882d40843df3a4dead7; n
42 extern PyObject *const_int_0; 38 extern PyObject *const_int_0;
43 static PyObject *const_xrange_0_50000; 39 static PyObject *const_xrange_0_50000;
44 extern PyObject *const_str_plain_print; 40 extern PyObject *const_str_plain_print;
n n 41 static PyObject *const_int_pos_50000;
42 static PyObject *const_str_plain_gen;
45 static PyObject *const_int_pos_3; 43 static PyObject *const_int_pos_3;
n 46 static PyObject *const_str_plain_gen; n
47 static PyObject *const_int_pos_50000;
48 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 44 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
49 static PyObject *const_str_plain_calledRepeatedly; 45 static PyObject *const_str_plain_calledRepeatedly;
50 static PyObject *const_str_angle_module; 46 static PyObject *const_str_angle_module;
51 static PyObject *const_str_plain_x; 47 static PyObject *const_str_plain_x;
52 extern PyObject *const_tuple_empty; 48 extern PyObject *const_tuple_empty;
53 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 49 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
54 static PyObject *const_tuple_str_plain_gen_str_plain_x_tuple; 50 static PyObject *const_tuple_str_plain_gen_str_plain_x_tuple;
n 55 static PyObject *const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_str_plain_x_tuple; n 51 static PyObject *const_int_pos_2;
56 extern PyObject *const_str_plain___main__; 52 extern PyObject *const_str_plain___main__;
57 static PyObject *const_str_digest_effff7d86edfc979aa8f6f259f951c7a; 53 static PyObject *const_str_digest_effff7d86edfc979aa8f6f259f951c7a;
n n 54 static PyObject *const_tuple_int_pos_1_int_pos_2_int_pos_3_tuple;
58 extern PyObject *const_str_plain___doc__; 55 extern PyObject *const_str_plain___doc__;
59 extern PyObject *const_str_plain___cached__; 56 extern PyObject *const_str_plain___cached__;
60 static PyObject *module_filename_obj; 57 static PyObject *module_filename_obj;
61 58
62 static bool constants_created = false; 59 static bool constants_created = false;
63 60
64 static void createModuleConstants( void ) 61 static void createModuleConstants( void )
65 { 62 {
n 66     const_str_digest_57aac74124c55d29a6f122835861daff = UNSTREAM_STRING( &constant_bin[ 0 ], 35, 0 ); n
67     const_str_plain___package__ = UNSTREAM_STRING( &constant_bin[ 35 ], 11, 1 ); 63     const_str_plain___package__ = UNSTREAM_STRING( &constant_bin[ 0 ], 11, 1 );
68     const_str_angle_genexpr = UNSTREAM_STRING( &constant_bin[ 26 ], 9, 0 );
69     const_int_pos_3 = PyLong_FromUnsignedLong( 3ul );
70     const_xrange_0_3 = BUILTIN_XRANGE3( const_int_0, const_int_pos_3, const_int_pos_1 );
71     const_str_digest_b9c4baf879ebd882d40843df3a4dead7 = UNSTREAM_STRING( &constant_bin[ 46 ], 2, 1 );
72     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 64     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
73     const_xrange_0_50000 = BUILTIN_XRANGE3( const_int_0, const_int_pos_50000, const_int_pos_1 ); 65     const_xrange_0_50000 = BUILTIN_XRANGE3( const_int_0, const_int_pos_50000, const_int_pos_1 );
n 74     const_str_plain_gen = UNSTREAM_STRING( &constant_bin[ 27 ], 3, 1 ); n 66     const_str_plain_gen = UNSTREAM_STRING( &constant_bin[ 11 ], 3, 1 );
67     const_int_pos_3 = PyLong_FromUnsignedLong( 3ul );
75     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 68     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
n 76     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 48 ], 3, 0 ); n 69     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 14 ], 3, 0 );
77     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 70     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
n 78     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 0 ], 16, 1 ); n 71     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 17 ], 16, 1 );
79     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 51 ], 8, 0 ); 72     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 33 ], 8, 0 );
80     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 31 ], 1, 1 ); 73     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 41 ], 1, 1 );
81     const_tuple_str_plain_gen_str_plain_x_tuple = PyTuple_New( 2 ); 74     const_tuple_str_plain_gen_str_plain_x_tuple = PyTuple_New( 2 );
82     PyTuple_SET_ITEM( const_tuple_str_plain_gen_str_plain_x_tuple, 0, const_str_plain_gen ); Py_INCREF( const_str_plain_gen ); 75     PyTuple_SET_ITEM( const_tuple_str_plain_gen_str_plain_x_tuple, 0, const_str_plain_gen ); Py_INCREF( const_str_plain_gen );
83     PyTuple_SET_ITEM( const_tuple_str_plain_gen_str_plain_x_tuple, 1, const_str_plain_x ); Py_INCREF( const_str_plain_x ); 76     PyTuple_SET_ITEM( const_tuple_str_plain_gen_str_plain_x_tuple, 1, const_str_plain_x ); Py_INCREF( const_str_plain_x );
n 84     const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_str_plain_x_tuple = PyTuple_New( 2 ); n 77     const_int_pos_2 = PyLong_FromUnsignedLong( 2ul );
85     PyTuple_SET_ITEM( const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_str_plain_x_tuple, 0, const_str_digest_b9c4baf879ebd882d40843df3a4dead7 ); Py_INCREF( const_str_digest_b9c4baf879ebd882d40843df3a4dead7 );
86     PyTuple_SET_ITEM( const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_str_plain_x_tuple, 1, const_str_plain_x ); Py_INCREF( const_str_plain_x );
87     const_str_digest_effff7d86edfc979aa8f6f259f951c7a = UNSTREAM_STRING( &constant_bin[ 59 ], 85, 0 ); 78     const_str_digest_effff7d86edfc979aa8f6f259f951c7a = UNSTREAM_STRING( &constant_bin[ 42 ], 85, 0 );
79     const_tuple_int_pos_1_int_pos_2_int_pos_3_tuple = PyTuple_New( 3 );
80     PyTuple_SET_ITEM( const_tuple_int_pos_1_int_pos_2_int_pos_3_tuple, 0, const_int_pos_1 ); Py_INCREF( const_int_pos_1 );
81     PyTuple_SET_ITEM( const_tuple_int_pos_1_int_pos_2_int_pos_3_tuple, 1, const_int_pos_2 ); Py_INCREF( const_int_pos_2 );
82     PyTuple_SET_ITEM( const_tuple_int_pos_1_int_pos_2_int_pos_3_tuple, 2, const_int_pos_3 ); Py_INCREF( const_int_pos_3 );
88 83
89     constants_created = true; 84     constants_created = true;
90 } 85 }
91 86
92 #ifndef __NUITKA_NO_ASSERT__ 87 #ifndef __NUITKA_NO_ASSERT__
98 93
99 } 94 }
100 #endif 95 #endif
101 96
102 // The module code objects. 97 // The module code objects.
n 103 static PyCodeObject *codeobj_e7710bf6c61e772fc75a450993bda5f8; n
104 static PyCodeObject *codeobj_b666f7d5a21a8f1a99fdc6caaad769f0; 98 static PyCodeObject *codeobj_b666f7d5a21a8f1a99fdc6caaad769f0;
105 static PyCodeObject *codeobj_9bddd0a5f78972eb9b43eefd790cb64f; 99 static PyCodeObject *codeobj_9bddd0a5f78972eb9b43eefd790cb64f;
106 /* For use in "MainProgram.c". */ 100 /* For use in "MainProgram.c". */
107 PyCodeObject *codeobj_main = NULL; 101 PyCodeObject *codeobj_main = NULL;
108 102
109 static void createModuleCodeObjects(void) 103 static void createModuleCodeObjects(void)
110 { 104 {
111     module_filename_obj = const_str_digest_effff7d86edfc979aa8f6f259f951c7a; 105     module_filename_obj = const_str_digest_effff7d86edfc979aa8f6f259f951c7a;
n 112     codeobj_e7710bf6c61e772fc75a450993bda5f8 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_genexpr, 24, const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_str_plain_x_tuple, 1, 0, CO_GENERATOR | CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE ); n
113     codeobj_b666f7d5a21a8f1a99fdc6caaad769f0 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE ); 106     codeobj_b666f7d5a21a8f1a99fdc6caaad769f0 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE );
114     codeobj_main = codeobj_b666f7d5a21a8f1a99fdc6caaad769f0; 107     codeobj_main = codeobj_b666f7d5a21a8f1a99fdc6caaad769f0;
115     codeobj_9bddd0a5f78972eb9b43eefd790cb64f = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 21, const_tuple_str_plain_gen_str_plain_x_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE ); 108     codeobj_9bddd0a5f78972eb9b43eefd790cb64f = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 21, const_tuple_str_plain_gen_str_plain_x_tuple, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
116 } 109 }
117 110
118 // The module function declarations. 111 // The module function declarations.
n 119 static void __main__$$$function_1_calledRepeatedly$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator ); n
120  
121  
122 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ); 112 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  );
123 113
124 114
125 // The module function definitions. 115 // The module function definitions.
126 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) 116 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
131 #endif 121 #endif
132 122
133     // Local variable declarations. 123     // Local variable declarations.
134     PyObject *var_gen = NULL; 124     PyObject *var_gen = NULL;
135     PyObject *var_x = NULL; 125     PyObject *var_x = NULL;
n 136     PyObject *tmp_genexpr_1__$0 = NULL; n
137     PyObject *exception_type = NULL, *exception_value = NULL; 126     PyObject *exception_type = NULL, *exception_value = NULL;
138     PyTracebackObject *exception_tb = NULL; 127     PyTracebackObject *exception_tb = NULL;
139     NUITKA_MAY_BE_UNUSED int exception_lineno = -1; 128     NUITKA_MAY_BE_UNUSED int exception_lineno = -1;
140     PyObject *exception_keeper_type_1; 129     PyObject *exception_keeper_type_1;
141     PyObject *exception_keeper_value_1; 130     PyObject *exception_keeper_value_1;
142     PyTracebackObject *exception_keeper_tb_1; 131     PyTracebackObject *exception_keeper_tb_1;
143     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 132     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
144     PyObject *tmp_assign_source_1; 133     PyObject *tmp_assign_source_1;
145     PyObject *tmp_assign_source_2; 134     PyObject *tmp_assign_source_2;
n 146     PyObject *tmp_assign_source_3; n
147     PyObject *tmp_iter_arg_1; 135     PyObject *tmp_iter_arg_1;
n 148     PyObject *tmp_outline_return_value_1; n
149     PyObject *tmp_return_value; 136     PyObject *tmp_return_value;
150     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 137     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
151     PyObject *tmp_value_name_1; 138     PyObject *tmp_value_name_1;
152     PyObject *tmp_value_name_2; 139     PyObject *tmp_value_name_2;
153     static struct Nuitka_FrameObject *cache_frame_9bddd0a5f78972eb9b43eefd790cb64f = NULL; 140     static struct Nuitka_FrameObject *cache_frame_9bddd0a5f78972eb9b43eefd790cb64f = NULL;
154 141
155     struct Nuitka_FrameObject *frame_9bddd0a5f78972eb9b43eefd790cb64f; 142     struct Nuitka_FrameObject *frame_9bddd0a5f78972eb9b43eefd790cb64f;
156 143
157     char const *type_description; 144     char const *type_description;
158     tmp_return_value = NULL; 145     tmp_return_value = NULL;
n 159     tmp_outline_return_value_1 = NULL; n
160 146
161     // Actual function code. 147     // Actual function code.
n 162     tmp_iter_arg_1 = const_xrange_0_3; n 148     tmp_iter_arg_1 = const_tuple_int_pos_1_int_pos_2_int_pos_3_tuple;
163     tmp_assign_source_2 = MAKE_ITERATOR( tmp_iter_arg_1 ); 149     tmp_assign_source_1 = MAKE_ITERATOR( tmp_iter_arg_1 );
164     assert( tmp_assign_source_2 != NULL ); 150     assert( tmp_assign_source_1 != NULL );
165     assert( tmp_genexpr_1__$0 == NULL );
166     tmp_genexpr_1__$0 = tmp_assign_source_2;
167  
168     // Tried code:
169     tmp_outline_return_value_1 = Nuitka_Generator_New(
170         __main__$$$function_1_calledRepeatedly$$$genexpr_1_genexpr_context,
171         module___main__,
172         const_str_angle_genexpr,
173 #if PYTHON_VERSION >= 350
174         const_str_digest_57aac74124c55d29a6f122835861daff,
175 #endif
176         codeobj_e7710bf6c61e772fc75a450993bda5f8,
177         1
178     );
179  
180     ((struct Nuitka_GeneratorObject *)tmp_outline_return_value_1)->m_closure[0] = PyCell_NEW0( tmp_genexpr_1__$0 );
181     assert( Py_SIZE( tmp_outline_return_value_1) >= 1 ); 
182  
183  
184     goto try_return_handler_1;
185     // tried codes exits in all cases
186     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
187     return NULL;
188     // Return handler code:
189     try_return_handler_1:;
190     CHECK_OBJECT( (PyObject *)tmp_genexpr_1__$0 );
191     Py_DECREF( tmp_genexpr_1__$0 );
192     tmp_genexpr_1__$0 = NULL;
193  
194     goto outline_result_1;
195     // End of try:
196     CHECK_OBJECT( (PyObject *)tmp_genexpr_1__$0 );
197     Py_DECREF( tmp_genexpr_1__$0 );
198     tmp_genexpr_1__$0 = NULL;
199  
200     // Return statement must have exited already.
201     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
202     return NULL;
203     outline_result_1:;
204     tmp_assign_source_1 = tmp_outline_return_value_1;
205     assert( var_gen == NULL ); 151     assert( var_gen == NULL );
206     var_gen = tmp_assign_source_1; 152     var_gen = tmp_assign_source_1;
207 153
208     // Tried code: 154     // Tried code:
209     MAKE_OR_REUSE_FRAME( cache_frame_9bddd0a5f78972eb9b43eefd790cb64f, codeobj_9bddd0a5f78972eb9b43eefd790cb64f, module___main__, sizeof(PyObject *)+sizeof(PyObject *) ); 155     MAKE_OR_REUSE_FRAME( cache_frame_9bddd0a5f78972eb9b43eefd790cb64f, codeobj_9bddd0a5f78972eb9b43eefd790cb64f, module___main__, sizeof(PyObject *)+sizeof(PyObject *) );
217 163
218     // Framed code: 164     // Framed code:
219     tmp_value_name_1 = var_gen; 165     tmp_value_name_1 = var_gen;
220 166
221     CHECK_OBJECT( tmp_value_name_1 ); 167     CHECK_OBJECT( tmp_value_name_1 );
n 222     tmp_assign_source_3 = ITERATOR_NEXT( tmp_value_name_1 ); n 168     tmp_assign_source_2 = ITERATOR_NEXT( tmp_value_name_1 );
223     if ( tmp_assign_source_3 == NULL ) 169     if ( tmp_assign_source_2 == NULL )
224     { 170     {
225         if ( !ERROR_OCCURRED() ) 171         if ( !ERROR_OCCURRED() )
226         { 172         {
227             exception_type = PyExc_StopIteration; 173             exception_type = PyExc_StopIteration;
228             Py_INCREF( exception_type ); 174             Py_INCREF( exception_type );
238         type_description = "oo"; 184         type_description = "oo";
239         exception_lineno = 29; 185         exception_lineno = 29;
240         goto frame_exception_exit_1; 186         goto frame_exception_exit_1;
241     } 187     }
242     assert( var_x == NULL ); 188     assert( var_x == NULL );
n 243     var_x = tmp_assign_source_3; n 189     var_x = tmp_assign_source_2;
244 190
245     tmp_value_name_2 = var_gen; 191     tmp_value_name_2 = var_gen;
246 192
247     if ( tmp_value_name_2 == NULL ) 193     if ( tmp_value_name_2 == NULL )
248     { 194     {
319 265
320     // Put the previous frame back on top. 266     // Put the previous frame back on top.
321     popFrameStack(); 267     popFrameStack();
322 268
323     // Return the error. 269     // Return the error.
n 324     goto try_except_handler_2; n 270     goto try_except_handler_1;
325 271
326     frame_no_exception_1:; 272     frame_no_exception_1:;
327 273
328     tmp_return_value = var_x; 274     tmp_return_value = var_x;
329 275
337         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 283         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
338         CHAIN_EXCEPTION( exception_value ); 284         CHAIN_EXCEPTION( exception_value );
339 285
340 286
341 287
n 342         goto try_except_handler_2; n 288         goto try_except_handler_1;
343     } 289     }
344 290
345     Py_INCREF( tmp_return_value ); 291     Py_INCREF( tmp_return_value );
n 346     goto try_return_handler_2; n 292     goto try_return_handler_1;
347     // tried codes exits in all cases 293     // tried codes exits in all cases
348     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 294     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
349     return NULL; 295     return NULL;
350     // Return handler code: 296     // Return handler code:
n 351     try_return_handler_2:; n 297     try_return_handler_1:;
352     Py_XDECREF( var_gen ); 298     Py_XDECREF( var_gen );
353     var_gen = NULL; 299     var_gen = NULL;
354 300
355     Py_XDECREF( var_x ); 301     Py_XDECREF( var_x );
356     var_x = NULL; 302     var_x = NULL;
357 303
358     goto function_return_exit; 304     goto function_return_exit;
359     // Exception handler code: 305     // Exception handler code:
n 360     try_except_handler_2:; n 306     try_except_handler_1:;
361     exception_keeper_type_1 = exception_type; 307     exception_keeper_type_1 = exception_type;
362     exception_keeper_value_1 = exception_value; 308     exception_keeper_value_1 = exception_value;
363     exception_keeper_tb_1 = exception_tb; 309     exception_keeper_tb_1 = exception_tb;
364     exception_keeper_lineno_1 = exception_lineno; 310     exception_keeper_lineno_1 = exception_lineno;
365     exception_type = NULL; 311     exception_type = NULL;
395 341
396     CHECK_OBJECT( tmp_return_value ); 342     CHECK_OBJECT( tmp_return_value );
397     assert( had_error || !ERROR_OCCURRED() ); 343     assert( had_error || !ERROR_OCCURRED() );
398     return tmp_return_value; 344     return tmp_return_value;
399 345
t 400 } t
401  
402  
403  
404 static void __main__$$$function_1_calledRepeatedly$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator )
405 {
406     CHECK_OBJECT( (PyObject *)generator );
407     assert( Nuitka_Generator_Check( (PyObject *)generator ) );
408  
409     // Local variable initialization
410     PyObject *var_x = NULL;
411     PyObject *tmp_iter_value_0 = NULL;
412     PyObject *exception_type = NULL, *exception_value = NULL;
413     PyTracebackObject *exception_tb = NULL;
414     NUITKA_MAY_BE_UNUSED int exception_lineno = -1;
415     PyObject *exception_keeper_type_1;
416     PyObject *exception_keeper_value_1;
417     PyTracebackObject *exception_keeper_tb_1;
418     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
419     PyObject *exception_keeper_type_2;
420     PyObject *exception_keeper_value_2;
421     PyTracebackObject *exception_keeper_tb_2;
422     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
423     PyObject *tmp_assign_source_1;
424     PyObject *tmp_assign_source_2;
425     PyObject *tmp_expression_name_1;
426     PyObject *tmp_next_source_1;
427     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
428     static struct Nuitka_FrameObject *cache_frame_generator = NULL;
429  
430     char const *type_description;
431  
432     // Actual function code.
433     // Tried code:
434     MAKE_OR_REUSE_FRAME( cache_frame_generator, codeobj_e7710bf6c61e772fc75a450993bda5f8, module___main__, sizeof(void *)+sizeof(PyObject *) );
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     // Tried code:
472     loop_start_1:;
473     if ( generator->m_closure[0] == NULL )
474     {
475         tmp_next_source_1 = NULL;
476     }
477     else
478     {
479         tmp_next_source_1 = PyCell_GET( generator->m_closure[0] );
480     }
481  
482     CHECK_OBJECT( tmp_next_source_1 );
483     tmp_assign_source_1 = ITERATOR_NEXT( tmp_next_source_1 );
484     if ( tmp_assign_source_1 == NULL )
485     {
486         if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
487         {
488  
489             goto loop_end_1;
490         }
491         else
492         {
493  
494             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
495             type_description = "No";
496             generator->m_frame->m_frame.f_lineno = 24;
497             goto try_except_handler_2;
498         }
499     }
500  
501     {
502         PyObject *old = tmp_iter_value_0;
503         tmp_iter_value_0 = tmp_assign_source_1;
504         Py_XDECREF( old );
505     }
506  
507     tmp_assign_source_2 = tmp_iter_value_0;
508  
509     CHECK_OBJECT( tmp_assign_source_2 );
510     {
511         PyObject *old = var_x;
512         var_x = tmp_assign_source_2;
513         Py_INCREF( var_x );
514         Py_XDECREF( old );
515     }
516  
517     tmp_expression_name_1 = var_x;
518  
519     CHECK_OBJECT( tmp_expression_name_1 );
520     Py_INCREF( tmp_expression_name_1 );
521     tmp_unused = GENERATOR_YIELD( generator, tmp_expression_name_1 );
522     if ( tmp_unused == NULL )
523     {
524         assert( ERROR_OCCURRED() );
525  
526         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
527  
528  
529         exception_lineno = 24;
530         type_description = "No";
531         goto try_except_handler_2;
532     }
533     if ( CONSIDER_THREADING() == false )
534     {
535         assert( ERROR_OCCURRED() );
536  
537         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
538  
539  
540         exception_lineno = 24;
541         type_description = "No";
542         goto try_except_handler_2;
543     }
544     goto loop_start_1;
545     loop_end_1:;
546     goto try_end_1;
547     // Exception handler code:
548     try_except_handler_2:;
549     exception_keeper_type_1 = exception_type;
550     exception_keeper_value_1 = exception_value;
551     exception_keeper_tb_1 = exception_tb;
552     exception_keeper_lineno_1 = exception_lineno;
553     exception_type = NULL;
554     exception_value = NULL;
555     exception_tb = NULL;
556     exception_lineno = -1;
557  
558     Py_XDECREF( tmp_iter_value_0 );
559     tmp_iter_value_0 = NULL;
560  
561     // Re-raise.
562     exception_type = exception_keeper_type_1;
563     exception_value = exception_keeper_value_1;
564     exception_tb = exception_keeper_tb_1;
565     exception_lineno = exception_keeper_lineno_1;
566  
567     goto frame_exception_exit_1;
568     // End of try:
569     try_end_1:;
570  
571     Nuitka_Frame_MarkAsNotExecuting( generator->m_frame );
572  
573 #if PYTHON_VERSION >= 300
574     Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
575     Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
576     Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
577 #endif
578  
579     // Allow re-use of the frame again.
580     Py_DECREF( generator->m_frame );
581     goto frame_no_exception_1;
582  
583     frame_exception_exit_1:;
584  
585     // If it's not an exit exception, consider and create a traceback for it.
586     if ( !EXCEPTION_MATCH_GENERATOR( exception_type ) )
587     {
588         if ( exception_tb == NULL )
589         {
590             exception_tb = MAKE_TRACEBACK( generator->m_frame, exception_lineno );
591         }
592         else if ( exception_tb->tb_frame != &generator->m_frame->m_frame )
593         {
594             exception_tb = ADD_TRACEBACK( exception_tb, generator->m_frame, exception_lineno );
595         }
596  
597         Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)generator->m_frame, type_description ,NULL, var_x );
598  
599         // Release cached frame.
600         if ( generator->m_frame == cache_frame_generator )
601         {
602             Py_DECREF( generator->m_frame );
603         }
604         cache_frame_generator = NULL;
605  
606         assertFrameObject( generator->m_frame );
607     }
608  
609 #if PYTHON_VERSION >= 300
610     Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
611     Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
612     Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
613 #endif
614  
615     Py_DECREF( generator->m_frame );
616     // Return the error.
617     goto try_except_handler_1;
618  
619     frame_no_exception_1:;
620  
621     goto try_end_2;
622     // Exception handler code:
623     try_except_handler_1:;
624     exception_keeper_type_2 = exception_type;
625     exception_keeper_value_2 = exception_value;
626     exception_keeper_tb_2 = exception_tb;
627     exception_keeper_lineno_2 = exception_lineno;
628     exception_type = NULL;
629     exception_value = NULL;
630     exception_tb = NULL;
631     exception_lineno = -1;
632  
633     Py_XDECREF( var_x );
634     var_x = NULL;
635  
636     // Re-raise.
637     exception_type = exception_keeper_type_2;
638     exception_value = exception_keeper_value_2;
639     exception_tb = exception_keeper_tb_2;
640     exception_lineno = exception_keeper_lineno_2;
641  
642     goto function_exception_exit;
643     // End of try:
644     try_end_2:;
645     Py_XDECREF( tmp_iter_value_0 );
646     tmp_iter_value_0 = NULL;
647  
648     Py_XDECREF( var_x );
649     var_x = NULL;
650  
651  
652     generator->m_yielded = NULL;
653     return;
654  
655     function_exception_exit:
656     assert( exception_type );
657     RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
658     generator->m_yielded = NULL;
659     return;
660 } 346 }
661 347
662 348
663 349
664 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ) 350 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  )