
    i2                       S SK r S SKrS SKrS SKrS SKrS SKrS SKJrJrJ	r	  S SK
JrJrJr  S SKJrJr  S SKJrJrJr  S SKJrJrJrJr  S SKJr  S SKJr  \S	;   a  S S
KJr  O\S;   a  O\ " \5      e " S S\!5      r"\RF                  " \$5      r% " S S\!5      r&S r'S r(S r)S r*S r+S r,S r-S r.S r/S r0S r1 " S S\!5      r2\S	;   a   " S S\35      r4g\S;   a  g\ " \5      e)    N)errorsirconfig)NotDefinedErrorUnsupportedBytecodeErrorerror_extras)get_definitionguard)	PYVERSIONBINOPS_TO_OPERATORSINPLACE_BINOPS_TO_OPERATORS)FlowAdaptDFAAdaptCFA	BlockKind)eh)unpack_single_tuple      r      )CALL_INTRINSIC_1_Operandr   
   r      c                   $    \ rS rSrSrS rS rSrg)_UNKNOWN_VALUE   zNRepresents an unknown value, this is for ease of debugging purposes only.
    c                     Xl         g N_varname)selfvarnames     Q/var/www/html/trading/venv/lib/python3.13/site-packages/numba/core/interpreter.py__init___UNKNOWN_VALUE.__init__#   s        c                 8    SR                  U R                  5      $ )Nz_UNKNOWN_VALUE({}))formatr&   r'   s    r)   __repr___UNKNOWN_VALUE.__repr__&   s    #**4==99r,   r%   N)__name__
