
    SLh                       d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZmZm	Z	 d dl
mZmZmZ d dlmZmZ d dlmZmZmZmZ d dlmZmZmZmZ d dlmZ d dlmZ ed	v rd d
lmZ  nedv rn e!e       G d de"      Z# ejH                  e%      Z& G d de"      Z'd Z(d Z)d Z*d Z+d Z,d Z-d Z.d Z/d Z0d Z1d Z2 G d de"      Z3ed	v r G d de4      Z5yedv ry e!e      )    N)errorsirconfig)NotDefinedErrorUnsupportedBytecodeErrorerror_extras)get_definitionguard)	PYVERSIONBINOPS_TO_OPERATORSINPLACE_BINOPS_TO_OPERATORS_lazy_pformat)FlowAdaptDFAAdaptCFA	BlockKind)eh)unpack_single_tuple      r      )CALL_INTRINSIC_1_Operandr   
   r      c                       e Zd ZdZd Zd Zy)_UNKNOWN_VALUEzNRepresents an unknown value, this is for ease of debugging purposes only.
    c                     || _         y N)_varname)selfvarnames     Q/var/www/html/whisper/venv/lib/python3.12/site-packages/numba/core/interpreter.py__init__z_UNKNOWN_VALUE.__init__#   s	        c                 8    dj                  | j                        S )Nz_UNKNOWN_VALUE({}))formatr%   r&   s    r(   __repr__z_UNKNOWN_VALUE.__repr__&   s    #**4==99r*   N)__name__
