Construct GeneratorExpressionCreation

Performance Diagrams

Construct GeneratorExpressionCreation 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)20452746688.11538461538461257.0CPython 2.780278525240.03846153846155407.1207903454357Nuitka (master)80278537391.96153846153845407.12077584672477Nuitka (develop)80279119543.8846153846154407.1200726592426Nuitka (factory)Construct GeneratorExpressionCreationTicks Construct GeneratorExpressionCreation 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000240000000240000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)24099979188.11538461538461257.0CPython 3.590287928240.03846153846155411.5363165536777Nuitka (master)90288395391.96153846153845411.5358377031188Nuitka (develop)90295416543.8846153846154411.5286385387204Nuitka (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

import itertools
for x in itertools.repeat(None, 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

import itertools
for x in itertools.repeat(None, 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_itertools; 34 static PyObject *const_str_plain_itertools;
36 static PyObject *const_str_plain___package__; 35 static PyObject *const_str_plain___package__;
37 static PyObject *const_str_plain___spec__; 36 static PyObject *const_str_plain___spec__;
n 38 static PyObject *const_str_angle_genexpr; n
39 static PyObject *const_xrange_0_3;
40 extern PyObject *const_int_pos_1; 37 extern PyObject *const_int_pos_1;
41 extern PyObject *const_dict_empty; 38 extern PyObject *const_dict_empty;
42 extern PyObject *const_str_plain___file__; 39 extern PyObject *const_str_plain___file__;
43 static PyObject *const_str_digest_e326bde780e40ac5f3307691c65bb6fa; 40 static PyObject *const_str_digest_e326bde780e40ac5f3307691c65bb6fa;
n 44 static PyObject *const_str_digest_b9c4baf879ebd882d40843df3a4dead7; n
45 extern PyObject *const_int_0; 41 extern PyObject *const_int_0;
46 extern PyObject *const_str_plain_print; 42 extern PyObject *const_str_plain_print;
n n 43 static PyObject *const_int_pos_50000;
44 static PyObject *const_str_plain_gen;
47 static PyObject *const_int_pos_3; 45 static PyObject *const_int_pos_3;
n 48 static PyObject *const_str_plain_gen; n
49 static PyObject *const_int_pos_50000;
50 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 46 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
51 static PyObject *const_str_plain_calledRepeatedly; 47 static PyObject *const_str_plain_calledRepeatedly;
52 static PyObject *const_str_angle_module; 48 static PyObject *const_str_angle_module;
53 static PyObject *const_str_plain_x; 49 static PyObject *const_str_plain_x;
54 extern PyObject *const_tuple_empty; 50 extern PyObject *const_tuple_empty;
55 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 51 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
56 static PyObject *const_tuple_str_plain_gen_str_plain_x_tuple; 52 static PyObject *const_tuple_str_plain_gen_str_plain_x_tuple;
57 static PyObject *const_str_plain_repeat; 53 static PyObject *const_str_plain_repeat;
n 58 static PyObject *const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_str_plain_x_tuple; n 54 static PyObject *const_int_pos_2;
59 static PyObject *const_tuple_none_int_pos_50000_tuple; 55 static PyObject *const_tuple_none_int_pos_50000_tuple;
60 extern PyObject *const_str_plain___loader__; 56 extern PyObject *const_str_plain___loader__;
61 extern PyObject *const_str_plain___main__; 57 extern PyObject *const_str_plain___main__;
n n 58 static PyObject *const_tuple_int_pos_1_int_pos_2_int_pos_3_tuple;
62 extern PyObject *const_str_plain___doc__; 59 extern PyObject *const_str_plain___doc__;
63 extern PyObject *const_str_plain___cached__; 60 extern PyObject *const_str_plain___cached__;
64 static PyObject *module_filename_obj; 61 static PyObject *module_filename_obj;
65 62
66 static bool constants_created = false; 63 static bool constants_created = false;
67 64
68 static void createModuleConstants( void ) 65 static void createModuleConstants( void )
69 { 66 {
n 70     const_str_digest_57aac74124c55d29a6f122835861daff = UNSTREAM_STRING( &constant_bin[ 0 ], 35, 0 ); n
71     const_str_plain_itertools = UNSTREAM_STRING( &constant_bin[ 35 ], 9, 1 ); 67     const_str_plain_itertools = UNSTREAM_STRING( &constant_bin[ 0 ], 9, 1 );
72     const_str_plain___package__ = UNSTREAM_STRING( &constant_bin[ 44 ], 11, 1 ); 68     const_str_plain___package__ = UNSTREAM_STRING( &constant_bin[ 9 ], 11, 1 );
73     const_str_plain___spec__ = UNSTREAM_STRING( &constant_bin[ 55 ], 8, 1 ); 69     const_str_plain___spec__ = UNSTREAM_STRING( &constant_bin[ 20 ], 8, 1 );
70     const_str_digest_e326bde780e40ac5f3307691c65bb6fa = UNSTREAM_STRING( &constant_bin[ 28 ], 85, 0 );
71     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
74     const_str_angle_genexpr = UNSTREAM_STRING( &constant_bin[ 26 ], 90 ); 72     const_str_plain_gen = UNSTREAM_STRING( &constant_bin[ 113 ], 31 );
75     const_int_pos_3 = PyLong_FromUnsignedLong( 3ul ); 73     const_int_pos_3 = PyLong_FromUnsignedLong( 3ul );
n 76     const_xrange_0_3 = BUILTIN_XRANGE3( const_int_0, const_int_pos_3, const_int_pos_1 ); n
77     const_str_digest_e326bde780e40ac5f3307691c65bb6fa = UNSTREAM_STRING( &constant_bin[ 63 ], 85, 0 );
78     const_str_digest_b9c4baf879ebd882d40843df3a4dead7 = UNSTREAM_STRING( &constant_bin[ 148 ], 2, 1 );
79     const_str_plain_gen = UNSTREAM_STRING( &constant_bin[ 27 ], 3, 1 );
80     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
81     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 74     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
n 82     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 150 ], 3, 0 ); n 75     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 116 ], 3, 0 );
83     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 76     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
n 84     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 0 ], 16, 1 ); n 77     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 119 ], 16, 1 );
85     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 153 ], 8, 0 ); 78     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 135 ], 8, 0 );
86     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 31 ], 1, 1 ); 79     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 53 ], 1, 1 );
87     const_tuple_str_plain_gen_str_plain_x_tuple = PyTuple_New( 2 ); 80     const_tuple_str_plain_gen_str_plain_x_tuple = PyTuple_New( 2 );
88     PyTuple_SET_ITEM( const_tuple_str_plain_gen_str_plain_x_tuple, 0, const_str_plain_gen ); Py_INCREF( const_str_plain_gen ); 81     PyTuple_SET_ITEM( const_tuple_str_plain_gen_str_plain_x_tuple, 0, const_str_plain_gen ); Py_INCREF( const_str_plain_gen );
89     PyTuple_SET_ITEM( const_tuple_str_plain_gen_str_plain_x_tuple, 1, const_str_plain_x ); Py_INCREF( const_str_plain_x ); 82     PyTuple_SET_ITEM( const_tuple_str_plain_gen_str_plain_x_tuple, 1, const_str_plain_x ); Py_INCREF( const_str_plain_x );
n 90     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 161 ], 6, 1 ); n 83     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 143 ], 6, 1 );
91     const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_str_plain_x_tuple = PyTuple_New( 2 ); 84     const_int_pos_2 = PyLong_FromUnsignedLong( 2ul );
92     PyTuple_SET_ITEM( const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_str_plain_x_tuple, 0, const_str_digest_b9c4baf879ebd882d40843df3a4dead7 ); Py_INCREF( const_str_digest_b9c4baf879ebd882d40843df3a4dead7 );
93     PyTuple_SET_ITEM( const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_str_plain_x_tuple, 1, const_str_plain_x ); Py_INCREF( const_str_plain_x );
94     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 85     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
95     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 86     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
96     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 87     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
n n 88     const_tuple_int_pos_1_int_pos_2_int_pos_3_tuple = PyTuple_New( 3 );
89     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 );
90     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 );
91     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 );
97 92
98     constants_created = true; 93     constants_created = true;
99 } 94 }
100 95
101 #ifndef __NUITKA_NO_ASSERT__ 96 #ifndef __NUITKA_NO_ASSERT__
107 102
108 } 103 }
109 #endif 104 #endif
110 105
111 // The module code objects. 106 // The module code objects.
n 112 static PyCodeObject *codeobj_70654a8f5d42eb19c74fab721ae03f5c; n
113 static PyCodeObject *codeobj_5fcef4e48bac68cc8074caebcf13a6cc; 107 static PyCodeObject *codeobj_5fcef4e48bac68cc8074caebcf13a6cc;
114 static PyCodeObject *codeobj_5b2c8078ed58654bac12aee75bb4b6af; 108 static PyCodeObject *codeobj_5b2c8078ed58654bac12aee75bb4b6af;
115 /* For use in "MainProgram.c". */ 109 /* For use in "MainProgram.c". */
116 PyCodeObject *codeobj_main = NULL; 110 PyCodeObject *codeobj_main = NULL;
117 111
118 static void createModuleCodeObjects(void) 112 static void createModuleCodeObjects(void)
119 { 113 {
120     module_filename_obj = const_str_digest_e326bde780e40ac5f3307691c65bb6fa; 114     module_filename_obj = const_str_digest_e326bde780e40ac5f3307691c65bb6fa;
n 121     codeobj_70654a8f5d42eb19c74fab721ae03f5c = 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
122     codeobj_5fcef4e48bac68cc8074caebcf13a6cc = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE ); 115     codeobj_5fcef4e48bac68cc8074caebcf13a6cc = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE );
123     codeobj_main = codeobj_5fcef4e48bac68cc8074caebcf13a6cc; 116     codeobj_main = codeobj_5fcef4e48bac68cc8074caebcf13a6cc;
124     codeobj_5b2c8078ed58654bac12aee75bb4b6af = 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 ); 117     codeobj_5b2c8078ed58654bac12aee75bb4b6af = 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 );
125 } 118 }
126 119
127 // The module function declarations. 120 // The module function declarations.
n 128 #if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO n
129 static PyObject *__main__$$$function_1_calledRepeatedly$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value );
130 #else
131 static void __main__$$$function_1_calledRepeatedly$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator );
132 #endif
133  
134  
135 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ); 121 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  );
136 122
137 123
138 // The module function definitions. 124 // The module function definitions.
139 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) 125 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
144 #endif 130 #endif
145 131
146     // Local variable declarations. 132     // Local variable declarations.
147     PyObject *var_gen = NULL; 133     PyObject *var_gen = NULL;
148     PyObject *var_x = NULL; 134     PyObject *var_x = NULL;
n 149     PyObject *tmp_genexpr_1__$0 = NULL; n
150     PyObject *exception_type = NULL; 135     PyObject *exception_type = NULL;
151     PyObject *exception_value = NULL; 136     PyObject *exception_value = NULL;
152     PyTracebackObject *exception_tb = NULL; 137     PyTracebackObject *exception_tb = NULL;
153     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 138     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
154     PyObject *exception_keeper_type_1; 139     PyObject *exception_keeper_type_1;
155     PyObject *exception_keeper_value_1; 140     PyObject *exception_keeper_value_1;
156     PyTracebackObject *exception_keeper_tb_1; 141     PyTracebackObject *exception_keeper_tb_1;
157     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 142     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
158     PyObject *tmp_assign_source_1; 143     PyObject *tmp_assign_source_1;
159     PyObject *tmp_assign_source_2; 144     PyObject *tmp_assign_source_2;
n 160     PyObject *tmp_assign_source_3; n
161     PyObject *tmp_iter_arg_1; 145     PyObject *tmp_iter_arg_1;
n 162     PyObject *tmp_outline_return_value_1; n
163     PyObject *tmp_return_value; 146     PyObject *tmp_return_value;
164     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 147     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
165     PyObject *tmp_value_name_1; 148     PyObject *tmp_value_name_1;
166     PyObject *tmp_value_name_2; 149     PyObject *tmp_value_name_2;
167     static struct Nuitka_FrameObject *cache_frame_5b2c8078ed58654bac12aee75bb4b6af = NULL; 150     static struct Nuitka_FrameObject *cache_frame_5b2c8078ed58654bac12aee75bb4b6af = NULL;
168 151
169     struct Nuitka_FrameObject *frame_5b2c8078ed58654bac12aee75bb4b6af; 152     struct Nuitka_FrameObject *frame_5b2c8078ed58654bac12aee75bb4b6af;
170 153
171     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 154     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
172     tmp_return_value = NULL; 155     tmp_return_value = NULL;
n 173     tmp_outline_return_value_1 = NULL; n
174 156
175     // Actual function code. 157     // Actual function code.
n 176     tmp_iter_arg_1 = const_xrange_0_3; n 158     tmp_iter_arg_1 = const_tuple_int_pos_1_int_pos_2_int_pos_3_tuple;
177     tmp_assign_source_2 = MAKE_ITERATOR( tmp_iter_arg_1 ); 159     tmp_assign_source_1 = MAKE_ITERATOR( tmp_iter_arg_1 );
178     assert( tmp_assign_source_2 != NULL ); 160     assert( tmp_assign_source_1 != NULL );
179     assert( tmp_genexpr_1__$0 == NULL );
180     tmp_genexpr_1__$0 = tmp_assign_source_2;
181  
182     // Tried code:
183     tmp_outline_return_value_1 = Nuitka_Generator_New(
184         __main__$$$function_1_calledRepeatedly$$$genexpr_1_genexpr_context,
185         module___main__,
186         const_str_angle_genexpr,
187 #if PYTHON_VERSION >= 350
188         const_str_digest_57aac74124c55d29a6f122835861daff,
189 #endif
190         codeobj_70654a8f5d42eb19c74fab721ae03f5c,
191         1
192     );
193  
194     ((struct Nuitka_GeneratorObject *)tmp_outline_return_value_1)->m_closure[0] = PyCell_NEW0( tmp_genexpr_1__$0 );
195     assert( Py_SIZE( tmp_outline_return_value_1 ) >= 1 ); 
196  
197  
198     goto try_return_handler_1;
199     // tried codes exits in all cases
200     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
201     return NULL;
202     // Return handler code:
203     try_return_handler_1:;
204     CHECK_OBJECT( (PyObject *)tmp_genexpr_1__$0 );
205     Py_DECREF( tmp_genexpr_1__$0 );
206     tmp_genexpr_1__$0 = NULL;
207  
208     goto outline_result_1;
209     // End of try:
210     CHECK_OBJECT( (PyObject *)tmp_genexpr_1__$0 );
211     Py_DECREF( tmp_genexpr_1__$0 );
212     tmp_genexpr_1__$0 = NULL;
213  
214     // Return statement must have exited already.
215     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
216     return NULL;
217     outline_result_1:;
218     tmp_assign_source_1 = tmp_outline_return_value_1;
219     assert( var_gen == NULL ); 161     assert( var_gen == NULL );
220     var_gen = tmp_assign_source_1; 162     var_gen = tmp_assign_source_1;
221 163
222     // Tried code: 164     // Tried code:
223     MAKE_OR_REUSE_FRAME( cache_frame_5b2c8078ed58654bac12aee75bb4b6af, codeobj_5b2c8078ed58654bac12aee75bb4b6af, module___main__, sizeof(void *)+sizeof(void *) ); 165     MAKE_OR_REUSE_FRAME( cache_frame_5b2c8078ed58654bac12aee75bb4b6af, codeobj_5b2c8078ed58654bac12aee75bb4b6af, module___main__, sizeof(void *)+sizeof(void *) );
231 173
232     // Framed code: 174     // Framed code:
233     tmp_value_name_1 = var_gen; 175     tmp_value_name_1 = var_gen;
234 176
235     CHECK_OBJECT( tmp_value_name_1 ); 177     CHECK_OBJECT( tmp_value_name_1 );
n 236     tmp_assign_source_3 = ITERATOR_NEXT( tmp_value_name_1 ); n 178     tmp_assign_source_2 = ITERATOR_NEXT( tmp_value_name_1 );
237     if ( tmp_assign_source_3 == NULL ) 179     if ( tmp_assign_source_2 == NULL )
238     { 180     {
239         if ( !ERROR_OCCURRED() ) 181         if ( !ERROR_OCCURRED() )
240         { 182         {
241             exception_type = PyExc_StopIteration; 183             exception_type = PyExc_StopIteration;
242             Py_INCREF( exception_type ); 184             Py_INCREF( exception_type );
252         type_description_1 = "oo"; 194         type_description_1 = "oo";
253         exception_lineno = 29; 195         exception_lineno = 29;
254         goto frame_exception_exit_1; 196         goto frame_exception_exit_1;
255     } 197     }
256     assert( var_x == NULL ); 198     assert( var_x == NULL );
n 257     var_x = tmp_assign_source_3; n 199     var_x = tmp_assign_source_2;
258 200
259     tmp_value_name_2 = var_gen; 201     tmp_value_name_2 = var_gen;
260 202
261     if ( tmp_value_name_2 == NULL ) 203     if ( tmp_value_name_2 == NULL )
262     { 204     {
339 281
340     // Put the previous frame back on top. 282     // Put the previous frame back on top.
341     popFrameStack(); 283     popFrameStack();
342 284
343     // Return the error. 285     // Return the error.
n 344     goto try_except_handler_2; n 286     goto try_except_handler_1;
345 287
346     frame_no_exception_1:; 288     frame_no_exception_1:;
347 289
348     tmp_return_value = var_x; 290     tmp_return_value = var_x;
349 291
357         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 299         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
358         CHAIN_EXCEPTION( exception_value ); 300         CHAIN_EXCEPTION( exception_value );
359 301
360 302
361 303
n 362         goto try_except_handler_2; n 304         goto try_except_handler_1;
363     } 305     }
364 306
365     Py_INCREF( tmp_return_value ); 307     Py_INCREF( tmp_return_value );
n 366     goto try_return_handler_2; n 308     goto try_return_handler_1;
367     // tried codes exits in all cases 309     // tried codes exits in all cases
368     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 310     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
369     return NULL; 311     return NULL;
370     // Return handler code: 312     // Return handler code:
n 371     try_return_handler_2:; n 313     try_return_handler_1:;
372     Py_XDECREF( var_gen ); 314     Py_XDECREF( var_gen );
373     var_gen = NULL; 315     var_gen = NULL;
374 316
375     Py_XDECREF( var_x ); 317     Py_XDECREF( var_x );
376     var_x = NULL; 318     var_x = NULL;
377 319
378     goto function_return_exit; 320     goto function_return_exit;
379     // Exception handler code: 321     // Exception handler code:
n 380     try_except_handler_2:; n 322     try_except_handler_1:;
381     exception_keeper_type_1 = exception_type; 323     exception_keeper_type_1 = exception_type;
382     exception_keeper_value_1 = exception_value; 324     exception_keeper_value_1 = exception_value;
383     exception_keeper_tb_1 = exception_tb; 325     exception_keeper_tb_1 = exception_tb;
384     exception_keeper_lineno_1 = exception_lineno; 326     exception_keeper_lineno_1 = exception_lineno;
385     exception_type = NULL; 327     exception_type = NULL;
414     function_return_exit: 356     function_return_exit:
415 357
416     CHECK_OBJECT( tmp_return_value ); 358     CHECK_OBJECT( tmp_return_value );
417     assert( had_error || !ERROR_OCCURRED() ); 359     assert( had_error || !ERROR_OCCURRED() );
418     return tmp_return_value; 360     return tmp_return_value;
t 419   t
420 }
421  
422  
423  
424 #if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
425 struct __main__$$$function_1_calledRepeatedly$$$genexpr_1_genexpr_locals {
426     PyObject *var_x
427     PyObject *tmp_iter_value_0
428     PyObject *exception_type
429     PyObject *exception_value
430     PyTracebackObject *exception_tb
431     int exception_lineno
432     PyObject *exception_keeper_type_1;
433     PyObject *exception_keeper_value_1;
434     PyTracebackObject *exception_keeper_tb_1;
435     int exception_keeper_lineno_1;
436     PyObject *exception_keeper_type_2;
437     PyObject *exception_keeper_value_2;
438     PyTracebackObject *exception_keeper_tb_2;
439     int exception_keeper_lineno_2;
440     PyObject *tmp_assign_source_1;
441     PyObject *tmp_assign_source_2;
442     PyObject *tmp_expression_name_1;
443     PyObject *tmp_next_source_1;
444     char const *type_description_1
445 };
446 #endif
447  
448 #if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
449 static PyObject *__main__$$$function_1_calledRepeatedly$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value )
450 #else
451 static void __main__$$$function_1_calledRepeatedly$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator )
452 #endif
453 {
454     CHECK_OBJECT( (PyObject *)generator );
455     assert( Nuitka_Generator_Check( (PyObject *)generator ) );
456  
457     // Local variable initialization
458     PyObject *var_x = NULL;
459     PyObject *tmp_iter_value_0 = NULL;
460     PyObject *exception_type = NULL;
461     PyObject *exception_value = NULL;
462     PyTracebackObject *exception_tb = NULL;
463     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
464     PyObject *exception_keeper_type_1;
465     PyObject *exception_keeper_value_1;
466     PyTracebackObject *exception_keeper_tb_1;
467     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
468     PyObject *exception_keeper_type_2;
469     PyObject *exception_keeper_value_2;
470     PyTracebackObject *exception_keeper_tb_2;
471     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
472     PyObject *tmp_assign_source_1;
473     PyObject *tmp_assign_source_2;
474     PyObject *tmp_expression_name_1;
475     PyObject *tmp_next_source_1;
476     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
477     static struct Nuitka_FrameObject *cache_frame_generator = NULL;
478  
479     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
480  
481     // Dispatch to yield based on return label index:
482  
483  
484     // Actual function code.
485     // Tried code:
486     MAKE_OR_REUSE_FRAME( cache_frame_generator, codeobj_70654a8f5d42eb19c74fab721ae03f5c, module___main__, sizeof(void *)+sizeof(void *) );
487     generator->m_frame = cache_frame_generator;
488  
489     // Mark the frame object as in use, ref count 1 will be up for reuse.
490     Py_INCREF( generator->m_frame );
491     assert( Py_REFCNT( generator->m_frame ) == 2 ); // Frame stack
492  
493 #if PYTHON_VERSION >= 340
494     generator->m_frame->m_frame.f_gen = (PyObject *)generator;
495 #endif
496  
497     Py_CLEAR( generator->m_frame->m_frame.f_back );
498  
499     generator->m_frame->m_frame.f_back = PyThreadState_GET()->frame;
500     Py_INCREF( generator->m_frame->m_frame.f_back );
501  
502     PyThreadState_GET()->frame = &generator->m_frame->m_frame;
503     Py_INCREF( generator->m_frame );
504  
505     Nuitka_Frame_MarkAsExecuting( generator->m_frame );
506  
507 #if PYTHON_VERSION >= 300
508     // Accept currently existing exception as the one to publish again when we
509     // yield or yield from.
510  
511     PyThreadState *thread_state = PyThreadState_GET();
512  
513     generator->m_frame->m_frame.f_exc_type = thread_state->exc_type;
514     if ( generator->m_frame->m_frame.f_exc_type == Py_None ) generator->m_frame->m_frame.f_exc_type = NULL;
515     Py_XINCREF( generator->m_frame->m_frame.f_exc_type );
516     generator->m_frame->m_frame.f_exc_value = thread_state->exc_value;
517     Py_XINCREF( generator->m_frame->m_frame.f_exc_value );
518     generator->m_frame->m_frame.f_exc_traceback = thread_state->exc_traceback;
519     Py_XINCREF( generator->m_frame->m_frame.f_exc_traceback );
520 #endif
521  
522     // Framed code:
523     // Tried code:
524     loop_start_1:;
525     if ( generator->m_closure[0] == NULL )
526     {
527         tmp_next_source_1 = NULL;
528     }
529     else
530     {
531         tmp_next_source_1 = PyCell_GET( generator->m_closure[0] );
532     }
533  
534     CHECK_OBJECT( tmp_next_source_1 );
535     tmp_assign_source_1 = ITERATOR_NEXT( tmp_next_source_1 );
536     if ( tmp_assign_source_1 == NULL )
537     {
538         if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
539         {
540  
541             goto loop_end_1;
542         }
543         else
544         {
545  
546             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
547             type_description_1 = "No";
548             exception_lineno = 24;
549             goto try_except_handler_2;
550         }
551     }
552  
553     {
554         PyObject *old = tmp_iter_value_0;
555         tmp_iter_value_0 = tmp_assign_source_1;
556         Py_XDECREF( old );
557     }
558  
559     tmp_assign_source_2 = tmp_iter_value_0;
560  
561     CHECK_OBJECT( tmp_assign_source_2 );
562     {
563         PyObject *old = var_x;
564         var_x = tmp_assign_source_2;
565         Py_INCREF( var_x );
566         Py_XDECREF( old );
567     }
568  
569     tmp_expression_name_1 = var_x;
570  
571     CHECK_OBJECT( tmp_expression_name_1 );
572     Py_INCREF( tmp_expression_name_1 );
573     tmp_unused = GENERATOR_YIELD( generator, tmp_expression_name_1 );
574     if ( tmp_unused == NULL )
575     {
576         assert( ERROR_OCCURRED() );
577  
578         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
579  
580  
581         exception_lineno = 24;
582         type_description_1 = "No";
583         goto try_except_handler_2;
584     }
585     if ( CONSIDER_THREADING() == false )
586     {
587         assert( ERROR_OCCURRED() );
588  
589         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
590  
591  
592         exception_lineno = 24;
593         type_description_1 = "No";
594         goto try_except_handler_2;
595     }
596     goto loop_start_1;
597     loop_end_1:;
598     goto try_end_1;
599     // Exception handler code:
600     try_except_handler_2:;
601     exception_keeper_type_1 = exception_type;
602     exception_keeper_value_1 = exception_value;
603     exception_keeper_tb_1 = exception_tb;
604     exception_keeper_lineno_1 = exception_lineno;
605     exception_type = NULL;
606     exception_value = NULL;
607     exception_tb = NULL;
608     exception_lineno = 0;
609  
610     Py_XDECREF( tmp_iter_value_0 );
611     tmp_iter_value_0 = NULL;
612  
613     // Re-raise.
614     exception_type = exception_keeper_type_1;
615     exception_value = exception_keeper_value_1;
616     exception_tb = exception_keeper_tb_1;
617     exception_lineno = exception_keeper_lineno_1;
618  
619     goto frame_exception_exit_1;
620     // End of try:
621     try_end_1:;
622  
623     Nuitka_Frame_MarkAsNotExecuting( generator->m_frame );
624  
625 #if PYTHON_VERSION >= 300
626     Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
627     Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
628     Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
629 #endif
630  
631     // Allow re-use of the frame again.
632     Py_DECREF( generator->m_frame );
633     goto frame_no_exception_1;
634  
635     frame_exception_exit_1:;
636  
637     // If it's not an exit exception, consider and create a traceback for it.
638     if ( !EXCEPTION_MATCH_GENERATOR( exception_type ) )
639     {
640         if ( exception_tb == NULL )
641         {
642             exception_tb = MAKE_TRACEBACK( generator->m_frame, exception_lineno );
643         }
644         else if ( exception_tb->tb_frame != &generator->m_frame->m_frame )
645         {
646             exception_tb = ADD_TRACEBACK( exception_tb, generator->m_frame, exception_lineno );
647         }
648  
649         Nuitka_Frame_AttachLocals(
650             (struct Nuitka_FrameObject *)generator->m_frame,
651             type_description_1,
652             NULL,
653             var_x
654         );
655  
656  
657         // Release cached frame.
658         if ( generator->m_frame == cache_frame_generator )
659         {
660             Py_DECREF( generator->m_frame );
661         }
662         cache_frame_generator = NULL;
663  
664         assertFrameObject( generator->m_frame );
665     }
666  
667 #if PYTHON_VERSION >= 300
668     Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
669     Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
670     Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
671 #endif
672  
673     Py_DECREF( generator->m_frame );
674     // Return the error.
675     goto try_except_handler_1;
676  
677     frame_no_exception_1:;
678  
679     goto try_end_2;
680     // Exception handler code:
681     try_except_handler_1:;
682     exception_keeper_type_2 = exception_type;
683     exception_keeper_value_2 = exception_value;
684     exception_keeper_tb_2 = exception_tb;
685     exception_keeper_lineno_2 = exception_lineno;
686     exception_type = NULL;
687     exception_value = NULL;
688     exception_tb = NULL;
689     exception_lineno = 0;
690  
691     Py_XDECREF( var_x );
692     var_x = NULL;
693  
694     // Re-raise.
695     exception_type = exception_keeper_type_2;
696     exception_value = exception_keeper_value_2;
697     exception_tb = exception_keeper_tb_2;
698     exception_lineno = exception_keeper_lineno_2;
699  
700     goto function_exception_exit;
701     // End of try:
702     try_end_2:;
703     Py_XDECREF( tmp_iter_value_0 );
704     tmp_iter_value_0 = NULL;
705  
706     Py_XDECREF( var_x );
707     var_x = NULL;
708  
709  
710 #if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
711     return NULL;
712 #else
713     generator->m_yielded = NULL;
714     return;
715 #endif
716  
717     function_exception_exit:
718     assert( exception_type );
719     RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
720  
721 #if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
722     return NULL;
723 #else
724     generator->m_yielded = NULL;
725     return;
726 #endif
727 361
728 } 362 }
729 363
730 364
731 365