__module____qualname____firstlineno____doc__r*   r0   __static_attributes__ r,   r)   r!   r!      s     :r,   r!   c                   *    \ rS rSrSrS rS rS rSrg)Assigner-   a  
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                 n    0 U l         [        R                  " [        5      U l        [        5       U l        g r$   )dest_to_srccollectionsdefaultdictlistsrc_invalidatesetunused_destsr/   s    r)   r*   Assigner.__init__:   s)     *55d;Er,   c                    UR                   nUR                   nX@R                  ;   a=  U R                  R                  U5       H  nU R                  R                  U5        M      X0R                  ;   a  U R                  U   nUR                  (       aG  XR                  U'   U R                  U   R                  U5        U R                  R                  U5        U$ )z
Assign *srcvar* to *destvar*. Return either *srcvar* or a possible
simplified assignment source (earlier assigned to *srcvar*).
)namerA   popr=   is_tempappendrC   add)r'   srcvardestvarsrcnamedestnameds         r)   assignAssigner.assignB   s    
 ++<<*** ((,,X6  $$Q' 7&&&%%g.F??)/X&(//9!!(+r,   c                 v    XR                   ;   a  U R                   U   $ U R                  R                  U5        g)z]
Get a possible assignment source (a ir.Var instance) to replace
*destname*, otherwise None.
N)r=   rC   discard)r'   rN   s     r)   get_assignment_sourceAssigner.get_assignment_sourceV   s8    
 '''##H--!!(+r,   )r=   rA   rC   N)	r2   r3   r4   r5   r6   r*   rP   rT   r7   r8   r,   r)   r:   r:   -   s    
"(r,   r:   c                     X   R                   R                  nX   R                  nXRR                  U   ;   a2  UR                  U   R	                  U5        X4   R                  U5        gXSU   ;  a  [        S5      eg)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)targetrF   value_definitionsremoverJ   r   )old_bodyidxfunc_iralready_deleted_defslhsrhss         r)   _remove_assignment_definitionra   a   s     -


#
#C
-

C
""3''S!((-!%%c*	-	-&A
 	
 
.r,   c                     UR                   R                  5       nUR                  nUR                  5        H  u  pXU	   S   4Xi'   M     SX#'   [        XXE5        U$ )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_indexesra   )
r[   keyword_exprnew_bodybuildmap_idxr]   r^   kwsrf   keyindexs
             r)   #_call_function_ex_replace_kws_smallrm   z   sj    2 


!
!
#C !..M#))+
u:a=)
 , "H! Jr,   c                    SXB'   [        XXW5        / nUS-   n	X::  Ga  X	   n
[        U
[        R                  5      (       a)  [        U
R                  [        R
                  5      (       d  [        U5      eU
R                  R                  nU
R                  R                  nU	S-  n	SnX::  a  U(       d  X	   n[        U[        R                  5      (       a  [        UR                  [        R                  5      (       a[  UR                  R                  S:X  aA  UR                  R                  R                  U:X  a  UR                  R                  S:X  a  SnOU	S-  n	X::  a	  U(       d  M  U(       a  X:X  a  [        U5      eX	S-      n[        U[        R                  5      (       a  [        UR                  [        R                  5      (       a  UR                  R                  S:X  a  UR                  R                  R                  WR                  R                  :X  aJ  [        UR                  R                  5      S:X  a'  UR                  R                  S	   R                  U:X  d  [        U5      eUR                  R                  S   nUR                  UU45        SXI'   SXIS-   '   [        X	XW5        [        X	S-   XW5        U	S-  n	X::  a  GM  U$ )
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.
Nrc   Fgetattr__setitem__Tcall   r   )ra   
isinstancer   AssignrX   Constr   rW   rF   ExpropattrfunclenargsrI   )r[   buildmap_nameri   
search_endrh   r]   errmsgr^   rj   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

$+
z299--:++RXX66 +622!((--""((&!#1L<33|11277;; &&))Y6 &&,,11$% !&&++}< $$ !A &!MB ) +622q 01|RYY//<--rww77""%%/""'',,&&++, L&&++,1""''*//  +622$$))!,

GW%&!%%)!"%G	
 	&Q&	
 	s 
$t Jr,   c                 :    SX#'   [        XXE5        UR                  $ )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)ra   rd   )r[   
tuple_exprrh   buildtuple_idxr]   r^   s         r)   $_call_function_ex_replace_args_smallr   .  s'    4  $H!' r,   c                    Sn/ n[        U[        R                  5      (       aU  [        UR                  [        R                  5      (       a,  UR                  R
                  n	SX#'   [        XXF5        US-  nO[        S5      eX7:  GaA  X   n
[        U
[        R                  5      (       a  U
R                  R
                  U	:X  ap  [        U
R                  [        R                  5      (       aG  U
R                  R                  S:X  a-  U
R                  R                  (       d  SX#'   [        XXF5        GOX7:X  d  [        U
[        R                  5      (       a  U
R                  R
                  U	:X  ak  [        U
R                  [        R                  5      (       aB  U
R                  R                  S:X  a(  U
R                  R                  [        R                  :X  d  [        U5      eU
R                  R                   R
                  nU
R                  R"                  R
                  nXS-
     n[        U[        R                  5      (       af  [        UR                  [        R                  5      (       a=  UR                  R                  S:X  a#  [%        UR                  R                  5      S:X  d  [        U5      eUR                  R
                  U:X  a  [        S5      eUR                  R
                  U:X  a  Un	O[        U5      eUR'                  UR                  R                  S   5        SX#'   SX#S-
  '   [        XXF5        [        XS-
  XF5        US-  nSnX7:  aZ  U(       aS  X   n[        U[        R                  5      (       a  UR                  R
                  U	:X  a  S	nOUS-  nX7:  a	  U(       a  MS  X7:  a  GMA  X7:X  a  [        U5      eUSSS
2   $ )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   Nrc   unreachablebuild_tuplebinoprr   TF)rs   r   rt   rX   VarrF   ra   AssertionErrorrW   rv   rw   rd   fnoperatorrJ   r   r_   r`   rz   rI   )r[   vararg_stmtrh   r}   r]   r~   r^   r   
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  sb   L LJ;		**{(("&&11!'',,#%'	
 	a

 ]++ 
$*{BII..""'';6;,,bgg66!!$$5%%++#'H )g  *;		22&&++"# %%rww   %%((G3%%((HLL8 /v66"((,,11H"((,,11H &1n5N>29955"(("''  #((++$% ,,223q8 /v66$$))X5$]33&&++x7& /v66$$**1- $(H '+H!^$)g *q.' !OJL,$0	y"))44!((--&' $)L( !OJ; ,U 
$P ! 'v..ddr,   c                 J   [         R                  " S5      n[        R                  " [        5      nU R
                  R                  5        GH  nSn/ n[        UR                  5       GHW  u  pg[        U[        R                  5      (       Ga  [        UR                  [        R                  5      (       Ga  UR                  R                  S:X  Ga  UR                  R                  Gb  SnUR                  nUR                   n	UR"                  n
UR$                  nUR                  nUS-
  nUnSnSnUS:  ap  U(       di  UR                  U   n[        U[        R                  5      (       a'  UR&                  R(                  UR(                  :X  a  SnOUS-  nUS:  a	  U(       d  Mi  U
(       dJ  U(       aC  [        UR                  [        R                  5      (       a  UR                  R                  S:X  d  [+        U5      eUR                  R,                  (       a%  [/        UR                  UR                  UUU U5      n
O)[1        UR                  UR(                  UUS-
  UU UU5      n
UnUGbq  U	(       a  [+        U5      eUnSnSnUS:  ap  U(       di  UR                  U   n[        U[        R                  5      (       a'  UR&                  R(                  UR(                  :X  a  SnOUS-  nUS:  a	  U(       d  Mi  U(       d  [+        U5      e[        UR                  [        R                  5      (       a?  UR                  R                  S	:X  a%  [3        UR                  UR                  UUU U5      n	Oi[        UR                  [        R                  5      (       a%  UR                  R                  S
:X  a  [+        U5      e[5        UR                  UUUU UU5      n	[        R                  R7                  UR8                  XUR:                  UR&                  S9n[=        UR                  X`U5        [        R                  " UUR&                  UR:                  5      nU R>                  UR&                  R(                     RA                  U5        GO[        U[        R                  5      (       a  [        UR                  [        R                  5      (       a  UR                  R                  S:X  a  UR                  R$                  b  UR                  nUR$                  R(                  nUU R>                  ;   ah  [C        U R>                  U   5      S:X  aL  U R>                  U   S   n[        U[        R                  5      (       a  UR                  S
:X  a  [+        U5      eURA                  U5        GMZ     U(       d  GM  UR                  RE                  5         UR                  RG                  U Vs/ s H
  nUc  M  UPM     sn5        GM     U $ s  snf )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, ...)Frq   NTrc   r   	build_mapr   list_to_tuple)rW   )$textwrapdedentr>   r?   rB   blocksvalues	enumeratebodyrs   r   rt   rX   rv   rw   varkwargr{   rj   varargrW   rF   r   rd   rm   r   r   r   rq   ry   locra   rY   rI   rz   clearextend)r]   r~   r^   blkblk_changedrh   istmtrq   r{   rj   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~~$$& *GA4++tzz2773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<<IIt$((4;; (  .HHa*> yy4;;A$$T[[%5%56==hG4++tzz27733JJMMV+JJ%%1
 zz"kk..7#7#77G00=>!C #//<Q?D!$00TWW5O6v>>OOD!a +d ;HHNNHHOOB1AQBCo 'p N Cs   X 
X 
c           
        ^ ^^ SnT R                   R                  5        GH  u  nm U4S jnU" 5       nUGb}  TR                  US   S   US   S    nU(       a*  [        S5        U H  n[        U5        M     [        S5        / n/ nUS   S   n	U	R                  R
                  n
U H  n[        U[        R                  5      (       d  M$  [        UR                  [        R                  5      (       d  MO  UR                  nUR                  S:X  d  Mm  UR                  R
                  U
:X  d  M  UR                  S	:X  a'  UR                  UR                  R
                  5        M  UR                  S
:X  a'  UR                  UR                  R
                  5        M   e   / mU U4S jnU	R                  nU(       a  [        S5        TR                  5         US   S   nUnU GH  n[        U[        R                  5      (       Ga  [        UR                  [        R                  5      (       Gan  UR                  nUR                  S:X  ax  UR                  R
                  U;   d  UR                  R
                  U;   a1  T R                  R!                  UR                  R
                  5        M  TR                  U5        M  UR                  S:X  Ga   UR"                  R
                  nUU;   d  UU;   Ga  UR$                  S   n[        U[        R&                  5      (       Ga?  U< SUR
                  < 3nUU;   a,  [        R                  R)                  U/UR*                  5      nO[        R,                  " S[.        UR*                  S9nUR0                  R3                  SUR*                  S9nTR                  [        R                  " UUUR*                  S95        [        R                  R5                  UU4SUR*                  S9n[        R&                  " UR0                  UUR*                  5      n[        R                  " UUUR*                  5      nU" U5        Un[        R                  R7                  [8        R:                  UUUR*                  S9n[        R                  " UUR                  UR*                  5      nU" U5        UR                  nGM  TR                  U5        GM  UR                  S:X  a  UR                  R
                  U
:X  ak  [        R                  R)                  UR                  UR*                  5      n[        R                  " UUR                  UR*                  5      nU" U5        GM  TR                  U5        GM  TR                  U5        GM  TR                  U5        GM     U" [        R                  " XR                  UR*                  5      5        U(       a  [        S5        T H  n[        U5        M     TR                  SS nUSUS   S    nTR                  US   S   S-   S nUT-   U-   nTR                  R=                  5         TR                  R?                  U5        U(       a  [        S5        TR                  5         OGM  GM     T $ )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                    > Sn [        [        [        TR                  5      5      5       H  nTR                  U   n[	        U[
        R                  5      (       aO  UR                  n[	        U[
        R                  5      (       a$  UR                  S:X  a  UR                  S   nSn X4nU (       d  M  [	        U[
        R                  5      (       d  M  UR                  R                  W:X  d  M  WX44nUs  $    g )NFr   r   T)reversedrangerz   r   rs   r   rt   rX   rv   rw   inforW   rF   )r   r\   r   rX   target_listbtregionr   s          r)   find_postive_region4peep_hole_list_to_tuple.<locals>.find_postive_region$  s    #E#chh-$89C88C=D!$		22 $

&ubgg66 %O ;*/**Q-K$(E"%Bu%dBII66#{{//;>*,sk):'- :r,   Nrc   r   z
WINDOW: ro   r   rI   c                   > TR                  U 5        U R                  R                  TR                  ;   ac  [	        TR                  U R                  R                     5      S:X  d   eTR                  U R                  R                     R                  5         TR                  U R                  R                     R                  U R                  5        g)z-Adds to the new_hole and fixes up definitionsrc   N)rI   rW   rF   rY   rz   r   rX   )r   r]   new_holes    r)   append_and_fix/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:rq   _var_tuplerF   rX   r   $_list_extend_gv_tupler   )rW   rX   r   r8   r   r_   r`   r   
build_listz

NEW HOLE:z
DUMP post hole:) r   rd   r   printrW   rF   rs   r   rt   rX   rv   rw   rx   rI   dumprY   rG   ry   r{   r   r   r   Globalr   scoperedefinerq   r   r   rJ   r   r   )r]   _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     s3   @ F ~~++-." )*F!HHVAYq\F1IaLA	+&&a '"Iay|![[--
 #A!!RYY//%aggrww77#$77D $9 4$(JJOOz$A $(99#8$+NN188==$A%)YY(%:$+NN188==$A$,1 #  	H "& *%HHJ !)A,$"A!!RYY//%aggrww7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. !*[ #` ryynn)7);); = >-(%a & hhqk=F1IaL)xxq	!q 0 12Xo, $-.HHJ i  .p Nr,   c                    [        5       nU R                  R                  5        GH1  nUR                   H  n[        UR	                  5       5      nU H6  nUR
                  R                  S5      (       d  M%  UR                  U5        M8     XA-  (       d  Mc  [        U[        R                  5      (       d  M  UR                  UR                  5        M     / nUR                   H7  n[        UR	                  5       5      U-  (       a  M&  UR                  U5        M9     UR                  R                  5         UR                  R                  U5        GM4     U $ )z\
This rewrite removes variables used to store the `__exit__` function
loaded by SETUP_WITH.
z$setup_with_exitfn)rB   r   r   r   	list_varsrF   
startswithrJ   rs   r   rt   rW   rI   r   r   )r]   	dead_varsr   r   usedvrh   s          r)   peep_hole_delete_with_exitr     s    
 I~~$$&HHD t~~'(D66$$%9::MM!$ 
 dBII..MM$++.  HHD()I55%  	!) ', Nr,   c           
      
   [         R                  " S5      n[        R                  " [        5      nU R
                  R                  5        GH   n/ n0 n[        R                  " [        5      n0 nSn[        UR                  5       GH  u  pU
nSn[        U
[        R                  5      (       GaN  [        U
R                  [        R                  5      (       Ga$  U
R                  R                  S:X  a  U
R                   R"                  nXU
R                   R"                  '   XjR                   R"                     R%                  U	5        U
R                  R&                  R)                  5       XzR                   R"                  '   GOyU
R                  R                  S:X  Ga^  U	S:  GaW  U
R                  R*                  R"                  nUR                  U	S-
     nU
R                  R,                  n[        U[        R                  5      (       Ga  UR                   R"                  U:X  Ga  [        UR                  [        R                  5      (       Ga  UR                  R                  S:X  Ga  UR                  R.                  S	;   Gat  UR                  R                  R"                  nUR                  R.                  nUS
:X  a5  UU;   a/  UU   R%                  U5        UU   R1                  U	S-
  U	/5        GOUS:X  a  US   R"                  nUU;   a  UU;   a  UU   R1                  UU   5        UU   R1                  UU   5        UU   R%                  U	S-
  5        UU    H   n[3        UR                  UU U5        SUU'   M"     UU	 UU	 UU	 [3        UR                  XU5        [5        U UUR                  UU   UU   5      nUU   R7                  5         UU   R%                  U	5        SnO[9        U5      e[        U
[        R                  5      (       a  [        U
R                  [        R                  5      (       aX  U
R                  R                  S:X  a>  U
R                  R                  R"                  U;   a  U
R                  R.                  S	;   db  U
R;                  5        HN  nUR"                  U;   d  M  UR"                  U:w  d  M'  UUR"                  	 UUR"                  	 UUR"                  	 MP     UR%                  U5        GM     U(       d  GM  UR                  R7                  5         UR                  R1                  U Vs/ s H
  nUc  M  UPM     sn5        GM#     U $ s  snf )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   rq   r   rc   ro   )rp   _update_from_bytecoderp   r   T)r   r   r>   r?   rB   r   r   r@   r   r   rs   r   rt   rX   rv   rw   rW   rF   rI   rd   re   ry   r{   rx   r   ra   _build_new_build_mapr   r   r   )r]   r~   r^   r   rh   lit_map_def_idxlit_map_use_idxmap_updatesr   r   r   new_inststmt_build_map_out	func_namer   r{   update_map_namerx   d2_map_namelinenumr   r   s                         r)   peep_hole_fuse_dict_add_updatesr    s   D __ # $F '2237~~$$&
 &11$7 *GAH "&$		**z$**bgg/N/N::==K/)-)9)9& 9:DKK$4$45#KK$4$45<<Q?48JJ4D4D4I4I4KK 0 01ZZ]]f,Q !%

 4 4I $'88AE?L::??D"<;;(//44	A&|'9'9277C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/>/OG$A(+(/(/(<	%& 9=HW$5 0P %4K$@$3K$@$/$< !>$'HHa:N!" ,@$+$3$'HH$3O$D$/$@," !0 @ F F H / @ G G J.2 '?v&F F 4++tzz27733JJMMY.JJ$$))_<JJOO'OO>>+C
 O3HH(::+CHH5+CHH5'1 , OOH%m +p ;HHNNHHOOB1AQBCQ 'T N Cs   U2
U2
c           	         0 n[        U R                  R                  5       5      n[        U5       GH  u  nu  pE/ n[        UR                  5       H7  u  px[        U[        R                  5      (       d  M&  UR                  U5        M9     U(       d  Md  / n	U H  n[        R                  " UR                  UR                  S9n
U
R                  R                  UR                  SU 5        U	R                  U
5        [        R                  " UR                  UR                  S9nUR                  R                  UR                  U   5        U	R                  U5        M     UnU	 HE  nXU'   US-   nUR                  R                  [        R                  " XR                  S95        UnMG     US-   [        U5      :  a$  XUS-      S   :  a  [        R                   " S5      e[        R                  " UR                  UR                  S9nUR                  R                  UR                  US   S-   S 5        XU'   GM     U R                  R#                  U5        U $ )z
Split blocks that contain ir.PopBlock.

This rewrite restores the IR structure to pre 3.11 so that withlifting
can work correctly.
r   Nrc   r   zPOP_BLOCK peephole failedr   )sortedr   rd   r   r   rs   r   PopBlockrI   Blockr   r   r   Jumprz   r   InternalErrorupdate)r]   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% *GA$,,%%a( + >J#XXciiSWW=
&&sxx|4!!*-XXciiSWW=
&&sxx{3!!*- $ J$,2j)'!^
""277:77#CD'
	 % {S//w{!;A!>> !../JKKxx		sww7HMM  .*<q*@*A!BC(0*%E ":H NN-(Nr,   c                 D   X#   nUR                   nUR                  n/ n/ n	U GH   n
U
u  p[        [        X5      n[	        U[
        R                  [
        R                  [
        R                  45      (       a  UR                  UR                  5        [        [        X5      n[	        U[
        R                  [
        R                  [
        R                  45      (       a  U	R                  UR                  5        M  U	R                  [        UR                  5      5        GM     0 n[        U5      [        U5      :X  a;  [        X5       VVs0 s H	  u  nnUU_M     nnn[        U5       H
  u  nnUX'   M     OSn[
        R                  R!                  U[        U5      UUUR"                  S9nU R$                  U   R                  U5        [
        R&                  " U[
        R(                  " UR*                  XR"                  5      UR"                  5      $ s  snnf )z[
Create a new build_map with a new set of key/value items
but all the other info the same.
Nrd   sizeliteral_valuerf   r   )rW   rX   r
   r	   rs   r   ru   r   FreeVarrI   r!   rF   rz   zipr   rv   r   r   rY   rt   r   r   )r]   rF   r[   
old_lineno	new_items
old_assign
old_targetold_bmliteral_keysr   pairkr   key_def	value_defrf   r   yr  r   new_bms                        r)   r   r   	  s   
 %J""JFL F3g"))RZZ@AA..'5	i"((BIIrzz!BCCMM)//* MM.01  M
<C	N**-l*CD*C$!QA*CDl+DAq M ,  WW^##JJ  F %%f- 99z''~~>

 ) Es   Hc                   :   \ rS rSrSrSrS rS rS rS r	S r
S	 rS
 rS rS rSS jrS rS rS rS rS rS rS rS rS r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       rS r SS jr!S  r"SS! jr#S" r$S# r%S$ r&S% r'S& r(S' r)S( r*S) r+S* r,S+ r-S, r.S- r/S. r0\1S/;   a  S0 r2O\1S1;   a  O\3" \15      e\1S/;   a  S2 r4O\1S1;   a  O\3" \15      eS3 r5S4 r6S5 r7S6 r8S7 r9S8 r:S9 r;S: r<S; r=S< r>S= r?S> r@S? rA\1S@;   a  SSA jrBO\ArB\1S@;   a
  SB rCSC rDSD rEO\1SE;   a  O\3" \15      e\1S/;   a  \BrFSF rGO\1S1;   a  O\3" \15      eSG rHSH rISI rJ\JrK\JrLSJ rMSK rNSL rOSM rP\1SN;   a  SO rQO\1SP;   a  SQ rQO\3" \15      eSR rR\1SN;   a  SS rSO\1SP;   a  ST rSO\3" \15      e\1SN;   a  SU rT\1SN;   a  SV rUO\1SP;   a  SW rUO\3" \15      eSX rVSSY jrWSZ rXS[ rYS\ rZS] r[S^ r\S_ r]S` r^Sa r_\1S@;   a  Sb r`O\1Sc:  d   eSd raSe rbSf rcSg rdSh reSi rfSj rgSk rhSl riSm rjSn rkSo rlSp rmSq rnSr roSs rpSt rqSu rrSv rsSw rtSx ruSy rvSz rwS{ rxS| ryS} rzS~ r{S r|S r}S r~S rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r\rSS jrS r\1S/;   a  S rO\1S1;   a  O\3" \15      e\1S@;   a  S rO\1SE;   a  O\3" \15      eS rS rS rSS jrS rS rS rS rS rS r\1S/;   a  S rS rO\1S1;   a  O\3" \15      eS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r\1SN;   a  S rO\1SP;   a  S rO\3" \15      eS rS rS rS rS rS r\1S/;   a  S rSrg\1S1;   a  Srg\3" \15      e)Interpreteri>  z2A bytecode interpreter that builds up the IR.
    Fc                    Xl         U R                  (       a  [        UR                  5        UR                  U l        UR
                  U l        [        R                  R                  U5      =U l	        U l
        UR                  U l        0 U l        [        R                  " [        5      U l        [#        5       U l        g r$   )func_id_DEBUG_PRINTr   ry   	arg_count	arg_namesr   Locfrom_function_idr   	first_locis_generatorr   r>   r?   r@   definitionsrB   _exception_vars)r'   r,  s     r)   r*   Interpreter.__init__D  s    ',, ** **$&FF$;$;G$DD4>#00 &2248  #ur,   c           	         Xl         / U l        [        R                  " SU R                  S9nU R                  R                  U5        [        U5      nUR                  5         [        U5      U l	        [        U5      U l        [        R                  (       a  U R                  R                  5         SU l        SU l        SnU R                  R"                  R%                  5        H7  u  pVUR&                  (       d  M  [)        U[)        UR&                  5      5      nM9     X@l        [,        S;   aR  [/        U R                   R0                   Vs/ s H!  nUR2                  U R*                  :  d  M  UPM#     sn5      U l        O[,        S;   a  O[7        [,        5      e/ U l        SU l        U R                  R                  [        R                  " U R<                  U R                  S95        U R?                  5        H  u  pU RA                  X5        M     [,        S;   a  U RC                  5         O[,        S;   a  O[7        [,        5      eU RE                  5         [        RF                  " U R"                  U RH                  U RJ                  U RL                  U RN                  U RP                  U RR                  5      n
[T        RW                  U
RY                  5       5        / n[,        S;   a  UR                  [Z        5        [,        S;   a  UR                  [\        5        UR                  [^        5        [,        S;   a*  UR                  [`        5        UR                  [b        5        U Re                  X5      nU$ s  snf )	z 
Generate IR for this bytecode.
N)parentr   r   r   r   r   r   r   r   )r   r   r   r   )3bytecodescopesr   Scoper   rI   r   runr   dfar   cfar   DUMP_CFGr   current_blockcurrent_block_offsetr   rd   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
FunctionIRr3  r,  r2  r4  r.  r/  _loggerdebugdump_to_stringr  r   r   r   r  post_process)r'   r;  global_scopeflowrE  _inst_blocksentryr  rj   r]   	peepholespost_processed_irs                r)   	interpretInterpreter.interpretU  s    !xxt:<(H~
D>D>??HHMMO "$(!"hhoo335NA%();),[-=-=)>&@" 6 #5**,1$(MM$C$C ;$C5KK$"9"99 $C ;-<D) ,,%i002884+=+=488LM *IDNN4% +33  "*$%i00%%'--T->-> $0@0@ $@ 	g,,./ 	339:<<4534<<
 KL<= --iA  ];s   M=0M=c                 (    U H  nU" U5      nM     U$ r$   r8   )r'   r[  r]   peeps       r)   rU  Interpreter.post_process  s    D7mG r,   c           	      "  ^ ^ [         S;   d   eT R                  R                  nT R                  R	                  5        H  u  nmT R
                  R                  U   R                  nUR                  U5       H  u  pET R
                  R                  U   R                  n[        [        X65      5       H  u  nu  pX:w  d  M    O    [        [        U5      [        U5      5      nUU 4S jn
U
" [        XgS 5      5      (       d  M    M     M     g)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
r9  c                 0  > U (       a  U R                  5       nUS   [        S5      :X  ab  TTl        [        TR                  5      nTR                  R                  5         TR                  5         TR                  R                  U5        gU (       a  M  g g )NkindTRYT)rG   r   rB  r@   r   r   _insert_try_block_endr   )remainentoldbodyblockr'   s      r)   	do_change.Interpreter._end_try_blocks.<locals>.do_change  sp     $jjlv;)E*::16D.&*5::&6G!JJ,,. 668!JJ--g6#' !&r,   N)r   r@  graphr   rd   r?  infos
blockstackpredecessorsr   r  minrz   r@   )r'   rm  r   cur_bsincrX  inc_bsr   r   r'  rk  rj  s   `          @r)   rO  Interpreter._end_try_blocks  s      7777![[..0MFEXX^^F+66F,,V4,77 "+3v+>!?IAvv "@ CKV5A
( T&*-../ 5	 1r,   c                    U R                   R                  5       nU R                  R                  5        HS  u  p#U HH  n[	        U[
        R                  5      (       d  M$  UR                  nXQ;   d  M7  UR                  U5        MJ     MU     [        [        S U5      5      nU(       aP  US   nU R                  R                  U5      R                  nSn	[        R                  " U	R!                  U5      US9eg)zcSearch for unsupported use of exception variables.
Note, they cannot be stored into user variable.
c                 .    U R                  S5      (       + $ )N$)r   )r   s    r)   <lambda>6Interpreter._legalize_exception_vars.<locals>.<lambda>  s    ALL,=(=r,   r   z5Exception object cannot be stored into variable ({}).r   N)r5  re   r4  rd   rs   r   r   rF   rJ   r@   filterrL  getr   r   r   r.   )
r'   excvarsr(   defnvarsr   r$  uservarfirstr   msgs
             r)   rP  $Interpreter._legalize_exception_vars  s    
 &&++-!%!1!1!7!7!9Ga((A|G,	  ": v=wGHAJE$$((/33CIC11#**U2CMM r,   c                     [        U R                  5       H5  u  p[        R                  " XU R                  S9nU R                  X25        M7     g )N)rl   rF   r   )r   r/  r   Argr   store)r'   rl   rF   vals       r)   init_first_blockInterpreter.init_first_block  s7    $T^^4KE&&uTXX>CJJs! 5r,   c              #   |  #    [        U R                  R                  5       5       GH  u  pU R                  UR                     nUR
                  S:X  a  U R                  UR                     nU R                  R                  UR                  5      U l        U R                  UR                  5        US:X  a  U R                  5         U R                  R                   HC  u  pEU R                  U   nU R                  R                  UR                  5      U l        Xe4v   ME     U R                  5         GM     g 7f)NEND_FORr   )r   r@  iterliveblocksr;  r   opnamenextr   with_linenolineno_start_new_blockr  rK  insts_end_current_block)r'   blkctrj  	firstinstr   rj   r  s          r)   rM  Interpreter._iter_inst  s     %dhh&=&=&?@LEell3I
 9, MM)..9	xx++I,<,<=DH!!%,,/z%%'#||11}}V,88//<i  2 ##%# As   D:D<c                 2   U R                   nU R                  U5        U R                  (       a  U R                  R                  OS nUb  UR                  (       d  Ubp  US   U R
                  R                  R                  5       ;   aE  [        R                  " U R                  S5      US   UU R                  S9nUR                  U5        O/[        R                  " XR                  S9nUR                  U5        U R                  R                  U R                      U l        [#        5       U l        [&        S;   a  U R(                  (       a  XR(                  S   R*                  :  as  U R(                  R-                  5       n[/        U[        R0                  5      (       a9  U R                   R                  [        R2                  " U R                  5      5        OOU R(                  (       a  M  U R                  R                  nUb  XsLa  U R5                  5         g g g [&        S;   a^  U R(                  (       aL  XR(                  S   R*                  :  a  U R(                  R-                  5         Og U R(                  (       a  MK  g g [7        [&        5      e)Nend$exception_checkcondtruebrfalsebrr   r   r9  r   r:  )rB  insert_blockrK  active_try_blockis_terminatedr@  rm  nodesr   Branchr|  r   rI   r  r?  rn  rC  r:   assignerr   rJ  exitrG   rs   Withr  _insert_try_block_beginrI  )r'   r   oldblocktryblkbranchjmpsynblk	newtryblks           r)   r  Interpreter._start_new_block  s   %%&!26,,..D(>(> !fUmtxx~~7K7K7M&M "45!%="	 ' ggf((3$ xx~~d&?&?@ 
33$$//3888!//335F!&"''22**11"++dhh2GH $$$ 55I$*002 + % *$$$//3888&&**,	 $$$ &i00r,   c                     U R                   R                  (       d)  U R                  R                  nUb  U R	                  5         U R                  5         U R                  5         g r$   )rB  r  rK  r  _insert_exception_check_remove_unused_temporaries_insert_outgoing_phis)r'   r  s     r)   r  Interpreter._end_current_block:  sJ    !!//\\22F!,,.'')""$r,   Nc                 (   [         R                  " X!U R                  S9nU R                  XBSS9  [         R                  R                  U R                  U5      SSU R                  S9nU=(       d    SR                  U5      nU R                  XSSS9  g)ah  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rX   rF   r   r8   z$callres_{}N)r   r   r   r  rv   rq   r|  r.   )r'   ry   gv_nameres_namegv_fncallress         r)   _inject_callInterpreter._inject_callD  st     		'TXX6

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

$
?r,   c                 D    U R                  [        R                  S5        g)z<Insert IR-nodes to mark the start of a `try` block.
        mark_try_blockN)r  r   r  r/   s    r)   r  #Interpreter._insert_try_block_beginW  s     	"++-=>r,   c                 D    U R                  [        R                  S5        g)z:Insert IR-nodes to mark the end of a `try` block.
        end_try_blockN)r  r   r  r/   s    r)   rf  !Interpreter._insert_try_block_end\  s     	"**O<r,   c                 l   U R                   R                  nUS   nU R                   R                  R                  U5      nU(       am  [        R
                  " SU R                  S9nU HG  nXPR                  ;   a  [        S5      eU R                  XES9  U R                  R                  U5        MI     gg)z?Insert IR-nodes to initialize the exception variables.
        r  NrX   r   z2exception variable CANNOT be defined by other coderX   rF   )rK  r  outgoing_edgepushedr|  r   ru   r   r4  r   r  r5  rJ   )r'   r  endblk
edgepushed
const_noner   s         r)   _insert_exception_variables'Interpreter._insert_exception_variablesa  s     ..\\5599&A
 $((;J!***(L  


6$$((- " r,   c                 f    U R                  5         U R                  [        R                  SS5        g)zECalled before the end of a block to inject checks if raised.
        exception_checkr  N)r  r  r   r  r/   s    r)   r  #Interpreter._insert_exception_checku  s,     	((*",,.?,	.r,   c                    / n0 nU R                   R                   GH  n[        U[        R                  [        R
                  45      (       a9  UR                  R                  U;   a  X#R                  R                     Ul        GO6[        U[        R                  5      (       Ga  UR                  R                  (       a0  UR                  R                  U R                  R                  ;   a  M  [        UR                  [        R                  5      (       aK  UR                  R                  U;   a1  X#R                  R                     Ul        UR                  U5        GMK  [        UR                  [        R                  5      (       a  UR                  R                   S:X  ai  UR                  R                  R                  U;   aE  X#R                  R                  R                     UR                  l        UR                  U5        GM  [        UR                  [        R                  5      (       Ga  UR                  R                  (       Gae  U(       Ga]  [        US   [        R                  5      (       Ga:  US   nUR                  R                  UR                  R                  :X  Ga  U R#                  UR                  R                  UR                  5      (       d  UR                  X#R                  R                  '   UR                  Ul	        U R$                  UR                  R                     R'                  UR                  5        U R$                  UR                  R                     R)                  U R$                  R+                  UR                  R                  5      5        GM  UR                  U5        GM     XR                   l        g)zJ
Remove assignments to unused temporary variables from the
current block.
exhaust_iterr   N)rB  r   rs   r   SetItemSetAttrrX   rF   rt   rW   rH   r  rC   r   rI   rv   rw   _var_used_in_binopr4  rZ   r   rG   )r'   rh   replaced_varr  prev_assigns        r)   r  &Interpreter._remove_unused_temporaries}  s   
 &&++D 4"**bjj!9::

<7)**//:
D")),,KK'' KK,,0J0JJ tzz26622 JJOO|;!-jjoo!>DJOOD) tzz27733 JJMM^; JJ,,11\A'3JJ4D4D4I4I'JDJJ$OOD) tzz26622tzz7I7I7I$HRL")))L)L"*2,K $**//4::??B$($;$; $ 0 0+2C2C%E %E8<ZZ__5-1[[*(()9)9:AA$**M(()9)9:AA ,,00A !OOD!e ,h #+r,   c                     [        U[        R                  5      =(       aM    UR                  S;   =(       a7    XR                  R
                  :H  =(       d    XR                  R
                  :H  $ )zXreturn True if 'expr' is a binary expression and 'varname' is used
in it as an argument
)r   inplace_binop)rs   r   rv   rw   r_   rF   r`   )r'   r(   r   s      r)   r  Interpreter._var_used_in_binop  sO     4) KGG99K-IHHMM1I	Lr,   c                    U R                   R                  R                  5        H  u  pU R                  R	                  UU R
                  S9n U R                  U5      n[        R                  " XCU R
                  S9nU R                  UR                     R                  UR                  5        U R                   R"                  (       d  U R                   R                  U5        M  U R                   R%                  U5        M     g! [        R                   a3    [        S;   d   S5       e[        R                  " SU R
                  S9n Nf = f)zL
Add assignments to forward requested outgoing values
to subsequent blocks.
r   r9  zunexpected missing definitionNr  rX   rW   r   )rK  outgoing_phisrd   rL  get_or_definer   r|  r   r   r   ru   rt   r4  rF   rI   rX   rB  r  insert_before_terminator)r'   phinamer(   rW   r  r   s         r)   r  !Interpreter._insert_outgoing_phis  s   
 !% : : @ @ BG''55g:>(( 6 DF9hhw' 993!%+DV[[)00<%%33""))$/"";;DA! !C
 %% 9 $?? 767?hhTtxx8	9s   D		AEEc                      U R                   R                  R                  U   $ ! [         a"    [	        [
        U[        R                  5      s $ f = f)zt
Get a global value from the func_global (first) or
as a builtins (second).  If both failed, return a ir.UNDEFINED.
)r,  ry   __globals__KeyErrorro   builtinsr   	UNDEFINED)r'   rF   s     r)   get_global_valueInterpreter.get_global_value  sD    
	9<<$$0066 	98T2<<88	9s   "% )AAc                     U R                   R                  R                  U   n UR                  $ ! [         a    [
        R                  s $ f = f)zd
Get a value from the cell contained in this function's closure.
If not set, return a ir.UNDEFINED.
)r,  ry   __closure__cell_contents
ValueErrorr   r  )r'   rl   cells      r)   get_closure_valueInterpreter.get_closure_value  sH    
 ||  ,,U3	 %%% 	 <<	 s   1 AAc                      U R                   S   $ )Nr   )r<  r/   s    r)   rL  Interpreter.current_scope  s    {{2r,   c                 .    U R                   R                  $ r$   )r;  	co_constsr/   s    r)   code_constsInterpreter.code_consts  s    }}&&&r,   c                 .    U R                   R                  $ r$   )r;  co_varnamesr/   s    r)   code_localsInterpreter.code_locals      }}(((r,   c                 .    U R                   R                  $ r$   )r;  co_namesr/   s    r)   
code_namesInterpreter.code_names  s    }}%%%r,   c                 .    U R                   R                  $ r$   )r;  co_cellvarsr/   s    r)   code_cellvarsInterpreter.code_cellvars  r  r,   c                 .    U R                   R                  $ r$   )r;  co_freevarsr/   s    r)   code_freevarsInterpreter.code_freevars  r  r,   c                     U R                   (       a  [        U5        U R                  c   e[        S;   a  U R                  (       a  U R                  S   n[        U[        R                  5      (       ak  UR                  UR                  :  aQ  U R                  R                  [        R                  " U R                  S95        U R                  R                  5         O[        S;   a  O[        [        5      eSUR                  R!                  SS5      -  n [#        X5      n U" U40 UD6$ ! [$        R&                   a  nUR                  c  U R                  nOUR                  n[$        R&                  " UR(                  US9n[*        R,                  (       d  US eSU S	UR                   3n	UR/                  U	5        UR/                  U R0                  R3                  5       5        UeS nAff = f! [4         a    [        U5      ef = f)
Nr9  r   r   r:  zop_%s+rX  zhandling op: z | offset: )r-  r   rB  r   rJ  rs   r   r  r   r  rI   r  r   rG   rI  r  replacero   r   r   rF   r   FULL_TRACEBACKSadd_contextr;  r   AttributeError)
r'   r  rj   topr   r   er   errms
             r)   rN  Interpreter._dispatch  s   $K!!---33!!((,c277++{{chh.**11"++$((2KL**..0*$%i00$++--c377	%B$#&)) 55=((C%%C,,QVV=--4''v[FAOOA&OODMM$6$6$89I  	,%d++	,s%   G7 'D0 0G4B+G//G47Hc                 @   U(       d$  U R                   U R                  R                  ;   a3  X R                  ;  nU R                  R                  X R                  US9nO#U R                  R                  X R                  S9n[        U[        R                  5      (       a  U R                  R                  X5      n[        R                  " XU R                  S9nU R                  R                  U5        U R                   UR"                     R                  U5        U$ )zt
Store *value* (a Expr or Var instance) into the variable named *name*
(a str object). Returns the target variable.
)r   renamer   r  )rC  r@  backboner  rL  r   r   r  rs   r   r   r  rP   rt   rB  rI   r4  rF   )r'   rX   rF   r   r  rW   r   s          r)   r  Interpreter.store/  s    
 t00DHH4E4EE"4"44F''00888> 1 @F ''55d5IFeRVV$$MM((7EyyuB!!$'%,,U3r,   c                     US   S:X  a,  USS R                  5       (       a  SR                  USS 5      nU R                  R                  U5      nUc  U R                  R                  U5      nU$ )z:
Get the variable (a Var instance) with the given *name*.
r   .rc   Nz
implicit{})isdigitr.   r  rT   rL  r|  )r'   rF   r   s      r)   r|  Interpreter.getA  so     7c>d12h..00&&tABx0D mm11$7;$$((.C
r,   c                     U=(       d    U R                   nU=(       d    U R                  n[        R                  " X#S9nX@R                  U'   X@l        Xl        U$ )N)r   r   )rL  r   r   r  r   rB  rC  )r'   r   r   r   r   s        r)   r  Interpreter.insert_blockS  sJ    +++oTXXhhU,!F $*!
r,   c                     g r$   r8   r'   r  s     r)   op_NOPInterpreter.op_NOP^      r,   c                     g r$   r8   r  s     r)   	op_RESUMEInterpreter.op_RESUMEa  r  r,   c                     g r$   r8   r  s     r)   op_CACHEInterpreter.op_CACHEd  r  r,   c                     g r$   r8   r  s     r)   
op_PRECALLInterpreter.op_PRECALLg  r  r,   c                     g r$   r8   r  s     r)   op_PUSH_NULLInterpreter.op_PUSH_NULLj  r  r,   c                     g r$   r8   r  s     r)   op_RETURN_GENERATORInterpreter.op_RETURN_GENERATORm  r  r,   c                    U R                  U5      n[        R                  " S[        U R                  S9nU R                  XSS9  [        R                  R                  U R                  U5      U4SU R                  S9nU R                  XdS9  g Nr   r   r  r8   )r|  r   r   r   r   r  rv   rq   )r'   r  itemprintvarresprintgvrq   s          r)   op_PRINT_ITEMInterpreter.op_PRINT_ITEMp  sj    xx~))GU9

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


(r,   c                     [         R                  " S[        U R                  S9nU R	                  XBS9  [         R
                  R                  U R                  U5      SSU R                  S9nU R	                  XSS9  g r-  )r   r   r   r   r  rv   rq   r|  )r'   r  r/  r0  r1  rq   s         r)   op_PRINT_NEWLINEInterpreter.op_PRINT_NEWLINEw  s[    ))GU9

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


(r,   c                 d   [        U5      n[        R                  R                  U R	                  U5      U R
                  US9nU R                  XFS9  [        U5       HO  u  px[        R                  R                  U R	                  U5      US U R
                  S9n	U R                  X5        MQ     g )N)rX   r   count)rF   rX   )rl   	index_varr   )	rz   r   rv   r  r|  r   r  r   static_getitem)
r'   r  iterablestorestupleobjr8  tupr   str   s
             r)   op_UNPACK_SEQUENCEInterpreter.op_UNPACK_SEQUENCE}  s    Fgg""();). # 0


, v&EA77))$((8*<01T.2hh * 8D JJt 	 'r,   c                 &    U R                  XX45      $ r$   )op_FORMAT_VALUE)r'   r  rX   r0  strvars        r)   op_FORMAT_SIMPLEInterpreter.op_FORMAT_SIMPLE  s    ##D==r,   c                    U R                  U5      n[        R                  " S[        U R                  S9nU R                  XTS9  [        R                  R                  U R                  U5      U4SU R                  S9nU R                  XcS9  g)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  r8   N)r|  r   r   rH  r   r  rv   rq   )r'   r  rX   r0  rD  strgvrq   s          r)   rC  Interpreter.op_FORMAT_VALUE  sl     		%$((3

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


(r,   c                    UR                   nUS:X  a4  [        R                  " SU R                  S9nU R	                  XSS   5        gU R                  US   5      n[        USS U5       Ho  u  pxU R                  U5      n[        R                  R                  [        R                  XgU R                  S9n	U R	                  X5        U R                  U5      nMq     g)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   Nrc   r_   r`   r   )r   r   ru   r   r  r|  r  rv   r   r   rJ   )
r'   r  stringstmpsr8  constprevotherr   r   s
             r)   op_BUILD_STRINGInterpreter.op_BUILD_STRING  s     A:HHRTXX.EJJu2h'xx
#gabk40JEHHUOE77==$txx ! D JJt!88C=D 1r,   c                    U R                  U5      nU R                  U5      n[        R                  " S[        U R                  S9nU R                  XvS9  Uc;  [        R                  R                  U R                  U5      X#4SU R                  S9nOLU R                  U5      n[        R                  R                  U R                  U5      X#U4SU R                  S9nU R                  XS9  g Nslicer   r  r8   )r|  r   r   rV  r   r  rv   rq   )	r'   r  rG  stopstepr0  slicevarslicegv	sliceinsts	            r)   op_BUILD_SLICEInterpreter.op_BUILD_SLICE  s    xx~))GU9

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


-r,   r   c                    U R                  U5      nU R                  U5      n[        R                  " S[        U R                  S9nU R                  XS9  [        R                  R                  U R                  U5      X#4SU R                  S9n	U R                  XS9  U R                  U5      n
U R                  U5      n[        R                  R                  XU R                  S9nU R                  X5        g )NrV  r   r  r8   rl   r   	r|  r   r   rV  r   r  rv   rq   getitem)r'   r  rG  r  	containerr0  rY  temp_resrZ  r[  rl   rW   r   s                r)   op_BINARY_SLICEInterpreter.op_BINARY_SLICE  s    HHUOE((3-CiiDHH=GJJWJ4TXXh%7%r)- % 3IJJYJ6HHX&EXXi(F77??6DHH?EDJJt!r,   r   c                    U R                  U5      nU R                  U5      n[        R                  " S[        U R                  S9nU R                  XS9  [        R                  R                  U R                  U5      X#4SU R                  S9n	U R                  XS9  U R                  U5      n
U R                  U5      nU R                  U5      n[        R                  " XUU R                  S9nU R                  R                  U5        g )NrV  r   r  r8   rW   rl   rX   r   r|  r   r   rV  r   r  rv   rq   r  rB  rI   )r'   r  rG  r  rb  rX   r0  rY  rZ  r[  rl   rW   r   s                r)   op_STORE_SLICEInterpreter.op_STORE_SLICE  s    HHUOE((3-CiiDHH=GJJWJ4TXXh%7%r)- % 3IJJYJ1HHSMEXXi(FHHUOE::V"&((,D%%d+r,   c                 (   U R                  U5      n[        R                  " S[        U R                  S9nU R                  XtS9  [        R                  " S U R                  S9nU R                  XS9  U R                  U5      n	[        R                  R                  U R                  U5      X4SU R                  S9n
U R                  XS9  [        R                  R                  X R                  U5      U R                  S9nU R                  XS9  g rU  )
r|  r   r   rV  r   r  ru   rv   rq   ra  )r'   r  baser0  rY  indexvarnonevarrZ  nonegvnonerl   r   s               r)   
op_SLICE_0Interpreter.op_SLICE_0  s    xx~))GU9

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

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

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


(r,   c                 J   U R                  U5      nU R                  U5      n[        R                  " S U R                  S9nU R	                  XS9  U R                  U5      n	[        R
                  " S[        U R                  S9n
U R	                  XS9  [        R                  R                  U R                  U5      X94SU R                  S9nU R	                  XS9  [        R                  R                  X R                  U5      U R                  S9nU R	                  XS9  g Nr   r  rV  r8   
r|  r   ru   r   r  r   rV  rv   rq   ra  )r'   r  rl  rG  rn  r0  rY  rm  ro  rp  rZ  rl   r   s                r)   
op_SLICE_1Interpreter.op_SLICE_1  s    xx~$DHH-

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

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

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


(r,   c                 J   U R                  U5      nU R                  U5      n[        R                  " S U R                  S9nU R	                  XS9  U R                  U5      n	[        R
                  " S[        U R                  S9n
U R	                  XS9  [        R                  R                  U R                  U5      X4SU R                  S9nU R	                  XS9  [        R                  R                  X R                  U5      U R                  S9nU R	                  XS9  g rt  ru  )r'   r  rl  rn  rW  r0  rY  rm  ro  rp  rZ  rl   r   s                r)   
op_SLICE_2Interpreter.op_SLICE_2  s    xx~xx~$DHH-

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

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

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


(r,   c                    U R                  U5      nU R                  U5      nU R                  U5      n[        R                  " S[        U R                  S9nU R                  XS9  [        R                  R                  U R                  U5      X44SU R                  S9n	U R                  XS9  [        R                  R                  X R                  U5      U R                  S9n
U R                  XS9  g rU  r`  )r'   r  rl  rG  rW  r0  rY  rm  rZ  rl   r   s              r)   
op_SLICE_3Interpreter.op_SLICE_3  s    xx~xx~))GU9

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

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


(r,   c                 N   U R                  U5      n[        R                  " S[        U R                  S9nU R                  XtS9  [        R                  " S U R                  S9nU R                  XS9  U R                  U5      n	[        R                  R                  U R                  U5      X4SU R                  S9n
U R                  XS9  [        R                  " X R                  U5      U R                  U5      U R                  S9nU R                  R                  U5        g rU  )r|  r   r   rV  r   r  ru   rv   rq   r  rB  rI   )r'   r  rl  rX   rY  rm  rn  rZ  ro  rp  rl   r   s               r)   op_STORE_SLICE_0Interpreter.op_STORE_SLICE_0-  s    xx~))GU9

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

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


.zz$ 2DHHUO"hh(!!$'r,   c                 p   U R                  U5      nU R                  U5      n[        R                  " S U R                  S9nU R	                  XS9  U R                  U5      n	[        R
                  " S[        U R                  S9n
U R	                  XS9  [        R                  R                  U R                  U5      X94SU R                  S9nU R	                  XS9  [        R                  " X R                  U5      U R                  U5      U R                  S9nU R                  R                  U5        g rt  r|  r   ru   r   r  r   rV  rv   rq   r  rB  rI   )r'   r  rl  rG  rn  rX   rY  rm  ro  rp  rZ  rl   r   s                r)   op_STORE_SLICE_1Interpreter.op_STORE_SLICE_1>  s    xx~$DHH-

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

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


.zz$ 2DHHUO"hh(!!$'r,   c                 p   U R                  U5      nU R                  U5      n[        R                  " S U R                  S9nU R	                  XS9  U R                  U5      n	[        R
                  " S[        U R                  S9n
U R	                  XS9  [        R                  R                  U R                  U5      X4SU R                  S9nU R	                  XS9  [        R                  " X R                  U5      U R                  U5      U R                  S9nU R                  R                  U5        g rt  r  )r'   r  rl  rn  rW  rX   rY  rm  ro  rp  rZ  rl   r   s                r)   op_STORE_SLICE_2Interpreter.op_STORE_SLICE_2R  s    xx~xx~$DHH-

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

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


.zz$ 2DHHUO"hh(!!$'r,   c                    U R                  U5      nU R                  U5      nU R                  U5      n[        R                  " S[        U R                  S9nU R                  XS9  [        R                  R                  U R                  U5      X44SU R                  S9n	U R                  XS9  [        R                  " X R                  U5      U R                  U5      U R                  S9n
U R                  R                  U
5        g rU  rh  )r'   r  rl  rG  rW  rX   rY  rm  rZ  rl   r   s              r)   op_STORE_SLICE_3Interpreter.op_STORE_SLICE_3f  s    xx~xx~))GU9

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


.zz$ 2DHHUO"hh(!!$'r,   c                 .   U R                  U5      n[        R                  " S[        U R                  S9nU R                  XcS9  [        R                  " S U R                  S9nU R                  XuS9  U R                  U5      n[        R                  R                  U R                  U5      X4SU R                  S9n	U R                  XS9  [        R                  " X R                  U5      U R                  S9n
U R                  R                  U
5        g rU  )r|  r   r   rV  r   r  ru   rv   rq   DelItemrB  rI   )r'   r  rl  rY  rm  rn  rZ  ro  rp  rl   r   s              r)   op_DELETE_SLICE_0Interpreter.op_DELETE_SLICE_0v  s    xx~))GU9

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

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


.zz$ 2A!!$'r,   c                 P   U R                  U5      nU R                  U5      n[        R                  " S U R                  S9nU R	                  XtS9  U R                  U5      n[        R
                  " S[        U R                  S9n	U R	                  XS9  [        R                  R                  U R                  U5      X84SU R                  S9n
U R	                  XS9  [        R                  " X R                  U5      U R                  S9nU R                  R                  U5        g rt  r|  r   ru   r   r  r   rV  rv   rq   r  rB  rI   )r'   r  rl  rG  rn  rY  rm  ro  rp  rZ  rl   r   s               r)   op_DELETE_SLICE_1Interpreter.op_DELETE_SLICE_1  s    xx~$DHH-

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

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


.zz$ 2A!!$'r,   c                 P   U R                  U5      nU R                  U5      n[        R                  " S U R                  S9nU R	                  XsS9  U R                  U5      n[        R
                  " S[        U R                  S9n	U R	                  XS9  [        R                  R                  U R                  U5      X4SU R                  S9n
U R	                  XS9  [        R                  " X R                  U5      U R                  S9nU R                  R                  U5        g rt  r  )r'   r  rl  rn  rW  rY  rm  ro  rp  rZ  rl   r   s               r)   op_DELETE_SLICE_2Interpreter.op_DELETE_SLICE_2  s    xx~xx~$DHH-

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

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


.zz$ 2A!!$'r,   c                    U R                  U5      nU R                  U5      nU R                  U5      n[        R                  " S[        U R                  S9nU R                  XuS9  [        R                  R                  U R                  U5      X44SU R                  S9nU R                  XS9  [        R                  " X R                  U5      U R                  S9n	U R                  R                  U	5        g rU  )r|  r   r   rV  r   r  rv   rq   r  rB  rI   )
r'   r  rl  rG  rW  rY  rm  rZ  rl   r   s
             r)   op_DELETE_SLICE_3Interpreter.op_DELETE_SLICE_3  s    xx~xx~))GU9

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


.zz$ 2A!!$'r,   c                 t    U R                   UR                     nU R                  U R                  U5      US9  g Nr  )r  r   r  r|  )r'   r  r0  rM   s       r)   _op_LOAD_FASTInterpreter._op_LOAD_FAST  s/    ""488,

'*
5r,   r   c                 X    U(       a  U R                  X5        g U R                  X5        g r$   )op_LOAD_DEREFr  )r'   r  r0  as_load_derefs       r)   op_LOAD_FASTInterpreter.op_LOAD_FAST  s!    ""4-""4-r,   c                     UR                   nUS-	  nUS-  nU R                  U R                  U   5      nU R                  U R                  U   5      nU R                  XrS9  U R                  XS9  g N      r  )r   r|  r  r  )	r'   r  res1res2opargoparg1oparg2src1src2s	            r)   op_LOAD_FAST_LOAD_FAST"Interpreter.op_LOAD_FAST_LOAD_FAST  sk    HHEaZFRZF88D,,V45D88D,,V45DJJTJ-JJTJ-r,   c                     UR                   nUS-	  nUS-  nU R                  U   nU R                  U5      nU R                  XS9  U R                  U R                  U   5      n	U R                  XS9  g r  )r   r  r|  r  )
r'   r  store_valueload_resr  r  r  dstname	dst_value	src_values
             r)   op_STORE_FAST_LOAD_FAST#Interpreter.op_STORE_FAST_LOAD_FAST  sp    HHEaZFRZF&&v.G-IJJYJ5!1!1&!9:IJJYJ6r,   c                     UR                   nUS-	  nUS-  nU R                  U   nU R                  U R                  U5      US9  U R                  U   nU R                  U R                  U5      US9  g r  )r   r  r  r|  )r'   r  value1value2r  r  r  r  s           r)   op_STORE_FAST_STORE_FAST$Interpreter.op_STORE_FAST_STORE_FAST  so    HHEaZFRZF&&v.GJJTXXf-GJ<&&v.GJJTXXf-GJ<r,   )r   r   r   c                     U R                   UR                     nU R                  U R                  U5      US9  g ! [         a9    [
        R                  R                  U R                  S9nU R                  XBS9   g f = f)Nr  r   rF   )	r  r   r  r|  r   r   rv   undefr   )r'   r  r0  rM   r  s        r)   op_LOAD_FAST_AND_CLEAR"Interpreter.op_LOAD_FAST_AND_CLEAR  si    ,**4884

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

5
+,s   8; A A>=A>c                 v    U R                   UR                     nU R                  U5      nU R                  X#S9  g r  )r  r   r|  r  )r'   r  rX   r  s       r)   op_STORE_FASTInterpreter.op_STORE_FAST  s1    ""488,


-r,   c                     U R                   UR                     nU R                  R                  [        R
                  " X R                  S95        g Nr   )r  r   rB  rI   r   Delr   )r'   r  r  s      r)   op_DELETE_FASTInterpreter.op_DELETE_FAST	  s7    ""488,!!"&&hh"?@r,   c                 j    [        X#5       H$  u  pEU R                  U R                  U5      US9  M&     g r  )r  r  r|  )r'   r  origdupedsrcdsts         r)   op_DUP_TOPXInterpreter.op_DUP_TOPX	  s+    D(HCJJTXXc]J5 )r,   c                     U R                   UR                     n[        R                  " U R	                  U5      U R	                  U5      X@R
                  S9nU R                  R                  U5        g )N)rW   rX   rx   r   )r  r   r   r  r|  r   rB  rI   )r'   r  rW   rX   rx   sas         r)   op_STORE_ATTRInterpreter.op_STORE_ATTR	  sR    txx(ZZtxx/txx!xx1!!"%r,   c                     U R                   UR                     n[        R                  " U R	                  U5      X0R
                  S9nU R                  R                  U5        g )N)rW   rx   r   )r  r   r   DelAttrr|  r   rB  rI   )r'   r  rW   rx   r  s        r)   op_DELETE_ATTRInterpreter.op_DELETE_ATTR	  sE    txx(ZZtxx/dI!!"%r,   c                 L   U R                  U5      n[        S;   a  U R                  UR                  S-	     nO3[        S;   a  U R                  UR                     nO[	        [        5      e[
        R                  R                  X$U R                  S9nU R                  XS5        g )Nr   rc   r   r   )
r|  r   r  r   rI  r   rv   ro   r   r  )r'   r  r.  r0  rx   ro   s         r)   op_LOAD_ATTRInterpreter.op_LOAD_ATTR	  sz    xx~**??488q=1D,,??488,D%i00''//$$((/;

7 r,   c                    U R                   UR                     n[        U[        5      (       a  / nU HP  nS[	        U5      -  n[
        R                  " XPR                  S9nU R                  XvSS9nUR                  U5        MR     [
        R                  R                  X@R                  S9n	O[        U[        5      (       a  / nU HP  nS[	        U5      -  n[
        R                  " XPR                  S9nU R                  XvSS9nUR                  U5        MR     [
        R                  R                  X@R                  S9n	O[
        R                  " X0R                  S9n	U R                  X5        g )Nz	$const_%sr   T)rF   r   )r  r   rs   r   rH  r   ru   r   r  rI   rv   r   	frozenset	build_set)
r'   r  r0  rX   r?  r   nm	val_constrW   rO  s
             r)   op_LOAD_CONSTInterpreter.op_LOAD_CONST#	  s"     *eU##B 3q6)HHQHH5	IF		&!	 
 GG'''9Ey))B 3q6)HHQHH5	IF		&!	 
 GG%%bhh%7EHHU1E