__module____qualname____doc__r)   r.    r*   r(   r"   r"      s     :r*   r"   c                   "    e Zd ZdZd Zd Zd Zy)Assignera  
    This object keeps track of potential assignment simplifications
    inside a code block.
    For example `$O.1 = x` followed by `y = $0.1` can be simplified
    into `y = x`, but it's not possible anymore if we have `x = z`
    in-between those two instructions.

    NOTE: this is not only an optimization, but is actually necessary
    due to certain limitations of Numba - such as only accepting the
    returning of an array passed as function argument.
    c                 l    i | _         t        j                  t              | _        t               | _        y r$   )dest_to_srccollectionsdefaultdictlistsrc_invalidatesetunused_destsr-   s    r(   r)   zAssigner.__init__:   s)     *55d;Er*   c                    |j                   }|j                   }|| j                  v r;| j                  j                  |      D ]  }| j                  j                  |        || j                  v r| j                  |   }|j                  rH|| j                  |<   | j                  |   j                  |       | j                  j                  |       |S )z
        Assign *srcvar* to *destvar*. Return either *srcvar* or a possible
        simplified assignment source (earlier assigned to *srcvar*).
        )namer;   popr7   is_tempappendr=   add)r&   srcvardestvarsrcnamedestnameds         r(   assignzAssigner.assignB   s    
 ++<<t*** ((,,X6 (  $$Q'(d&&&%%g.F??)/DX&(//9!!(+r*   c                 t    || j                   v r| j                   |   S | j                  j                  |       y)zu
        Get a possible assignment source (a ir.Var instance) to replace
        *destname*, otherwise None.
        N)r7   r=   discard)r&   rG   s     r(   get_assignment_sourcezAssigner.get_assignment_sourceV   s:    
 t'''##H--!!(+r*   N)r/   r0   r1   r2   r)   rI   rL   r3   r*   r(   r5   r5   -   s    
"(r*   r5   c                     | |   j                   j                  }| |   j                  }||j                  |   v r3|j                  |   j	                  |       ||   j                  |       y|||   vrt        d      y)a  
    Deletes the definition defined for old_body at index idx
    from func_ir. We assume this stmt will be deleted from
    new_body.

    In some optimizations we may update the same variable multiple times.
    In this situation, we only need to delete a particular definition once,
    this is tracked in already_deleted_def, which is a map from
    assignment name to the set of values that have already been
    deleted.
    zInconsistency found in the definitions while executing a peephole optimization. This suggests an internal error or inconsistency elsewhere in the compiler.N)targetr?   value_definitionsremoverC   r   )old_bodyidxfunc_iralready_deleted_defslhsrhss         r(   _remove_assignment_definitionrX   a   s     3-


#
#C
3-

C
g""3''S!((-S!%%c*	(-	-&A
 	
 
.r*   c                     |j                   j                         }|j                  }|j                         D ]  \  }}	|||	   d   f||	<    d||<   t        | |||       |S )a  
    Extracts the kws args passed as varkwarg
    for CALL_FUNCTION_EX. This pass is taken when
    n_kws <= 15 and the bytecode looks like:

        # Start for each argument
        LOAD_FAST  # Load each argument.
        # End for each argument
        ...
        BUILD_CONST_KEY_MAP # Build a map

    In the generated IR, the varkwarg refers
    to a single build_map that contains all of the
    kws. In addition to returning the kws, this
    function updates new_body to remove all usage
    of the map.
       N)itemscopyvalue_indexesrX   )
rR   keyword_exprnew_bodybuildmap_idxrT   rU   kwsr]   keyindexs
             r(   #_call_function_ex_replace_kws_smallrd   z   s|    2 


!
!
#C !..M#))+ *
U3u:a=)E
* "H\!,)= Jr*   c                 d   d||<   t        | |||       g }|dz   }	|	|k  r| |	   }
t        |
t        j                        r$t        |
j                  t        j
                        st        |      |
j                  j                  }|
j                  j                  }|	dz  }	d}|	|k  r|s| |	   }t        |t        j                        r|t        |j                  t        j                        rX|j                  j                  dk(  r?|j                  j                  j                  |k(  r|j                  j                  dk(  rd}n|	dz  }	|	|k  r|s|r|	|k(  rt        |      | |	dz      }t        |t        j                        rt        |j                  t        j                        r|j                  j                  dk(  r|j                  j                  j                  j                  j                  k(  rHt        |j                  j                        dk(  r&|j                  j                  d	   j                  |k(  st        |      |j                  j                  d   }|j                  ||f       d||	<   d||	dz   <   t        | |	||       t        | |	dz   ||       |	dz  }	|	|k  r|S )
a  
    Extracts the kws args passed as varkwarg
    for CALL_FUNCTION_EX. This pass is taken when
    n_kws > 15 and the bytecode looks like:

        BUILD_MAP # Construct the map
        # Start for each argument
        LOAD_CONST # Load a constant for the name of the argument
        LOAD_FAST  # Load each argument.
        MAP_ADD # Append the (key, value) pair to the map
        # End for each argument

    In the IR generated, the initial build map is empty and a series
    of setitems are applied afterwards. THE IR looks like:

        $build_map_var = build_map(items=[])
        $constvar = const(str, ...) # create the const key
        # CREATE THE ARGUMENT, This may take multiple lines.
        $created_arg = ...
        $var = getattr(
            value=$build_map_var,
            attr=__setitem__,
        )
        $unused_var = call $var($constvar, $created_arg)

    We iterate through the IR, deleting all usages of the buildmap
    from the new_body, and adds the kws to a new kws list.
    NrZ   Fgetattr__setitem__Tcall   r   )rX   
isinstancer   AssignrO   Constr   rN   r?   ExpropattrfunclenargsrB   )rR   buildmap_namer`   
search_endr_   rT   errmsgrU   ra   search_start
const_stmtkey_var_namekey_valfound_getattrgetattr_stmtsetitem_stmtarg_vars                    r(   #_call_function_ex_replace_kws_larger~      s   N "H\!,)= C!#L
*
$l+
z299-:++RXX6 +622!((--""((J&!#L1L<3|11277; &&))Y6 &&,,11$% !&&++}< $$ !A J&!B z) +622q 01|RYY/<--rww7""%%/""'',,&&++, L&&++,1""''*//  +622$$))!,

GW%&!%%)!"%lG-A	
 	&lQ&1E	
 	s *
$t Jr*   c                 @    d||<   t        | |||       |j                  S )a  
    Extracts the args passed as vararg
    for CALL_FUNCTION_EX. This pass is taken when
    n_args <= 30 and the bytecode looks like:

        # Start for each argument
        LOAD_FAST  # Load each argument.
        # End for each argument
        ...
        BUILD_TUPLE # Create a tuple of the arguments

    In the IR generated, the vararg refer
    to a single build_tuple that contains all of the
    args. In addition to returning the args, this
    function updates new_body to remove all usage
    of the tuple.
    N)rX   r[   )rR   
tuple_exprr_   buildtuple_idxrT   rU   s         r(   $_call_function_ex_replace_args_smallr   .  s.    4  $H^!.'+? r*   c                 T   d}g }t        |t        j                        rSt        |j                  t        j                        r/|j                  j
                  }	d||<   t        | |||       |dz  }nt        d      ||k\  r| |   }
t        |
t        j                        r|
j                  j
                  |	k(  rht        |
j                  t        j                        rD|
j                  j                  dk(  r+|
j                  j                  sd||<   t        | |||       no||k(  st        |
t        j                        r}|
j                  j
                  |	k(  rdt        |
j                  t        j                        r@|
j                  j                  dk(  r'|
j                  j                  t        j                  k(  st        |      |
j                  j                   j
                  }|
j                  j"                  j
                  }| |dz
     }t        |t        j                        r_t        |j                  t        j                        r;|j                  j                  dk(  r"t%        |j                  j                        dk(  st        |      |j                  j
                  |k(  rt        d      |j                  j
                  |k(  r|}	nt        |      |j'                  |j                  j                  d          d||<   d||dz
  <   t        | |||       t        | |dz
  ||       |dz  }d}||k\  rJ|rH| |   }t        |t        j                        r|j                  j
                  |	k(  rd	}n|dz  }||k\  r|rH||k\  r||k(  rt        |      |ddd
   S )a  
    Extracts the args passed as vararg
    for CALL_FUNCTION_EX. This pass is taken when
    n_args > 30 and the bytecode looks like:

        BUILD_TUPLE # Create a list to append to
        # Start for each argument
        LOAD_FAST  # Load each argument.
        LIST_APPEND # Add the argument to the list
        # End for each argument
        ...
        LIST_TO_TUPLE # Convert the args to a tuple.

    In the IR generated, the tuple is created by concatenating
    together several 1 element tuples to an initial empty tuple.
    We traverse backwards in the IR, collecting args, until we
    find the original empty tuple. For example, the IR might
    look like:

        $orig_tuple = build_tuple(items=[])
        $first_var = build_tuple(items=[Var(arg0, test.py:6)])
        $next_tuple = $orig_tuple + $first_var
        ...
        $final_var = build_tuple(items=[Var(argn, test.py:6)])
        $final_tuple = $prev_tuple + $final_var
        $varargs_var = $final_tuple
    r   NrZ   unreachablebuild_tuplebinopri   TF)rj   r   rk   rO   Varr?   rX   AssertionErrorrN   rm   rn   r[   fnoperatorrC   r   rV   rW   rq   rB   )rR   vararg_stmtr_   rt   rT   ru   rU   rv   
total_argstarget_nameconcat_stmtlhs_namerhs_namearg_tuple_stmtkeep_looking	next_stmts                   r(   $_call_function_ex_replace_args_larger   Q  so   L LJ;		*{(("&&1!'',,#%j'+?	
 	a

 ]++ 
$z*{BII.""'';6;,,bgg6!!$$5%%++#'HZ )*g/C  l*;		2&&++"# %%rww  %%((G3%%((HLL8 /v66"((,,11H"((,,11H &j1n5N>2995"(("'' #((++$% ,,223q8 /v66$$))X5$]33&&++x7& /v66$$**1- $(HZ '+HZ!^$)*g/C **q.'3G !OJL,$Z0	y"))4!((--&' $)L( !OJ; ,U 
$P \! 'v..ddr*   c                 J   t        j                  d      }t        j                  t              }| j
                  j                         D ]Q  }d}g }t        |j                        D ]  \  }}t        |t        j                        rt        |j                  t        j                        r|j                  j                  dk(  rx|j                  j                  ad}|j                  }|j                   }	|j"                  }
|j$                  }|j                  }|dz
  }|}d}d}|dk\  r^|s\|j                  |   }t        |t        j                        r&|j&                  j(                  |j(                  k(  rd}n|dz  }|dk\  r|s\|
s?|r=t        |j                  t        j                        r|j                  j                  dk(  st+        |      |j                  j,                  r%t/        |j                  |j                  ||| |      }
n)t1        |j                  |j(                  ||dz
  || ||      }
|}|H|	rt+        |      |}d}d}|dk\  r^|s\|j                  |   }t        |t        j                        r&|j&                  j(                  |j(                  k(  rd}n|dz  }|dk\  r|s\|st+        |      t        |j                  t        j                        r>|j                  j                  d	k(  r%t3        |j                  |j                  ||| |      }	nct        |j                  t        j                        r$|j                  j                  d
k(  rt+        |      t5        |j                  |||| ||      }	t        j                  j7                  |j8                  |	|
|j:                  |j&                        }t=        |j                  || |       t        j                  ||j&                  |j:                        }| j>                  |j&                  j(                     jA                  |       nt        |t        j                        rt        |j                  t        j                        r|j                  j                  dk(  r|j                  j$                  |j                  }|j$                  j(                  }|| j>                  v ratC        | j>                  |         dk(  rF| j>                  |   d   }t        |t        j                        r|j                  d
k(  rt+        |      |jA                  |        |s|j                  jE                          |j                  jG                  |D cg c]  }||	 c}       T | S c c}w )a_  
    This peephole rewrites a bytecode sequence unique to Python 3.10
    where CALL_FUNCTION_EX is used instead of CALL_FUNCTION_KW because of
    stack limitations set by CPython. This limitation is imposed whenever
    a function call has too many arguments or keyword arguments.

    https://github.com/python/cpython/blob/a58ebcc701dd6c43630df941481475ff0f615a81/Python/compile.c#L55
    https://github.com/python/cpython/blob/a58ebcc701dd6c43630df941481475ff0f615a81/Python/compile.c#L4442

    In particular, this change is imposed whenever (n_args / 2) + n_kws > 15.

    Different bytecode is generated for args depending on if n_args > 30
    or n_args <= 30 and similarly if n_kws > 15 or n_kws <= 15.

    This function unwraps the *args and **kwargs in the function call
    and places these values directly into the args and kwargs of the call.
    a  
        CALL_FUNCTION_EX with **kwargs not supported.
        If you are not using **kwargs this may indicate that
        you have a large number of kwargs and are using inlined control
        flow. You can resolve this issue by moving the control flow out of
        the function call. For example, if you have

            f(a=1 if flag else 0, ...)

        Replace that with:

            a_val = 1 if flag else 0
            f(a=a_val, ...)Frh   NTrZ   r   	build_mapr   list_to_tuple)rN   )$textwrapdedentr8   r9   r<   blocksvalues	enumeratebodyrj   r   rk   rO   rm   rn   varkwargrr   ra   varargrN   r?   r   r[   rd   r~   r   r   rh   rp   locrX   rP   rB   rq   clearextend)rT   ru   rU   blkblk_changedr_   istmtrh   rr   ra   r   r   start_searchvarkwarg_lockeyword_deffound
vararg_locargs_defnew_callvararg_nameexprxs                          r(   .peep_hole_call_function_ex_to_call_function_kwr     s   ( __   F '2237~~$$& WD * P	"GAt4+tzz2773JJMMV+JJ''3"zzyyhh == 1u+""a'"%((<"8K";		:'..33x}}D $$) #a'  ";#4#4bgg>'--00K? 36::$$** >#)) $,C* > $A ,	C  ,% 7v>>!-J#H!E$/%#&88J#7&x; ( 4 4 C$(E&!OJ %/% ! 7v>>"8>>277;$NN-->  DHH$NN$&#0  #8>>277;$NN--@
 7v>>0  DHH$$&#"0  77<<IItS$((4;; (  .HHa*> yy4;;A$$T[[%5%56==hG4+tzz2773JJMMV+JJ%%1
 zz"kk..7#7#77G00=>!C #//<Q?D!$0TWW5O6v>>OOD!aP	"d HHNNHHOOB1AMQBCoWDp N Cs   V 
V 
c           	          d} j                   j                         D ]H  \  }	 fd} |       }|0j                  |d   d   |d   d    }|r(t        d       |D ]  }t        |        t        d       g }g }|d   d   }	|	j                  j
                  }
|D ]  }t        |t        j                        st        |j                  t        j                        sC|j                  }|j                  dk(  s_|j                  j
                  |
k(  sy|j                  d	k(  r&|j                  |j                  j
                         |j                  d
k(  r&|j                  |j                  j
                         J  g  fd}|	j                  }|rt        d       j                          |d   d   }|}|D ]  }t        |t        j                        rt        |j                  t        j                        r\|j                  }|j                  dk(  rr|j                  j
                  |v s|j                  j
                  |v r0 j                  j!                  |j                  j
                         j                  |       |j                  dk(  r|j"                  j
                  }||v s||v r|j$                  d   }t        |t        j&                        rC|d|j
                  }||v r,t        j                  j)                  |g|j*                        }nt        j,                  dt.        |j*                        }|j0                  j3                  d|j*                        }j                  t        j                  |||j*                               t        j                  j5                  ||fd|j*                        }t        j&                  |j0                  ||j*                        }t        j                  |||j*                        } ||       |}t        j                  j7                  t8        j:                  |||j*                        }t        j                  ||j                  |j*                        } ||       |j                  }j                  |       |j                  dk(  r|j                  j
                  |
k(  rit        j                  j)                  |j                  |j*                        }t        j                  ||j                  |j*                        } ||       j                  |       j                  |       j                  |         |t        j                  ||j                  |j*                               |rt        d       D ]  }t        |        j                  dd }|d|d   d    }j                  |d   d   dz   d }|z   |z   }j                  j=                          j                  j?                  |       |rt        d       j                          nIC  S )a  
    This peephole rewrites a bytecode sequence new to Python 3.9 that looks
    like e.g.:

    def foo(a):
        return (*a,)

    41          0 BUILD_LIST               0
                2 LOAD_FAST                0 (a)
                4 LIST_EXTEND              1
                6 LIST_TO_TUPLE
                8 RETURN_VAL

    essentially, the unpacking of tuples is written as a list which is appended
    to/extended and then "magicked" into a tuple by the new LIST_TO_TUPLE
    opcode.

    This peephole repeatedly analyses the bytecode in a block looking for a
    window between a `LIST_TO_TUPLE` and `BUILD_LIST` and...

    1. Turns the BUILD_LIST into a BUILD_TUPLE
    2. Sets an accumulator's initial value as the target of the BUILD_TUPLE
    3. Searches for 'extend' on the original list and turns these into binary
       additions on the accumulator.
    4. Searches for 'append' on the original list and turns these into a
       `BUILD_TUPLE` which is then appended via binary addition to the
       accumulator.
    5. Assigns the accumulator to the variable that exits the peephole and the
       rest of the block/code refers to as the result of the unpack operation.
    6. Patches up
    Fc                     d} t        t        t        j                                    D ]  }j                  |   }t	        |t
        j                        rJ|j                  }t	        |t
        j                        r$|j                  dk(  r|j                  d   }d} ||f}| syt	        |t
        j                        s|j                  j                  k(  s||ff}|c S  y )NFr   r   T)reversedrangerq   r   rj   r   rk   rO   rm   rn   inforN   r?   )r   rS   r   rO   target_listbtregionr   s          r(   find_postive_regionz4peep_hole_list_to_tuple.<locals>.find_postive_region$  s    #E#chh-$89 .C88C=D!$		2 $

&ubgg6 %O ;*/**Q-K$(E"%tB%dBII6#{{//;>*,sDk):'-.r*   NrZ   r   z
WINDOW: rf   r   rB   c                    j                  |        | j                  j                  j                  v rbt	        j                  | j                  j                           dk(  sJ j                  | j                  j                     j                          j                  | j                  j                     j                  | j                         y)z. Adds to the new_hole and fixes up definitionsrZ   N)rB   rN   r?   rP   rq   r   rO   )r   rT   new_holes    r(   append_and_fixz/peep_hole_list_to_tuple.<locals>.append_and_fixW  s    OOA&xx}}(<(<<  #7#7#7#FG1LLL,,QXX]];AAC((7>>qwwGr*   z
BLOCK:rh   _var_tupler?   rO   r   $_list_extend_gv_tupler   )rN   rO   r   r3   r   rV   rW   r   
build_listz

NEW HOLE:z
DUMP post hole:) r   r[   r   printrN   r?   rj   r   rk   rO   rm   rn   ro   rB   dumprP   r@   rp   rr   r   r   r   Globalr   scoperedefinerh   r   r   rC   r   r   )rT   _DEBUGoffsetr   r   	peep_holer   appendsextendsinit
const_listr   r   the_build_listt2l_agnaccfnameargtmp_namer   gv_tuple	tuple_varvarasgnnewcpyheadtailtmpr   r   s   `                            @@r(   peep_hole_list_to_tupler     sB   @ F ~~++- v." )*F!HHVAYq\F1IaLA	+&& !a!"Iay|![[--
 # -A!!RYY/%aggrww7#$77D $9 4$(JJOOz$A $(99#8$+NN188==$A%)YY(%:$+NN188==$A$,1-  	H "& *%HHJ !)A,$" M+A!!RYY/%aggrww7#$77D#ww)3$%HHMMW$<()(@ %,$8$8$<$<QXX]]$K$, %-OOA$6!%F!2(,		#(G#3u7G*.))A,C'1#rvv'>BGBE((4L+0G+;131D1DcVEIXX2OB 8:yy5<E48HH8.H 9<		8J8J0H48HH 9K 9.I -5OO02		;D:B8<12-. 2409C6248HH 2> 2.B /1ffSYY59XX/?/1yyS$((/K(6t(<.1 +-''--8<<<?<?<=EE +8 +CC ,.99S!((DHH+MD$24$8*.++C %-OOA$6"&''\"9$%HHMMZ$?&(gg&9&9$**dhh&O')yyahh'I .t 4 ( 2$OOA. !*[M+` ryygnn)7);); = >-(% !a! hhqk=F1IaL)xxq	!q 0 12Xo, $-.HHJ i vp Nr*   c                 |   t               }| j                  j                         D ]  }|j                  D ]  }t        |j	                               }|D ]/  }|j
                  j                  d      s|j                  |       1 ||z  sVt        |t        j                        sq|j                  |j                          g }|j                  D ]0  }t        |j	                               |z  r |j                  |       2 |j                  j                          |j                  j                  |        | S )zh
    This rewrite removes variables used to store the `__exit__` function
    loaded by SETUP_WITH.
    z$setup_with_exitfn)r<   r   r   r   	list_varsr?   
startswithrC   rj   r   rk   rN   rB   r   r   )rT   	dead_varsr   r   usedvr_   s          r(   peep_hole_delete_with_exitr     s   
 I~~$$& "HH 	/D t~~'(D %66$$%9:MM!$%
 idBII.MM$++.	/ HH 	&D()I5%	& 	!)", Nr*   c           
      \
   t        j                  d      }t        j                  t              }| j
                  j                         D ]  }g }i }t        j                  t              }i }d}t        |j                        D ]S  \  }	}
|
}d}t        |
t        j                        r1t        |
j                  t        j                        r|
j                  j                  dk(  r|
j                   j"                  }|	||
j                   j"                  <   ||
j                   j"                     j%                  |	       |
j                  j&                  j)                         ||
j                   j"                  <   n_|
j                  j                  dk(  rE|	dkD  r?|
j                  j*                  j"                  }|j                  |	dz
     }|
j                  j,                  }t        |t        j                        r|j                   j"                  |k(  rt        |j                  t        j                        r|j                  j                  dk(  r|j                  j.                  d	v rj|j                  j                  j"                  }|j                  j.                  }|d
k(  r2||v r.||   j%                  |       ||   j1                  |	dz
  |	g       n|dk(  r|d   j"                  }||v r||v r||   j1                  ||          ||   j1                  ||          ||   j%                  |	dz
         ||   D ]  }t3        |j                  || |       d||<   ! ||= ||= ||= t3        |j                  |	| |       t5        | ||j                  ||   ||         }||   j7                          ||   j%                  |	       d}nt9        |      t        |
t        j                        rwt        |
j                  t        j                        rS|
j                  j                  dk(  r:|
j                  j                  j"                  |v r|
j                  j.                  d	v s[|
j;                         D ]H  }|j"                  |v s|j"                  |k7  s"||j"                  = ||j"                  = ||j"                  = J |j%                  |       V |s|j                  j7                          |j                  j1                  |D cg c]  }||	 c}        | S c c}w )a  
    This rewrite removes d1._update_from_bytecode(d2)
    calls that are between two dictionaries, d1 and d2,
    in the same basic block. This pattern can appear as a
    result of Python 3.10 bytecode emission changes, which
    prevent large constant literal dictionaries
    (> 15 elements) from being constant. If both dictionaries
    are constant dictionaries defined in the same block and
    neither is used between the update call, then we replace d1
    with a new definition that combines the two dictionaries. At
    the bytecode translation stage we convert DICT_UPDATE into
    _update_from_bytecode, so we know that _update_from_bytecode
    always comes from the bytecode change and not user code.

    Python 3.10 may also rewrite the individual dictionaries
    as an empty build_map + many map_add. Here we again look
    for an _update_from_bytecode, and if so we replace these
    with a single constant dictionary.

    When running this algorithm we can always safely remove d2.

    This is the relevant section of the CPython 3.10 that causes
    this bytecode change:
    https://github.com/python/cpython/blob/3.10/Python/compile.c#L4048
    a  
        A DICT_UPDATE op-code was encountered that could not be replaced.
        If you have created a large constant dictionary, this may
        be an an indication that you are using inlined control
        flow. You can resolve this issue by moving the control flow out of
        the dicitonary constructor. For example, if you have

            d = {a: 1 if flag else 0, ...)

        Replace that with:

            a_val = 1 if flag else 0
            d = {a: a_val, ...)FNr   rh   r   rZ   rf   )rg   _update_from_bytecoderg   r   T)r   r   r8   r9   r<   r   r   r:   r   r   rj   r   rk   rO   rm   rn   rN   r?   rB   r[   r\   rp   rr   ro   r   rX   _build_new_build_mapr   r   r   )rT   ru   rU   r   r_   lit_map_def_idxlit_map_use_idxmap_updatesr   r   r   new_inststmt_build_map_out	func_namer{   rr   update_map_namero   d2_map_namelinenumr   r   s                         r(   peep_hole_fuse_dict_add_updatesr     s   D __ # $F '2237~~$$& HD
 &11$7 * v	&GAtH "&$		*z$**bgg/N::==K/)-)9)9& 9:ODKK$4$45#DKK$4$45<<Q?48JJ4D4D4I4I4KK 0 01ZZ]]f,Q !%

 4 4I $'88AE?L::??D"<;(//44	A&|'9'9277C(..11Y>(..33 8  +7*<*<*B*B*G*G+1166 M1./A'8??E ,O<CCQUAJO!%<<*.q',,K /? B#./#A !,O < C C$/$<!" !0 @ G G$3K$@!" !0 @ G GA N/>/O 	!=G$A(+(/(/(<	%& 9=HW$5	!= %4K$@$3K$@$/$< !>$'HHa:N!" ,@$+$3$'HH$3O$D$/$@," !0 @ F F H / @ G G J.2 '?v&F F 4+tzz2773JJMMY.JJ$$))_<JJOO'OO>>+ 
2C
 O3HH(::+CHH5+CHH5'1
2 OOH%mv	&p HHNNHHOOB1AMQBCQHDT N Cs   T)
T)
c                    i }t        | j                  j                               }t        |      D ]	  \  }\  }}g }t        |j                        D ]1  \  }}t        |t        j                        s!|j                  |       3 |sXg }	|D ]  }t        j                  |j                  |j                        }
|
j                  j                  |j                  d|        |	j                  |
       t        j                  |j                  |j                        }|j                  j                  |j                  |          |	j                  |        |}|	D ]H  }|||<   |dz   }|j                  j                  t        j                  ||j                               |}J |dz   t        |      k  r#|||dz      d   k\  rt        j                   d      t        j                  |j                  |j                        }|j                  j                  |j                  |d   dz   d        |||<    | j                  j#                  |       | S )z
    Split blocks that contain ir.PopBlock.

    This rewrite restores the IR structure to pre 3.11 so that withlifting
    can work correctly.
    r   NrZ   r   zPOP_BLOCK peephole failedr   )sortedr   r[   r   r   rj   r   PopBlockrB   Blockr   r   r   Jumprq   r   InternalErrorupdate)rT   new_block_mapsorted_blocksblk_idxlabelr   pop_block_locsr   inst
new_blocks
before_blk
popblk_blk
prev_labelnewblk
next_labeltail_blks                   r(   peep_hole_split_at_pop_blockr    s    M7>>//12M!*=!9 "1% * 	)GAt$,%%a(	) J# .XXciiSWW=
&&sxx|4!!*-XXciiSWW=
&&sxx{3!!*-. J$ (,2j)'!^
""277:377#CD'
	( {S//w{!;A!>> !../JKKxx		sww7HMM  .*<q*@*A!BC(0M*%E"1H NN-(Nr*   c                 *   ||   }|j                   }|j                  }g }g }	|D ]  }
|
\  }}t        t        | |      }t	        |t
        j                  t
        j                  t
        j                  f      r|j                  |j                         t        t        | |      }t	        |t
        j                  t
        j                  t
        j                  f      r|	j                  |j                         |	j                  t        |j                                i }t        |      t        |      k(  r8t        ||	      D ci c]  \  }}||
 }}}t        |      D ]
  \  }}|||<    nd}t
        j                  j!                  |t        |      |||j"                        }| j$                  |   j                  |       t        j&                  |t        j(                  |j*                  ||j"                        |j"                        S c c}}w )zg
    Create a new build_map with a new set of key/value items
    but all the other info the same.
    Nr[   sizeliteral_valuer]   r   )rN   rO   r
   r	   rj   r   rl   r   FreeVarrB   r"   r?   rq   zipr   rm   r   r   rP   rk   r   r   )rT   r?   rR   
old_lineno	new_items
old_assign
old_targetold_bmliteral_keysr   pairkr   key_def	value_defr]   r   yr  r   new_bms                        r(   r   r   	  s   
 *%J""JFL F 
213g"))RZZ@A..'15	i"((BIIrzz!BCMM)//* MM.01
2 M
<C	N**-lF*CD$!QADDl+ 	!DAq M!	!  WW^##JJ  F %%f- 99z''z~~>

 ) Es   Hc                      e Zd ZdZdZd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd ZddZd Zd Zd Zd Zd Zd Zd Zd Zd Zed        Zed        Zed        Zed        Zed        Zed        Zd ZddZ d Z!dd Z"d! Z#d" Z$d# Z%d$ Z&d% Z'd& Z(d' Z)d( Z*d) Z+d* Z,d+ Z-d, Z.d- Z/e0d.v rd/ Z1ne0d0v rn e2e0      e0d.v rd1 Z3ne0d0v rn e2e0      d2 Z4d3 Z5d4 Z6d5 Z7d6 Z8d7 Z9d8 Z:d9 Z;d: Z<d; Z=d< Z>d= Z?d> Z@e0d?v rdd@ZAne@ZAe0d?v r
dA ZBdB ZCdC ZDne0dDv rn e2e0      e0d.v reAZEdE ZFne0d0v rn e2e0      dF ZGdG ZHdH ZIeIZJeIZKdI ZLdJ ZMdK ZNdL ZOe0dMv rdN ZPne0dOv rdP ZPn e2e0      dQ ZQe0dMv rdR ZRne0dOv rdS ZRn e2e0      e0dMv rdT ZSe0dMv rdU ZTne0dOv rdV ZTn e2e0      dW ZUddXZVdY ZWdZ ZXd[ ZYd\ ZZd] Z[d^ Z\d_ Z]d` Z^e0d?v rda Z_ne0dbk  sJ dc Z`dd Zade Zbdf Zcdg Zddh Zedi Zfdj Zgdk Zhdl Zidm Zjdn Zkdo Zldp Zmdq Zndr Zods Zpdt Zqdu Zrdv Zsdw Ztdx Zudy Zvdz Zwd{ Zxd| Zyd} Zzd~ Z{d Z|d Z}d Z~d Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd ZeZddZd Ze0d.v rd Zne0d0v rn e2e0      e0d?v rd Zne0dDv rn e2e0      d Zd Zd ZddZd Zd Zd Zd Zd Zd Ze0d.v rd Zd Zne0d0v rn e2e0      d Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Ze0dMv rd Zne0dOv rd Zn e2e0      d Zd Zd ZdÄ ZdĄ Zdń Ze0d.v rdƄ Zye0d0v ry e2e0      )Interpreterz2A bytecode interpreter that builds up the IR.
    Fc                 x   || _         | j                  rt        |j                         |j                  | _        |j
                  | _        t        j                  j                  |      x| _	        | _
        |j                  | _        i | _        t        j                  t              | _        t#               | _        y r$   )func_id_DEBUG_PRINTr   rp   	arg_count	arg_namesr   Locfrom_function_idr   	first_locis_generatorr   r8   r9   r:   definitionsr<   _exception_vars)r&   r!  s     r(   r)   zInterpreter.__init__D  s    ',, ** **$&FF$;$;G$DD4>#00 &2248  #ur*   c           	         || _         g | _        t        j                  d| j                        }| j                  j                  |       t        |      }|j                          t        |      | _	        t        |      | _        t        j                  r| j                  j                          d| _        d| _        d}| j                  j"                  j%                         D ]1  \  }}|j&                  st)        |t)        |j&                              }3 || _        t,        dv rLt/        | j                   j0                  D cg c]  }|j2                  | j*                  k  r| c}      | _        nt,        dv rnt7        t,              g | _        d| _        | j                  j                  t        j                  | j<                  | j                               | j?                         D ]  \  }}	| jA                  ||	        t,        dv r| jC                          nt,        dv rnt7        t,              | jE                          t        jF                  | j"                  | jH                  | jJ                  | jL                  | jN                  | jP                  | jR                        }
tT        jW                  tY        |
d 	             g }t,        dv r|j                  tZ               t,        d
v r|j                  t\               |j                  t^               t,        d
v r*|j                  t`               |j                  tb               | je                  ||
      }|S c c}w )z0
        Generate IR for this bytecode.
        N)parentr   r   r   r   r   r   r   r   c                 "    | j                         S r$   )dump_to_stringr   s    r(   <lambda>z'Interpreter.interpret.<locals>.<lambda>  s    8H8H8J r*   )	lazy_func)r   r   r   r   )3bytecodescopesr   Scoper   rB   r   runr   dfar   cfar   DUMP_CFGr   current_blockcurrent_block_offsetr   r[   r   maxlast_active_offsetr   r   exception_entriesstartactive_exception_entriesNotImplementedErrorsyntax_blocksdfainfocurrent_scope
_iter_inst	_dispatch_end_try_blocks_legalize_exception_vars
FunctionIRr(  r!  r'  r)  r#  r$  _loggerdebugr   r  r   r   r   r   post_process)r&   r4  global_scopeflowr>  _inst_blocksentryr  ra   rT   	peepholespost_processed_irs                r(   	interpretzInterpreter.interpretU  s    !xxt:<(H~
D>D>??HHMMO "$(!"hhoo335 	@NA{%();),[-=-=)>&@"	@ #5**,1$(MM$C$C ;5KK$"9"99  ;-<D) ,,%i002884+=+=488LM * 	&ID#NN4%	&33  "*$%i00%%'--T->-> $0@0@ $@ 	mG.JL 	M
 	339:<<4534<<
 KL<= --iA  _;s   "M!c                 $    |D ]
  } ||      } |S r$   r3   )r&   rS  rT   peeps       r(   rM  zInterpreter.post_process  s     	$D7mG	$r*   c           	          t         dv sJ  j                  j                  } j                  j	                         D ]  \  } j
                  j                  |   j                  }|j                  |      D ]  \  }} j
                  j                  |   j                  }t        t        ||            D ]  \  }\  }}	||	k7  s n t        t        |      t        |            } fd}
 |
t        ||d             s   y)a=  Closes all try blocks by inserting the required marker at the
        exception handler

        This is only needed for py3.11 because of the changes in exception
        handling. This merely maps the new py3.11 semantics back to the old way.

        What the code does:

        - For each block, compute the difference of blockstack to its incoming
          blocks' blockstack.
        - If the incoming blockstack has an extra TRY, the current block must
          be the EXCEPT block and we need to insert a marker.

        See also: _insert_try_block_end
        r-  c                    | r| j                         }|d   t        d      k(  rb_        t        j                        }j                  j                          j                          j                  j                  |       y| ry y )NkindTRYT)r@   r   r;  r:   r   r   _insert_try_block_endr   )remainentoldbodyblockr&   s      r(   	do_changez.Interpreter._end_try_blocks.<locals>.do_change  sn     $jjlv;)E*::16D.&*5::&6G!JJ,,. 668!JJ--g6#' !r*   N)r   r9  graphr   r[   r8  infos
blockstackpredecessorsr   r  minrq   r:   )r&   rb  r   cur_bsincrP  inc_bsr   r   r  ra  r`  s   `          @r(   rH  zInterpreter._end_try_blocks  s      7777![[..0 	MFEXX^^F+66F,,V4 Q,77 "+3vv+>!? 6IAv1Av6 CKV5A
( T&*-./		r*   c                    | j                   j                         }| j                  j                         D ]I  \  }}|D ]?  }t	        |t
        j                        s|j                  }||v s/|j                  |       A K t        t        d |            }|rR|d   }| j                  j                  |      j                  }d}	t        j                  |	j!                  |      |      y)zsSearch for unsupported use of exception variables.
        Note, they cannot be stored into user variable.
        c                 &    | j                  d       S )N$)r   r1  s    r(   r2  z6Interpreter._legalize_exception_vars.<locals>.<lambda>  s    ALL,=(= r*   r   z5Exception object cannot be stored into variable ({}).r   N)r*  r\   r)  r[   rj   r   r   r?   rC   r:   filterrE  getr   r   r   r,   )
r&   excvarsr'   defnvarsr   r  uservarfirstr   msgs
             r(   rI  z$Interpreter._legalize_exception_vars  s    
 &&++-!%!1!1!7!7!9 	-GX -a(AG|G,	-	- v=wGHAJE$$((/33CIC11#**U2CMM r*   c                     t        | j                        D ]9  \  }}t        j                  ||| j                        }| j                  ||       ; y )N)rc   r?   r   )r   r$  r   Argr   store)r&   rc   r?   vals       r(   init_first_blockzInterpreter.init_first_block  sB    $T^^4 	"KE4&&u4TXX>CJJsD!	"r*   c              #   v  K   t        | j                  j                               D ]  \  }}| j                  |j                     }|j
                  dk(  r| j                  |j                     }| j                  j                  |j                        | _        | j                  |j                         |dk(  r| j                          | j                  j                  D ]D  \  }}| j                  |   }| j                  j                  |j                        | _        ||f F | j                           y w)NEND_FORr   )r   r9  iterliveblocksr4  r   opnamenextr   with_linenolineno_start_new_blockrx  rD  insts_end_current_block)r&   blkctr`  	firstinstr   ra   r  s          r(   rF  zInterpreter._iter_inst  s     %dhh&=&=&?@ 	&LE5ell3I
 9, MM)..9	xx++I,<,<=DH!!%,,/z%%'#||11  }}V,88//<Ci  ##%#	&s   D7D9c                    | j                   }| j                  |       | j                  r| j                  j                  nd }||j                  s|p|d   | j
                  j                  j                         v rGt        j                  | j                  d      |d   || j                        }|j                  |       n2t        j                  || j                        }|j                  |       | j                  j                  | j                      | _        t#               | _        t&        dv r| j(                  r|| j(                  d   j*                  k\  rm| j(                  j-                         }t/        |t        j0                        r:| j                   j                  t        j2                  | j                               nn| j(                  r| j                  j                  }|||ur| j5                          y y y t&        dv rS| j(                  rF|| j(                  d   j*                  k\  r| j(                  j-                          ny | j(                  rEy y t7        t&              )Nend$exception_checkcondtruebrfalsebrr   r   r-  r   r.  )r;  insert_blockrD  active_try_blockis_terminatedr9  rb  nodesr   Branchrn  r   rB   r   r8  rc  r<  r5   assignerr   rC  exitr@   rj   Withr   _insert_try_block_beginrB  )r&   r   oldblocktryblkbranchjmpsynblk	newtryblks           r(   r  zInterpreter._start_new_block  s   %%&!26,,..D(>(> !fUmtxx~~7K7K7M&M "45!%="	 ' ggf$((3$ xx~~d&?&?@ 
33$$T//3888!//335F!&"''2**11"++dhh2GH $$ 55I$F*002 + % *$$$T//3888&&**,	 $$ &i00r*   c                     | j                   j                  s(| j                  j                  }|| j	                          | j                          | j                          y r$   )r;  r  rD  r  _insert_exception_check_remove_unused_temporaries_insert_outgoing_phis)r&   r  s     r(   r  zInterpreter._end_current_block;  sJ    !!//\\22F!,,.'')""$r*   Nc                 :   t        j                  ||| j                        }| j                  ||d       t         j                  j                  | j                  |      dd| j                        }|xs dj                  |      }| j                  ||d       y)a  A helper function to inject a call to *func* which is a python
        function.
        Parameters
        ----------
        func : callable
            The function object to be called.
        gv_name : str
            The variable name to be used to store the function object.
        res_name : str; optional
            The variable name to be used to store the call result.
            If ``None``, a name is created automatically.
        r   TrO   r?   r   r3   z$callres_{}N)r   r   r   rv  rm   rh   rn  r,   )r&   rp   gv_nameres_namegv_fncallress         r(   _inject_callzInterpreter._inject_callE  sz     		'4TXX6

Wt
<'',,txx0"bdhh,G<}33G<

x$
?r*   c                 D    | j                  t        j                  d       y)z<Insert IR-nodes to mark the start of a `try` block.
        mark_try_blockN)r  r   r  r-   s    r(   r  z#Interpreter._insert_try_block_beginX  s     	"++-=>r*   c                 D    | j                  t        j                  d       y)z:Insert IR-nodes to mark the end of a `try` block.
        end_try_blockN)r  r   r  r-   s    r(   r\  z!Interpreter._insert_try_block_end]  s     	"**O<r*   c                 h   | j                   j                  }|d   }| j                   j                  j                  |      }|rpt	        j
                  d| j                        }|D ]I  }|| j                  v rt        d      | j                  ||       | j                  j                  |       K yy)z?Insert IR-nodes to initialize the exception variables.
        r  NrO   r   z2exception variable CANNOT be defined by other coderO   r?   )rD  r  outgoing_edgepushedrn  r   rl   r   r)  r   rv  r*  rC   )r&   r  endblk
edgepushed
const_noner   s         r(   _insert_exception_variablesz'Interpreter._insert_exception_variablesb  s     ..\\5599&A
 $((;J! .$***(L  

#
6$$((-. r*   c                 f    | j                          | j                  t        j                  dd       y)zECalled before the end of a block to inject checks if raised.
        exception_checkr  N)r  r  r   r  r-   s    r(   r  z#Interpreter._insert_exception_checkv  s,     	((*",,.?,	.r*   c                 N   g }i }| j                   j                  D ]v  }t        |t        j                  t        j
                  f      r8|j                  j                  |v r ||j                  j                     |_        n t        |t        j                        r|j                  j                  r-|j                  j                  | j                  j                  v rt        |j                  t        j                        rI|j                  j                  |v r1||j                  j                     |_        |j                  |       1t        |j                  t        j                        r|j                  j                   dk(  rg|j                  j                  j                  |v rE||j                  j                  j                     |j                  _        |j                  |       t        |j                  t        j                        rl|j                  j                  rU|rRt        |d   t        j                        r4|d   }|j                  j                  |j                  j                  k(  r| j#                  |j                  j                  |j                        s|j                  ||j                  j                  <   |j                  |_	        | j$                  |j                  j                     j'                  |j                         | j$                  |j                  j                     j)                  | j$                  j+                  |j                  j                               f|j                  |       y || j                   _        y)zb
        Remove assignments to unused temporary variables from the
        current block.
        exhaust_iterr   N)r;  r   rj   r   SetItemSetAttrrO   r?   rk   rN   rA   r  r=   r   rB   rm   rn   _var_used_in_binopr)  rQ   r   r@   )r&   r_   replaced_varr  prev_assigns        r(   r  z&Interpreter._remove_unused_temporaries~  s}   
 &&++ 2	"D 4"**bjj!9:

<7)$**//:
D")),KK'' KK,,0J0JJ tzz2662 JJOO|;!-djjoo!>DJOOD) tzz2773 JJMM^; JJ,,11\A'3DJJ4D4D4I4I'JDJJ$OOD) tzz2662tzz7I7I$HRL")))L"*2,K $**//4::??B$($;$; $ 0 0+2C2C%E8<TZZ__5-1[[*(()9)9:AA$**M(()9)9:AA ,,00A !OOD!e2	"h #+r*   c                     t        |t        j                        xrD |j                  dv xr4 ||j                  j
                  k(  xs ||j                  j
                  k(  S )zhreturn True if 'expr' is a binary expression and 'varname' is used
        in it as an argument
        )r   inplace_binop)rj   r   rm   rn   rV   r?   rW   )r&   r'   r   s      r(   r  zInterpreter._var_used_in_binop  sS     4) KGG99K-IDHHMM1I	Lr*   c                    | j                   j                  j                         D ]  \  }}| j                  j	                  || j
                        }	 | j                  |      }t        j                  ||| j
                        }| j                  |j                     j                  |j                         | j                   j"                  s| j                   j                  |       | j                   j%                  |        y# t        j                  $ r3 t        dv sJ d       t        j                  d| j
                        }Y w xY w)zd
        Add assignments to forward requested outgoing values
        to subsequent blocks.
        r   r-  zunexpected missing definitionNr  rO   rN   r   )rD  outgoing_phisr[   rE  get_or_definer   rn  r   r   r   rl   rk   r)  r?   rB   rO   r;  r  insert_before_terminator)r&   phinamer'   rN   rw  r   s         r(   r  z!Interpreter._insert_outgoing_phis  s   
 !% : : @ @ B 	BGW''55g:>(( 6 DF9hhw' 993v!%+DV[[)00<%%33""))$/"";;DA!	B
 %% 9 $?? 767?hhTtxx8	9s   DAEEc                     	 | j                   j                  j                  |   S # t        $ r" t	        t
        |t        j                        cY S w xY w)z
        Get a global value from the func_global (first) or
        as a builtins (second).  If both failed, return a ir.UNDEFINED.
        )r!  rp   __globals__KeyErrorrf   builtinsr   	UNDEFINED)r&   r?   s     r(   get_global_valuezInterpreter.get_global_value  sD    
	9<<$$0066 	98T2<<88	9s   "% (AAc                     | j                   j                  j                  |   }	 |j                  S # t        $ r t
        j                  cY S w xY w)z|
        Get a value from the cell contained in this function's closure.
        If not set, return a ir.UNDEFINED.
        )r!  rp   __closure__cell_contents
ValueErrorr   r  )r&   rc   cells      r(   get_closure_valuezInterpreter.get_closure_value  sH    
 ||  ,,U3	 %%% 	 <<	 s   1 AAc                      | j                   d   S )Nr   )r5  r-   s    r(   rE  zInterpreter.current_scope  s    {{2r*   c                 .    | j                   j                  S r$   )r4  	co_constsr-   s    r(   code_constszInterpreter.code_consts  s    }}&&&r*   c                 .    | j                   j                  S r$   )r4  co_varnamesr-   s    r(   code_localszInterpreter.code_locals      }}(((r*   c                 .    | j                   j                  S r$   )r4  co_namesr-   s    r(   
code_nameszInterpreter.code_names  s    }}%%%r*   c                 .    | j                   j                  S r$   )r4  co_cellvarsr-   s    r(   code_cellvarszInterpreter.code_cellvars  r  r*   c                 .    | j                   j                  S r$   )r4  co_freevarsr-   s    r(   code_freevarszInterpreter.code_freevars  r  r*   c                    | j                   rt        |       | j                  J t        dv r| j                  r| j                  d   }t        |t        j                        r|j                  |j                  k\  rl| j                  j                  t        j                  | j                               | j                  j                          nt        dv rnt        t              d|j                  j!                  dd      z  }	 t#        | |      }	  ||fi |S # t$        j&                  $ r}|j                  | j                  }n|j                  }t%        j&                  |j(                  |      }t*        j,                  s|d d| d	|j                   }	|j/                  |	       |j/                  | j0                  j3                                |d }~ww xY w# t4        $ r t        |      w xY w)
Nr-  r   r   r.  zop_%s+rP  zhandling op: z | offset: )r"  r   r;  r   rC  rj   r   r  r   r  rB   r   r   r@   rB  r|  replacerf   r   r   r?   r   FULL_TRACEBACKSadd_contextr4  r   AttributeError)
r&   r  ra   topr   r   er   errms
             r(   rG  zInterpreter._dispatch  s   $K!!---33!!((,c277+{{chh.**11"++$((2KL**..0*$%i00$++--c377	u%B$#&)) 55=((C%%C,,QVV=--4''v[FAOOA&OODMM$6$6$89I  	,%d++	,s%   G  D G1B'GG G5c                 @   |s"| j                   | j                  j                  v r7|| j                  v}| j                  j                  || j                  |      }n'| j                  j                  || j                        }t        |t        j                        r| j                  j                  ||      }t        j                  ||| j                        }| j                  j                  |       | j                   |j"                     j                  |       |S )z
        Store *value* (a Expr or Var instance) into the variable named *name*
        (a str object). Returns the target variable.
        )r   renamer   r  )r<  r9  backboner  rE  r   r   r  rj   r   r   r  rI   rk   r;  rB   r)  r?   )r&   rO   r?   r   r  rN   r   s          r(   rv  zInterpreter.store0  s    
 t00DHH4E4EE$"4"44F''004888> 1 @F ''55d5IFeRVV$MM((7EyyuVB!!$'%,,U3r*   c                     |d   dk(  r'|dd j                         rdj                  |dd       }| j                  j                  |      }|| j                  j                  |      }|S )zJ
        Get the variable (a Var instance) with the given *name*.
        r   .rZ   Nz
implicit{})isdigitr,   r  rL   rE  rn  )r&   r?   r   s      r(   rn  zInterpreter.getB  sl     7c>d12h..0&&tABx0D mm11$7;$$((.C
r*   c                     |xs | j                   }|xs | j                  }t        j                  ||      }|| j                  |<   || _        || _        |S )N)r   r   )rE  r   r   r   r   r;  r<  )r&   r   r   r   r   s        r(   r  zInterpreter.insert_blockT  sR    +++oTXXhhU,!F $*!
r*   c                      y r$   r3   r&   r  s     r(   op_NOPzInterpreter.op_NOP_      r*   c                      y r$   r3   r  s     r(   	op_RESUMEzInterpreter.op_RESUMEb  r  r*   c                      y r$   r3   r  s     r(   op_CACHEzInterpreter.op_CACHEe  r  r*   c                      y r$   r3   r  s     r(   
op_PRECALLzInterpreter.op_PRECALLh  r  r*   c                      y r$   r3   r  s     r(   op_PUSH_NULLzInterpreter.op_PUSH_NULLk  r  r*   c                      y r$   r3   r  s     r(   op_RETURN_GENERATORzInterpreter.op_RETURN_GENERATORn  r  r*   c                 8   | j                  |      }t        j                  dt        | j                        }| j                  ||       t        j                  j                  | j                  |      |fd| j                        }| j                  ||       y Nr   r   r  r3   )rn  r   r   r   r   rv  rm   rh   )r&   r  itemprintvarresprintgvrh   s          r(   op_PRINT_ITEMzInterpreter.op_PRINT_ITEMq  sn    xx~))GU9

x
0ww||DHHX.|J

C
(r*   c                    t        j                  dt        | j                        }| j	                  ||       t         j
                  j                  | j                  |      dd| j                        }| j	                  ||       y r   )r   r   r   r   rv  rm   rh   rn  )r&   r  r  r  r  rh   s         r(   op_PRINT_NEWLINEzInterpreter.op_PRINT_NEWLINEx  s_    ))GU9

x
0ww||DHHX.BDHH|E

C
(r*   c                 x   t        |      }t        j                  j                  | j	                  |      | j
                  |      }| j                  ||       t        |      D ]S  \  }}t        j                  j                  | j	                  |      |d | j
                        }	| j                  |	|       U y )N)rO   r   count)r?   rO   )rc   	index_varr   )	rq   r   rm   r  rn  r   rv  r   static_getitem)
r&   r  iterablestorestupleobjr	  tupr   str   s
             r(   op_UNPACK_SEQUENCEzInterpreter.op_UNPACK_SEQUENCE~  s    Fgg""();). # 0


, v& 	!EAr77))$((8*<01T.2hh * 8D JJtR 		!r*   c                 *    | j                  ||||      S r$   )op_FORMAT_VALUE)r&   r  rO   r  strvars        r(   op_FORMAT_SIMPLEzInterpreter.op_FORMAT_SIMPLE  s    ##D%f==r*   c                 8   | j                  |      }t        j                  dt        | j                        }| j                  ||       t        j                  j                  | j                  |      |fd| j                        }| j                  ||       y)z
        FORMAT_VALUE(flags): flags argument specifies format spec which is not
        supported yet. Currently, str() is simply called on the value.
        https://docs.python.org/3/library/dis.html#opcode-FORMAT_VALUE
        strr   r  r3   N)rn  r   r   r  r   rv  rm   rh   )r&   r  rO   r  r  strgvrh   s          r(   r  zInterpreter.op_FORMAT_VALUE  sp     		%$((3

V
,ww||DHHV,uh|I

C
(r*   c                    |j                   }|dk(  r7t        j                  d| j                        }| j	                  ||d          y| j                  |d         }t        |dd |      D ]t  \  }}| j                  |      }t        j                  j                  t        j                  ||| j                        }	| j	                  |	|       | j                  |      }v y)z
        BUILD_STRING(count): Concatenates count strings.
        Required for supporting f-strings.
        https://docs.python.org/3/library/dis.html#opcode-BUILD_STRING
        r   r   r   r   NrZ   rV   rW   r   )r   r   rl   r   rv  rn  r  rm   r   r   rC   )
r&   r  stringstmpsr	  constprevotherr   r   s
             r(   op_BUILD_STRINGzInterpreter.op_BUILD_STRING  s     A:HHRTXX.EJJud2h'xx
#gabk40 	!JE3HHUOE77==$Etxx ! D JJtS!88C=D	!r*   c                    | j                  |      }| j                  |      }t        j                  dt        | j                        }| j                  ||       |?t        j                  j                  | j                  |      ||fd| j                        }nP| j                  |      }t        j                  j                  | j                  |      |||fd| j                        }| j                  ||       y Nslicer   r  r3   )rn  r   r   r#  r   rv  rm   rh   )	r&   r  r@  stopstepr  slicevarslicegv	sliceinsts	            r(   op_BUILD_SLICEzInterpreter.op_BUILD_SLICE  s    xx~))GU9

x
0<TXXh%7%)- % 3I 88D>DTXXh%7%t9L%'TXX % 7I


-r*   r   c                    | j                  |      }| j                  |      }t        j                  dt        | j                        }| j                  ||       t        j                  j                  | j                  |      ||fd| j                        }	| j                  |	|       | j                  |      }
| j                  |      }t        j                  j                  ||
| j                        }| j                  ||       y )Nr#  r   r  r3   rc   r   	rn  r   r   r#  r   rv  rm   rh   getitem)r&   r  r@  r  	containerr  r&  temp_resr'  r(  rc   rN   r   s                r(   op_BINARY_SLICEzInterpreter.op_BINARY_SLICE  s    HHUOE((3-CiiDHH=GJJW8J4TXXh%7%r)- % 3IJJYXJ6HHX&EXXi(F77??6DHH?EDJJtS!r*   r   c                 >   | j                  |      }| j                  |      }t        j                  dt        | j                        }| j                  ||       t        j                  j                  | j                  |      ||fd| j                        }	| j                  |	|       | j                  |      }
| j                  |      }| j                  |      }t        j                  ||
|| j                        }| j                  j                  |       y )Nr#  r   r  r3   rN   rc   rO   r   rn  r   r   r#  r   rv  rm   rh   r  r;  rB   )r&   r  r@  r  r.  rO   r  r&  r'  r(  rc   rN   r   s                r(   op_STORE_SLICEzInterpreter.op_STORE_SLICE  s    HHUOE((3-CiiDHH=GJJW8J4TXXh%7%r)- % 3IJJYSJ1HHSMEXXi(FHHUOE::V5"&((,D%%d+r*   c                 `   | j                  |      }t        j                  dt        | j                        }| j                  ||       t        j                  d | j                        }| j                  ||       | j                  |      }	t        j                  j                  | j                  |      |	|	fd| j                        }
| j                  |
|       t        j                  j                  || j                  |      | j                        }| j                  ||       y r"  )
rn  r   r   r#  r   rv  rl   rm   rh   r-  )r&   r  baser  r&  indexvarnonevarr'  nonegvnonerc   r   s               r(   
op_SLICE_0zInterpreter.op_SLICE_0  s    xx~))GU9

x
0$DHH-

g
.xx TXXh/$rtxxP

X
.wwtTXXh%7TXXF

C
(r*   c                    | j                  |      }| j                  |      }t        j                  d | j                        }| j	                  ||       | j                  |      }	t        j
                  dt        | j                        }
| j	                  |
|       t        j                  j                  | j                  |      ||	fd| j                        }| j	                  ||       t        j                  j                  || j                  |      | j                        }| j	                  ||       y Nr   r  r#  r3   
rn  r   rl   r   rv  r   r#  rm   rh   r-  )r&   r  r6  r@  r8  r  r&  r7  r9  r:  r'  rc   r   s                r(   
op_SLICE_1zInterpreter.op_SLICE_1  s    xx~$DHH-

g
.xx ))GU9

x
0TXXh/%!%  +

X
.wwtTXXh%7TXXF

C
(r*   c                    | j                  |      }| j                  |      }t        j                  d | j                        }| j	                  ||       | j                  |      }	t        j
                  dt        | j                        }
| j	                  |
|       t        j                  j                  | j                  |      |	|fd| j                        }| j	                  ||       t        j                  j                  || j                  |      | j                        }| j	                  ||       y r=  r>  )r&   r  r6  r8  r$  r  r&  r7  r9  r:  r'  rc   r   s                r(   
op_SLICE_2zInterpreter.op_SLICE_2  s    xx~xx~$DHH-

g
.xx ))GU9

x
0TXXh/$!%  +

X
.wwtTXXh%7TXXF

C
(r*   c                    | j                  |      }| j                  |      }| j                  |      }t        j                  dt        | j                        }| j                  ||       t        j                  j                  | j                  |      ||fd| j                        }	| j                  |	|       t        j                  j                  || j                  |      | j                        }
| j                  |
|       y r"  r,  )r&   r  r6  r@  r$  r  r&  r7  r'  rc   r   s              r(   
op_SLICE_3zInterpreter.op_SLICE_3  s    xx~xx~))GU9

x
0TXXh/%!%  +

X
.wwtTXXh%7TXXF

C
(r*   c                 |   | j                  |      }t        j                  dt        | j                        }| j                  ||       t        j                  d | j                        }| j                  ||       | j                  |      }	t        j                  j                  | j                  |      |	|	fd| j                        }
| j                  |
|       t        j                  || j                  |      | j                  |      | j                        }| j                  j                  |       y r"  )rn  r   r   r#  r   rv  rl   rm   rh   r  r;  rB   )r&   r  r6  rO   r&  r7  r8  r'  r9  r:  rc   r   s               r(   op_STORE_SLICE_0zInterpreter.op_STORE_SLICE_0.  s    xx~))GU9

x
0$DHH-

g
.xx TXXh/$rtxxP

X
.zz$ 2DHHUO"hh(!!$'r*   c                    | j                  |      }| j                  |      }t        j                  d | j                        }| j	                  ||       | j                  |      }	t        j
                  dt        | j                        }
| j	                  |
|       t        j                  j                  | j                  |      ||	fd| j                        }| j	                  ||       t        j                  || j                  |      | j                  |      | j                        }| j                  j                  |       y r=  rn  r   rl   r   rv  r   r#  rm   rh   r  r;  rB   )r&   r  r6  r@  r8  rO   r&  r7  r9  r:  r'  rc   r   s                r(   op_STORE_SLICE_1zInterpreter.op_STORE_SLICE_1?  s    xx~$DHH-

g
.xx ))GU9

x
0TXXh/%!%  +

X
.zz$ 2DHHUO"hh(!!$'r*   c                    | j                  |      }| j                  |      }t        j                  d | j                        }| j	                  ||       | j                  |      }	t        j
                  dt        | j                        }
| j	                  |
|       t        j                  j                  | j                  |      |	|fd| j                        }| j	                  ||       t        j                  || j                  |      | j                  |      | j                        }| j                  j                  |       y r=  rG  )r&   r  r6  r8  r$  rO   r&  r7  r9  r:  r'  rc   r   s                r(   op_STORE_SLICE_2zInterpreter.op_STORE_SLICE_2S  s    xx~xx~$DHH-

g
.xx ))GU9

x
0TXXh/$!%  +

X
.zz$ 2DHHUO"hh(!!$'r*   c                 6   | j                  |      }| j                  |      }| j                  |      }t        j                  dt        | j                        }| j                  ||       t        j                  j                  | j                  |      ||fd| j                        }	| j                  |	|       t        j                  || j                  |      | j                  |      | j                        }
| j                  j                  |
       y r"  r3  )r&   r  r6  r@  r$  rO   r&  r7  r'  rc   r   s              r(   op_STORE_SLICE_3zInterpreter.op_STORE_SLICE_3g  s    xx~xx~))GU9

x
0TXXh/%!%  +

X
.zz$ 2DHHUO"hh(!!$'r*   c                 \   | j                  |      }t        j                  dt        | j                        }| j                  ||       t        j                  d | j                        }| j                  ||       | j                  |      }t        j                  j                  | j                  |      ||fd| j                        }	| j                  |	|       t        j                  || j                  |      | j                        }
| j                  j                  |
       y r"  )rn  r   r   r#  r   rv  rl   rm   rh   DelItemr;  rB   )r&   r  r6  r&  r7  r8  r'  r9  r:  rc   r   s              r(   op_DELETE_SLICE_0zInterpreter.op_DELETE_SLICE_0w  s    xx~))GU9

x
0$DHH-

g
.xx TXXh/$rtxxP

X
.zz$ 2A!!$'r*   c                 ~   | j                  |      }| j                  |      }t        j                  d | j                        }| j	                  ||       | j                  |      }t        j
                  dt        | j                        }	| j	                  |	|       t        j                  j                  | j                  |      ||fd| j                        }
| j	                  |
|       t        j                  || j                  |      | j                        }| j                  j                  |       y r=  rn  r   rl   r   rv  r   r#  rm   rh   rN  r;  rB   )r&   r  r6  r@  r8  r&  r7  r9  r:  r'  rc   r   s               r(   op_DELETE_SLICE_1zInterpreter.op_DELETE_SLICE_1  s    xx~$DHH-

g
.xx ))GU9

x
0TXXh/%!%  +

X
.zz$ 2A!!$'r*   c                 ~   | j                  |      }| j                  |      }t        j                  d | j                        }| j	                  ||       | j                  |      }t        j
                  dt        | j                        }	| j	                  |	|       t        j                  j                  | j                  |      ||fd| j                        }
| j	                  |
|       t        j                  || j                  |      | j                        }| j                  j                  |       y r=  rQ  )r&   r  r6  r8  r$  r&  r7  r9  r:  r'  rc   r   s               r(   op_DELETE_SLICE_2zInterpreter.op_DELETE_SLICE_2  s    xx~xx~$DHH-

g
.xx ))GU9

x
0TXXh/$!%  +

X
.zz$ 2A!!$'r*   c                    | j                  |      }| j                  |      }| j                  |      }t        j                  dt        | j                        }| j                  ||       t        j                  j                  | j                  |      ||fd| j                        }| j                  ||       t        j                  || j                  |      | j                        }	| j                  j                  |	       y r"  )rn  r   r   r#  r   rv  rm   rh   rN  r;  rB   )
r&   r  r6  r@  r$  r&  r7  r'  rc   r   s
             r(   op_DELETE_SLICE_3zInterpreter.op_DELETE_SLICE_3  s    xx~xx~))GU9

x
0TXXh/%!%  +

X
.zz$ 2A!!$'r*   c                 z    | j                   |j                     }| j                  | j                  |      |       y Nr  )r  r   rv  rn  )r&   r  r  rF   s       r(   _op_LOAD_FASTzInterpreter._op_LOAD_FAST  s/    ""488,

'*
5r*   r   c                 R    |r| j                  ||       y | j                  ||       y r$   )op_LOAD_DEREFrY  )r&   r  r  as_load_derefs       r(   op_LOAD_FASTzInterpreter.op_LOAD_FAST  s%    ""4-""4-r*   c                     |j                   }|dz	  }|dz  }| j                  | j                  |         }| j                  | j                  |         }| j                  ||       | j                  ||       y N      r  )r   rn  r  rv  )	r&   r  res1res2opargoparg1oparg2src1src2s	            r(   op_LOAD_FAST_LOAD_FASTz"Interpreter.op_LOAD_FAST_LOAD_FAST  so    HHEaZFRZF88D,,V45D88D,,V45DJJTJ-JJTJ-r*   c                     |j                   }|dz	  }|dz  }| j                  |   }| j                  |      }| j                  ||       | j                  | j                  |         }	| j                  |	|       y r`  )r   r  rn  rv  )
r&   r  store_valueload_resre  rf  rg  dstname	dst_value	src_values
             r(   op_STORE_FAST_LOAD_FASTz#Interpreter.op_STORE_FAST_LOAD_FAST  st    HHEaZFRZF&&v.G-IJJYWJ5!1!1&!9:IJJYXJ6r*   c                     |j                   }|dz	  }|dz  }| j                  |   }| j                  | j                  |      |       | j                  |   }| j                  | j                  |      |       y r`  )r   r  rv  rn  )r&   r  value1value2re  rf  rg  rn  s           r(   op_STORE_FAST_STORE_FASTz$Interpreter.op_STORE_FAST_STORE_FAST  so    HHEaZFRZF&&v.GJJTXXf-GJ<&&v.GJJTXXf-GJ<r*   )r   r   r   c                    	 | j                   |j                     }| j                  | j                  |      |       y # t        $ r@ t
        j                  j                  | j                        }| j                  ||       Y y w xY w)Nr  r   r?   )	r  r   rv  rn  r   r   rm   undefr   )r&   r  r  rF   rx  s        r(   op_LOAD_FAST_AND_CLEARz"Interpreter.op_LOAD_FAST_AND_CLEAR  sk    ,**4884

'!2
=" ,$((3

5s
+,s   ;> ABBc                 ~    | j                   |j                     }| j                  |      }| j                  ||       y rX  )r  r   rn  rv  )r&   r  rO   rn  s       r(   op_STORE_FASTzInterpreter.op_STORE_FAST  s3    ""488,

W
-r*   c                     | j                   |j                     }| j                  j                  t	        j
                  || j                               y Nr   )r  r   r;  rB   r   Delr   )r&   r  rn  s      r(   op_DELETE_FASTzInterpreter.op_DELETE_FAST	  s9    ""488,!!"&&dhh"?@r*   c                 p    t        ||      D ]'  \  }}| j                  | j                  |      |       ) y rX  )r  rv  rn  )r&   r  origdupedsrcdsts         r(   op_DUP_TOPXzInterpreter.op_DUP_TOPX	  s4    D%( 	6HCJJTXXc]J5	6r*   c                     | j                   |j                     }t        j                  | j	                  |      | j	                  |      || j
                        }| j                  j                  |       y )N)rN   rO   ro   r   )r  r   r   r  rn  r   r;  rB   )r&   r  rN   rO   ro   sas         r(   op_STORE_ATTRzInterpreter.op_STORE_ATTR	  sT    txx(ZZtxx/txx!txx1!!"%r*   c                     | j                   |j                     }t        j                  | j	                  |      || j
                        }| j                  j                  |       y )N)rN   ro   r   )r  r   r   DelAttrrn  r   r;  rB   )r&   r  rN   ro   r  s        r(   op_DELETE_ATTRzInterpreter.op_DELETE_ATTR	  sG    txx(ZZtxx/dI!!"%r*   c                 N   | j                  |      }t        dv r| j                  |j                  dz	     }n1t        dv r| j                  |j                     }nt	        t              t
        j                  j                  ||| j                        }| j                  ||       y )Nr   rZ   r   r   )
rn  r   r  r   rB  r   rm   rf   r   rv  )r&   r  r  r  ro   rf   s         r(   op_LOAD_ATTRzInterpreter.op_LOAD_ATTR	  s~    xx~**??488q=1D,,??488,D%i00''//$$((/;

7C r*   c                     | j                   |j                     }t        |t              rg }|D ]V  }dt	        |      z  }t        j                  || j                        }| j                  ||d      }|j                  |       X t
        j                  j                  || j                        }	nt        |t              rg }|D ]V  }dt	        |      z  }t        j                  || j                        }| j                  ||d      }|j                  |       X t
        j                  j                  || j                        }	n!t        j                  || j                        }	| j                  |	|       y )Nz	$const_%sr   T)r?   r   )r  r   rj   r   r  r   rl   r   rv  rB   rm   r   	frozenset	build_set)
r&   r  r  rO   r  r   nm	val_constrN   r  s
             r(   op_LOAD_CONSTzInterpreter.op_LOAD_CONST$	  s6     *eU#B " 3q6)HHQDHH5	IBF		&!	"
 GG'''9Ey)B " 3q6)HHQDHH5	IBF		&!	"
 GG%%bdhh%7EHHU1E

5#r*   r-  c                     | j                   |   }| j                  |      }t        j                  ||| j                        }| j                  ||       y r}  )r  r  r   r   r   rv  )r&   r  rS   r  r?   rO   gls          r(   op_LOAD_GLOBALzInterpreter.op_LOAD_GLOBAL;	  sD    ??3'D))$/E4DHH5BJJr3r*   r.  c                     | j                   |j                     }| j                  |      }t        j                  ||| j
                        }| j                  ||       y r}  )r  r   r  r   r   r   rv  )r&   r  r  r?   rO   r  s         r(   r  zInterpreter.op_LOAD_GLOBALA	  sH    ??488,D))$/E4DHH5BJJr3r*   c                      y r$   r3   r  s     r(   op_COPY_FREE_VARSzInterpreter.op_COPY_FREE_VARSI	  r  r*   c                    | j                   j                  j                  j                  |j                        }|| j
                  v r	 | j                  |      }n]|| j                  v rO| j                  j                  |      }| j                  |      }t        j                  |||| j                        }| j                  |       y # t        $ r d}t        |      w xY wN,Unsupported use of cell variable encounteredr   r!  rp   __code___varname_from_opargr   r  rn  r   rB  r  rc   r  r   r  r   rv  r&   r  r  r?   r  rs  rS   rO   s           r(   r\  zInterpreter.op_LOAD_DEREFM	  s    <<$$--AA$((KDt)))3$B +++((..t4..s3ZZT5dhh?JJr3 ' 3HC-c223s   	C C"c                 j   t        | j                        }|j                  |k  r+| j                  |j                     }| j                  |      }nR|j                  |z
  }| j                  |   }| j                  |      }t        j                  |||| j                        }| j                  ||       y r}  )
