Construct GeneratorExpressionCreation

Performance Diagrams

Construct GeneratorExpressionCreation 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)20487752072.9230769230769257.0CPython 2.70194.46153846153845504.11538461538464Nuitka (historic)80427559316.0407.1067563580651Nuitka (master)80278888437.53846153846143407.2860776000743Nuitka (develop)80279230559.0769230769231407.2856650928283Nuitka (factory)Construct GeneratorExpressionCreationTicks Construct GeneratorExpressionCreation 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)23979968172.9230769230769257.0CPython 3.50194.46153846153845504.11538461538464Nuitka (historic)91942553316.0409.36788848708335Nuitka (master)91897130437.53846153846143409.4146972320682Nuitka (develop)91893947559.0769230769231409.4179773376378Nuitka (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_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_tuple; n
42 static PyObject *const_str_digest_b9c4baf879ebd882d40843df3a4dead7;
43 extern PyObject *const_int_0; 38 extern PyObject *const_int_0;
44 static PyObject *const_xrange_0_50000; 39 static PyObject *const_xrange_0_50000;
45 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;
46 static PyObject *const_int_pos_3; 43 static PyObject *const_int_pos_3;
n 47 static PyObject *const_str_plain_gen; n
48 static PyObject *const_int_pos_50000;
49 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 44 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
50 static PyObject *const_str_plain_calledRepeatedly; 45 static PyObject *const_str_plain_calledRepeatedly;
51 static PyObject *const_str_digest_4ad97686e80c96e2f990d83666a8d6e1; 46 static PyObject *const_str_digest_4ad97686e80c96e2f990d83666a8d6e1;
52 static PyObject *const_str_angle_module; 47 static PyObject *const_str_angle_module;
53 static PyObject *const_str_plain_x; 48 static PyObject *const_str_plain_x;
54 extern PyObject *const_tuple_empty; 49 extern PyObject *const_tuple_empty;
55 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 50 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
56 static PyObject *const_tuple_str_plain_gen_str_plain_x_tuple; 51 static PyObject *const_tuple_str_plain_gen_str_plain_x_tuple;
n 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_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_tuple = PyTuple_New( 1 );
73     const_str_digest_b9c4baf879ebd882d40843df3a4dead7 = UNSTREAM_STRING( &constant_bin[ 46 ], 2, 1 );
74     PyTuple_SET_ITEM( const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_tuple, 0, const_str_digest_b9c4baf879ebd882d40843df3a4dead7 ); Py_INCREF( const_str_digest_b9c4baf879ebd882d40843df3a4dead7 );
75     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 65     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
76     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 77     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 );
78     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 69     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
n 79     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 48 ], 3, 0 ); n 70     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 14 ], 3, 0 );
80     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 81     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 0 ], 16, 1 ); n 72     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 17 ], 16, 1 );
82     const_str_digest_4ad97686e80c96e2f990d83666a8d6e1 = UNSTREAM_STRING( &constant_bin[ 51 ], 85, 0 ); 73     const_str_digest_4ad97686e80c96e2f990d83666a8d6e1 = UNSTREAM_STRING( &constant_bin[ 33 ], 85, 0 );
83     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 136 ], 8, 0 ); 74     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 118 ], 8, 0 );
84     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 31 ], 1, 1 ); 75     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 58 ], 1, 1 );
85     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 );
86     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 );
87     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 n 79     const_int_pos_2 = PyLong_FromUnsignedLong( 2ul );
80     const_tuple_int_pos_1_int_pos_2_int_pos_3_tuple = PyTuple_New( 3 );
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 );
88 84
89     constants_created = true; 85     constants_created = true;
90 } 86 }
91 87
92 #ifndef __NUITKA_NO_ASSERT__ 88 #ifndef __NUITKA_NO_ASSERT__
98 94
99 } 95 }
100 #endif 96 #endif
101 97
102 // The module code objects. 98 // The module code objects.
n 103 static PyCodeObject *codeobj_75d26f3acb0ae26694c6f3f03cd7abf7; n
104 static PyCodeObject *codeobj_4032c54be2feefb705daed7cb1072177; 99 static PyCodeObject *codeobj_4032c54be2feefb705daed7cb1072177;
105 static PyCodeObject *codeobj_4a24b5ee6944f20006d65c53ce08a166; 100 static PyCodeObject *codeobj_4a24b5ee6944f20006d65c53ce08a166;
106 /* For use in MainProgram.cpp. */ 101 /* For use in MainProgram.cpp. */
107 PyCodeObject *codeobj_main = NULL; 102 PyCodeObject *codeobj_main = NULL;
108 103
109 static void createModuleCodeObjects(void) 104 static void createModuleCodeObjects(void)
110 { 105 {
111     module_filename_obj = const_str_digest_4ad97686e80c96e2f990d83666a8d6e1; 106     module_filename_obj = const_str_digest_4ad97686e80c96e2f990d83666a8d6e1;
n 112     codeobj_75d26f3acb0ae26694c6f3f03cd7abf7 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_genexpr, 24, const_tuple_str_digest_b9c4baf879ebd882d40843df3a4dead7_tuple, 1, 0, CO_GENERATOR | CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE ); n
113     codeobj_4032c54be2feefb705daed7cb1072177 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE ); 107     codeobj_4032c54be2feefb705daed7cb1072177 = MAKE_CODEOBJ( module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE );
114     codeobj_main = codeobj_4032c54be2feefb705daed7cb1072177; 108     codeobj_main = codeobj_4032c54be2feefb705daed7cb1072177;
115     codeobj_4a24b5ee6944f20006d65c53ce08a166 = 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_4a24b5ee6944f20006d65c53ce08a166 = 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 } 110 }
117 111
118 // The module function declarations. 112 // The module function declarations.
n 119 NUITKA_LOCAL_MODULE PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_genexpr( PyObject **python_pars ); n
120  
121  
122 static void __main__$$$function_1_calledRepeatedly$$$function_1_genexpr$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator );
123  
124  
125 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ); 113 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  );
126 114
127 115
128 // The module function definitions. 116 // The module function definitions.
129 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 )
143     PyObject *exception_keeper_value_1; 131     PyObject *exception_keeper_value_1;
144     PyTracebackObject *exception_keeper_tb_1; 132     PyTracebackObject *exception_keeper_tb_1;
145     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 133     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
146     PyObject *tmp_assign_source_1; 134     PyObject *tmp_assign_source_1;
147     PyObject *tmp_assign_source_2; 135     PyObject *tmp_assign_source_2;
n 148     PyObject *tmp_dircall_arg1_1; n
149     PyObject *tmp_frame_locals; 136     PyObject *tmp_frame_locals;
150     PyObject *tmp_iter_arg_1; 137     PyObject *tmp_iter_arg_1;
151     PyObject *tmp_return_value; 138     PyObject *tmp_return_value;
152     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 139     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
153     PyObject *tmp_value_name_1; 140     PyObject *tmp_value_name_1;
157     PyFrameObject *frame_function; 144     PyFrameObject *frame_function;
158 145
159     tmp_return_value = NULL; 146     tmp_return_value = NULL;
160 147
161     // Actual function code. 148     // Actual function code.
n 162     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;
163     tmp_dircall_arg1_1 = MAKE_ITERATOR( tmp_iter_arg_1 ); 150     tmp_assign_source_1 = MAKE_ITERATOR( tmp_iter_arg_1 );
164     assert( tmp_dircall_arg1_1 != NULL );
165  
166     {
167         PyObject *dir_call_args[] = {tmp_dircall_arg1_1};
168         tmp_assign_source_1 = impl___main__$$$function_1_calledRepeatedly$$$function_1_genexpr( dir_call_args );
169     }
170     assert( tmp_assign_source_1 != NULL ); 151     assert( tmp_assign_source_1 != NULL );
171     assert( var_gen == NULL ); 152     assert( var_gen == NULL );
172     var_gen = tmp_assign_source_1; 153     var_gen = tmp_assign_source_1;
173 154
174     // Tried code: 155     // Tried code:
394 375
395     CHECK_OBJECT( tmp_return_value ); 376     CHECK_OBJECT( tmp_return_value );
396     assert( had_error || !ERROR_OCCURRED() ); 377     assert( had_error || !ERROR_OCCURRED() );
397     return tmp_return_value; 378     return tmp_return_value;
398 379
t 399 } t
400  
401  
402 NUITKA_LOCAL_MODULE PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_genexpr( PyObject **python_pars )
403 {
404 #ifndef __NUITKA_NO_ASSERT__
405     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
406     assert(!had_error); // Do not enter inlined functions with error set.
407 #endif
408  
409     // Local variable declarations.
410     struct Nuitka_CellObject *par_$0 = PyCell_NEW1( python_pars[ 0 ] );
411     PyObject *tmp_return_value;
412     tmp_return_value = NULL;
413  
414     // Actual function code.
415     // Tried code:
416     tmp_return_value = Nuitka_Generator_New(
417         __main__$$$function_1_calledRepeatedly$$$function_1_genexpr$$$genexpr_1_genexpr_context,
418         module___main__,
419         const_str_angle_genexpr,
420 #if PYTHON_VERSION >= 350
421         const_str_digest_57aac74124c55d29a6f122835861daff,
422 #endif
423         codeobj_75d26f3acb0ae26694c6f3f03cd7abf7,
424         1
425     );
426  
427     ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] = par_$0;
428     Py_INCREF( ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] );
429  
430  
431     goto try_return_handler_1;
432     // tried codes exits in all cases
433     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_genexpr );
434     return NULL;
435     // Return handler code:
436     try_return_handler_1:;
437     CHECK_OBJECT( (PyObject *)par_$0 );
438     Py_DECREF( par_$0 );
439     par_$0 = NULL;
440  
441     goto function_return_exit;
442     // End of try:
443     CHECK_OBJECT( (PyObject *)par_$0 );
444     Py_DECREF( par_$0 );
445     par_$0 = NULL;
446  
447  
448     // Return statement must have exited already.
449     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_genexpr );
450     return NULL;
451  
452     function_return_exit:
453  
454     CHECK_OBJECT( tmp_return_value );
455     assert( had_error || !ERROR_OCCURRED() );
456     return tmp_return_value;
457  
458 }
459  
460  
461  
462 static void __main__$$$function_1_calledRepeatedly$$$function_1_genexpr$$$genexpr_1_genexpr_context( struct Nuitka_GeneratorObject *generator )
463 {
464     CHECK_OBJECT( (PyObject *)generator );
465     assert( Nuitka_Generator_Check( (PyObject *)generator ) );
466  
467     // Local variable initialization
468     PyObject *var_x = NULL;
469     PyObject *tmp_iter_value_0 = NULL;
470     PyObject *exception_type = NULL, *exception_value = NULL;
471     PyTracebackObject *exception_tb = NULL;
472     NUITKA_MAY_BE_UNUSED int exception_lineno = -1;
473     PyObject *exception_keeper_type_1;
474     PyObject *exception_keeper_value_1;
475     PyTracebackObject *exception_keeper_tb_1;
476     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
477     PyObject *exception_keeper_type_2;
478     PyObject *exception_keeper_value_2;
479     PyTracebackObject *exception_keeper_tb_2;
480     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
481     PyObject *tmp_assign_source_1;
482     PyObject *tmp_assign_source_2;
483     PyObject *tmp_expression_name_1;
484     PyObject *tmp_frame_locals;
485     PyObject *tmp_next_source_1;
486     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
487     static PyFrameObject *cache_frame_generator = NULL;
488  
489  
490     // Actual function code.
491     // Tried code:
492     MAKE_OR_REUSE_FRAME( cache_frame_generator, codeobj_75d26f3acb0ae26694c6f3f03cd7abf7, module___main__ );
493     generator->m_frame = cache_frame_generator;
494     Py_INCREF( generator->m_frame );
495  
496 #if PYTHON_VERSION >= 340
497     generator->m_frame->f_gen = (PyObject *)generator;
498 #endif
499  
500     Py_CLEAR( generator->m_frame->f_back );
501  
502     generator->m_frame->f_back = PyThreadState_GET()->frame;
503     Py_INCREF( generator->m_frame->f_back );
504  
505     PyThreadState_GET()->frame = generator->m_frame;
506     Py_INCREF( generator->m_frame );
507  
508 #if PYTHON_VERSION >= 340
509     generator->m_frame->f_executing += 1;
510 #endif
511  
512 #if PYTHON_VERSION >= 300
513     // Accept currently existing exception as the one to publish again when we
514     // yield or yield from.
515  
516     PyThreadState *thread_state = PyThreadState_GET();
517  
518     generator->m_frame->f_exc_type = thread_state->exc_type;
519     if ( generator->m_frame->f_exc_type == Py_None ) generator->m_frame->f_exc_type = NULL;
520     Py_XINCREF( generator->m_frame->f_exc_type );
521     generator->m_frame->f_exc_value = thread_state->exc_value;
522     Py_XINCREF( generator->m_frame->f_exc_value );
523     generator->m_frame->f_exc_traceback = thread_state->exc_traceback;
524     Py_XINCREF( generator->m_frame->f_exc_traceback );
525 #endif
526  
527     // Framed code:
528     // Tried code:
529     loop_start_1:;
530     tmp_next_source_1 = PyCell_GET( generator->m_closure[0] );
531  
532     if ( tmp_next_source_1 == NULL )
533     {
534  
535         exception_type = PyExc_NameError;
536         Py_INCREF( exception_type );
537         exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", ".0" );
538         exception_tb = NULL;
539         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
540         CHAIN_EXCEPTION( exception_value );
541  
542         exception_lineno = 24;
543         goto try_except_handler_2;
544     }
545  
546     tmp_assign_source_1 = ITERATOR_NEXT( tmp_next_source_1 );
547     if ( tmp_assign_source_1 == NULL )
548     {
549         if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
550         {
551  
552             goto loop_end_1;
553         }
554         else
555         {
556  
557             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
558             generator->m_frame->f_lineno = 24;
559             goto try_except_handler_2;
560         }
561     }
562  
563     {
564         PyObject *old = tmp_iter_value_0;
565         tmp_iter_value_0 = tmp_assign_source_1;
566         Py_XDECREF( old );
567     }
568  
569     tmp_assign_source_2 = tmp_iter_value_0;
570  
571     {
572         PyObject *old = var_x;
573         var_x = tmp_assign_source_2;
574         Py_INCREF( var_x );
575         Py_XDECREF( old );
576     }
577  
578     tmp_expression_name_1 = var_x;
579  
580     tmp_unused = GENERATOR_YIELD( generator, INCREASE_REFCOUNT( tmp_expression_name_1 ) );
581     if ( tmp_unused == NULL )
582     {
583         assert( ERROR_OCCURRED() );
584  
585         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
586  
587  
588         exception_lineno = 24;
589         goto try_except_handler_2;
590     }
591     if ( CONSIDER_THREADING() == false )
592     {
593         assert( ERROR_OCCURRED() );
594  
595         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
596  
597  
598         exception_lineno = 24;
599         goto try_except_handler_2;
600     }
601     goto loop_start_1;
602     loop_end_1:;
603     goto try_end_1;
604     // Exception handler code:
605     try_except_handler_2:;
606     exception_keeper_type_1 = exception_type;
607     exception_keeper_value_1 = exception_value;
608     exception_keeper_tb_1 = exception_tb;
609     exception_keeper_lineno_1 = exception_lineno;
610     exception_type = NULL;
611     exception_value = NULL;
612     exception_tb = NULL;
613     exception_lineno = -1;
614  
615     Py_XDECREF( tmp_iter_value_0 );
616     tmp_iter_value_0 = NULL;
617  
618     // Re-raise.
619     exception_type = exception_keeper_type_1;
620     exception_value = exception_keeper_value_1;
621     exception_tb = exception_keeper_tb_1;
622     exception_lineno = exception_keeper_lineno_1;
623  
624     goto frame_exception_exit_1;
625     // End of try:
626     try_end_1:;
627  
628 #if PYTHON_VERSION >= 340
629     generator->m_frame->f_executing -= 1;
630 #endif
631  
632 #if PYTHON_VERSION >= 300
633     Py_CLEAR( generator->m_frame->f_exc_type );
634     Py_CLEAR( generator->m_frame->f_exc_value );
635     Py_CLEAR( generator->m_frame->f_exc_traceback );
636 #endif
637  
638     Py_DECREF( generator->m_frame );
639     goto frame_no_exception_1;
640  
641     frame_exception_exit_1:;
642  
643     // If it's not an exit exception, consider and create a traceback for it.
644     if ( !EXCEPTION_MATCH_GENERATOR( exception_type ) )
645     {
646         int needs_detach = false;
647  
648         if ( exception_tb == NULL )
649         {
650             exception_tb = MAKE_TRACEBACK( generator->m_frame, exception_lineno );
651             needs_detach = true;
652         }
653         else if ( exception_tb->tb_frame != generator->m_frame )
654         {
655             PyTracebackObject *traceback_new = MAKE_TRACEBACK( generator->m_frame, exception_lineno );
656             traceback_new->tb_next = exception_tb;
657             exception_tb = traceback_new;
658  
659             needs_detach = true;
660         }
661  
662         if (needs_detach)
663         {
664  
665             tmp_frame_locals = PyDict_New();
666             if ( generator->m_closure[0]->ob_ref )
667             {
668                 int res = PyDict_SetItem(
669                     tmp_frame_locals,
670                     const_str_digest_b9c4baf879ebd882d40843df3a4dead7,
671                     generator->m_closure[0]->ob_ref
672                 );
673  
674                 assert( res == 0 );
675             }
676  
677             if ( var_x )
678             {
679                 int res = PyDict_SetItem(
680                     tmp_frame_locals,
681                     const_str_plain_x,
682                     var_x
683                 );
684  
685                 assert( res == 0 );
686             }
687  
688  
689  
690             detachFrame( exception_tb, tmp_frame_locals );
691         }
692     }
693  
694 #if PYTHON_VERSION >= 300
695     Py_CLEAR( generator->m_frame->f_exc_type );
696     Py_CLEAR( generator->m_frame->f_exc_value );
697     Py_CLEAR( generator->m_frame->f_exc_traceback );
698 #endif
699  
700     Py_DECREF( generator->m_frame );
701     // Return the error.
702     goto try_except_handler_1;
703  
704     frame_no_exception_1:;
705  
706     goto try_end_2;
707     // Exception handler code:
708     try_except_handler_1:;
709     exception_keeper_type_2 = exception_type;
710     exception_keeper_value_2 = exception_value;
711     exception_keeper_tb_2 = exception_tb;
712     exception_keeper_lineno_2 = exception_lineno;
713     exception_type = NULL;
714     exception_value = NULL;
715     exception_tb = NULL;
716     exception_lineno = -1;
717  
718     Py_XDECREF( var_x );
719     var_x = NULL;
720  
721     // Re-raise.
722     exception_type = exception_keeper_type_2;
723     exception_value = exception_keeper_value_2;
724     exception_tb = exception_keeper_tb_2;
725     exception_lineno = exception_keeper_lineno_2;
726  
727     goto function_exception_exit;
728     // End of try:
729     try_end_2:;
730     Py_XDECREF( tmp_iter_value_0 );
731     tmp_iter_value_0 = NULL;
732  
733     Py_XDECREF( var_x );
734     var_x = NULL;
735  
736  
737     generator->m_yielded = NULL;
738     return;
739  
740     function_exception_exit:
741     assert( exception_type );
742     RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
743     generator->m_yielded = NULL;
744     return;
745 } 380 }
746 381
747 382
748 383
749 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ) 384 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  )