5r,   r9  c                     U R                   U   nU R                  U5      n[        R                  " XEU R                  S9nU R                  Xc5        g r  )r  r  r   r   r   r  )r'   r  r\   r0  rF   rX   gls          r)   op_LOAD_GLOBALInterpreter.op_LOAD_GLOBAL:	  s@    ??3'D))$/E4DHH5BJJrr,   r:  c                     U R                   UR                     nU R                  U5      n[        R                  " X4U R
                  S9nU R                  XR5        g r  )r  r   r  r   r   r   r  )r'   r  r0  rF   rX   r  s         r)   r  r  @	  sD    ??488,D))$/E4DHH5BJJrr,   c                     g r$   r8   r  s     r)   op_COPY_FREE_VARSInterpreter.op_COPY_FREE_VARSH	  r  r,   c                    U R                   R                  R                  R                  UR                  5      nX0R
                  ;   a   U R                  U5      nOZX0R                  ;   aK  U R                  R                  U5      nU R                  U5      n[        R                  " XcXpR                  S9nU R                  WU5        g ! [         a    Sn[        U5      ef = fN,Unsupported use of cell variable encounteredr   r,  ry   __code___varname_from_opargr   r  r|  r   rI  r  rl   r  r   r  r   r  r'   r  r0  rF   r  r  r\   rX   s           r)   r  Interpreter.op_LOAD_DEREFL	  s    <<$$--AA$((KD)))3$B +++((..t4..s3ZZ5hh?JJr3 ' 3HC-c223s   
C	 	C!c                 b   [        U R                  5      nUR                  U:  a+  U R                  UR                     nU R                  U5      nONUR                  U-
  nU R                  U   nU R                  U5      n[        R                  " XdXpR                  S9nU R                  XR5        g r  )
rz   r  r   r|  r  r  r   r  r   r  )r'   r  r0  
n_cellvarsrF   r  r\   rX   s           r)   r  r  Z	  s    T//0Jxx*$))$((3XXd^hh+))#...s3ZZ5hh?JJrr,   c                     g r$   r8   r  s     r)   op_MAKE_CELLInterpreter.op_MAKE_CELLi	  s    r,   c                     U R                   R                  R                  R                  UR                  5      nU R                  U5      nU R                  X#S9  g r  )r,  ry   r  r  r   r|  r  )r'   r  rX   rF   s       r)   op_STORE_DEREFInterpreter.op_STORE_DEREFm	  sA    <<$$--AA$((KDHHUOEJJUJ.r,   c                     [        U R                  5      nUR                  U:  a  U R                  UR                     nOU R                  UR                  U-
     nU R	                  U5      nU R                  X$S9  g r  )rz   r  r   r  r|  r  )r'   r  rX   r  r  s        r)   r  r  r	  sf    T//0Jxx*$,,TXX6,,TXX