rq   r  r   rn  r  r  r   r  r   rv  )r&   r  r  
n_cellvarsr?   r  rS   rO   s           r(   r\  zInterpreter.op_LOAD_DEREF[	  s    T//0Jxx*$))$((3XXd^hh+))#...s3ZZT5dhh?JJr3r*   c                      y r$   r3   r  s     r(   op_MAKE_CELLzInterpreter.op_MAKE_CELLj	  s    r*   c                     | j                   j                  j                  j                  |j                        }| j                  |      }| j                  ||       y rX  )r!  rp   r  r  r   rn  rv  )r&   r  rO   r?   s       r(   op_STORE_DEREFzInterpreter.op_STORE_DEREFn	  sC    <<$$--AA$((KDHHUOEJJUJ.r*   c                     t        | j                        }|j                  |k  r| j                  |j                     }n| j                  |j                  |z
     }| j	                  |      }| j                  ||       y rX  )rq   r  r   r  rn  rv  )r&   r  rO   r  rn  s        r(   r  zInterpreter.op_STORE_DEREFs	  sh    T//0Jxx*$,,TXX6,,TXX
-BCHHUOEJJUJ1r*   c                     | j                   |j                     | j                  u sJ t        j                  |j                  |j
                  |j                  z         }| j                  j                  |       y )Nr  )	r   r   r;  r   Loopr}  r   rC  rB   )r&   r  loops      r(   op_SETUP_LOOPzInterpreter.op_SETUP_LOOP~	  sX    {{4;;'4+=+====wwt{{$))dhh*>@!!$'r*   c                    | j                   |j                     | j                  u sJ |j                  |j                  z   }t        j                  |j                  |      }| j                  j                  |       | j                  |      }| j                  j                  t        j                  ||j                  || j                               t        j                  d | j                        }| j                  ||       y )Nr  contextmanagerbeginr  r   r   r  )r   r   r;  r}  r   r   r  rC  rB   rn  	EnterWithr   rl   rv  )r&   r  r  exitfnexitptwthctxmgrexit_fn_objs           r(   op_SETUP_WITHzInterpreter.op_SETUP_WITH	  s    {{4;;'4+=+====TXX%ggdkk/!!#&.)!!",,f59[[39txx#J 	K
 hht2

6
2r*   c                    | j                   |j                     | j                  u sJ t        dv rL|| j                  kD  rUt        | j                  D cg c]  }|j                  |k(  r|j                   c}      }nt        dv rnt        t              t        j                  |j                  |      }| j                  j                  |       | j                  |      }| j                  j                  t        j                  ||j                  || j                                t        j"                  d | j                         }| j%                  ||       y c c}w )Nr   r   r  r  r   r  )r   r   r;  r   r>  r=  rA  rN   r  rB  r   r  rC  rB   rn  r  r   rl   rv  )	r&   r  r  r  r  exr  r  r  s	            r(   op_BEFORE_WITHzInterpreter.op_BEFORE_WITH	  s   {{4;;'4+=+====**T,,,D,I,I 0b ii3. 66 0 1,,%i00ggdkk,!!#&.)!!",,f59[[36DHH#G 	H
 hht2

6
2!0s   "Ec                 $    | j                          y r$   )r  r  s     r(   op_SETUP_FINALLYzInterpreter.op_SETUP_FINALLY	  s    $$&r*   c                      yzno-opNr3   r  s     r(   op_WITH_CLEANUPzInterpreter.op_WITH_CLEANUP	      r*   c                      yr  r3   r  s     r(   op_WITH_CLEANUP_STARTz!Interpreter.op_WITH_CLEANUP_START	  r  r*   c                      yr  r3   r  s     r(   op_WITH_CLEANUP_FINISHz"Interpreter.op_WITH_CLEANUP_FINISH	  r  r*   c                      yr  r3   r  s     r(   op_END_FINALLYzInterpreter.op_END_FINALLY	  r  r*   c                     t        j                  d | j                        }|D ]0  }| j                  ||       | j                  j                  |       2 y )Nr   rw  )r   rl   r   rv  r*  rC   )r&   r  tempsr  r   s        r(   op_BEGIN_FINALLYzInterpreter.op_BEGIN_FINALLY	  sI    XXd1
 	*CJJzJ,  $$S)	*r*   c           	         | j                  |      }|D cg c]  }| j                  |       }}|Lt        dk  sJ | j                  |   }t        t	        ||t        |       d              }|d t        |        }nd}t        j                  j                  |||| j                        }	| j                  |	|       y c c}w )Nr   r3   r   )rn  r   r  r:   r  rq   r   rm   rh   r   rv  )
