Construct GeneratorExpressionCreation

Performance Diagrams

Construct GeneratorExpressionCreation 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)20487752072.9230769230769257.0CPython 2.70194.46153846153845504.11538461538464Nuitka (historic)80279746316.0407.2850427134747Nuitka (master)80277178437.53846153846143407.28814013630415Nuitka (develop)80230031559.0769230769231407.3450070343341Nuitka (factory)Construct GeneratorExpressionCreationTicks Construct GeneratorExpressionCreation 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)23979968172.9230769230769257.0CPython 3.50194.46153846153845504.11538461538464Nuitka (historic)91895111316.0409.41677782683576Nuitka (master)91885977437.53846153846143409.42619048290624Nuitka (develop)91633427559.0769230769231409.686445167668Nuitka (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_digest_fdd0e79779157a3fb2b1a3f3b0764ab1; 45 static PyObject *const_str_digest_fdd0e79779157a3fb2b1a3f3b0764ab1;
50 static PyObject *const_str_plain_calledRepeatedly; 46 static PyObject *const_str_plain_calledRepeatedly;
51 static PyObject *const_str_angle_module; 47 static PyObject *const_str_angle_module;
52 static PyObject *const_str_plain_x; 48 static PyObject *const_str_plain_x;
53 extern PyObject *const_tuple_empty; 49 extern PyObject *const_tuple_empty;
54 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 50 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
55 static PyObject *const_tuple_str_plain_gen_str_plain_x_tuple; 51 static PyObject *const_tuple_str_plain_gen_str_plain_x_tuple;
n 56 static PyObject *const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_str_plain_x_tuple; n 52 static PyObject *const_int_pos_2;
57 extern PyObject *const_str_plain___loader__; 53 extern PyObject *const_str_plain___loader__;
58 extern PyObject *const_str_plain___main__; 54 extern PyObject *const_str_plain___main__;
n n 55 static PyObject *const_tuple_int_pos_1_int_pos_2_int_pos_3_tuple;
59 extern PyObject *const_str_plain___doc__; 56 extern PyObject *const_str_plain___doc__;
60 extern PyObject *const_str_plain___cached__; 57 extern PyObject *const_str_plain___cached__;
61 static PyObject *module_filename_obj; 58 static PyObject *module_filename_obj;
62 59
63 static bool constants_created = false; 60 static bool constants_created = false;
64 61
65 static void createModuleConstants( void ) 62 static void createModuleConstants( void )
66 { 63 {
n 67     const_str_digest_57aac74124c55d29a6f122835861daff = UNSTREAM_STRING( &constant_bin[ 0 ], 35, 0 ); n
68     const_str_plain___package__ = UNSTREAM_STRING( &constant_bin[ 35 ], 11, 1 ); 64     const_str_plain___package__ = UNSTREAM_STRING( &constant_bin[ 0 ], 11, 1 );
69     const_str_angle_genexpr = UNSTREAM_STRING( &constant_bin[ 26 ], 9, 0 );
70     const_int_pos_3 = PyLong_FromUnsignedLong( 3ul );
71     const_xrange_0_3 = BUILTIN_XRANGE3( const_int_0, const_int_pos_3, const_int_pos_1 );
72     const_str_digest_b9c4baf879ebd882d40843df3a4dead7 = UNSTREAM_STRING( &constant_bin[ 46 ], 2, 1 );
73     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 65     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
74     const_xrange_0_50000 = BUILTIN_XRANGE3( const_int_0, const_int_pos_50000, const_int_pos_1 ); 66     const_xrange_0_50000 = BUILTIN_XRANGE3( const_int_0, const_int_pos_50000, const_int_pos_1 );
n 75     const_str_plain_gen = UNSTREAM_STRING( &constant_bin[ 27 ], 3, 1 ); n 67     const_str_plain_gen = UNSTREAM_STRING( &constant_bin[ 11 ], 3, 1 );
68     const_int_pos_3 = PyLong_FromUnsignedLong( 3ul );
76     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 69     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
n 77     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 48 ], 3, 0 ); n 70     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 14 ], 3, 0 );
78     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 71     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
n 79     const_str_digest_fdd0e79779157a3fb2b1a3f3b0764ab1 = UNSTREAM_STRING( &constant_bin[ 51 ], 85, 0 ); n 72     const_str_digest_fdd0e79779157a3fb2b1a3f3b0764ab1 = UNSTREAM_STRING( &constant_bin[ 17 ], 85, 0 );
80     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 0 ], 16, 1 ); 73     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 102 ], 16, 1 );
81     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 136 ], 8, 0 ); 74     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 118 ], 8, 0 );
82     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 31 ], 1, 1 ); 75     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 42 ], 1, 1 );
83     const_tuple_str_plain_gen_str_plain_x_tuple = PyTuple_New( 2 ); 76     const_tuple_str_plain_gen_str_plain_x_tuple = PyTuple_New( 2 );
84     PyTuple_SET_ITEM( const_tuple_str_plain_gen_str_plain_x_tuple, 0, const_str_plain_gen ); Py_INCREF( const_str_plain_gen ); 77     PyTuple_SET_ITEM( const_tuple_str_plain_gen_str_plain_x_tuple, 0, const_str_plain_gen ); Py_INCREF( const_str_plain_gen );
85     PyTuple_SET_ITEM( const_tuple_str_plain_gen_str_plain_x_tuple, 1, const_str_plain_x ); Py_INCREF( const_str_plain_x ); 78     PyTuple_SET_ITEM( const_tuple_str_plain_gen_str_plain_x_tuple, 1, const_str_plain_x ); Py_INCREF( const_str_plain_x );
n 86     const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_str_plain_x_tuple = PyTuple_New( 2 ); n 79     const_int_pos_2 = PyLong_FromUnsignedLong( 2ul );
87     PyTuple_SET_ITEM( const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_str_plain_x_tuple, 0, const_str_digest_b9c4baf879ebd882d40843df3a4dead7 ); Py_INCREF( const_str_digest_b9c4baf879ebd882d40843df3a4dead7 ); 80     const_tuple_int_pos_1_int_pos_2_int_pos_3_tuple = PyTuple_New( 3 );
88     PyTuple_SET_ITEM( const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_str_plain_x_tuple, 1, const_str_plain_x ); Py_INCREF( const_str_plain_x ); 81     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 );
82     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 );
83     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 );
89 84
90     constants_created = true; 85     constants_created = true;
91 } 86 }
92 87
93 #ifndef __NUITKA_NO_ASSERT__ 88 #ifndef __NUITKA_NO_ASSERT__
99 94
100 } 95 }
101 #endif 96 #endif
102 97
103 // The module code objects. 98 // The module code objects.
n 104 static PyCodeObject *codeobj_53cc968c71da986fd0cc77877c48e219; n
105 static PyCodeObject *codeobj_780c5f46ef1f8d1e4c85117283f1500c; 99 static PyCodeObject *codeobj_780c5f46ef1f8d1e4c85117283f1500c;
106 static PyCodeObject *codeobj_de0258b6abeb3dce5417dc641e4acf90; 100 static PyCodeObject *codeobj_de0258b6abeb3dce5417dc641e4acf90;
107 /* For use in "MainProgram.c". */ 101 /* For use in "MainProgram.c". */
108 PyCodeObject *codeobj_main = NULL; 102 PyCodeObject *codeobj_main = NULL;
109 103
110 static void createModuleCodeObjects(void) 104 static void createModuleCodeObjects(void)
111 { 105 {
112     module_filename_obj = const_str_digest_fdd0e79779157a3fb2b1a3f3b0764ab1; 106     module_filename_obj = const_str_digest_fdd0e79779157a3fb2b1a3f3b0764ab1;
n 113     codeobj_53cc968c71da986fd0cc77877c48e219 = 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
114     codeobj_780c5f46ef1f8d1e4c85117283f1500c = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE ); 107     codeobj_780c5f46ef1f8d1e4c85117283f1500c = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE );
115     codeobj_main = codeobj_780c5f46ef1f8d1e4c85117283f1500c; 108     codeobj_main = codeobj_780c5f46ef1f8d1e4c85117283f1500c;
116     codeobj_de0258b6abeb3dce5417dc641e4acf90 = 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 ); 109     codeobj_de0258b6abeb3dce5417dc641e4acf90 = 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 } 110 }
118 111
119 // The module function declarations. 112 // The module function declarations.
n 120 NUITKA_LOCAL_MODULE PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_genexpr( PyObject **python_pars ); n
121  
122  
123 static void __main__$$$function_1_calledRepeatedly$$$function_1_genexpr$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator );
124  
125  
126 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ); 113 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  );
127 114
128 115
129 // The module function definitions. 116 // The module function definitions.
130 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) 117 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
144     PyObject *exception_keeper_value_1; 131     PyObject *exception_keeper_value_1;
145     PyTracebackObject *exception_keeper_tb_1; 132     PyTracebackObject *exception_keeper_tb_1;
146     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 133     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
147     PyObject *tmp_assign_source_1; 134     PyObject *tmp_assign_source_1;
148     PyObject *tmp_assign_source_2; 135     PyObject *tmp_assign_source_2;
n 149     PyObject *tmp_dircall_arg1_1; n
150     PyObject *tmp_iter_arg_1; 136     PyObject *tmp_iter_arg_1;
151     PyObject *tmp_return_value; 137     PyObject *tmp_return_value;
152     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 138     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
153     PyObject *tmp_value_name_1; 139     PyObject *tmp_value_name_1;
154     PyObject *tmp_value_name_2; 140     PyObject *tmp_value_name_2;
158 144
159     char const *type_description; 145     char const *type_description;
160     tmp_return_value = NULL; 146     tmp_return_value = NULL;
161 147
162     // Actual function code. 148     // Actual function code.
n 163     tmp_iter_arg_1 = const_xrange_0_3; n 149     tmp_iter_arg_1 = const_tuple_int_pos_1_int_pos_2_int_pos_3_tuple;
164     tmp_dircall_arg1_1 = MAKE_ITERATOR( tmp_iter_arg_1 ); 150     tmp_assign_source_1 = MAKE_ITERATOR( tmp_iter_arg_1 );
165     assert( tmp_dircall_arg1_1 != NULL );
166  
167     {
168         PyObject *dir_call_args[] = {tmp_dircall_arg1_1};
169         tmp_assign_source_1 = impl___main__$$$function_1_calledRepeatedly$$$function_1_genexpr( dir_call_args );
170     }
171     assert( tmp_assign_source_1 != NULL ); 151     assert( tmp_assign_source_1 != NULL );
172     assert( var_gen == NULL ); 152     assert( var_gen == NULL );
173     var_gen = tmp_assign_source_1; 153     var_gen = tmp_assign_source_1;
174 154
175     // Tried code: 155     // Tried code:
361 341
362     CHECK_OBJECT( tmp_return_value ); 342     CHECK_OBJECT( tmp_return_value );
363     assert( had_error || !ERROR_OCCURRED() ); 343     assert( had_error || !ERROR_OCCURRED() );
364     return tmp_return_value; 344     return tmp_return_value;
365 345
t 366 } t
367  
368  
369 NUITKA_LOCAL_MODULE PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_genexpr( PyObject **python_pars )
370 {
371 #ifndef __NUITKA_NO_ASSERT__
372     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
373     assert(!had_error); // Do not enter inlined functions with error set.
374 #endif
375  
376     // Local variable declarations.
377     struct Nuitka_CellObject *par_$0 = PyCell_NEW1( python_pars[ 0 ] );
378     PyObject *tmp_return_value;
379     tmp_return_value = NULL;
380  
381     // Actual function code.
382     // Tried code:
383     tmp_return_value = Nuitka_Generator_New(
384         __main__$$$function_1_calledRepeatedly$$$function_1_genexpr$$$genexpr_1_genexpr_context,
385         module___main__,
386         const_str_angle_genexpr,
387 #if PYTHON_VERSION >= 350
388         const_str_digest_57aac74124c55d29a6f122835861daff,
389 #endif
390         codeobj_53cc968c71da986fd0cc77877c48e219,
391         1
392     );
393  
394     ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] = par_$0;
395     Py_INCREF( ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] );
396  
397  
398     goto try_return_handler_1;
399     // tried codes exits in all cases
400     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_genexpr );
401     return NULL;
402     // Return handler code:
403     try_return_handler_1:;
404     CHECK_OBJECT( (PyObject *)par_$0 );
405     Py_DECREF( par_$0 );
406     par_$0 = NULL;
407  
408     goto function_return_exit;
409     // End of try:
410     CHECK_OBJECT( (PyObject *)par_$0 );
411     Py_DECREF( par_$0 );
412     par_$0 = NULL;
413  
414  
415     // Return statement must have exited already.
416     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_genexpr );
417     return NULL;
418  
419     function_return_exit:
420  
421     CHECK_OBJECT( tmp_return_value );
422     assert( had_error || !ERROR_OCCURRED() );
423     return tmp_return_value;
424  
425 }
426  
427  
428  
429 static void __main__$$$function_1_calledRepeatedly$$$function_1_genexpr$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator )
430 {
431     CHECK_OBJECT( (PyObject *)generator );
432     assert( Nuitka_Generator_Check( (PyObject *)generator ) );
433  
434     // Local variable initialization
435     PyObject *var_x = NULL;
436     PyObject *tmp_iter_value_0 = NULL;
437     PyObject *exception_type = NULL, *exception_value = NULL;
438     PyTracebackObject *exception_tb = NULL;
439     NUITKA_MAY_BE_UNUSED int exception_lineno = -1;
440     PyObject *exception_keeper_type_1;
441     PyObject *exception_keeper_value_1;
442     PyTracebackObject *exception_keeper_tb_1;
443     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
444     PyObject *exception_keeper_type_2;
445     PyObject *exception_keeper_value_2;
446     PyTracebackObject *exception_keeper_tb_2;
447     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
448     PyObject *tmp_assign_source_1;
449     PyObject *tmp_assign_source_2;
450     PyObject *tmp_expression_name_1;
451     PyObject *tmp_next_source_1;
452     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
453     static struct Nuitka_FrameObject *cache_frame_generator = NULL;
454  
455     char const *type_description;
456  
457     // Actual function code.
458     // Tried code:
459     MAKE_OR_REUSE_FRAME( cache_frame_generator, codeobj_53cc968c71da986fd0cc77877c48e219, module___main__, sizeof(struct Nuitka_CellObject *)+sizeof(PyObject *) );
460     generator->m_frame = cache_frame_generator;
461  
462     // Mark the frame object as in use, ref count 1 will be up for reuse.
463     Py_INCREF( generator->m_frame );
464     assert( Py_REFCNT( generator->m_frame ) == 2 ); // Frame stack
465  
466 #if PYTHON_VERSION >= 340
467     generator->m_frame->m_frame.f_gen = (PyObject *)generator;
468 #endif
469  
470     Py_CLEAR( generator->m_frame->m_frame.f_back );
471  
472     generator->m_frame->m_frame.f_back = PyThreadState_GET()->frame;
473     Py_INCREF( generator->m_frame->m_frame.f_back );
474  
475     PyThreadState_GET()->frame = &generator->m_frame->m_frame;
476     Py_INCREF( generator->m_frame );
477  
478     Nuitka_Frame_MarkAsExecuting( generator->m_frame );
479  
480 #if PYTHON_VERSION >= 300
481     // Accept currently existing exception as the one to publish again when we
482     // yield or yield from.
483  
484     PyThreadState *thread_state = PyThreadState_GET();
485  
486     generator->m_frame->m_frame.f_exc_type = thread_state->exc_type;
487     if ( generator->m_frame->m_frame.f_exc_type == Py_None ) generator->m_frame->m_frame.f_exc_type = NULL;
488     Py_XINCREF( generator->m_frame->m_frame.f_exc_type );
489     generator->m_frame->m_frame.f_exc_value = thread_state->exc_value;
490     Py_XINCREF( generator->m_frame->m_frame.f_exc_value );
491     generator->m_frame->m_frame.f_exc_traceback = thread_state->exc_traceback;
492     Py_XINCREF( generator->m_frame->m_frame.f_exc_traceback );
493 #endif
494  
495     // Framed code:
496     // Tried code:
497     loop_start_1:;
498     tmp_next_source_1 = PyCell_GET( generator->m_closure[0] );
499  
500     if ( tmp_next_source_1 == NULL )
501     {
502  
503         exception_type = PyExc_NameError;
504         Py_INCREF( exception_type );
505         exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", ".0" );
506         exception_tb = NULL;
507         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
508         CHAIN_EXCEPTION( exception_value );
509  
510         exception_lineno = 24;
511         type_description = "co";
512         goto try_except_handler_2;
513     }
514  
515     tmp_assign_source_1 = ITERATOR_NEXT( tmp_next_source_1 );
516     if ( tmp_assign_source_1 == NULL )
517     {
518         if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
519         {
520  
521             goto loop_end_1;
522         }
523         else
524         {
525  
526             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
527             type_description = "co";
528             generator->m_frame->m_frame.f_lineno = 24;
529             goto try_except_handler_2;
530         }
531     }
532  
533     {
534         PyObject *old = tmp_iter_value_0;
535         tmp_iter_value_0 = tmp_assign_source_1;
536         Py_XDECREF( old );
537     }
538  
539     tmp_assign_source_2 = tmp_iter_value_0;
540  
541     {
542         PyObject *old = var_x;
543         var_x = tmp_assign_source_2;
544         Py_INCREF( var_x );
545         Py_XDECREF( old );
546     }
547  
548     tmp_expression_name_1 = var_x;
549  
550     tmp_unused = GENERATOR_YIELD( generator, INCREASE_REFCOUNT( tmp_expression_name_1 ) );
551     if ( tmp_unused == NULL )
552     {
553         assert( ERROR_OCCURRED() );
554  
555         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
556  
557  
558         exception_lineno = 24;
559         type_description = "co";
560         goto try_except_handler_2;
561     }
562     if ( CONSIDER_THREADING() == false )
563     {
564         assert( ERROR_OCCURRED() );
565  
566         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
567  
568  
569         exception_lineno = 24;
570         type_description = "co";
571         goto try_except_handler_2;
572     }
573     goto loop_start_1;
574     loop_end_1:;
575     goto try_end_1;
576     // Exception handler code:
577     try_except_handler_2:;
578     exception_keeper_type_1 = exception_type;
579     exception_keeper_value_1 = exception_value;
580     exception_keeper_tb_1 = exception_tb;
581     exception_keeper_lineno_1 = exception_lineno;
582     exception_type = NULL;
583     exception_value = NULL;
584     exception_tb = NULL;
585     exception_lineno = -1;
586  
587     Py_XDECREF( tmp_iter_value_0 );
588     tmp_iter_value_0 = NULL;
589  
590     // Re-raise.
591     exception_type = exception_keeper_type_1;
592     exception_value = exception_keeper_value_1;
593     exception_tb = exception_keeper_tb_1;
594     exception_lineno = exception_keeper_lineno_1;
595  
596     goto frame_exception_exit_1;
597     // End of try:
598     try_end_1:;
599  
600     Nuitka_Frame_MarkAsNotExecuting( generator->m_frame );
601  
602 #if PYTHON_VERSION >= 300
603     Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
604     Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
605     Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
606 #endif
607  
608     // Allow re-use of the frame again.
609     Py_DECREF( generator->m_frame );
610     goto frame_no_exception_1;
611  
612     frame_exception_exit_1:;
613  
614     // If it's not an exit exception, consider and create a traceback for it.
615     if ( !EXCEPTION_MATCH_GENERATOR( exception_type ) )
616     {
617         if ( exception_tb == NULL )
618         {
619             exception_tb = MAKE_TRACEBACK( generator->m_frame, exception_lineno );
620         }
621         else if ( exception_tb->tb_frame != &generator->m_frame->m_frame )
622         {
623             exception_tb = ADD_TRACEBACK( exception_tb, generator->m_frame, exception_lineno );
624         }
625  
626         Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)generator->m_frame, type_description ,generator->m_closure[0], var_x );
627  
628         // Release cached frame.
629         if ( generator->m_frame == cache_frame_generator )
630         {
631             Py_DECREF( generator->m_frame );
632         }
633         cache_frame_generator = NULL;
634  
635         assertFrameObject( generator->m_frame );
636     }
637  
638 #if PYTHON_VERSION >= 300
639     Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
640     Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
641     Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
642 #endif
643  
644     Py_DECREF( generator->m_frame );
645     // Return the error.
646     goto try_except_handler_1;
647  
648     frame_no_exception_1:;
649  
650     goto try_end_2;
651     // Exception handler code:
652     try_except_handler_1:;
653     exception_keeper_type_2 = exception_type;
654     exception_keeper_value_2 = exception_value;
655     exception_keeper_tb_2 = exception_tb;
656     exception_keeper_lineno_2 = exception_lineno;
657     exception_type = NULL;
658     exception_value = NULL;
659     exception_tb = NULL;
660     exception_lineno = -1;
661  
662     Py_XDECREF( var_x );
663     var_x = NULL;
664  
665     // Re-raise.
666     exception_type = exception_keeper_type_2;
667     exception_value = exception_keeper_value_2;
668     exception_tb = exception_keeper_tb_2;
669     exception_lineno = exception_keeper_lineno_2;
670  
671     goto function_exception_exit;
672     // End of try:
673     try_end_2:;
674     Py_XDECREF( tmp_iter_value_0 );
675     tmp_iter_value_0 = NULL;
676  
677     Py_XDECREF( var_x );
678     var_x = NULL;
679  
680  
681     generator->m_yielded = NULL;
682     return;
683  
684     function_exception_exit:
685     assert( exception_type );
686     RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
687     generator->m_yielded = NULL;
688     return;
689 } 346 }
690 347
691 348
692 349
693 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ) 350 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  )