-BCHHUOEJJUJ1r,   c                     U R                   UR                     U R                  L d   e[        R                  " UR                  UR
                  UR                  -   S9nU R                  R                  U5        g )Nr  )	r   r   rB  r   Loopr  r   rJ  rI   )r'   r  loops      r)   op_SETUP_LOOPInterpreter.op_SETUP_LOOP}	  sX    {{4;;'4+=+====wwt{{$))dhh*>@!!$'r,   c           	         U R                   UR                     U R                  L d   eUR                  UR                  -   n[
        R                  " UR                  US9nU R                  R                  U5        U R                  U5      nU R                  R                  [
        R                  " UUR                  X@R                  S95        [
        R                  " S U R                  S9nU R                  XsS9  g )Nr  contextmanagerbeginr  r   r   r  )r   r   rB  r  r   r   r  rJ  rI   r|  	EnterWithr   ru   r  )r'   r  r  exitfnexitptwthctxmgrexit_fn_objs           r)   op_SETUP_WITHInterpreter.op_SETUP_WITH	  s    {{4;;'4+=+====TXX%ggdkk/!!#&.)!!",,f59[[39xx#J 	K
 hht2


2r,   c           	         U R                   UR                     U R                  L d   e[        S;   aR  X@R                  :  aB  [        U R                   Vs/ s H!  nUR                  U:X  d  M  UR                  PM#     sn5      nO[        S;   a  O[        [        5      e[        R                  " UR                  US9nU R                  R                  U5        U R                  U5      nU R                  R                  [        R                  " UUR                  X@R                   S95        [        R"                  " S U R                   S9nU R%                  XS9  g s  snf )Nr   r   r  r  r   r  )r   r   rB  r   rE  rD  rH  rW   r  rI  r   r  rJ  rI   r|  r  r   ru   r  )	r'   r  r  r  r  exr	  r
  r  s	            r)   op_BEFORE_WITHInterpreter.op_BEFORE_WITH	  s   {{4;;'4+=+====**,,,D,I,I 0,Ib ii3. "266,I 0 1,,%i00ggdkk,!!#&.)!!",,f59[[36HH#G 	H
 hht2


2!0s   E-Ec                 $    U R                  5         g r$   )r  r  s     r)   op_SETUP_FINALLYInterpreter.op_SETUP_FINALLY	  s    $$&r,   c                     gzno-opNr8   r  s     r)   op_WITH_CLEANUPInterpreter.op_WITH_CLEANUP	      r,   c                     gr  r8   r  s     r)   op_WITH_CLEANUP_START!Interpreter.op_WITH_CLEANUP_START	  r  r,   c                     gr  r8   r  s     r)   op_WITH_CLEANUP_FINISH"Interpreter.op_WITH_CLEANUP_FINISH	  r  r,   c                     gr  r8   r  s     r)   op_END_FINALLYInterpreter.op_END_FINALLY	  r  r,   c                     [         R                  " S U R                  S9nU H-  nU R                  X4S9  U R                  R                  U5        M/     g )Nr   r  )r   ru   r   r  r5  rJ   )r'   r  tempsr  r   s        r)   op_BEGIN_FINALLYInterpreter.op_BEGIN_FINALLY	  sB    XXd1
CJJzJ,  $$S) r,   c           	         U R                  U5      nU Vs/ s H  o`R                  U5      PM     nnUbL  [        S:  d   eU R                  U   n[        [	        Xs[        U5      * S  5      5      nUS [        U5      *  nOSn[        R                  R                  X#XR                  S9n	U R                  X5        g s  snf )Nr   r8   r   )r|  r   r  r@   r  rz   r   rv   rq   r   r  )
r'   r  ry   r{   kw_namesr0  r   nameskwargsr   s
             r)   op_CALLInterpreter.op_CALL	  s    xx~%)*TT*w&&&$$X.E#e3u:+,%789F#e*%DFww||DHH|=

4 +s   B=c           	         U R                  U5      nU Vs/ s H  o`R                  U5      PM     nn[        UR                  SS5      S   5      nU R                  U   n[	        [        X[        U5      * S  5      5      n	US [        U5      *  n[        R                  R                  X#XR                  S9n
U R                  X5        g s  snf )Nr  rr   r   r   )r|  intrsplitr  r@   r  rz   r   rv   rq   r   r  )r'   r  ry   r{   r(  r0  r   constir)  r*  r   s              r)   
op_CALL_KWInterpreter.op_CALL_KW	  s    88D>D)-.AHHQKD.a045F$$V,E#e3u:+,%789F#e*%D77<<F<ADJJt! /s   C	r   c                     U R                  U5      nU Vs/ s H  oPR                  U5      PM     nn[        R                  R                  X#SU R                  S9nU R                  Xd5        g s  snf )Nr8   r   r|  r   rv   rq   r   r  )r'   r  ry   r{   r0  r   r   s          r)   op_CALL_FUNCTIONInterpreter.op_CALL_FUNCTION	  sV    xx~%)*TT*ww||D|9

4 +s   A-c                 X   U R                  U5      nU Vs/ s H  o`R                  U5      PM     nnU R                  U5      nU R                  R                   H  n[        U[        R
                  5      (       d  M$  UR                  UL d  M5  U R                  R                  U5        / nUR                  R                   Hx  nU R                  R                  S S S2    HU  nXhR                  :X  d  M  U R                  R                  U5        UR                  UR                  R                  5          Mv     Mz     Un	  O   [        W	5      n
US U
*  nX:* S  n[        [        X5      5      n[        R                  R                  X+XR                   S9nU R#                  X5        g s  snf )Nr   r   )r|  rB  r   rs   r   rt   rW   rZ   rX   rd   rI   rz   r@   r  rv   rq   r   r  )r'   r  ry   r{   r)  r0  r   named_itemsr'  keysnkeysposvalskwvals	keyvaluesr   s                  r)   op_CALL_FUNCTION_KWInterpreter.op_CALL_FUNCTION_KW	  sS   xx~%)*TT*&&++D$		**t{{e/C""))$/ !))A!//44TrT:= ..55a8'..qww}}=!	 ; * # , D	w-fgT*+	ww||D9((|C

41 +s   F'c           	          U R                  U5      nU R                  U5      nUb  U R                  U5      n[        R                  R                  U/ / U R                  X4S9nU R                  Xe5        g )N)r   r   r   r4  )r'   r  ry   r   r   r0  r   s          r)   op_CALL_FUNCTION_EXInterpreter.op_CALL_FUNCTION_EX	  se    xx~&!xx)Hww||"bdhhv  
 	

4r,   c                 R   U R                  US   5      nU(       a  Sn[        R                  " U[        U R                  S9nU R                  XvSS9  [        R                  R                  U R                  U5      U4SU R                  S9nU R                  XS   5        g U R                  n	[        [        U R                   USS  5      U5       H  u  p[        R                  " S	[        U	S
9nU R                  USSS9n[        R                  R                  X4SU	S9nU R                  USSS9n[        R                  R                  [        R                  XPR                  UR                  5      U R                  S9nU R                  UU5        U R                  U5      nM     g )Nr   r   r   Tr  r8   r{   rj   r   rc   r   r   r   )r   z	$_tuplifyr   )r|  r   r   r   r   r  rv   rq   r  mapr   r   r   rJ   rF   )r'   r  tuplesr$  	is_assignr  r  r  excr   rQ  r   r   r   tuplify_valtuplify_varouts                    r)   _build_tuple_unpackInterpreter._build_tuple_unpack
  sw   # ,GIIg':JEJJU4J@'',,txx0xR#'88  .CJJs!H%((C!#dhhqr
";UC
99  !JJ6 ' 	 !ggllx +  #jjk26 ) 8ggmm||HH[=M=M4N $  

3$) Dr,   c                 (    U R                  XX45        g r$   rL  r'   r  rF  r$  rG  s        r)   op_BUILD_TUPLE_UNPACK_WITH_CALL+Interpreter.op_BUILD_TUPLE_UNPACK_WITH_CALL,
  s      u@r,   c                 (    U R                  XX45        g r$   rO  rP  s        r)   op_BUILD_TUPLE_UNPACK!Interpreter.op_BUILD_TUPLE_UNPACK0
  s      u@r,   c                 z    [         R                  R                  SU4U R                  S9nU R	                  XC5        g )Nr   r   )r   rv   dummyr   r  )r'   r  r   r0  r   s        r)   op_LIST_TO_TUPLEInterpreter.op_LIST_TO_TUPLE3
  s,    ww}}_zm}J

4r,   c           	        ^  T R                  U5      nT R                  R                   H  n[        U[        R
                  5      (       d  M$  UR                  UL d  M5  T R                  R                  U5        / nUR                  R                   Hx  nT R                  R                  S S S2    HU  n	XR                  :X  d  M  T R                  R                  U	5        UR                  U	R                  R                  5          Mv     Mz     Un
  O   [        W
5      [        U5      :X  d   eU
 Vs/ s H"  n[        R                  " UT R                  S9PM$     nn[        X5       H  u  pT R                  X5        M     [!        [        [#        T R                   U5      [#        T R                   U5      5      5      n/ nU Hd  nT R$                  U   n[        U5      S:w  a    OEUS   n[        U[        R                  5      (       d    OUR                  UR                  5        Mf     U 4S jn[        U5      [        U5      :w  a'  [        X5       VV	s0 s H  u  pUU" U	5      _M     nnn	O[        X5       VV	s0 s H  u  pX_M	     nnn	0 n['        U
5       H  u  nnUUU'   M     [        R(                  R+                  USUUT R                  S9nT R                  UU5        g s  snf s  sn	nf s  sn	nf )Nr   r  rc   r   c                 0  > TR                   U    n[        U5      S:w  a$  [        TR                  U 5      R                  5      $ US   n[        U[        R                  5      (       d$  [        TR                  U 5      R                  5      $ UR                  $ Nrc   r   )	r4  rz   r!   r|  rF   rs   r   ru   rX   )r   defnsdefnr'   s      r)   resolve_const9Interpreter.op_BUILD_CONST_KEY_MAP.<locals>.resolve_const[
  st    $$Q'E5zQ%dhhqk&6&6778DdBHH--%dhhqk&6&677::r,   rr   r  )r|  rB  r   rs   r   rt   rW   rZ   rX   rd   rI   rz   ru   r   r  r  r@   rE  r4  r   rv   r   )r'   r  r9  keytmpsr   r0  keyvarr8  r   r'  keytup	keyconstskvalr   rd   literal_itemsr   r]  r^  r_  literal_dictrf   r   r$  r   s   `                        r)   op_BUILD_CONST_KEY_MAP"Interpreter.op_BUILD_CONST_KEY_MAP7
  s    $&&++D$		**t{{f/D""))$/ !))A!//44TrT:= ..55a8'..qww}}=!	 ; * % , 6{c&k)))>DEfRXXA4884f	EY0IDJJt! 1STXXw/TXXv1FGH A$$Q'E5zQ8DdBHH--  , 	 }V,/1/ 59AA}Q///  1L -0,FG,FDAAC,FLG f%DAq M! & ww  u&'/;/<%)XX	 ! / 	