r&   r  rp   rr   kw_namesr  r   nameskwargsr   s
             r(   op_CALLzInterpreter.op_CALL	  s    xx~%)***w&&&$$X.E#eT3u:+,%789F#e*%DFww||D$DHH|=

4 +s   C c           	         | j                  |      }|D cg c]  }| j                  |       }}t        |j                  dd      d         }| j                  |   }t	        t        ||t        |       d              }	|d t        |        }t        j                  j                  |||	| j                        }
| j                  |
|       y c c}w )Nr  ri   r   r   )rn  intrsplitr  r:   r  rq   r   rm   rh   r   rv  )r&   r  rp   rr   r  r  r   constir  r  r   s              r(   
op_CALL_KWzInterpreter.op_CALL_KW	  s    88D>D)-.ADHHQK.D.a045F$$V,E#eT3u:+,%789F#e*%D77<<dF<ADJJtS! /s   Cr   c                     | j                  |      }|D cg c]  }| j                  |       }}t        j                  j                  ||d| j                        }| j                  ||       y c c}w )Nr3   r   rn  r   rm   rh   r   rv  )r&   r  rp   rr   r  r   r   s          r(   op_CALL_FUNCTIONzInterpreter.op_CALL_FUNCTION	  s[    xx~%)***ww||D$|9

4 +s   A0c                 H   | j                  |      }|D cg c]  }| j                  |       }}| j                  |      }| j                  j                  D ]  }t        |t        j
                        s|j                  |u s-| j                  j                  |       g }|j                  j                  D ]t  }| j                  j                  d d d   D ]S  }||j                  k(  s| j                  j                  |       |j                  |j                  j                          t v |}	 n t        	      }
|d |
  }||
 d  }t        t        |	|            }t        j                  j                  |||| j                         }| j#                  ||       y c c}w )Nr   r   )rn  r;  r   rj   r   rk   rN   rQ   rO   r[   rB   rq   r:   r  rm   rh   r   rv  )r&   r  rp   rr   r  r  r   named_itemsr  keysnkeysposvalskwvals	keyvaluesr   s                  r(   op_CALL_FUNCTION_KWzInterpreter.op_CALL_FUNCTION_KW	  sl   xx~%)***&&++ 	D$		*t{{e/C""))$/ !)) "A!//44TrT: "= ..55a8'..qww}}=!	"" #	 D	w-ufgT6*+	ww||D'9$((|C

41 +s   Fc                     | j                  |      }| j                  |      }|| j                  |      }t        j                  j                  |g g | j                  ||      }| j                  ||       y )N)r   r   r   r  )r&   r  rp   r   r   r  r   s          r(   op_CALL_FUNCTION_EXzInterpreter.op_CALL_FUNCTION_EX	  si    xx~&!xx)Hww||"bdhhv  
 	