4[ F41 Hs   1)K(K-=K3c                     [         R                  R                  U R                  U5      U R                  S9nU R                  XC5        g )Nr  )r   rv   getiterr|  r   r  r'   r  rX   r0  r   s        r)   op_GET_ITERInterpreter.op_GET_ITERz
  s0    wwTXXe_$((C

4r,   c                    UR                   U R                  ;   d   S5       eU R                  U5      n[        R                  R                  X`R                  S9nU R                  Xs5        [        R                  R                  U R                  U5      U R                  S9nU R                  X5        [        R                  R                  U R                  U5      U R                  S9n	U R                  X5        [        R                  " U R                  U5      UR                  UR                  5       U R                  S9n
U R                  R                  U
5        g)z*
Assign new block other this instruction.
zFOR_ITER must be block headr  r  N)r   r   r|  r   rv   iternextr   r  
pair_firstpair_secondr  r  get_jump_targetrB  rI   )r'   r  iteratorr#  indvalpredr  pairvalrp  isvalidbrs              r)   op_FOR_ITERInterpreter.op_FOR_ITER~
  s    {{dkk)H+HH) hhx ''""((";

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

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

7! YYDHHTN499#33588% 	!!"%r,   c                     U R                  U5      nU R                  U5      n[        R                  R                  X#U R                  S9nU R                  XT5        g )Nr_  )r|  r   rv   ra  r   r  )r'   r  rW   rl   r0  r   s         r)   op_BINARY_SUBSCRInterpreter.op_BINARY_SUBSCR
  sC    &!wwvA

4r,   c                     U R                  U5      nU R                  U5      nU R                  U5      n[        R                  " X#UU R                  S9nU R                  R                  U5        g )Nrg  )r|  r   r  r   rB  rI   )r'   r  rW   rl   rX   r   s         r)   op_STORE_SUBSCRInterpreter.op_STORE_SUBSCR
  sW    &!zzE"hh(!!$'r,   c                     U R                  U5      nU R                  U5      n[        R                  " X#U R                  S9nU R                  R                  U5        g )N)rW   rl   r   )r|  r   r  r   rB  rI   )r'   r  rW   rl   r   s        r)   op_DELETE_SUBSCRInterpreter.op_DELETE_SUBSCR
  sE    &!zz$((C!!$'r,   c                     [         R                  R                  U Vs/ s H  o@R                  U5      PM     snU R                  S9nU R                  XS5        g s  snf N)rd   r   )r   rv   r   r|  r   r  r'   r  rd   r0  r   r   s         r)   op_BUILD_TUPLEInterpreter.op_BUILD_TUPLE
  sK    ww""u)Eu!((1+u)E'+xx # 1

4 *F   Ac                     [         R                  R                  U Vs/ s H  o@R                  U5      PM     snU R                  S9nU R                  XS5        g s  snf r  )r   rv   r   r|  r   r  r  s         r)   op_BUILD_LISTInterpreter.op_BUILD_LIST
  sK    ww!!e(De!e(D&*hh " 0

4 )Er  c                     [         R                  R                  U Vs/ s H  o@R                  U5      PM     snU R                  S9nU R                  XS5        g s  snf r  )r   rv   r  r|  r   r  r  s         r)   op_BUILD_SETInterpreter.op_BUILD_SET
  sK    ww  U'CUU'C%)XX ! /

4 (Dr  c                 J   U R                  U5      nU R                  U5      n[        R                  R                  USU R                  S9nU R                  XdS9  [        R                  R                  U R                  U5      U4SU R                  S9nU R                  XuS9  g )Nr  r   r  r8   r|  r   rv   ro   r   r  rq   r'   r  rW   rX   	updatevarr0  
updateattr
updateinsts           r)   op_SET_UPDATEInterpreter.op_SET_UPDATE
      &!WW__VX488_D


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


.r,   c                 J   U R                  U5      nU R                  U5      n[        R                  R                  USU R                  S9nU R                  XdS9  [        R                  R                  U R                  U5      U4SU R                  S9nU R                  XuS9  g )Nr   r   r  r8   r  r  s           r)   op_DICT_UPDATEInterpreter.op_DICT_UPDATE
  s    &! WW__+ % 

 	

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


.r,   c           	        ^  U VVs/ s H'  u  pVT R                  U5      T R                  U5      4PM)     nnnU 4S jnU" S U 5       5      n	U" S U 5       5      n
[        U	5      [        U5      :H  n[        U
5      [        U5      :H  n0 nU(       d
  U(       d  S nOU(       aN  U(       dG  [        X5       VVs0 s H  u  nnU[        US   5      _M     nnn[	        U	5       H
  u  nnUX'   M     O:[        X5       VVs0 s H	  u  nnUU_M     nnn[	        U	5       H
  u  nnUX'   M     [
        R                  R                  XsUUT R                  S9nT R                  UU5        g s  snnf s  snnf s  snnf )Nc                 X  > / nU  Vs/ s H  nTR                  UR                  5      PM      nnU Hp  nTR                  UR                     n[        U5      S:w  a    U$ US   n[	        U[
        R                  5      (       d    U$ UR                  UR                  5        Mr     U$ s  snf r\  )	r|  rF   r4  rz   rs   r   ru   rI   rX   )rW   rf  r   r   r]  r^  r'   s         r)   get_literals.Interpreter.op_BUILD_MAP.<locals>.get_literals
  s    M0671dhhqvv&F7((0u:?
 ! 	 Qx!$11   $$TZZ0  !  8s   %B'c              3   *   #    U  H	  oS    v   M     g7f)r   Nr8   .0r   s     r)   	<genexpr>+Interpreter.op_BUILD_MAP.<locals>.<genexpr>
  s     #<)QaD)   c              3   *   #    U  H	  oS    v   M     g7f)rc   Nr8   r  s     r)   r  r  
  s     %>IqdIr  rc   r  )
r|  rz   r  r!   r   r   rv   r   r   r  )r'   r  rd   r  r0  r$  r   	got_itemsr  r"  literal_valueshas_literal_keyshas_literal_valuesrf   rg  r   r'  r   r   s   `                  r)   op_BUILD_MAPInterpreter.op_BUILD_MAP
  sq   <ABEDAdhhqk488A;/E	B
	! $#<)#<<%%>I%>>|,I> 0C	NB(:L&88:8 9=1A~ad338  :!,/1#$  0 .1-NO-NTQAqD-NLO!,/1#$  0 ww  y/;/<%)XX ! / 	

4S C8:
 Ps   .E)9E/ E5c                     [         R                  " U R                  U5      U R                  U5      U R                  U5      U R                  S9nU R                  R                  U5        g )N)dctrk   rX   r   )r   StoreMapr|  r   rB  rI   )r'   r  r  rk   rX   r   s         r)   op_STORE_MAPInterpreter.op_STORE_MAP
  sJ    {{txx}$((3-!%%dhh@!!$'r,   c                     U R                  U5      n[        R                  R                  SX R                  S9nU R                  XC5      $ )N-r  r|  r   rv   unaryr   r  rl  s        r)   op_UNARY_NEGATIVEInterpreter.op_UNARY_NEGATIVE  8    ww}}S88}<zz$$$r,   c                     U R                  U5      n[        R                  R                  SX R                  S9nU R                  XC5      $ )Nr  r  r  rl  s        r)   op_UNARY_POSITIVEInterpreter.op_UNARY_POSITIVE  r  r,   c                     U R                  U5      n[        R                  R                  SX R                  S9nU R                  XC5      $ )N~r  r  rl  s        r)   op_UNARY_INVERTInterpreter.op_UNARY_INVERT  r  r,   c                     U R                  U5      n[        R                  R                  SX R                  S9nU R                  XC5      $ )Nnotr  r  rl  s        r)   op_UNARY_NOTInterpreter.op_UNARY_NOT  s8    ww}}U%XX}>zz$$$r,   c                     [         U   nU R                  U5      nU R                  U5      n[        R                  R	                  XX0R
                  S9nU R                  XT5        g )NrL  )r   r|  r   rv   r   r   r  )r'   rw   r_   r`   r0  r   s         r)   _binopInterpreter._binop  sL     $hhsmhhsmww}}Rcxx}@

4r,   c                     [         U   n[        US-      nU R                  U5      nU R                  U5      n[        R                  R                  XX#U R                  S9nU R                  Xd5        g )N=rL  )r   r   r|  r   rv   r  r   r  )r'   rw   r_   r`   r0  immuopr   s          r)   _inplace_binopInterpreter._inplace_binop  sd    $R((c2hhsmhhsmww$$RS)- % 3

4r,   c                 b    SU;   a  U R                  US S X4U5        g U R                  X#XE5        g )Nr  r   )r  r  )r'   r  rw   r_   r`   r0  s         r)   op_BINARY_OPInterpreter.op_BINARY_OP'  s/    "93B37KK*r,   c                 *    U R                  SX#U5        g Nr  r  r'   r  r_   r`   r0  s        r)   op_BINARY_ADDInterpreter.op_BINARY_ADD-      C3'r,   c                 *    U R                  SX#U5        g Nr  r  r  s        r)   op_BINARY_SUBTRACTInterpreter.op_BINARY_SUBTRACT0  r  r,   c                 *    U R                  SX#U5        g N*r  r  s        r)   op_BINARY_MULTIPLYInterpreter.op_BINARY_MULTIPLY3  r  r,   c                 *    U R                  SX#U5        g Nz/?r  r  s        r)   op_BINARY_DIVIDEInterpreter.op_BINARY_DIVIDE6      D#C(r,   c                 *    U R                  SX#U5        g N/r  r  s        r)   op_BINARY_TRUE_DIVIDE!Interpreter.op_BINARY_TRUE_DIVIDE9  r  r,   c                 *    U R                  SX#U5        g Nz//r  r  s        r)   op_BINARY_FLOOR_DIVIDE"Interpreter.op_BINARY_FLOOR_DIVIDE<  r  r,   c                 *    U R                  SX#U5        g N%r  r  s        r)   op_BINARY_MODULOInterpreter.op_BINARY_MODULO?  r  r,   c                 *    U R                  SX#U5        g Nz**r  r  s        r)   op_BINARY_POWERInterpreter.op_BINARY_POWERB  r  r,   c                 *    U R                  SX#U5        g N@r  r  s        r)   op_BINARY_MATRIX_MULTIPLY%Interpreter.op_BINARY_MATRIX_MULTIPLYE  r  r,   c                 *    U R                  SX#U5        g Nz<<r  r  s        r)   op_BINARY_LSHIFTInterpreter.op_BINARY_LSHIFTH  r  r,   c                 *    U R                  SX#U5        g Nz>>r  r  s        r)   op_BINARY_RSHIFTInterpreter.op_BINARY_RSHIFTK  r  r,   c                 *    U R                  SX#U5        g N&r  r  s        r)   op_BINARY_ANDInterpreter.op_BINARY_ANDN  r  r,   c                 *    U R                  SX#U5        g N|r  r  s        r)   op_BINARY_ORInterpreter.op_BINARY_ORQ  r  r,   c                 *    U R                  SX#U5        g N^r  r  s        r)   op_BINARY_XORInterpreter.op_BINARY_XORT  r  r,   c                 *    U R                  SX#U5        g r  r  r  s        r)   op_INPLACE_ADDInterpreter.op_INPLACE_ADDW      C3/r,   c                 *    U R                  SX#U5        g r  r  r  s        r)   op_INPLACE_SUBTRACTInterpreter.op_INPLACE_SUBTRACTZ  r  r,   c                 *    U R                  SX#U5        g r  r  r  s        r)   op_INPLACE_MULTIPLYInterpreter.op_INPLACE_MULTIPLY]  r  r,   c                 *    U R                  SX#U5        g r  r  r  s        r)   op_INPLACE_DIVIDEInterpreter.op_INPLACE_DIVIDE`      D#C0r,   c                 *    U R                  SX#U5        g r  r  r  s        r)   op_INPLACE_TRUE_DIVIDE"Interpreter.op_INPLACE_TRUE_DIVIDEc  r  r,   c                 *    U R                  SX#U5        g r  r  r  s        r)   op_INPLACE_FLOOR_DIVIDE#Interpreter.op_INPLACE_FLOOR_DIVIDEf  r!  r,   c                 *    U R                  SX#U5        g r  r  r  s        r)   op_INPLACE_MODULOInterpreter.op_INPLACE_MODULOi  r  r,   c                 *    U R                  SX#U5        g r  r  r  s        r)   op_INPLACE_POWERInterpreter.op_INPLACE_POWERl  r!  r,   c                 *    U R                  SX#U5        g r  r  r  s        r)   op_INPLACE_MATRIX_MULTIPLY&Interpreter.op_INPLACE_MATRIX_MULTIPLYo  r  r,   c                 *    U R                  SX#U5        g r  r  r  s        r)   op_INPLACE_LSHIFTInterpreter.op_INPLACE_LSHIFTr  r!  r,   c                 *    U R                  SX#U5        g r  r  r  s        r)   op_INPLACE_RSHIFTInterpreter.op_INPLACE_RSHIFTu  r!  r,   c                 *    U R                  SX#U5        g r  r  r  s        r)   op_INPLACE_ANDInterpreter.op_INPLACE_ANDx  r  r,   c                 *    U R                  SX#U5        g r
  r  r  s        r)   op_INPLACE_ORInterpreter.op_INPLACE_OR{  r  r,   c                 *    U R                  SX#U5        g r  r  r  s        r)   op_INPLACE_XORInterpreter.op_INPLACE_XOR~  r  r,   c                     [         R                  " UR                  5       U R                  S9nU R                  R                  U5        g r  r   r  rs  r   rB  rI   r'   r  r  s      r)   op_JUMP_ABSOLUTEInterpreter.op_JUMP_ABSOLUTE  3    ggd**,$((;!!#&r,   c                     [         R                  " UR                  5       U R                  S9nU R                  R                  U5        g r  rA  rB  s      r)   op_JUMP_FORWARDInterpreter.op_JUMP_FORWARD  rE  r,   c                     [         R                  " UR                  5       U R                  S9nU R                  R                  U5        g r  rA  rB  s      r)   op_JUMP_BACKWARDInterpreter.op_JUMP_BACKWARD  rE  r,   c                     Uc  U R                   R                  5         g US:X  a:  [        R                  " U R                  S9nU R
                  R                  U5        g US:X  a  U R                  5         g g )Nwithr   try)rJ  rG   r   r  r   rB  rI   rf  )r'   r  rd  rO   s       r)   op_POP_BLOCKInterpreter.op_POP_BLOCK  s^    <""$V^)A%%a(U]&&( r,   c                 $   U R                  [        R                  R                  U R	                  U5      U R
                  S9U5        [        R                  " U R	                  U5      U R
                  S9nU R                  R                  U5        g r  )	r  r   rv   castr|  r   ReturnrB  rI   )r'   r  retvalcastvalrets        r)   op_RETURN_VALUEInterpreter.op_RETURN_VALUE  s_    

277<< 0dhh<?Iii)txx8!!#&r,   c                    U R                   UR                     n[        R                  " X@R                  S9nU R                  XR5        U R                  [        R                  R                  U R                  U5      U R                  S9U5        [        R                  " U R                  U5      U R                  S9nU R                  R                  U5        g r  )r  r   r   ru   r   r  rv   rR  r|  rS  rB  rI   )r'   r  rT  rU  rX   rO  rV  s          r)   op_RETURN_CONSTInterpreter.op_RETURN_CONST  s    $$TXX.EHHU1EJJu%JJrww||DHHV$4$((|CWM))DHHW-488<C%%c*r,   c                 F    U R                  U R                  U5      U5        g r$   )r  r|  )r'   r  r  r0  s       r)   
op_TO_BOOLInterpreter.op_TO_BOOL  s    JJtxx}c*r,   c                    [         S;   a!  [        R                  UR                  S-	     nOb[         S;   a!  [        R                  UR                  S-	     nO7[         S;   a  [        R                  UR                     nO[	        [         5      eUS:X  d  US:X  a  X2p2US:X  a^  U R                  SX#U5        U R                  U5      n[        R                  R                  SX`R                  S	9nU R                  Xt5        g US
:X  a  [        R                  " S[        R                  U R                  S9nSn	U R                  XSS9  U R                  U5      nU R                  U5      n[        R                  R                  U R                  U	5      X#4SU R                  S9n
U R                  X5        g U R                  XRX45        g )Nr     )r   r  r   inznot inr  r  zexception matchexception_matchr   
$exc_matchTr  r8   rD  )r   discmp_opr   rI  r  r|  r   rv   r  r   r  r   r   rb  rq   )r'   r  r_   r`   r0  rw   r   rK  r  exc_match_namerH  s              r)   op_COMPARE_OPInterpreter.op_COMPARE_OP  sd   
"DHHM*B*$DHHM*B,,DHH%B%i00:x>KKc,((3-C''--Shh-?CJJs $$II!2#5#5488E *NJJU$JG((3-C((3-C'',,(zrtxx  C JJs KK*r,   c                 P    UR                   S:X  a  SOSnU R                  XRX45        g )Nrc   is notis)r   r  )r'   r  r_   r`   r0  rw   s         r)   op_IS_OPInterpreter.op_IS_OP  s!    QXDBS&r,   c                     X2p2U R                  SX#U5        UR                  S:X  aK  U R                  U5      n[        R                  R                  SXPR                  S9nU R                  Xd5        g g )Nra  rc   r  r  )r  r   r|  r   rv   r  r   r  )r'   r  r_   r`   r0  r   rK  s          r)   op_CONTAINS_OPInterpreter.op_CONTAINS_OP  sZ    SD#C(88q=((3-C''--Shh-?CJJs  r,   c                     Uc<  U R                   S   n[        U[        R                  5      (       d   eUR                  n[        R
                  " X R                  S9nU R                  R                  U5        g )Nr   )rW   r   )	rJ  rs   r   r  r  r  r   rB  rI   )r'   r  r  r  r  s        r)   op_BREAK_LOOPInterpreter.op_BREAK_LOOP  s]    ;%%b)DdBGG,,,,))CggShh/!!#&r,   c                     UR                  5       UR                  S.nXC   nXC(       +    nSUR                  -  n[        R                  " S[
        U R                  S9nU R                  XS9  [        R                  R                  U R                  U5      U R                  U5      4SU R                  S9n	SUR                  -  n
U R                  XS9n[        R                  " XUU R                  S9nU R                  R                  U5        g )	N)TFzbool%sboolr   r  r8   z$%spredr  )rs  r  r   r   r   ru  r   r  rv   rq   r|  r  rB  rI   )r'   r  rv  iftruebrsr  r  rF   r  r  pname	predicatebras                r)   _op_JUMP_IFInterpreter._op_JUMP_IF  s    &&(99
 j/4;;'		&$DHH5


*'',,txx~/@"#'88  - T[[)JJWJ9	iiYw HH&!!#&r,   c                 $    U R                  XSS9  g NFrv  rv  r{  r'   r  rv  s      r)   op_JUMP_IF_FALSEInterpreter.op_JUMP_IF_FALSE      7r,   c                 $    U R                  XSS9  g NTr  r  r  s      r)   op_JUMP_IF_TRUEInterpreter.op_JUMP_IF_TRUE      6r,   c                 \   UR                   nUR                  5       nU(       d
  [        S   nO	[        S   nU R                  [        R
                  " S U R                  S9SUR                   3S9nU R                  U5      n[        R                  R                  XhXpR                  S9n	SUR                   3n
U R                  XS9  SUR                   3n[        R                  " S	[        U R                  S9nU R                  XS9  [        R                  R                  U R                  U5      U R                  U
5      4S
U R                  S9nSUR                   3nU R                  XS9n[        R                  " UUUU R                  S9nU R                  R!                  U5        g )Nrk  rj  r   z
$constNoner  rL  z
$maybeNonez$boolru  r8   z$predr  )r  rs  r   r  r   ru   r   r   r|  rv   r   r   ru  rq   r  rB  rI   )r'   r  rv  rv  r  r  rw   r`   r_   isnone	maybeNonerF   r  r  rx  ry  r  s                    r)   _jump_if_noneInterpreter._jump_if_none  sj   &&( $T*B$X.Bjjrxx$((; *4;;-8  :hhtnrB .	

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


*'',,txx~0C/Er#'88  - }%JJWJ9		"(#*#xx) 	!!&)r,   c                 (    U R                  XS5        g NTr  r  s      r)   op_POP_JUMP_FORWARD_IF_NONE'Interpreter.op_POP_JUMP_FORWARD_IF_NONE'      4t,r,   c                 (    U R                  XS5        g NFr  r  s      r)   op_POP_JUMP_FORWARD_IF_NOT_NONE+Interpreter.op_POP_JUMP_FORWARD_IF_NOT_NONE*      4u-r,   c                 (    U R                  XS5        g r  r  r  s      r)   op_POP_JUMP_IF_NONEInterpreter.op_POP_JUMP_IF_NONE.  s    t40r,   c                 (    U R                  XS5        g r  r  r  s      r)   op_POP_JUMP_IF_NOT_NONE#Interpreter.op_POP_JUMP_IF_NOT_NONE1  s    t51r,   c                 (    U R                  XS5        g r  r  r  s      r)   op_POP_JUMP_BACKWARD_IF_NONE(Interpreter.op_POP_JUMP_BACKWARD_IF_NONE8  r  r,   c                 (    U R                  XS5        g r  r  r  s      r)    op_POP_JUMP_BACKWARD_IF_NOT_NONE,Interpreter.op_POP_JUMP_BACKWARD_IF_NOT_NONE;  r  r,   c                 $    U R                  XSS9  g r~  r  r  s      r)   op_POP_JUMP_FORWARD_IF_FALSE(Interpreter.op_POP_JUMP_FORWARD_IF_FALSE>  r  r,   c                 $    U R                  XSS9  g r  r  r  s      r)   op_POP_JUMP_FORWARD_IF_TRUE'Interpreter.op_POP_JUMP_FORWARD_IF_TRUEA  r  r,   c                 $    U R                  XSS9  g r~  r  r  s      r)   op_POP_JUMP_BACKWARD_IF_FALSE)Interpreter.op_POP_JUMP_BACKWARD_IF_FALSED  r  r,   c                 $    U R                  XSS9  g r  r  r  s      r)   op_POP_JUMP_BACKWARD_IF_TRUE(Interpreter.op_POP_JUMP_BACKWARD_IF_TRUEG  r  r,   c                 $    U R                  XSS9  g r~  r  r  s      r)   op_POP_JUMP_IF_FALSE Interpreter.op_POP_JUMP_IF_FALSEJ  r  r,   c                 $    U R                  XSS9  g r  r  r  s      r)   op_POP_JUMP_IF_TRUEInterpreter.op_POP_JUMP_IF_TRUEM  r  r,   c                 $    U R                  XSS9  g r~  r  r  s      r)   op_JUMP_IF_FALSE_OR_POP#Interpreter.op_JUMP_IF_FALSE_OR_POPP  r  r,   c                 $    U R                  XSS9  g r  r  r  s      r)   op_JUMP_IF_TRUE_OR_POP"Interpreter.op_JUMP_IF_TRUE_OR_POPS  r  r,   c                 ^   [         R                  " S[        R                  U R                  S9nSnU R                  XVSS9  U R                  U5      nU R                  U5      n[         R                  R                  U R                  U5      Xx4SU R                  S9n	U R                  X5        g )Nrb  r   rc  Tr  r8   rD  )	r   r   r   rb  r   r  r|  rv   rq   )
r'   r  rv  tostos1r  rf  r_   r`   rH  s
             r)   op_CHECK_EXC_MATCHInterpreter.op_CHECK_EXC_MATCHV  s    		r11txx
 &

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

3r,   c                    UR                   nUR                  5       n[        R                  " S[        R
                  U R                  S9nSnU R                  XxSS9  U R                  U5      n	U R                  U5      n
[        R                  R                  U R                  U5      X4SU R                  S9nU R                  X5      n[        R                  " XUU R                  S9nU R                  R                  U5        g )	Nrb  r   rc  Tr  r8   rD  r  )r  rs  r   r   r   rb  r   r  r|  rv   rq   r  rB  rI   )r'   r  rv  r  r  r  r  r  rf  r_   r`   rH  ry  rz  s                 r)   op_JUMP_IF_NOT_EXC_MATCH$Interpreter.op_JUMP_IF_NOT_EXC_MATCHc  s    &&(		r11txx
 &

d
ChhtnhhsmggllHH^$C:2488  
 JJs)	iiYw HH&!!#&r,   c                    U R                   R                  nUb  [        R                  " S U R                  S9nU R
                  R                  U5        U R                  5         U R
                  R                  [        R                  " US   U R                  S95        g S[        S    3n[        R                  " [        U4U R                  5      nU R
                  R                  U5        g )N	exceptionr   r  r   z8Unreachable condition reached (op code RERAISE executed)
reportable)rK  r  r   TryRaiser   rB  rI   rf  r  r   StaticRaiser   )r'   r  rH  r  r   r  s         r)   
op_RERAISEInterpreter.op_RERAISEu  s    ..;;488<D%%d+&&(%%bggfUm&JK N"<013C>>.3&$((CD%%d+r,   c                    Ub  U R                  U5      nU R                  R                  nUb  [        R                  " X R
                  S9nU R                  R                  U5        U R                  5         U R                  R                  [        R                  " US   U R
                  S95        g [        R                  " X R
                  S9nU R                  R                  U5        g )Nr  r  r   )r|  rK  r  r   r  r   rB  rI   rf  r  Raise)r'   r  rH  r  r   s        r)   op_RAISE_VARARGSInterpreter.op_RAISE_VARARGS  s    ?((3-C..;;((;D%%d+&&(%%bggfUm&JK 88cxx8D%%d+r,   c                     S n[         R                  " U R                  U5      X@R                  S9nU R	                  X5      $ )N)rX   rl   r   )r   Yieldr|  r   r  )r'   r  rX   r0  rl   s        r)   op_YIELD_VALUEInterpreter.op_YIELD_VALUE  s2    xxdhhuoUIzz$$$r,   c	                 p   Ub  Sn	[        U	5      eU(       aQ  [        U[        5      (       a+  [        U Vs/ s H  o R                  U5      PM     sn5      nOU R                  U5      nU R                  U   S   n
[        U
[
        R                  5      (       d   Sn	[        R                  " XR                  S9eU
R                  nW(       a  U R                  U5      nU(       a  U R                  U5      n[
        R                  R                  X+XGU R                  5      nU R                  X5        g s  snf )Nz3op_MAKE_FUNCTION with kwdefaults is not implementedr   z_Unsupported use of closure. Probably caused by complex control-flow constructs; e.g. try-exceptr   )rI  rs   r   r|  r4  r   ru   r   r   r   rX   rv   make_functionr  )r'   r  rF   codeclosureannotations
kwdefaultsdefaultsr0  r  assume_code_constfcoder   s                r)   op_MAKE_FUNCTIONInterpreter.op_MAKE_FUNCTION  s     !GC%c**(E** X!FXT((4.X!FG88H- ,,T215+RXX66" 
 11#88DD!''88D>Dhhw'Gww$$T'TXXN

4% "Gs   D3c	           
      .    U R                  XX4UXgU5        g r$   )r  )	r'   r  rF   r  r  r  r  r  r0  s	            r)   op_MAKE_CLOSUREInterpreter.op_MAKE_CLOSURE  s    d$(C	9r,   c                    U R                   R                  R                  R                  UR                  5      nX0R
                  ;   a   U R                  U5      nObX0R                  ;   aL  U R                  R                  U5      nU R                  U5      n[        R                  " XcXpR                  S9nO S5       eU R                  XB5        g ! [         a    Sn[        U5      ef = f)Nr  r   r   r  r  s           r)   op_LOAD_CLOSUREInterpreter.op_LOAD_CLOSURE  s    <<$$--AA$((KD)))3$B +++((..t4..s3ZZ5hh?'-'qJJr ' 3HC-c223s   
C C(c                    [        U R                  5      nUR                  U:  a,  U R                  UR                     n U R                  U5      nONUR                  U-
  nU R                  U   nU R                  U5      n[        R                  " XtXR                  S9nU R                  XR5        g ! [         a    Sn[        U5      ef = fr  )rz   r  r   r|  r   rI  r  r  r   r  r   r  )	r'   r  r0  r  rF   r  r  r\   rX   s	            r)   r  r    s    T//0Jxx*$))$((33$B
 hh+))#...s3ZZ5hh?JJr ' 3HC-c223s    B2 2C
c                 J   U R                  U5      nU R                  U5      n[        R                  R                  USU R                  S9nU R                  XdS9  [        R                  R                  U R                  U5      U4SU R                  S9nU R                  XuS9  g )NrI   r   r  r8   r  )r'   r  rW   rX   	appendvarr0  
appendattr
appendinsts           r)   op_LIST_APPENDInterpreter.op_LIST_APPEND  r  r,   c                 |   U R                  U5      nU R                  U5      nSnU R                  R                  (       d  [        R                  " U5      eU R                  R                  S   n[        UR                  [        R                  5      =(       a    UR                  R                  S:H  nS n	U(       a  [        U R                  R                  S S 5       H  n[        U[        R                  5      (       d  Sn  O[        UR                  [        R                  5      (       a  MQ  [        UR                  [        R                  5      (       a/  UR                  U:X  a  Un	UR                  R                  (       + n  OSn  O   U(       a  U	c  [        R                  " U5      eU(       a  U R                  R                  n
U R                  R                  S   nU
R                  U
R!                  U
R#                  U	5      5      5        UR                  nU	R                  nUR                  Ul        g [        R                  R%                  USU R&                  S9nU R)                  XS9  [        R                  R+                  U R                  U5      U4SU R&                  S9nU R)                  XS9  g )	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  r8   )r|  rB  r   r   r   rs   rX   r   rv   rw   r   rt   ru   rW   rd   rI   rG   rl   ro   r   r  rq   )r'   r  rW   rX   	extendvarr0  r  r   okbuild_empty_liststmtsbuild_tuple_asgnr   r   
extendattr
extendinsts                   r)   op_LIST_EXTENDInterpreter.op_LIST_EXTEND  s   &!L !!&&11#66 !!&&r*

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

BGG4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JJZJ8dhhy&9E8R*.(( & 4JJJZJ2r,   c                 l   U R                  U5      nU R                  U5      nU R                  U5      n[        R                  R                  USU R                  S9nU R                  XuS9  [        R                  R                  U R                  U5      X44SU R                  S9nU R                  XS9  g )Nrp   r   r  r8   r  )	r'   r  rW   rk   rX   
setitemvarr0  setitemattrr  s	            r)   
op_MAP_ADDInterpreter.op_MAP_ADD)  s    &!hhsmggoofmoJ

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


.r,   c                 j    [         R                  " S[        U R                  S9nU R	                  X2S9  g )Nr   r   r  )r   r   r   r   r  )r'   r  r0  r  s       r)   op_LOAD_ASSERTION_ERROR#Interpreter.op_LOAD_ASSERTION_ERROR3  s'    		*NI


)r,   c                 (    U R                   " U0 UD6  g r$   )r  r'   r{   rj   s      r)   op_LOAD_METHODInterpreter.op_LOAD_METHOD?  s    4'3'r,   c                 (    U R                   " U0 UD6  g r$   )r5  r  s      r)   op_CALL_METHODInterpreter.op_CALL_METHODB  s    t+s+r,   c                 d   U[         R                  :X  aB  [        R                  " [        SU R                  5      nU R
                  R                  U5        g U[         R                  :X  a  U R                  " U40 UD6  g U[         R                  :X  a  U R                  " U40 UD6  g [        U5      e)Nr8   )ci1opINTRINSIC_STOPITERATION_ERRORr   r  r   rB  rI   UNARY_POSITIVEr  INTRINSIC_LIST_TO_TUPLErX  rI  )r'   r  operandr*  r   s        r)   op_CALL_INTRINSIC_1Interpreter.op_CALL_INTRINSIC_1F  s    %===~~&CR&*hh0""))$/E000&&t6v6E999%%d5f5)'22r,   )r5  rH  r.  r/  r  r   r;  r@  rB  rC  r4  r?  rK  r2  r,  r3  rE  r   r<  rJ  r$   )F)NN)r2   r3   r4   r5   r6   r-  r*   r]  rU  rO  rP  r  rM  r  r  r  r  rf  r  r  r  r  r  r  r  propertyrL  r  r  r  r  r  rN  r  r|  r  r  r  r!  r$  r'  r*  r2  r5  r@  rE  rC  rR  r\  r   rd  rI  ri  rq  rv  ry  r|  r  r  r  r  r  r  r  r  r  r  r  r  r  op_LOAD_FAST_CHECKr  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+  r1  r5  r>  rA  rL  rQ  rT  rX  rh  rm  rz  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&  r)  r,  r/  r2  r5  r8  r;  r>  rC  rG  rJ  op_JUMP_BACKWARD_NO_INTERRUPTrO  rW  rZ  r]  rg  rl  ro  rr  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   r8   r,   r)   r*  r*  >  s    L%"K!Z
-^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                       \ rS rSrSrg)r	  i[  r8   N)r2   r3   r4   r5   r7   r8   r,   r)   r	  r	  [  s    r,   r	  )5r  r>   rd  r   loggingr   
numba.corer   r   r   numba.core.errorsr   r   r   numba.core.ir_utilsr	   r
   numba.core.utilsr   r   r   numba.core.byteflowr   r   r   r   numba.core.unsafer   numba.cpython.unsafe.tupler   r   r  rI  objectr!   	getLoggerr2   rR  r:   ra   rm   r   r   r   r   r   r   r  r  r   r*  r   r	  r8   r,   r)   <module>r     s     
    ) ) 
 6< < C C   : ""E$$
i
((:V : 

H
%1v 1h
2&RHV FiX|~[|@[|.b2jY -& Y -x@ "" $$
i
((r,   