4r*   c                 z   | j                  |d         }|rd}t        j                  |t        | j                        }| j                  ||d       t        j                  j                  | j                  |      |fd| j                        }| j                  ||d          y | j                  }	t        t        | j                   |dd        |      D ]  \  }
}t        j                  d	t        |	
      }| j                  |dd      }t        j                  j                  ||
fd|	      }| j                  |dd      }t        j                  j                  t        j                  || j                  |j                        | j                        }| j                  ||       | j                  |      } y )Nr   r   r   Tr  r3   rr   ra   r   rZ   r   r   r   )r   z	$_tuplifyr   )rn  r   r   r   r   rv  rm   rh   r  mapr   r   r   rC   r?   )r&   r  tuplesr  	is_assignrr  r  r  excr   r  r   r   r   tuplify_valtuplify_varouts                    r(   _build_tuple_unpackzInterpreter._build_tuple_unpack	
  s   # ,GIIg':JEJJU4J@'',,txx0xR#'88  .CJJsE!H%((C!#dhhqr
";UC &
s99  !JJ6 ' 	 !ggllx +  #jjk26 ) 8ggmm||DHH[=M=M4N $  

3$)&r*   c                 ,    | j                  ||||       y r$   r  r&   r  r  r  r  s        r(   op_BUILD_TUPLE_UNPACK_WITH_CALLz+Interpreter.op_BUILD_TUPLE_UNPACK_WITH_CALL-
  s      vui@r*   c                 ,    | j                  ||||       y r$   r  r  s        r(   op_BUILD_TUPLE_UNPACKz!Interpreter.op_BUILD_TUPLE_UNPACK1
  s      vui@r*   c                     t         j                  j                  d|f| j                        }| j	                  ||       y )Nr   r   )r   rm   dummyr   rv  )r&   r  r   r  r   s        r(   op_LIST_TO_TUPLEzInterpreter.op_LIST_TO_TUPLE4
  s.    ww}}_zm}J

4r*   c           	           j                  |      } j                  j                  D ]  }t        |t        j
                        s|j                  |u s- j                  j                  |       g }|j                  j                  D ]t  } j                  j                  d d d   D ]S  }	||	j                  k(  s j                  j                  |	       |j                  |	j                  j                          t v |}
 n t        
      t        |      k(  sJ |
D cg c]#  }t	        j                  | j                        % }}t        ||      D ]  \  }} j                  ||        t!        t        t#         j                   |      t#         j                   |                  }g }|D ]]  } j$                  |   }t        |      dk7  r n>|d   }t        |t        j                        s n|j                  |j                         _  fd}t        |      t        |      k7  r&t        |
|      D 	ci c]  \  }}	| ||	       }}}	nt        |
|      D 	ci c]  \  }}	||	
 }}}	i }t'        |
      D ]
  \  }}|||<    t        j(                  j+                  |d|| j                        } j                  ||       y c c}w c c}	}w c c}	}w )Nr   r  rZ   r   c                 $   j                   |    }t        |      dk7  r$t        j                  |       j                        S |d   }t        |t        j                        s$t        j                  |       j                        S |j                  S NrZ   r   )	r)  rq   r"   rn  r?   rj   r   rl   rO   )r   defnsdefnr&   s      r(   resolve_constz9Interpreter.op_BUILD_CONST_KEY_MAP.<locals>.resolve_const\
  sq    $$Q'E5zQ%dhhqk&6&6778DdBHH-%dhhqk&6&677::r*   ri   r  )rn  r;  r   rj   r   rk   rN   rQ   rO   r[   rB   rq   rl   r   r  rv  r:   r  r)  r   rm   r   )r&   r  r  keytmpsr   r  keyvarr  r   r  keytup	keyconstskvalr   r[   literal_itemsr   r  r  r  literal_dictr]   r   r  r   s   `                        r(   op_BUILD_CONST_KEY_MAPz"Interpreter.op_BUILD_CONST_KEY_MAP8
  s    $&&++ 	D$		*t{{f/D""))$/ !)) "A!//44TrT: "= ..55a8'..qww}}=!	"" %	 6{c&k)))>DERXXA4884E	EY0 	"ID#JJtS!	"STXXw/TXXv1FGH  	-A$$Q'E5zQ8DdBHH-  ,	-	 }V,/1DAqA}Q// 1L 1 -0,FGDAqAaCGLG f% 	!DAq M!	! ww  u&'/;/<%)XX	 ! / 	

4[ F41 Hs   "(K>K$Kc                     t         j                  j                  | j                  |      | j                        }| j                  ||       y )Nr  )r   rm   getiterrn  r   rv  r&   r  rO   r  r   s        r(   op_GET_ITERzInterpreter.op_GET_ITER{
  s2    wwTXXe_$((C

4r*   c                    |j                   | j                  v sJ d       | j                  |      }t        j                  j                  || j                        }| j                  ||       t        j                  j                  | j                  |      | j                        }| j                  ||       t        j                  j                  | j                  |      | j                        }	| j                  |	|       t        j                  | j                  |      |j                  |j                         | j                        }
| j                  j                  |
       y)z:
        Assign new block other this instruction.
        zFOR_ITER must be block headr  r  N)r   r   rn  r   rm   iternextr   rv  
pair_firstpair_secondr  r}  get_jump_targetr;  rB   )r&   r  iteratorr  indvalpredrw  pairvalr  isvalidbrs              r(   op_FOR_ITERzInterpreter.op_FOR_ITER
  s
    {{dkk)H+HH) hhx ''""$((";

7D!77%%DHHTN%I

8V$''%%DHHTN%I

7D! YYDHHTN499#33588% 	!!"%r*   c                     | j                  |      }| j                  |      }t        j                  j                  ||| j                        }| j                  ||       y )Nr+  )rn  r   rm   r-  r   rv  )r&   r  rN   rc   r  r   s         r(   op_BINARY_SUBSCRzInterpreter.op_BINARY_SUBSCR
  sG    &!wwvUA

4r*   c                     | j                  |      }| j                  |      }| j                  |      }t        j                  |||| j                        }| j                  j                  |       y )Nr2  )rn  r   r  r   r;  rB   )r&   r  rN   rc   rO   r   s         r(   op_STORE_SUBSCRzInterpreter.op_STORE_SUBSCR
  sY    &!zzuE"hh(!!$'r*   c                     | j                  |      }| j                  |      }t        j                  ||| j                        }| j                  j                  |       y )N)rN   rc   r   )rn  r   rN  r   r;  rB   )r&   r  rN   rc   r   s        r(   op_DELETE_SUBSCRzInterpreter.op_DELETE_SUBSCR
  sG    &!zzu$((C!!$'r*   c                     t         j                  j                  |D cg c]  }| j                  |       c}| j                        }| j                  ||       y c c}w N)r[   r   )r   rm   r   rn  r   rv  r&   r  r[   r  r   r   s         r(   op_BUILD_TUPLEzInterpreter.op_BUILD_TUPLE
  sK    ww""u)E!$((1+)E'+xx # 1

4 *F   Ac                     t         j                  j                  |D cg c]  }| j                  |       c}| j                        }| j                  ||       y c c}w r  )r   rm   r   rn  r   rv  r  s         r(   op_BUILD_LISTzInterpreter.op_BUILD_LIST
  sK    ww!!e(D!(D&*hh " 0

4 )Er  c                     t         j                  j                  |D cg c]  }| j                  |       c}| j                        }| j                  ||       y c c}w r  )r   rm   r  rn  r   rv  r  s         r(   op_BUILD_SETzInterpreter.op_BUILD_SET
  sK    ww  U'C'C%)XX ! /

4 (Dr  c                 f   | j                  |      }| j                  |      }t        j                  j                  |d| j                        }| j                  ||       t        j                  j                  | j                  |      |fd| j                        }| j                  ||       y )Nr   r   r  r3   rn  r   rm   rf   r   rv  rh   r&   r  rN   rO   	updatevarr  
updateattr
updateinsts           r(   op_SET_UPDATEzInterpreter.op_SET_UPDATE
      &!WW__VX488_D


)
4WW\\$((9"5x&*hh " 0


#
.r*   c                 f   | j                  |      }| j                  |      }t        j                  j                  |d| j                        }| j                  ||       t        j                  j                  | j                  |      |fd| j                        }| j                  ||       y )Nr   r   r  r3   r"  r#  s           r(   op_DICT_UPDATEzInterpreter.op_DICT_UPDATE
  s    &! WW__+ % 

 	

)
4WW\\$((9"5x&*hh " 0


#
.r*   c           	          |D cg c]'  \  }} j                  |       j                  |      f) }}} fd} |d |D              }	 |d |D              }
t        |	      t        |      k(  }t        |
      t        |      k(  }i }|s|sd }n|rF|sDt        |	|      D ci c]  \  }}|t        |d          }}}t	        |	      D ]
  \  }}|||<    n7t        |	|
      D ci c]  \  }}||
 }}}t	        |	      D ]
  \  }}|||<    t
        j                  j                  |||| j                        } j                  ||       y c c}}w c c}}w c c}}w )Nc                 B   g }| D cg c]  }j                  |j                         }}|D ]i  }j                  |j                     }t        |      dk7  r |S |d   }t	        |t
        j                        s |S |j                  |j                         k |S c c}w r  )	rn  r?   r)  rq   rj   r   rl   rB   rO   )rN   r  r   r   r  r  r&   s         r(   get_literalsz.Interpreter.op_BUILD_MAP.<locals>.get_literals
  s    M0671dhhqvv&7F7 1((0u:?
 ! 	 Qx!$1   $$TZZ01 !  8s   "Bc              3   &   K   | ]	  }|d      yw)r   Nr3   .0r   s     r(   	<genexpr>z+Interpreter.op_BUILD_MAP.<locals>.<genexpr>
  s     #<QAaD#<   c              3   &   K   | ]	  }|d      yw)rZ   Nr3   r/  s     r(   r1  z+Interpreter.op_BUILD_MAP.<locals>.<genexpr>
  s     %>qad%>r2  rZ   r  )
rn  rq   r  r"   r   r   rm   r   r   rv  )r&   r  r[   r  r  r  r   	got_itemsr-  r  literal_valueshas_literal_keyshas_literal_valuesr]   r   r   r  r   r   s   `                  r(   op_BUILD_MAPzInterpreter.op_BUILD_MAP
  s|   <ABDAqdhhqk488A;/B	B
	! $#<)#<<%%>I%>>|,I> 0C	NB(:L&8i8:1A~ad33 :L :!,/ %1#$a % .1~-NOTQAqDOLO!,/ %1#$a % ww  yt/;/<%)XX ! / 	

4S C8:
 Ps   ,E#E'Ec                     t        j                  | j                  |      | j                  |      | j                  |      | j                        }| j                  j                  |       y )N)dctrb   rO   r   )r   StoreMaprn  r   r;  rB   )r&   r  r:  rb   rO   r   s         r(   op_STORE_MAPzInterpreter.op_STORE_MAP
  sJ    {{txx}$((3-!%%dhh@!!$'r*   c                     | j                  |      }t        j                  j                  d|| j                        }| j                  ||      S )N-r  rn  r   rm   unaryr   rv  r  s        r(   op_UNARY_NEGATIVEzInterpreter.op_UNARY_NEGATIVE  <    ww}}S488}<zz$$$r*   c                     | j                  |      }t        j                  j                  d|| j                        }| j                  ||      S )Nr  r  r?  r  s        r(   op_UNARY_POSITIVEzInterpreter.op_UNARY_POSITIVE	  rB  r*   c                     | j                  |      }t        j                  j                  d|| j                        }| j                  ||      S )N~r  r?  r  s        r(   op_UNARY_INVERTzInterpreter.op_UNARY_INVERT  rB  r*   c                     | j                  |      }t        j                  j                  d|| j                        }| j                  ||      S )Nnotr  r?  r  s        r(   op_UNARY_NOTzInterpreter.op_UNARY_NOT  s<    ww}}U%TXX}>zz$$$r*   c                     t         |   }| j                  |      }| j                  |      }t        j                  j	                  |||| j
                        }| j                  ||       y )Nr  )r   rn  r   rm   r   r   rv  )r&   rn   rV   rW   r  r   s         r(   _binopzInterpreter._binop  sR     $hhsmhhsmww}}RSctxx}@

4r*   c                     t         |   }t        |dz      }| j                  |      }| j                  |      }t        j                  j                  ||||| j                        }| j                  ||       y )N=r  )r   r   rn  r   rm   r  r   rv  )r&   rn   rV   rW   r  immuopr   s          r(   _inplace_binopzInterpreter._inplace_binop  sj    $R((c2hhsmhhsmww$$RSc)- % 3

4r*   c                 d    d|v r| j                  |d d |||       y | j                  ||||       y )NrN  r   )rP  rL  )r&   r  rn   rV   rW   r  s         r(   op_BINARY_OPzInterpreter.op_BINARY_OP(  s5    "93Bc37KKCc*r*   c                 ,    | j                  d|||       y Nr  rL  r&   r  rV   rW   r  s        r(   op_BINARY_ADDzInterpreter.op_BINARY_ADD.      Cc3'r*   c                 ,    | j                  d|||       y Nr>  rU  rV  s        r(   op_BINARY_SUBTRACTzInterpreter.op_BINARY_SUBTRACT1  rX  r*   c                 ,    | j                  d|||       y N*rU  rV  s        r(   op_BINARY_MULTIPLYzInterpreter.op_BINARY_MULTIPLY4  rX  r*   c                 ,    | j                  d|||       y Nz/?rU  rV  s        r(   op_BINARY_DIVIDEzInterpreter.op_BINARY_DIVIDE7      D#sC(r*   c                 ,    | j                  d|||       y N/rU  rV  s        r(   op_BINARY_TRUE_DIVIDEz!Interpreter.op_BINARY_TRUE_DIVIDE:  rX  r*   c                 ,    | j                  d|||       y Nz//rU  rV  s        r(   op_BINARY_FLOOR_DIVIDEz"Interpreter.op_BINARY_FLOOR_DIVIDE=  rc  r*   c                 ,    | j                  d|||       y N%rU  rV  s        r(   op_BINARY_MODULOzInterpreter.op_BINARY_MODULO@  rX  r*   c                 ,    | j                  d|||       y Nz**rU  rV  s        r(   op_BINARY_POWERzInterpreter.op_BINARY_POWERC  rc  r*   c                 ,    | j                  d|||       y N@rU  rV  s        r(   op_BINARY_MATRIX_MULTIPLYz%Interpreter.op_BINARY_MATRIX_MULTIPLYF  rX  r*   c                 ,    | j                  d|||       y Nz<<rU  rV  s        r(   op_BINARY_LSHIFTzInterpreter.op_BINARY_LSHIFTI  rc  r*   c                 ,    | j                  d|||       y Nz>>rU  rV  s        r(   op_BINARY_RSHIFTzInterpreter.op_BINARY_RSHIFTL  rc  r*   c                 ,    | j                  d|||       y N&rU  rV  s        r(   op_BINARY_ANDzInterpreter.op_BINARY_ANDO  rX  r*   c                 ,    | j                  d|||       y N|rU  rV  s        r(   op_BINARY_ORzInterpreter.op_BINARY_ORR  rX  r*   c                 ,    | j                  d|||       y N^rU  rV  s        r(   op_BINARY_XORzInterpreter.op_BINARY_XORU  rX  r*   c                 ,    | j                  d|||       y rT  rP  rV  s        r(   op_INPLACE_ADDzInterpreter.op_INPLACE_ADDX      Cc3/r*   c                 ,    | j                  d|||       y rZ  r  rV  s        r(   op_INPLACE_SUBTRACTzInterpreter.op_INPLACE_SUBTRACT[  r  r*   c                 ,    | j                  d|||       y r]  r  rV  s        r(   op_INPLACE_MULTIPLYzInterpreter.op_INPLACE_MULTIPLY^  r  r*   c                 ,    | j                  d|||       y ra  r  rV  s        r(   op_INPLACE_DIVIDEzInterpreter.op_INPLACE_DIVIDEa      D#sC0r*   c                 ,    | j                  d|||       y re  r  rV  s        r(   op_INPLACE_TRUE_DIVIDEz"Interpreter.op_INPLACE_TRUE_DIVIDEd  r  r*   c                 ,    | j                  d|||       y ri  r  rV  s        r(   op_INPLACE_FLOOR_DIVIDEz#Interpreter.op_INPLACE_FLOOR_DIVIDEg  r  r*   c                 ,    | j                  d|||       y rl  r  rV  s        r(   op_INPLACE_MODULOzInterpreter.op_INPLACE_MODULOj  r  r*   c                 ,    | j                  d|||       y rp  r  rV  s        r(   op_INPLACE_POWERzInterpreter.op_INPLACE_POWERm  r  r*   c                 ,    | j                  d|||       y rs  r  rV  s        r(   op_INPLACE_MATRIX_MULTIPLYz&Interpreter.op_INPLACE_MATRIX_MULTIPLYp  r  r*   c                 ,    | j                  d|||       y rw  r  rV  s        r(   op_INPLACE_LSHIFTzInterpreter.op_INPLACE_LSHIFTs  r  r*   c                 ,    | j                  d|||       y rz  r  rV  s        r(   op_INPLACE_RSHIFTzInterpreter.op_INPLACE_RSHIFTv  r  r*   c                 ,    | j                  d|||       y r}  r  rV  s        r(   op_INPLACE_ANDzInterpreter.op_INPLACE_ANDy  r  r*   c                 ,    | j                  d|||       y r  r  rV  s        r(   op_INPLACE_ORzInterpreter.op_INPLACE_OR|  r  r*   c                 ,    | j                  d|||       y r  r  rV  s        r(   op_INPLACE_XORzInterpreter.op_INPLACE_XOR  r  r*   c                     t        j                  |j                         | j                        }| j                  j                  |       y r}  r   r   r
  r   r;  rB   r&   r  r  s      r(   op_JUMP_ABSOLUTEzInterpreter.op_JUMP_ABSOLUTE  3    ggd**,$((;!!#&r*   c                     t        j                  |j                         | j                        }| j                  j                  |       y r}  r  r  s      r(   op_JUMP_FORWARDzInterpreter.op_JUMP_FORWARD  r  r*   c                     t        j                  |j                         | j                        }| j                  j                  |       y r}  r  r  s      r(   op_JUMP_BACKWARDzInterpreter.op_JUMP_BACKWARD  r  r*   c                     || j                   j                          y |dk(  r<t        j                  | j                        }| j
                  j                  |       y |dk(  r| j                          y y )Nwithr   try)rC  r@   r   r   r   r;  rB   r\  )r&   r  rZ  rH   s       r(   op_POP_BLOCKzInterpreter.op_POP_BLOCK  s^    <""$V^)A%%a(U]&&( r*   c                 .   | j                  t        j                  j                  | j	                  |      | j
                        |       t        j                  | j	                  |      | j
                        }| j                  j                  |       y r}  )	rv  r   rm   castrn  r   Returnr;  rB   )r&   r  retvalcastvalrets        r(   op_RETURN_VALUEzInterpreter.op_RETURN_VALUE  s_    

277<< 0dhh<?Iii)txx8!!#&r*   c                    | j                   |j                     }t        j                  || j                        }| j                  ||       | j                  t        j                  j                  | j                  |      | j                        |       t        j                  | j                  |      | j                        }| j                  j                  |       y r}  )r  r   r   rl   r   rv  rm   r  rn  r  r;  rB   )r&   r  r  r  rO   r  r  s          r(   op_RETURN_CONSTzInterpreter.op_RETURN_CONST  s    $$TXX.EHHU1EJJuf%JJrww||DHHV$4$((|CWM))DHHW-488<C%%c*r*   c                 F    | j                  | j                  |      |       y r$   )rv  rn  )r&   r  rw  r  s       r(   
op_TO_BOOLzInterpreter.op_TO_BOOL  s    JJtxx}c*r*   c                    t         dv r!t        j                  |j                  dz	     }n^t         dv r!t        j                  |j                  dz	     }n5t         dv rt        j                  |j                     }nt	        t               |dk(  s|dk(  r||}}|dk(  rd| j                  d|||       | j                  |      }t        j                  j                  d|| j                  	      }| j                  ||       y |d
k(  rt        j                  dt        j                  | j                        }d}	| j                  ||	d       | j                  |      }| j                  |      }t        j                  j                  | j                  |	      ||fd| j                        }
| j                  |
|       y | j                  ||||       y )NrZ     )r   ra  r   inznot inrI  r  zexception matchexception_matchr   
$exc_matchTr  r3   r  )r   discmp_opr   rB  rL  rn  r   rm   r@  r   rv  r   r   r  rh   )r&   r  rV   rW   r  rn   r   r  r  exc_match_namer  s              r(   op_COMPARE_OPzInterpreter.op_COMPARE_OP  sx   
"DHHM*B*$DHHM*B,,DHH%B%i00:xCC>KKc3,((3-C''--Sdhh-?CJJsC $$II!2#5#5488E *NJJU$JG((3-C((3-C'',,(Szrtxx  C JJsC KKCc*r*   c                 R    |j                   dk(  rdnd}| j                  ||||       y )NrZ   is notis)r   rL  )r&   r  rV   rW   r  rn   s         r(   op_IS_OPzInterpreter.op_IS_OP  s%    QXDBS#&r*   c                     ||}}| j                  d|||       |j                  dk(  rP| j                  |      }t        j                  j                  d|| j                        }| j                  ||       y y )Nr  rZ   rI  r  )rL  r   rn  r   rm   r@  r   rv  )r&   r  rV   rW   r  r   r  s          r(   op_CONTAINS_OPzInterpreter.op_CONTAINS_OP  sd    SD#sC(88q=((3-C''--Sdhh-?CJJsC  r*   c                     |7| j                   d   }t        |t        j                        sJ |j                  }t        j
                  || j                        }| j                  j                  |       y )Nr   )rN   r   )	rC  rj   r   r  r  r   r   r;  rB   )r&   r  r  r  r  s        r(   op_BREAK_LOOPzInterpreter.op_BREAK_LOOP  s\    ;%%b)DdBGG,,,))CggSdhh/!!#&r*   c                 <   |j                         |j                  d}||   }||    }d|j                  z  }t        j                  dt
        | j                        }| j                  ||       t        j                  j                  | j                  |      | j                  |      fd| j                        }	d|j                  z  }
| j                  |	|
      }t        j                  |||| j                        }| j                  j                  |       y )	N)TFz$bool%sboolr   r  r3   z$%spredr  )r
  r}  r   r   r   r  r   rv  rm   rh   rn  r  r;  rB   )r&   r  r  iftruebrsr  r  r?   r  r  pname	predicatebras                r(   _op_JUMP_IFzInterpreter._op_JUMP_IF  s    &&(99
 V&j/DKK(		&$DHH5

T
*'',,txx~/@"#'88  - T[[)JJW5J9	iiYvw HH&!!#&r*   c                 ,    | j                  ||d       y NFr  r  r  r&   r  r  s      r(   op_JUMP_IF_FALSEzInterpreter.op_JUMP_IF_FALSE       D7r*   c                 ,    | j                  ||d       y NTr  r  r  s      r(   op_JUMP_IF_TRUEzInterpreter.op_JUMP_IF_TRUE      D6r*   c                    |j                   }|j                         }|s
t        d   }n	t        d   }| j                  t	        j
                  d | j                        d|j                         }| j                  |      }t        j                  j                  |||| j                        }	d|j                   }
| j                  |	|
       d|j                   }t	        j                  d	t        | j                        }| j                  ||       t        j                  j                  | j                  |      | j                  |
      fd
| j                        }d|j                   }| j                  ||      }t	        j                  |||| j                        }| j                  j!                  |       y )Nr  r  r   z
$constNoner  r  z
$maybeNonez$boolr  r3   z$predr  )r}  r
  r   rv  r   rl   r   r   rn  rm   r   r   r  rh   r  r;  rB   )r&   r  r  r  r  r  rn   rW   rV   isnone	maybeNoner?   r  r  r  r  r  s                    r(   _jump_if_nonezInterpreter._jump_if_none  st   &&( $T*B$X.Bjjrxx$((; *4;;-8  :hhtnrsB .	

i
0t{{m$		&$DHH5

T
*'',,txx~0C/Er#'88  - }%JJW5J9		"(#*#xx) 	!!&)r*   c                 *    | j                  ||d       y NTr  r  s      r(   op_POP_JUMP_FORWARD_IF_NONEz'Interpreter.op_POP_JUMP_FORWARD_IF_NONE(      4t,r*   c                 *    | j                  ||d       y NFr  r  s      r(   op_POP_JUMP_FORWARD_IF_NOT_NONEz+Interpreter.op_POP_JUMP_FORWARD_IF_NOT_NONE+      4u-r*   c                 *    | j                  ||d       y r  r  r  s      r(   op_POP_JUMP_IF_NONEzInterpreter.op_POP_JUMP_IF_NONE/  s    tT40r*   c                 *    | j                  ||d       y r  r  r  s      r(   op_POP_JUMP_IF_NOT_NONEz#Interpreter.op_POP_JUMP_IF_NOT_NONE2  s    tT51r*   c                 *    | j                  ||d       y r  r  r  s      r(   op_POP_JUMP_BACKWARD_IF_NONEz(Interpreter.op_POP_JUMP_BACKWARD_IF_NONE9  r  r*   c                 *    | j                  ||d       y r  r  r  s      r(    op_POP_JUMP_BACKWARD_IF_NOT_NONEz,Interpreter.op_POP_JUMP_BACKWARD_IF_NOT_NONE<  r  r*   c                 ,    | j                  ||d       y r  r  r  s      r(   op_POP_JUMP_FORWARD_IF_FALSEz(Interpreter.op_POP_JUMP_FORWARD_IF_FALSE?  r  r*   c                 ,    | j                  ||d       y r  r  r  s      r(   op_POP_JUMP_FORWARD_IF_TRUEz'Interpreter.op_POP_JUMP_FORWARD_IF_TRUEB  r  r*   c                 ,    | j                  ||d       y r  r  r  s      r(   op_POP_JUMP_BACKWARD_IF_FALSEz)Interpreter.op_POP_JUMP_BACKWARD_IF_FALSEE  r  r*   c                 ,    | j                  ||d       y r  r  r  s      r(   op_POP_JUMP_BACKWARD_IF_TRUEz(Interpreter.op_POP_JUMP_BACKWARD_IF_TRUEH  r  r*   c                 ,    | j                  ||d       y r  r  r  s      r(   op_POP_JUMP_IF_FALSEz Interpreter.op_POP_JUMP_IF_FALSEK  r  r*   c                 ,    | j                  ||d       y r  r  r  s      r(   op_POP_JUMP_IF_TRUEzInterpreter.op_POP_JUMP_IF_TRUEN  r  r*   c                 ,    | j                  ||d       y r  r  r  s      r(   op_JUMP_IF_FALSE_OR_POPz#Interpreter.op_JUMP_IF_FALSE_OR_POPQ  r  r*   c                 ,    | j                  ||d       y r  r  r  s      r(   op_JUMP_IF_TRUE_OR_POPz"Interpreter.op_JUMP_IF_TRUE_OR_POPT  r  r*   c                 t   t        j                  dt        j                  | j                        }d}| j                  ||d       | j                  |      }| j                  |      }t         j                  j                  | j                  |      ||fd| j                        }	| j                  |	|       y )Nr  r   r  Tr  r3   r  )	r   r   r   r  r   rv  rn  rm   rh   )
r&   r  r  tostos1r  r  rV   rW   r  s
             r(   op_CHECK_EXC_MATCHzInterpreter.op_CHECK_EXC_MATCHW  s    		r11txx
 &

^d
ChhtnhhsmggllHH^$C:2488  
 	

3r*   c                 (   |j                   }|j                         }t        j                  dt        j
                  | j                        }d}| j                  ||d       | j                  |      }	| j                  |      }
t        j                  j                  | j                  |      |	|
fd| j                        }| j                  ||      }t        j                  |||| j                        }| j                  j                  |       y )	Nr  r   r  Tr  r3   r  r  )r}  r
  r   r   r   r  r   rv  rn  rm   rh   r  r;  rB   )r&   r  r  r	  r
  r  r  r  r  rV   rW   r  r  r  s                 r(   op_JUMP_IF_NOT_EXC_MATCHz$Interpreter.op_JUMP_IF_NOT_EXC_MATCHd  s    &&(		r11txx
 &

^d
ChhtnhhsmggllHH^$C:2488  
 JJsD)	iiYvw HH&!!#&r*   c                    | j                   j                  }|t        j                  d | j                        }| j
                  j                  |       | j                          | j
                  j                  t        j                  |d   | j                               y dt        d    }t        j                  t        |f| j                        }| j
                  j                  |       y )N	exceptionr   r  r   z8Unreachable condition reached (op code RERAISE executed)
reportable)rD  r  r   TryRaiser   r;  rB   r\  r   r   StaticRaiser   )r&   r  r  r  r   rs  s         r(   
op_RERAISEzInterpreter.op_RERAISEv  s    ..;;488<D%%d+&&(%%bggfUm&JK N"<013C>>.3&$((CD%%d+r*   c                    || j                  |      }| j                  j                  }|t        j                  || j
                        }| j                  j                  |       | j                          | j                  j                  t        j                  |d   | j
                               y t        j                  || j
                        }| j                  j                  |       y )Nr  r  r   )rn  rD  r  r   r  r   r;  rB   r\  r   Raise)r&   r  r  r  r   s        r(   op_RAISE_VARARGSzInterpreter.op_RAISE_VARARGS  s    ?((3-C..;;$((;D%%d+&&(%%bggfUm&JK 88ctxx8D%%d+r*   c                     d }t        j                  | j                  |      || j                        }| j	                  ||      S )N)rO   rc   r   )r   Yieldrn  r   rv  )r&   r  rO   r  rc   s        r(   op_YIELD_VALUEzInterpreter.op_YIELD_VALUE  s6    xxdhhuoUIzz$$$r*   c	                 D   |d}	t        |	      |rJt        |t              r)t        |D cg c]  }| j                  |       c}      }n| j                  |      }| j                  |   d   }
t        |
t
        j                        s#d}	t        j                  |	| j                        |
j                  }r| j                  |      }|r| j                  |      }t
        j                  j                  ||||| j                        }| j                  ||       y c c}w )Nz3op_MAKE_FUNCTION with kwdefaults is not implementedr   z_Unsupported use of closure. Probably caused by complex control-flow constructs; e.g. try-exceptr   )rB  rj   r   rn  r)  r   rl   r   r   r   rO   rm   make_functionrv  )r&   r  r?   codeclosureannotations
kwdefaultsdefaultsr  rs  assume_code_constfcoder   s                r(   op_MAKE_FUNCTIONzInterpreter.op_MAKE_FUNCTION  s     !GC%c**(E* X!FT$((4.!FG88H- ,,T215+RXX6" 
 11#488DD!''88D>Dhhw'Gww$$T5'8TXXN

4% "Gs   Dc	           
      4    | j                  ||||||||       y r$   )r$  )	r&   r  r?   r  r  r  r   r!  r  s	            r(   op_MAKE_CLOSUREzInterpreter.op_MAKE_CLOSURE  s!    dD$((C	9r*   c                    | j                   j                  j                  j                  |j                        }|| j
                  v r	 | j                  |      }ne|| j                  v rP| j                  j                  |      }| j                  |      }t        j                  |||| j                        }nJ d       | j                  ||       y # t        $ r d}t        |      w xY w)Nr  r   r   r  r  s           r(   op_LOAD_CLOSUREzInterpreter.op_LOAD_CLOSURE  s    <<$$--AA$((KDt)))3$B +++((..t4..s3ZZT5dhh?'-'qJJr3 ' 3HC-c223s   	C C*c                    t        | j                        }|j                  |k  r,| j                  |j                     }	 | j                  |      }nR|j                  |z
  }| j                  |   }| j                  |      }t        j                  |||| j                        }| j                  ||       y # t        $ r d}t        |      w xY wr  )rq   r  r   rn  r   rB  r  r  r   r  r   rv  )	r&   r  r  r  r?   r  rs  rS   rO   s	            r(   r(  zInterpreter.op_LOAD_CLOSURE  s    T//0Jxx*$))$((33$B
 hh+))#...s3ZZT5dhh?JJr3 ' 3HC-c223s   B6 6Cc                 f   | j                  |      }| j                  |      }t        j                  j                  |d| j                        }| j                  ||       t        j                  j                  | j                  |      |fd| j                        }| j                  ||       y )NrB   r   r  r3   r"  )r&   r  rN   rO   	appendvarr  
appendattr
appendinsts           r(   op_LIST_APPENDzInterpreter.op_LIST_APPEND  r(  r*   c                 4   | j                  |      }| j                  |      }d}| j                  j                  st        j                  |      | j                  j                  d   }t        |j                  t        j                        xr |j                  j                  dk(  }d }	|rt        | j                  j                  d d       D ]  }t        |t        j                        sd} nxt        |j                  t        j                        rFt        |j                  t        j                        r*|j                  |k(  r|}	|j                  j                   } nd} n |r|	t        j                  |      |r| j                  j                  }
| j                  j                  d   }|
j                  |
j!                  |
j#                  |	                   |j                  }|	j                  }|j                  |_        y t        j                  j%                  |d| j&                        }| j)                  ||       t        j                  j+                  | j                  |      |fd| j&                        }| j)                  ||       y )	NzAn unsupported bytecode sequence has been encountered: op_LIST_EXTEND at the start of a block.

This could be due to the use of a branch in a tuple unpacking statement.r   r   Fr   r   r  r3   )rn  r;  r   r   r   rj   rO   r   rm   rn   r   rk   rl   rN   r[   rB   r@   rc   rf   r   rv  rh   )r&   r  rN   rO   	extendvarr  rs  r   okbuild_empty_liststmtsbuild_tuple_asgnr   r   
extendattr
extendinsts                   r(   op_LIST_EXTENDzInterpreter.op_LIST_EXTEND  s   &!L !!&&11#66 !!&&r*

BGG,O-1O   !3!3!8!8"!=> !$		2B djj"((3  

BGG49N'+$ "ZZ---BB'( "*11#66&&++E#1166r:LL5;;/?#@AB*00K)//J*00J txxHJJJZiJ8dhhy&9E8R*.(( & 4JJJZcJ2r*   c                    | j                  |      }| j                  |      }| j                  |      }t        j                  j                  |d| j                        }| j                  ||       t        j                  j                  | j                  |      ||fd| j                        }| j                  ||       y )Nrg   r   r  r3   r"  )	r&   r  rN   rb   rO   
setitemvarr  setitemattrr-  s	            r(   
op_MAP_ADDzInterpreter.op_MAP_ADD*  s    &!hhsmggoofmoJ

:
6WW\\$((:"6er&*hh " 0


#
.r*   c                 v    t        j                  dt        | j                        }| j	                  ||       y )Nr   r   r  )r   r   r   r   rv  )r&   r  r  r  s       r(   op_LOAD_ASSERTION_ERRORz#Interpreter.op_LOAD_ASSERTION_ERROR4  s)    		*NI

S
)r*   c                 (     | j                   |i | y r$   )r  r&   rr   ra   s      r(   op_LOAD_METHODzInterpreter.op_LOAD_METHOD@  s    4'3'r*   c                 (     | j                   |i | y r$   )r  r?  s      r(   op_CALL_METHODzInterpreter.op_CALL_METHODC  s    t+s+r*   c                 \   |t         j                  k(  rAt        j                  t        d| j                        }| j
                  j                  |       y |t         j                  k(  r | j                  |fi | y |t         j                  k(  r | j                  |fi | y t        |      )Nr3   )ci1opINTRINSIC_STOPITERATION_ERRORr   r  r   r;  rB   UNARY_POSITIVErD  INTRINSIC_LIST_TO_TUPLEr  rB  )r&   r  operandr  r   s        r(   op_CALL_INTRINSIC_1zInterpreter.op_CALL_INTRINSIC_1G  s    %===~~&CR&*hh0""))$/E000&&&t6v6E999%%%d5f5)'22r*   r$   )F)NN)r/   r0   r1   r2   r"  r)   rU  rM  rH  rI  rx  rF  r  r  r  r  r\  r  r  r  r  r  r  r  propertyrE  r  r  r  r  r  rG  rv  rn  r  r  r  r  r  r  r  r  r  r  r  r  r   r)  r   r0  rB  r4  r;  r?  rA  rC  rE  rH  rJ  rL  rO  rR  rT  rV  rY  r^  rj  rq  ru  op_LOAD_FAST_CHECKry  r{  r  r  
op_DUP_TOPop_DUP_TOP_TWOr  r  r  r  r  r  r\  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r'  r*  r8  r<  rA  rD  rG  rJ  rL  rP  rR  rW  r[  r_  rb  rg  rj  rn  rq  ru  rx  r{  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  op_JUMP_BACKWARD_NO_INTERRUPTr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r$  r&  r(  r.  r7  r;  r=  r@  rB  rI  r3   r*   r(   r  r  >  s    L%"L!\
-^N,"&(21h%@&?
=
.(.;+zLB.9	    ' ' ) ) & & ) ) ) )%R$$))!>
)!,.  &&	" 
(	(!),,&&	,  
(	(!),,) )$)$)("((((( ( ($($(6 K	. %J	.
	7	= 
1	1!),,&&)	, 
(	(!),,.
A6 J N&&
	!, //	 
 
j	 	  "),, //	  
j	 
	  "),,//	 //	/ 
j	 	2 "),,(
3 30'* J	" 7"""8"&HAAAF&0((


// *X(
%
%
%
%
+((()()()())(((00010101011000''' %5!)'
 &&	+ 
(	(!),,J	+ 
1	1!),,+B'
!''*87 *D-. &&	1	2	(	(!),,-.87878787'$,,%:9
 //	   
j	 	   "),,/?3B/*(, &&	3 
(	(!),,r*   r  c                       e Zd Zy)rE  N)r/   r0   r1   r3   r*   r(   rE  rE  \  s    r*   rE  )6r  r8   r  r   loggingr   
numba.corer   r   r   numba.core.errorsr   r   r   numba.core.ir_utilsr	   r
   numba.core.utilsr   r   r   r   numba.core.byteflowr   r   r   r   numba.core.unsafer   numba.cpython.unsafe.tupler   r   rD  rB  objectr"   	getLoggerr/   rK  r5   rX   rd   r~   r   r   r   r   r   r   r  r   r  r   rE  r3   r*   r(   <module>rZ     s     
    ) ) 
 6K K C C   : ""E$$
i
((:V : '

H
%1v 1h
2&RHV FiX|~[|@[|.b2jZ -& Z -z@ "" $$
i
((r*   