+
    Bi                     $   ^ RI t ^ RIt^ RIHt ^ RIHt ^ RIt^ RIHtH	t	 ^ RI
HtHtHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt  ^ R	I5  ^ RIt ^ RIt ]P:                  ! 4       ;_uu_ 4       ]n        ]P>                  ! 4       ;_uu_ 4        ^ R
I Ht! RRR4       RRR4        ^ RI"t"Rt#/ R^ bR^ bR^ bR^ bR^ bR^ bR^ bR^ bR^ bR^ bR^ bR^ bR^ bR^ bR^ bR^ bt$]!'       d   ]$R ]$R ]'       d    ]PJ                  ! RRg4       ^ ]$R&   ^ ]$R&   RRhRRiRRjRRiRRkRRlRRmRRnRRmRRnRRoRRpRRqRRoR^R,          ) ^R,          3/t'R t(R ]$R!]$R"]'R#]'R$]'R%]'/t)]'       d#   ])R!,           F  t*](! ]*4      ])R!,          ]*&   K  	  ]$PW                  4       t,]$PW                  4       t-]$ F  t.].R&9   d   K  ]-]. K  	  ]$PW                  4       t/]$ F  t.].R'9   d   K  ]/]. K  	  ],])R(&   ],])R)&   ]-])R*&   ]/])R&   ]/])R+&   ^ t0^t1R,. RrO. RsO3R-R*.R .3R.R .R .3R/R)R(.R .3R0R+R.R .3/t2R1 t3R2 t4R3 t5R4 t6RtR5 lt7R
R6 lt8R
R7 lt9R8 t:R9 t;])R!,           U u. uF  p ]:! T 4      '       d   K  T NK  	  up t<R: t=R; t>R< t?R= t@R> tAR? tBR@ tCRA tDRB tERC tFRD tGRE tHRF tIRG tJRH tKRI tLRJ tMRK tNRL tORM tPRN tQRO tRRuRP ltSRQ tTRR tURvRS ltVRT tWRwRU ltXRV tYRxRW ltZRX t[RY t\RZ t]RyR[ lt^RyR\ lt_RzR] lt`RxR^ ltaR_ tb^dtc^td^
te]#'       d   ^
tc^td^te]_t\]`t]]at]P                  ! ]R`4      ]P                  ! ]Ra4       ! Rb Rc]P                  4      4       4       th ! Rd Re]P                  4      ti]jRf8X  d   ]P                  ! 4        R# R#   ] d    Rt EL2i ; i  ] d    Rt EL=i ; i  ] d    Rt ELHi ; i  + '       g   i     EL; i  + '       g   i     EL!; i  ] d    Rt! EL0i ; i  ] d    Rt" EL;i ; i  ]PL                   d     ELi ; iu up i ){    N)support)	os_helper)permutationsproduct)	randrangesamplechoice)Decimal)Fraction)warnings_helper)*)ndarrayT?cbBhHiIlLnNefdPQq  c                   V R8X  d   RpV# V R8X  d   RpV# V R8X  d   R	pV# V R8X  d   R
pV# V R8X  d   ^R,          ) ^R,          3pV# R F)  p \         P                  ! V ^V,          ^,
          4        M	  X^,          '       d   ^V,          ) ^V,          3M
^ ^V,          3pV#   \         P                   d     Kt  i ; i)zReturn range of a native type.r   r   r   r   r   r!   r      r      i i  l                     )
      @   ?                      )structpackerror)fmtlhexps   &  '/usr/lib/python3.14/test/test_buffer.pynative_type_ranger;   b   s    
cz" I! 
 I 
 I 
 I 
4j!T'" I <CC!S&!, < %(!GG3iC !QVI << s   %B''C ?C  @<>=!
bBhHiIlLfdBbcm@ma@br   arraynumpy
memoryviewbytefmtc                   \        \        V ,          V,          !  pVR8X  d   \        V.4      pVR8X  d
   VR8X  d   RpVR8X  d   \        V4      pVR9   d4   \        P
                  ! W4      p\        P                  ! W4      ^ ,          pV# )zPReturn random item for a type specified by a mode and a single
format character.r   rI          r   efd)r   fmtdictbytesboolr4   r5   unpack)modecharobjxs   &&& r:   randrange_fmtrX      sx     	74=&'As{1#J'>a7lAs{Gu}KK MM$"1%H    c                    V P                  R4      w  r#. pV F  pVP                  \        W%V4      4       K   	  \        V4      ^8X  d
   V^ ,          # \	        V4      # )zReturn single random item.#)splitappendrX   lentuple)r7   rV   rT   charsrW   r   s   &&    r:   gen_itemra      sP    ))C.KD
A	t,- q6Q;1Q4,E!H,rY   c                |    V ^ 8X  d   \        W4      # ^ .V ,          p\        V 4       F  p\        W4      W4&   K  	  V# )z,Return a list of random items (or a scalar).)ra   range)r   r7   rV   lstr   s   &&&  r:   	gen_itemsre      s>    Av!!#'C1X## JrY   c                    \        \        V,          \        ,          4      pVR ,           pVP                  R4      p\	        ^^
4      p\        V4       Ft  p\        \        \        V,          4      4      p\        \        V,          \        ,          4      pY7\        V'       d   TM^4      ,          ,          pWHV,           ,          pKv  	  \        WV4      p	\        W14      p
WIV
3# )r[   amb)r	   capMODEstripr   rc   r_   rP   MULTintre   ra   )r   rV   rT   xfmtr7   nmemb_rU   
multiplieritemsitems   &&         r:   struct_itemsrs      s    #c(4.!D#:D
**U
CaE5\eGDM*+CHTN+
*J!<<=T!"	 
 as#EDDtrY   c                   Vf"   \        \        V,          \        ,          4      pVf    \        \        \        V,          4      4      p\        \        V,          \
        ,          4      pVR,           T\        V'       d   TM^4      ,          ,           p\        WV4      p\        WQ4      pVP                  R4      V,           V,           pWVV3# )z"Return random format, items, item.r[   rg   )
r	   rh   ri   r_   rP   rk   rl   re   ra   rj   )r   rV   rT   rU   rp   r7   rq   rr   s   &&&&    r:   	randitemsru      s    |c#htn%|eGDM*+C'J
*tc
*BB
BCac"ECD
**U
j
(4
/CtrY   c              #     "   \         V,          \        ,           F%  p\        V,           F  p\        WW#4      x  K  	  K'  	  R# 5i)z1Iterate through supported mode/char combinations.N)rh   ri   rP   ru   )r   rV   rT   rU   s   &&  r:   	iter_moderw      s6     CDMMDAD// " s   AAc              #  f   "   \        W4       F  pVx  K	  	  VR8w  d   R# \        W4      x  R# 5i)zpYield (format, items, item) for all possible modes and format
characters plus one random compound format string.r   N)rw   rs   )nitemstestobjts   && r:   iter_formatr|      s1      v' ()
v
''s   /1c                 @    R V 9   ;'       g    RV 9   ;'       g    RV 9   # )r   r   r    )r7   s   &r:   is_byte_formatr      s$    #:1111scz1rY   c                    \        V 4      pV^8H  ;'       g"    V^8H  ;'       d+    V ^ ,          R8H  ;'       d    W^,
          ,          \        9   # )zformat suitable for memoryviewr=   )r^   
MEMORYVIEW)r7   rW   s   & r:   is_memoryview_formatr      sM    CA!V11Q #03q6S= # #!H
"$rY   c                ,    \        V \        4      '       * # )z9Tuple items (representing structs) are regarded as atoms.
isinstancelistrd   s   &r:   atompr      s    #t$$$rY   c                 "    \        V \        4      # Nr   r   s   &r:   listpr     s    c4  rY   c                l    \        V 4      ^ 8X  d   ^ # V ^ ,          pV R,           F  pW,          pK  	  V# )zProduct of list elements.   NN)r^   )rd   rW   vs   &  r:   prodr     s5    
3x1}AAWW	 HrY   c                j   V ^ 8X  d   R# VR8X  dY   \        VR,          4      V.,           p\        V ^,
          RR4       F$  pWE;;,          WE^,           ,          ,          uu&   K&  	  V# V.\        VRR 4      ,           p\        ^V 4       F$  pWE;;,          WE^,
          ,          ,          uu&   K&  	  V# )zHCalculate strides of a contiguous array. Layout is 'C' or
'F' (Fortran).Cr   Nr~   )r   rc   )ndimshapeitemsizelayoutstridesr   s   &&&&  r:   strides_from_shaper     s     qy	}uRy/XJ.tAvr2&AJ'A#,&J ' N *tE#2J//q$AJ'A#,&J  NrY   c                P   \        V 4      '       d   V # \        V4      ^ 8X  d
   V ^ ,          # ^ .V^ ,          ,          pV^ ,          '       d   \        V 4      V^ ,          ,          M^ p\        V^ ,          4       F(  pWC,          p\        WWS,            VR,          4      W$&   K*  	  V# )zfConvert flat item list to the nested list representation of a
multidimensional C array with shape 's'.r   )r   r^   rc   _ca)rq   srd   strider   starts   &&    r:   r   r     s     U||
1v{Qx#!*C#$Q44SZ1Q4QF1Q4[U."6  JrY   c                    \        V 4      '       d   V # \        V4      ^ 8X  d
   V ^ ,          # ^ .V^ ,          ,          pV^ ,          p\        V^ ,          4       F!  p\        WRV1,          VR,          4      W$&   K#  	  V# )zlConvert flat item list to the nested list representation of a
multidimensional Fortran array with shape 's'.Nr   )r   r^   rc   _fa)rq   r   rd   r   r   s   &&   r:   r   r   -  sp     U||
1v{Qx#!*CqTF1Q4[U9f9%qu- JrY   c                     \        V 4      '       d,   ^ V9   g%   \        V4      \        V 4      8w  d   \        R4      h\	        W4      # r   zprod(shape) != len(items))r   r   r^   
ValueErrorr   rq   r   s   &&r:   carrayr   :  7    U||AJ4;#e*+D455urY   c                     \        V 4      '       d,   ^ V9   g%   \        V4      \        V 4      8w  d   \        R4      h\	        W4      # r   )r   r   r^   r   r   r   s   &&r:   farrayr   ?  r   rY   c                R    V  Uu. uF  p\        V4      NK  	  pp\        V!  # u upi )z(Generate all possible tuples of indices.)rc   r   )r   r   	iterabless   &  r:   indicesr   D  s*    #()5aq5I)I *s   $c                f    ^ p\        V 4       F  pW2V,          W,          ,          ,          pK!  	  V# )zAConvert multi-dimensional index to the position in the flat list.rc   )r   indr   retr   s   &&&  r:   getindexr   I  s-    
C4[qzCF"" JrY   c                   V'       g   V # \        V4      p\        W!^R4      p\        W!RRR1,          ^R4      p^ .\        V 4      ,          p\        V4       F/  p\        W&V4      p\        W&RRR1,          V4      pW,          WX&   K1  	  V# )z~Transpose flat item list that is regarded as a multi-dimensional
matrix defined by shape: dest...[k][j][i] = src[i][j][k]...  r   Nr   )r^   r   r   r   )	srcr   r   sstridesdstridesdestr   frtos	   &&       r:   	transposer   P  s     
u:D!$q#6H!$ddQ<H3S>Du~d*d"Ix07  KrY   c                    V . 8X  d   V # \        V 4      '       d   V .# \        V ^ ,          4      \        V R,          4      ,           # )zflatten listr   r   _flattenr   s   &r:   r   r   _  s;    
by
SzzuCFhs2w///rY   c                >    \        V 4      '       d   V # \        V 4      # )zflatten list or return scalarr   r   s   &r:   flattenr   g  s    Szz
C=rY   c                    \        V 4      '       d   . # \        W^ ,          ,          4      .\        V ^ ,          VR,          4      ,           # )zFGet the shape of lst after slicing: slices is a list of slice
objects.r   )r   r^   slice_shape)rd   slicess   &&r:   r   r   m  s:     Szz	1I ;s1vvbz#BBBrY   c                    \        V 4      '       d   V # W^ ,          ,           Uu. uF  p\        W!R,          4      NK  	  up# u upi )z=Multi-dimensional slicing: slices is a list of slice objects.r   )r   
multislice)rd   r   sublsts   && r:   r   r   t  s7    Szz
9<AYHvJvbz*HHHs   Ac                    \        V4      '       d   V# \        W^ ,          ,          W^ ,          ,          4       UUu. uF   w  rE\        WEVR,          VR,          4      NK"  	  pppWV^ ,          &   V # u uppi )a  Multi-dimensional slice assignment: llst and rlst are the operands,
lslices and rslices are lists of slice objects. llst and rlst must
have the same structure.

For a two-dimensional example, this is not implemented in Python:

  llst[0:3:2, 0:3:2] = rlst[1:3:1, 1:3:1]

Instead we write:

  lslices = [slice(0,3,2), slice(0,3,2)]
  rslices = [slice(1,3,1), slice(1,3,1)]
  multislice_assign(llst, rlst, lslices, rslices)
r   )r   zipm_assign)llstrlstlslicesrslicesr   rs   &&&&  r:   r   r   z  ss     T{{D,d1:.>?A? Q72;4? 	 AKAs   &A3c                    \        W4      p\        W4      p\        V4      \        V4      8w  d   R# \        \        V4      4       F*  pWF,          WV,          8w  d   Ru # WF,          ^ 8X  g   K)   ^ # 	  ^ # )z9Compare the structure of llst[lslices] and rlst[rslices].r   )r   r^   rc   )r   r   r   r   lshapershaper   s   &&&&   r:   cmp_structurer     s`    'F'FFs6{"	3v;9	!I9>	  
 rY   c                R    \        WW#4      ^ 8  d   \        R4      h\        WW#4      # )z:Return llst after assigning: llst[lslices] = rlst[rslices]z+lvalue and rvalue have different structures)r   r   r   )r   r   r   r   s   &&&&r:   multislice_assignr     s*    T2Q6FGGD11rY   c                  aaa VS,          '       d   R# V^ 8  g   VS,           V 8  d   R# \         ;QJ d    V3R lS 4       F  '       g   K   RM	  RM! V3R lS 4       4      '       d   R# V^ 8:  d$   V^ 8H  ;'       d    S'       * ;'       d    S'       * # ^ S9   d   R# \        VV3R l\        V4       4       4      p\        VV3R l\        V4       4       4      p^ WV,           8*  ;'       d    WW,           S,           V 8*  # )zVerify that the parameters represent a valid array within
the bounds of the allocated memory:
    char *mem: start of the physical memory block
    memlen: length of the physical memory block
    offset: (char *)buf - mem
Fc              3   4   <"   T F  qS,          x  K  	  R # 5ir   r~   ).0r   r   s   & r:   	<genexpr>#verify_structure.<locals>.<genexpr>  s     
)Ax<<s   Tc              3      <"   T F3  pSV,          ^ 8:  g   K  SV,          SV,          ^,
          ,          x  K5  	  R# 5ir   Nr~   r   jr   r   s   & r:   r   r     s7      #1!*/ 'wqz58A:&&   >&>c              3      <"   T F3  pSV,          ^ 8  g   K  SV,          SV,          ^,
          ,          x  K5  	  R# 5ir   r~   r   s   & r:   r   r     s7      "1!*q. 'wqz58A:&&r   )anysumrc   )memlenr   r   r   r   offsetiminimaxs   &f&ff&  r:   verify_structurer     s     zVH_v-
s
)
)sss
)
)))qyqy66Y66w;6Ez #d # #D "d " "D >>H 4 >>rY   c                 (    V F  pW,          p K  	  V # r   r~   )rd   r   r   s   && r:   get_itemr     s    f JrY   c                r    Vw  r#rErgTp\        V4       F  p	WV	,          W	,          ,          ,          pK!  	  V# )z-Location of an item in the underlying memory.r   )
r   r{   r   r   r   r   r   r   pr   s
   &&        r:   memory_indexr     s9    562Fd7A4[	QZ
"" HrY   c                    V w  rr4rV^V,          p\        V4       F0  p\        W4      p	^V	,          p
Wz,          '       d    R# Wz,          pK2  	  R# )zThe structure 't' is overlapping if at least one memory location
is visited twice while iterating through all possible tuples of
indices.TF)r   r   )r{   r   r   r   r   r   r   visitedr   r   bits   &          r:   is_overlappingr     sP     672Fd7iGu~ d==  rY   c                4  aa S'       g   \        V^,           4      pV^ 8X  d@   V'       d   W VRR^ 3# \        ^^4      pW`,          p\        ^4      ^ 8X  d   V ) MTpWpVRRV3# ^p	\        ^d4      p
V
^_8  d   V'       d   ^ p	M	V
^Z8  d   ^p	^ .V,          o\        V4       F  p\        W^,           4      SV&   K  	  M\        S4      p^p\        ^d4      p
V
^_8  d   V
^,          '       d   RMRp^ .V,          oV \        V) V^,           4      ,          SV^,
          &   V'       g"   SV^,
          ,          ^ 8X  d   V SV^,
          &   \        V^,
          RR4       F  pTSV^,           ,          '       d   SV^,           ,          M^,          pV'       d!   V \        V) V^,           4      ,          SV&   KZ  R\        ^4      ,          V ,          \        ^V^,           4      ,          SV&   K  	  ^ ;r^ S9   g?   \        VV3R l\        V4       4       4      p\        VV3R l\        V4       4       4      pW,
          pV'       d"   V) V ,          pW^,           V ,          ,           pM-V) V,           V ,          p\        ^4      ^ 8X  d   V) V ,
          MTpWpVSSV3# )zReturn random structure:
    (memlen, itemsize, ndim, shape, strides, offset)
If 'valid' is true, the returned structure is valid, otherwise invalid.
If 'shape' is given, use that instead of creating a random shape.
TFc              3      <"   T F3  pSV,          ^ 8:  g   K  SV,          SV,          ^,
          ,          x  K5  	  R# 5ir   r~   r   s   & r:   r   !rand_structure.<locals>.<genexpr>!  s7      'KqajAo +71:uQxz**Kr   c              3      <"   T F3  pSV,          ^ 8  g   K  SV,          SV,          ^,
          ,          x  K5  	  R# 5ir   r~   r   s   & r:   r   r   #  s7      &Kqaj1n +71:uQxz**Kr   r~   r   r   r   )r   rc   r^   r   )r   validmaxdimmaxshaper   r   ry   r   r   minshaper   r   	maxstridezero_strider   r   r   s   &&&&f           @r:   rand_structurer     s\    "AI4R::"1d+*&/la&7(Vr2v==cN7uH"WHd
tA A:6E!H  5zI#Ar'a!ee$KcDjGI:y{!CCGDFO746?a/"Q462r"51::U1Q3Z14	!Iyj)A+$FFGAJ 1."#%.q)A+%>?GAJ # OD: 'E$K ' ' &E$K & & [F!6X--%$,(*#,Q<1#4$x&T5'699rY   c                    W,
          p\        V^,           4      pV '       d   W,
          V ,          M^p\        ^V^,           4      pW0V,          ,           p\        W6V4      p\        Wq4      w    rW8w  d   \        hV# )z=Create a random slice of len slicelen that fits into listlen.)r   sliceslice_indicesRuntimeError)
slicelenlistlenmaxstartr   maxstepstepstopr   ro   controls
   &&        r:   randslice_from_slicelenr  /  sr    !Hhqj!E/7w8+QGQ	"Dd?"De4 A$Q0Aq!HrY   c                    ^ .V ,          p^ .V ,          p\        V 4       FA  pW,          pV^ 8  d   \        ^V^,           4      M^ p\        We4      W$&   \        We4      W4&   KC  	  \        V4      \        V4      3# )zqCreate two sets of slices for an array x with shape 'shape'
such that shapeof(x[lslices]) == shapeof(x[rslices]).)rc   r   r  r_   )r   r   r   r   r   r   r   s   &&     r:   randslice_from_shaper  <  st     cDjGcDjG4[H()A9Q!$1,X9
,X9
	 
 >5>))rY   c                L   \        ^V ^,           4      p^p\        ^d4      pV^_8  d   ^ pM	V^Z8  d   ^p\        ^d4      ^P8  d   RMRp^ .V,          p^ .V,          p^ .V,          p^ .V,          p	\        V4       EF  p\        W1^,           4      p
\        W1^,           4      pW8  d   YrV'       dp   \        V
) V
^,           4      p\        V
) V
^,           4      pR\        ^4      ,          \        ^V
^,           4      ,          p\        WV4      p\        W4      w    ppM(V
^ 8  d   \        ^V
^,           4      M^ p\	        VV
4      p\	        VV4      p\        ^4      ^ 8X  d   WuWt&   Wd&   VVuW&   W&   K  WuWt&   Wd&   VVuW&   W&   EK  	  Wg\        V4      \        V	4      3# )zCreate (lshape, rshape, tuple(lslices), tuple(rslices)) such that
shapeof(x[lslices]) == shapeof(y[rslices]), where x is an array
with shape 'lshape' and y is an array with shape 'rshape'.TFr   )r   rc   r   r   r  r_   )r   r   r   r   r   
all_randomr   r   r   r   smallbigr   r  r  s_smallro   r   s_bigs   &&                 r:   rand_aligned_slicesr  H  s    Qq!DH#ABw	
b"32-5JSXFDvc$hG1#d(4[(QJ/1*-; ufeAg.EeVU1W-D)A,')AuQw*??DE.G -g =Aq!X05	yE!G,qH-h>G (#6Q<1#& FIvy%*G"GJ
#( FIvy%,e"GJ
1 4 5>5>99rY   c                F    Vw  r#   p\        W#,          RV ,           R4      # )zFReturn a list of random items for structure 't' with format
'fmtchar'.r[   rI   )re   )r7   r{   r   r   ro   s   &&   r:   randitems_from_structurer  s  s*     $% FaAqV%s3w88rY   c           	     B    Vw  rErgr\        WWV	\        V,          R7      # )z:Return ndarray from the tuple returned by rand_structure()r   r   formatr   flags)r   ND_WRITABLE)
rq   r7   r{   r  r   r   r   r   r   r   s
   &&&&      r:   ndarray_from_structurer  y  s)    562Fd75w E(9; ;rY   c                    Vw  r4rVrx\        V4      p	\        V 4       F#  w  r\        P                  ! WW,          V4       K%  	  \	        WVWR7      # )z>Return numpy_array from the tuple returned by rand_structure())bufferr   r   dtyper   )	bytearray	enumerater4   	pack_intonumpy_array)rq   r7   r{   r   r   r   r   r   r   bufr   r   s   &&&         r:   numpy_array_from_structurer    sQ    562Fd7
F
C% 1:q1 !c 1 1rY   c                   V P                   pV'       d   \        V4      V,          V8w  d   RV3# M>V. 8X  d   V P                  ^ 8X  g   W$8w  d   RV3# M\        WB4      w  rVV.pV^ 8w  d   RV3# V P	                  4       p\        ^ \        V4      V4       Uu. uF  qWV,            NK  	  p	p. p
V	 F=  p\        P                  ! W4      ^ ,          pW8w  d   RV3u # V
P                  V4       K?  	  V. 8w  d   W3# V
^ ,          V3# u upi )a  Interpret the raw memory of 'exporter' as a list of items with
size 'itemsize'. If shape=None, the new structure is assumed to
be 1-D with n * itemsize = bytelen. If shape is given, the usual
constraint for contiguous arrays prod(shape) * itemsize = bytelen
applies. On success, return (items, shape). If the constraints
cannot be met, return (None, None). If a chunk of bytes is interpreted
as NaN as a result of float conversion, return ('nan', None).Nnan)
nbytesr   r   divmodtobytesrc   r^   r4   rS   r]   )exporterr7   r   r   bytelenr   r   memr   	byteitemsrq   r   rr   s   &&&&         r:   
cast_itemsr(    s    ooG;!W,; -	"==A!4; "5 g(6;



C,1!SXx,HI,HqQz",HIIE}}S$Q'<%<T	  #b[E>?uQx.?? Js   Dc               #  l  "   \        ^ 4       F  p V .x  K
  	  \        ^^4      p\        ^d4      ^P8  d   ^M^p\        V4       Uu. uF  p\        V^4      NK  	  upx  \        ^^4      p\        ^d4      ^P8  d   ^M^p\        V4       Uu. uF  p\        V^4      NK  	  upx  R# u upi u upi 5i)z Generate shapes to test casting.N)rc   r   )r   r   r   ro   s       r:   gencastshapesr*    s     2Yc	 Q?DcNR'qQH+0;
7;a9Xq!;
77Q?DcNR'qQH+0;
7;a9Xq!;
77 8 8s   AB4B*2B4B/#B4c           	         \        \        V ) V ^,           4      \        V ) V ^,           4      \        V ) V ^,           4      4      # )z4Generate all possible slices for a single dimension.)r   rc   )r   s   &r:   	genslicesr,    s5    5!QqS>5!QqS>5!QqS>BBrY   c                p    \        V 4       Uu. uF  p\        W,          4      NK  	  pp\        V!  # u upi )z/Generate all possible slice tuples for 'shape'.)rc   r,  r   )r   r   r   r   s   &&  r:   genslices_ndimr.    s1    .3Dk:k58$kI:I ;s   3c                b    V'       g   V ^ 8X  d   ^ M^p\        W ^,           4      p\        W04      # )zGenerate random slice for a single dimension of length n.
If zero=True, the slices may be empty, otherwise they will
be non-empty.)r   r  )r   allow_emptyminlenr   s   &&  r:   rslicer2    s,     aQQF1%H"8//rY   c              #  L   "   \        ^4       F  p\        W4      x  K  	  R# 5i)z.Generate random slices for a single dimension.N)rc   r2  )r   r0  ro   s   && r:   r   r     s     1XQ$$ s   "$c              #    a"   \        V4       FI  p\        ;QJ d     . V3R l\        V 4       4       F  NK  	  5M! V3R l\        V 4       4       4      x  KK  	  \        V4       FI  p\        ;QJ d     . V3R l\        V 4       4       F  NK  	  5M! V3R l\        V 4       4       4      x  KK  	  \        ;QJ d    . R \        V 4       4       F  NK  	  5M! R \        V 4       4       4      x  R# 5i)z)Generate random slice tuples for 'shape'.c              3   H   <"   T F  p\        SV,          4      x  K  	  R # 5ir   r2  r   r   r   s   & r:   r   rslices_ndim.<locals>.<genexpr>  s     :kF58$$ks   "c              3   L   <"   T F  p\        SV,          R R7      x  K  	  R# 5i)T)r0  Nr6  r7  s   & r:   r   r8    s     L1F5866s   !$c              3   <   "   T F  p\        ^ ^^ 4      x  K  	  R# 5ir   )r   )r   ro   s   & r:   r   r8    s     2ka!ks   N)rc   r_   )r   r   
iterationsro   s   &f& r:   rslices_ndimr<    s      :e:eDk:ee:eDk:::  :eLdLeeLdLLL  %2eDk2%%2eDk2
22s   B;C6?7C6c              #   r   "   \        V 4      pVf   \        V4      MTp\        \        W!4      4      x  R # 5ir   )r_   r^   r   )iterabler   pools   && r:   rpermutationr@    s,     ?DYD	AA
t
  s   57c                    V P                  4       p\	        V \
        4      '       d   V P                  pV P                  pMRpRp\        RV: RV P                  : RV P                  : RV P                  : RV: RV P                  : RV P                  : R	V: R
24       \        P                  P!                  4        R#   \        \        3 d    T P                  4       p Li ; i)zPrint ndarray for debugging.unknownzndarray(z, shape=z
, strides=z, suboffsets=z	, offset=z
, format='z', itemsize=z, flags=)N)tolist	TypeErrorNotImplementedErrorr#  r   r   r   r  printr   r   
suboffsetsr  r   sysstdoutflush)ndrW   r   r  s   &   r:   ndarray_printrM    s    IIK "g	bhh

BMM699bkk5* + JJ *+ JJLs   C !C'&C'z%struct module required for this test.z%ndarray object required for this testc                     a  ] tR tRt o R tRRRR/R ltRYR lt]P                  ! R4      R	 4       t	R
 t
R tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR  t R! t!R" t"R# t#R$ t$R% t%R& t&R' t'R( t(R) t)R* t*R+ t+R, t,]PZ                  t-R- t.R. t/R/ t0R0 t1R1 t2]P                  ! R4      R2 4       t3R3 t4R4 t5R5 t6]7Pp                  R6 4       t9R7 t:R8 t;R9 t<R: t=R; t>]?P                  ! ]AR<7      R= 4       tBR> tCR? tDR@ tERA tFRB tGRC tHRD tIRE tJRF tKRG tLRH tMRI tNRJ tORK tPRL tQRM tRRN tSRO tTRP tURQ tVRR tWRS tXRT tY]P                  RU 4       t[]P                  RV 4       t\RWt]V t^RX# )ZTestBufferProtocoli  c                $    \        4       V n        R # r   )get_sizeof_void_psizeof_void_pselfs   &r:   setUpTestBufferProtocol.setUp  s    .0rY   slicedFcastc       
          a aaaaaaa	a
a'a(a) S'       d   \        S4      S,          o(MS'       g   \        S	4      o(MSo(Ro)SP                  '       d   S P                  S^ 4       ^ p\	        ^S4       FI  pSV,          ^ 8X  d    M:SV,          ^ 8:  g   K#  VSV,          ) SV,          ^,
          ,          ,          pKK  	  V.\	        S^,
          4       Uu. uF  pRNK  	  up,           o)S P
                  pS^ ,          ^ 8  d   V) pV.\        SR,          4      ,           oS P                  SP                  V4       S P                  SP                  S(4       S P                  SP                  S4       S P                  SP                  S4       S P                  SP                  V4       S P                  SP                  S4       S P                  SP                  \!        S4      4       S
'       d	   S)'       g&   S P                  SP"                  \!        S4      4       S P                  SP                  \!        S)4      4       \%        S\&        4      '       g   \)        S4      '       d;   S'       d   SP+                  4       MSP-                  4       pS P                  VS	4       S'       g   R# V'       Eg   \/        4       pRp\1        S4       F  p \3        SV4      p\5        S	V4      p\%        V\         4      '       d   \6        P8                  ! S.VO5!  pM\6        P8                  ! SV4      pVP;                  V4       S P                  TT4       K  	  V'       Eg   S P                  SP-                  4       V4       \?        S4      pRPA                  R V 4       4      pS P                  VPC                  4       V4       S'       d   SMRp\E        S	4      pR EFf  pSpVR8X  dE   \G        SR	4      '       d   \G        SR4      '       d    \I        VS4      p\'        VSV\J        R
7      pM9\G        SR	4      '       d   \G        SR4      '       d   VR8X  d   \'        VSVR7      p\M        S\N        V4      pS P                  VP-                  4       V4       S PQ                  \S        VV4      4       S^ 8X  d   K  \        V4      pV'       d   ^ M\T        p \W        SR\X        4      pS P                  \        V4      VS,          4       \	        V4       Uu. uF"  p\6        PZ                  ! SVVS,          4      NK$  	  p!p\        V!^ ,          4      ^8X  d   V! Uu. uF  q^ ,          NK  	  p!p\'        V!SV SR7      p"S P                  \?        V"4      \?        S4      4       \?        S4      P-                  4       p#S P                  V#V4       \?        S4      P-                  RR7      p#S P                  V#V4       \?        S4      P-                  RR7      p#S P                  V#V4       \W        SR\X        4      pS P                  \        V4      VS,          4       \	        V4       Uu. uF"  p\6        PZ                  ! SVVS,          4      NK$  	  p!p\        V!^ ,          4      ^8X  d   V! Uu. uF  q^ ,          NK  	  p!p\'        V!SV \J        ,          SR7      p"S P                  \?        V"4      \?        S4      4       \?        S4      P-                  RR7      p#S P                  V#V4       \W        SR	\X        4      pS P                  \        V4      VS,          4       \	        V4       Uu. uF"  p\6        PZ                  ! SVVS,          4      NK$  	  p!p\        V!^ ,          4      ^8X  d   V! Uu. uF  q^ ,          NK  	  p!p\G        SR4      '       d   \J        M^ p$\'        V!SV$V ,          SR7      p"S P                  \?        V"4      \?        S4      4       \?        S4      P-                  R	R7      p#S P                  V#V4       EKi  	  \)        S4      '       d    \?        S4      p\%        S\>        4      '       d   SP                  MSo'T3T'T(TTT	TTT TT
TT)3R llp%T%! T4       TP]                  4       ;_uu_ 4       p&T%! T&RR7       RRR4       TP-                  4        R# R# u upi   \<         d	    Rp  EK  i ; iu upi u upi u upi u upi u upi u upi   \<         d     R# i ; i  + '       g   i     Lo; i)r   r   NTr<   c              3   4   "   T F  pR V,          x  K  	  R# 5i)z%02xNr~   )r   r   s   & r:   r   ,TestBufferProtocol.verify.<locals>.<genexpr>]  s     21FQJJs   r   r   FAr   r  r  r   r  r   r  r  orderc                 |  < S
P                  V P                  S4       S
P                  V P                  S4       S
P                  V P                  S4       S
P                  V P
                  S4       S
P                  V P                  V4       S
P                  V P                  S4       S
P                  V P                  \        S4      4       S'       d	   S'       g&   S
P                  V P                  \        S4      4       S
P                  V P                  \        S4      4       S^ 8X  d   S
P                  \        \        V 4       M$S
P                  \        V 4      \        S4      4       S'       d   S	P                  4       MS	P!                  4       pS
P                  VS4       S
P                  V S	4       R# r   )assertIsrV   assertEqualr!  r   r  readonlyr   r   r_   r   rH  assertRaisesrE  r^   rD  r#  )rD   expected_readonlyrepexexpected_lenr7   r   rd   r   resultrT  r   rW  r   rH  s   && r:   check_memoryview3TestBufferProtocol.verify.<locals>.check_memoryview  s/   aeeR(  <8  X6  3/  ->?  .  %,7:$$QYYg?  uZ/@A19%%ia8$$SVSX6),fmmo&..2B  c*  F+rY   )rh  r~   r   r   r\  r]  )/r   r^   rH  assertGreaterrc   rR  r   rd  rV   re  r!  r   r  rf  r   r   r_   r   r   r   r   rD  r#  r  r   get_pointerr   r4   r5   extendBufferErrorrJ   joinhexr   is_contiguousr   
ND_FORTRANget_contiguous
PyBUF_READ
assertTrue
cmp_contigr  py_buffer_to_contiguousPyBUF_FULL_ROunpack_from
toreadonly)*rT  rl  rV   r   r7   rf  r   r   r   rd   rW  rX  
suboffset0r   r   stride0ri  r   buf_errr   item1item2rW   rD   r   ff	flattenedrb  expectedtranscontigrn   roinitlstycontig_bytesr   rm  mmrj  rk  rH  s*   ff$dd$ddddd$                           @@@r:   verifyTestBufferProtocol.verify  s   
 ;x/L"3x' 
tQ'J1d^8q=1:?71:+q!"<<J	 $ %U46](C]](CCJ ((GqzA~"(i$wr{"33Gfjj#&5(3,foox0d+uU|4:V^^U7^<**E*,=>fg&&*>s*C*C%(&--/fnn.>CS#& tAGu~
'4E$S#.E!%//"KK4e4"KKU3HHQK   . & 7  !115 v&GG222  !,  SS#CL	
 -E%H|,VS99(55 %.i$?E'.uE"5?(AH  -VS99(55%3,'.yb'QH+FJFF$$V^^%5q9OOJvx$@Aqy 	NE&KB 5VS-PF$$S[%(2BC(-e6(41  &11#vqzJ(4  671:!+18"9AQ44"9uBsKA$$Z]Jv4FG#-f#5#=#=#?L$$\6:#-f#5#=#=D#=#IL$$\6:#-f#5#=#=C#=#HL$$\6: 5VS-PF$$S[%(2BC(-e6(41  &11#vqzJ(4  671:!+18"9AQ44"9uBzM'*,A$$Z]Jv4FG#-f#5#=#=C#=#HL$$\6: 5VS-PF$$S[%(2BC(-e6(41  &11#vqzJ(4  671:!+18"9AQ44"9&3FC&@&@
aAuAbDMA$$Z]Jv4FG#-f#5#=#=C#=#HL$$\6:[ -^  $$v&  *&*==6B6> , , ,* Q2 t<  IIK? %c )DX # "Gl6 #:"6 #:6 #:  4  s[   c'A/c,(dd*(d/d-(d2dd   d2,c?>c? d/.d/2e	c                   R  pVP                   '       d   V! V\        4      '       g   V! V\        4      '       d   VP                  '       d   V! V\        4      '       d   VP
                  '       d   V! V\        4      '       d   VP                  '       dq   V! V\        4      '       g   VP                  '       gL   V! V\        4      '       g   VP                  '       d'   V! V\        4      '       g2   V! V\        4      '       d   V P                  \        \        W#R7       R# \!        V\        4      '       g   \#        VP$                  4      '       d   VP'                  4       pM!\        V\(        R7      pVP'                  4       pV! V\        4      '       d   RMVP                   pVP$                  p	VP*                  p
VP,                  pV! V\        4      '       g   Rp	VP/                  4       pV! V\        4      '       g   ^pV! V\        4      '       d   VP0                  MRpV! V\        4      '       d   VP2                  MRp\        W#R7      pV P5                  WrWVWVWdR7
       R# )c                     W,          V8H  # r   r~   )reqflags   &&r:   match/TestBufferProtocol.verify_getbuf.<locals>.match  s    X$&'rY   getbufNFr<   )	rV   r   r7   rf  r   r   r   rd   rW  r~   )rf  PyBUF_WRITABLEPyBUF_C_CONTIGUOUSc_contiguousPyBUF_F_CONTIGUOUSf_contiguousPyBUF_ANY_CONTIGUOUS
contiguousPyBUF_INDIRECTrH  PyBUF_STRIDESPyBUF_NDPyBUF_FORMATrg  rs  r   r   r   r  rD  r}  r   r   r#  r   r   r  )rT  orig_exrj  r  rW  r  rd   rL  r  r7   r   r   r   r   s   &&&&&         r:   verify_getbuf TestBufferProtocol.verify_getbuf  s   	( [[[U3773*++BOOO3*++BOOO3,--bmmmsN++sM**2???sH%%%\*B*Bk7BCb'""&:299&E&E))+CM2B))+C C00Ubkkii;;wwS,'' C//#CS(##D!&sH!5!52%*3%>%>'//BR$B%G 	 	,rY   cpuc                f
   \         \        \        \        \        \
        \        \        \        \        \        \        \        \        \        3p\        ^4       Uu. uF  q"^,          '       d   RMRNK  	  upR3. ROR3. ROR3\        ^4       Uu. uF#  q"^,          '       d
   RV,
          MRV,           NK%  	  upR33p. . ^ 3. RO. ^ 3^.. ^ 3^.R.^3^.^.^ 3^.R.^3^^.. ^ 3^^.RR.^3^^.^^.^3^^.RR.^33
p^ \         \"        \"        \         ,          \$        \$        \         ,          3p^ \&        \(        \&        \(        ,          3pV EF  w  rx\*        P,                  ! V4      p	V EF  w  rpV Uu. uF  qV	,          NK  	  ppW,          pV EF  pV'       d   V\"        ,          '       d   K!  V
'       g   V\$        ,          '       d   K>  V
'       d   TMV^ ,          p\/        WVWVR7      pV
'       d   VRRR1,          MRp\1        V4      pV'       d   \1        V4      pVP2                  ^ 8X  g"   VP2                  ^8X  d#   V
'       d   V'       d   V P5                  VV4       V'       d4   VP2                  ^8X  d#   V
'       d   V'       d   V P5                  XV4       V F  pV Fy  pV P7                  VVVV,          4       V P7                  VVVV,          4       V'       g   KA  V P7                  VVVV,          RR	7       V P7                  VXVV,          RR	7       K{  	  K  	  EK  	  EK  	  EK  	  . ROp\/        V^.\8        R
7      pV P;                  \<        \.        V4       \/        ^	.^.4      p\/        V\        R7      pV P;                  \<        \.        V\&        R7       V P;                  \<        \.        V\        R7       V P;                  \<        \.        V\        R7       V P;                  \<        \.        V\        R7       V P;                  \<        \.        V\
        R7       V P;                  \<        \.        V\        R7       \/        V\        R7      p. RO. RO3 F  p
^ \"        3 F  p\/        WzV\         ,          R
7      pV P?                  \A        VR4      4       V P?                  \A        VR4      4       V FF  p\/        VVR7      pV P?                  \A        VR4      4       V P?                  \A        VR4      4       KH  	  K  	  K  	  R# u upi u upi u upi )   TFr   r   r   r   )r  r  r   r   r   N)rW  r   r  r  r\  r   r   r&               r3   r2   	   
      r             )r   r  r   r   )r   r  r   )r3   r   r3   )!r  r  r  PyBUF_SIMPLEr  r  r  
PyBUF_FULLr}  PyBUF_RECORDSPyBUF_RECORDS_ROPyBUF_STRIDEDPyBUF_STRIDED_ROPyBUF_CONTIGPyBUF_CONTIG_ROrc   r  rw  ND_PILr  r  r4   calcsizer   rJ   r   re  r  ND_GETBUF_FAILrg  rs  rz  rv  )rT  requestsrW   	items_fmt	structurendflags
real_flagsrq   r7   r   r   r   r   r   r  _itemsex1ex2m1m2r  bitsrj  baserL  rb  s   &                         r:   test_ndarray_getbuf&TestBufferProtocol.test_ndarray_getbuf  s|    M8\ 24H++/	
 16b	:	1!eed&	:C@)3/)3/:?)D)Qq55uQwvax0)DcJ	
	 QKb!T2qMTB4S1#qMS2$OVROVb"Xr"VaVQVb"Xq!
	 {J
;(>F;&

 $\13
 $JEs+H*3&189Ax<<9"$EE*$4$4  eFll &+UqF!&E(-vOC',#dd)$C#CB'_xx1}Q5W((S1sxx1}7((S1'$.D ..sCTB ..sBDA"s $ 2 23SX:> !3 !@ $ 2 23CH:> !3 !@ %/  () % +4 $F - U2$n=+w3 sQC T,/+w>J+w8D+w=I+w;MN+w;MN+w;OPR- w&EJUu[7HIb# 67b# 67%E E2BOOM"c$:;OOM"c$:; & ' 'c ; E6 :s   T$)T)
;T.c           
        \        ^	.^.4      p\        ^	.^.\        R7      p\         VP                  VP                  3 EF  pV P                  \        V0 R m4       V P                  \        V. R!O4       V P                  \        V. R"O4       V P                  \        V. R#O^0R7       V P                  \        V. R#O^.^0R7       V P                  \        V. R#O^.. R7       V P                  \        V^.^./ R7       V P                  \        V^.^./ R7       V P                  \        V^.^./ R7       V P                  \        V^.^.^.\
        R	7       V P                  \        V^.. \        R7       V P                  \        V. ^.R7       V P                  \        VR
.^.RR7       V P                  \        P                  VR.^.RR7       V P                  \        V^R$.^.RR7       V P                  \        V. R#O^.RR7       \        ^,           pV P                  \        V^.V,          ^.V,          R7       V P                  \        V^.R%.R7       V P                  \        V. R#OR.R7       V P                  \        V^.^^,          .R7       V P                  \        V. R&O^^.^R7       V P                  \        V. R#O^.R.R7       V P                  \        V^.^.^^,          .R7       V P                  \        V^^.^^.^.R7       V P                  \        V. R'O^.^.RR7       V P                  \        V. R#O^.^R7       V P                  \        V. R#O^.^RR7       V P                  \        V. R#O^.RR7       V P                  \        P                  VR#.^.RR7       . R(OpV P                  \        W5^^.R)R*.^R7       V P                  \        V\        4       RR7       V P                  \        V^.^.\        R7       V P                  \        V^.4       EK  	  V P                  \        \         R\        R7       \        ^	.^.\        R7      pV P                  \        VP                  ^.^.\        R7       \        R4      pV P                  \        VP                  ^.^.4       V P                  \        VP                   4       \        ^	.^.4      pVP                  ^.^.4       \#        V4      pV P                  \        VP                  ^.^.4       V P                  \        VP                   4       VP%                  4        VP!                  4        V P                  \        VP                   4       ?V P                  \        \&        / . R#O4       V P                  \        \&        R/ 4       \        \)        \+        ^d4      4      ^.^d,          R7      pV P                  \        \&        V^.4       \        \)        \+        ^4      4      ^^.R7      pV P                  \        \&        V. R+O4       V P                  \        \&        V^^.4       V P                  \        \&        VR)^.4       V P                  \        \&        VR,^.4       \        . R#O^.RR7      p\        V\,        R7      pV P                  \        VP.                  4       \        . R#O^.RR7      p\        V4      p	\        V	4      pV P                  \        VP0                  4       \        R-.^.R.R7      pV P                  \        VP0                  4       \        p\        \)        \+        V4      4      ^.V,          R7      pV P                  \        VP0                  4       \        ^.^.R7      pV P                  \        \2        ^^^^^4       V P                  \        \2        VRR4       V P                  \        \2        VR,R4       V P                  \        \2        V\4        R4       V P                  \6        \2        V\4        R4       V P                  \        \2        V\4        R4       V P                  \        \2        V^R4       \        ^.^.R7      pV P                  \        \8        ^^^^^4       V P                  \        \8        / V4       V P                  \        \8        V/ 4       \        ^.^.R7      pV P                  \        \:        ^^^^^4       V P                  \        \:        / R4       V P                  \        \:        V^4       R# )/r  r  3r   r   r   r   r   r_  r  )r   r  r   r   r  XXXr   i  r   QL1r   r   r  )r   r   r  r<   z@#$)r   r   r   r   r     123r  xyzr     u    Zr]  N>   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  r3   r2   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   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   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   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   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   r   r   r   r   r   r   LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL)r   ND_VAREXPORTpushrg  rE  rw  r  r   r4   r6   ND_MAX_NDIMOverflowErrorr  r  rs  r  poprJ   releaserq  r   rc   r  rD  memoryview_from_bufferrx  ry  UnicodeEncodeErrorr{  rv  )
rT  rL  ndmr   r   rq   rD   rj  r  r  s
   &         r:   test_ndarray_exceptions*TestBufferProtocol.test_ndarray_exceptionsr  s+   aS1#qcA3l3 277CHH-AiG4iI6iK8iGA3?iGA3LiGA3rJiQCs2FiQCs"EiQCs2F iQCsQC$.  0 iQCrH j!Rs;j!eWQCLfllAvaSMj!aYqc#Nj!WQCM AAj!aSU1#a%@ j!aS=j!WSEBmQAsF8Dj![1aP j!WQC#OmQA3'(#vh  0 j!aU1Q%!Mj!YqcA3%(  * j!WQCJj!WQC%(  * j!WQCKfllAy%*  , +Ej!1Q%')2hq  : iIKD iQCs:N iQC0O .V 	+w~N aS1#\2*bggsQC|L V_+rwwaS9+rvv. aS1#
aSrN+rwwaS9+rvv.			
 	+rvv. 	)["g>)[&"=T%*%aSW5*k2s;T%)_QqE2*k2w?*k2!u=*k21v>-b5)D WQC4R-*bii0 gaS5clS\)R%>%>?hZs7;)R%>%>?T%(^A3q51*b&?&?@ aS$)^Q1aC)^RD-UCH)^RSI,nb*"	$*nb*cJ*nb#sC aS$)ZAq!Q?)ZR8)ZR8 aS$)]Aq!QB)]B<)]B<rY   c                   \        \        ^4      4       F  p^ .^,          p\        . RO^.\        R7      p\	        V4      V^ &   \        ^^4       F&  pVP                  . RO^.R7       \	        V4      W$&   K(  	  \        ^4       F   pW!V,          ,          P                  4        K"  	  V P                  \        VP                  4       ?K  	  R# )r  r  r  Nr  )
r   rc   r   r  rJ   r  r  rg  rs  r  )rT  permrD   rL  r   s   &    r:   test_ndarray_linked_list+TestBufferProtocol.test_ndarray_linked_list  s     q*DAA<@Bb>AaD1a[s+!"~ ! 1Xq'
""$  k2662 +rY   c                    \        ^ 4       FC  w  rp\        P                  ! V4      p\        VRVR7      pV P	                  VRWAR^ RRVR7	       KE  	  R# )r   r_  NTrV   r   r7   rf  r   r   r   rd   r~   )r|   r4   r  r   r  )rT  r7   scalarro   r   rL  s   &     r:   test_ndarray_format_scalar-TestBufferProtocol.test_ndarray_format_scalar   sT    )!nNCs+Hr#6BKK!)Tb""  $ -rY   c                    \        ^^
4      p\        V4       FT  w  r#p\        P                  ! V4      p^ \        3 F,  p\        W1.W&R7      pV P                  VRWRR^V3V3VR7	       K.  	  KV  	  R# )r   r^  NTr  )r   r|   r4   r  r  r   r  )rT  ry   r7   rq   ro   r   r  rL  s   &       r:   test_ndarray_format_shape,TestBufferProtocol.test_ndarray_format_shape*  ss    Ar"(0MCs+HVU(3LBD%-!"6)h[ %  ' % 1rY   c                   \        ^^4      p\        V4       F  w  r#p\        P                  ! V4      p\	        R^4       F  pV^ 8X  d   K  \        VRRV1,          4      .pWe,          .pV^ 8  d   WQ^,
          ,          M^ p	^ \        3 F4  p
\        W7VW)V
R7      pV P                  VRWRR^WxVRRV1,          R7	       K6  	  K  	  K  	  R# )r   Nr  Tr  )	r   r|   r4   r  rc   r^   r  r   r  )rT  ry   r7   rq   ro   r   r  r   r   r   r  rL  s   &           r:   test_ndarray_format_strides.TestBufferProtocol.test_ndarray_format_strides6  s    1b!(0MCs+Hb!19U6T6]+,=/04q!8,a[E W(+%IBKK)1T%&e$)&D&M   3 ) % 1rY   c                    . ROp\        VRRR7      p\        V\        \        ,          R7      pV P                  VP	                  4       \        VR4      4       R# )r   r  r  Nr  r  )r   r  )r   r  r  re  rD  r   )rT  rq   rj  rL  s   &   r:   test_ndarray_fortran'TestBufferProtocol.test_ndarray_fortranK  sD    ,U&&9R 2< ?@fUF&;<rY   c                \   \        ^4       EF  p\        V4       Uu. uF  p\        ^^
4      NK  	  pp\        V4      p\        V4       EFS  p\	        V4      w  rgp\
        P                  ! V4      p^ \        3 EF  p	V^ 8X  d   V	\        8X  d   K  \        WuWiR7      p
\        WVR4      p\        Wu4      pV P                  V
RWRWVVR7	       \        V4      '       dp   \        WuVR7      p\        V\        \        ,          R7      p
V P                  V
P                   R	8H  4       V
P#                  4       pV P                  VRWRWVVR7	       \        WuVV	\$        ,          R7      p
\        WVR4      p\'        Wu4      pV P                  V
RWRWVVR7	       EK!  	  EKV  	  EK  	  R# u upi )
r  r^  r   NTr  r_  r  r\  r~   )rc   r   r   r   ru   r4   r  r  r   r   r   r  r   r  r  rz  r   r  rw  r   )rT  r   ro   shape_try   r   r7   rq   r   r  rL  r   rd   rj  mvs   &              r:   test_ndarray_multidim(TestBufferProtocol.test_ndarray_multidimQ  s   !HD16t=AyB'G=']F%g. )& 1A!??3/[EqyUf_  !CMB0hLG .CKK)1T%)$'   )
 ,C00$UD$R0LM

b(89668BD-5)-G(+ $ - !C',Z'79B 1hLG .CKK)1T%)$'   )? ) / =s   F)c                   \        ^.^.R7      pV P                  \        VP                  ^^4       \	        V4      pV P                  W!4       V P                  \        VP                  ^^4       \        ^.^.\        R7      pV P                  \        VP                  ^4       \	        V4      pV P                  W!4       V P                  \        VP                  ^4       \        ^.^.\        R7      pV P                  \        VP                  R4       V P                  \        VP                  R^4       \	        V4      pV P                  W!4       V P                  \        VP                  R4       V P                  \        VP                  R^4       . R	Op\        V\        V4      .R\        R7      pV P                  \        P                  VP                  ^R4       V P                  \        VP                  ^R
4       \	        V4      pV P                  W!4       V P                  \        VP                  ^R4       V P                  \        VP                  ^R
4       . ROp\        V\        V4      .R\        R7      pV P                  \        VP                  ^R4       V P                  \        P                  VP                  ^R4       R# )r   r  r  r   r^  i,  LQNr  r   r&   r  r  r  r  r3   r2   )d      )r   r&   r  )r  r  )s    1r  )r   rg  rE  __setitem__rJ   re  r  __delitem__r  __getitem__
IndexErrorr^   r4   r6   r   )rT  rL  r  rq   s   &   r:   test_ndarray_index_invalid-TestBufferProtocol.test_ndarray_index_invalid~  s   aS$)R^^Q:^ )R^^Q: aS;7)R^^Q7^ )R^^Q7 aS;7-?-B^ *bnne<*bnneQ? "U3u:,s+N&,,3?*bnnaD^ *bnna=)R^^Q
C%U3u:,t;O*bnna=&,,?KrY   c                V   \        ^R\        R7      p\        V4      pV P                  W!4       VR,          q0P                  V^4       VR,          q0P                  VP	                  4       VP	                  4       4       VR,          q0P                  V^4       VR,          q0P                  VP	                  4       VP	                  4       4       V P                  \        VP                  ^ 4       V P                  \        VP                  ^ 4       V P                  \        VP                  ^ ^4       V P                  \        VP                  ^ ^4       V P                  VP	                  4       ^4       V P                  VP	                  4       ^4       ^	VR&   V P                  VP	                  4       ^	4       ^	VR&   V P                  VP	                  4       ^	4       ^VR&   V P                  VP	                  4       ^4       ^VR&   V P                  VP	                  4       ^4       R# )r   r  .Nr~   )	r   r  rJ   re  rD  rg  rE  r  r  )rT  rL  r  rW   s   &   r:   test_ndarray_index_scalar,TestBufferProtocol.test_ndarray_index_scalar  s   Qb4^ rF%%a+sG%%ahhj"))+>rF%%a+sG%%ahhj"))+>)R^^Q7)R^^Q7)R^^Q:)R^^Q:a(a(2D$$RYY[!42D$$RYY[!43T%%biik153T%%biik15rY   c           	        \        \        \        ^4      4      ^^.\        R7      p\        V\        R7      pV P                  \        VP                  ^4       V P                  \        VP                  \        ^^^4      4       R# )r&   r  r  N)	r   r   rc   r  r  rg  rs  r  r   )rT  rj  rL  s   &  r:   test_ndarray_index_null_strides2TestBufferProtocol.test_ndarray_index_null_strides  s_    T%*%aV;GR- 	+r~~q9+r~~uQq|DrY   c                   \        ^4       EF+  w  rp\        V^.VR7      p\        R^4       F!  pV P                  WE,          W%,          4       K#  	  V P	                  \
        VP                  R4       V P	                  \
        VP                  ^4       \        V4      '       g   K  \        V4      pV P                  Wd4       \        R^4       F!  pV P                  We,          W%,          4       K#  	  V P	                  \
        VP                  R4       V P	                  \
        VP                  ^4       EK.  	  \        ^4       F  w  rp\        V^.\        VR7      p\        V\        \        ,          R7      p\        R^4       F!  pV P                  WE,          W%,          4       K#  	  \        V4      '       g   Kz  VP                  4       pV P                  VP                  V4      \        4       \        R^4       F!  pV P                  We,          W%,          4       K#  	  K  	  . ROp\        V^.R7      p\        V\         R7      p\        R^4       F!  pV P                  WE,          W%,          4       K#  	  . ROp\        V^.R7      p\        V\"        R7      p\        R^4       F!  pV P                  WE,          W%,          4       K#  	  R# )	r  r_  r`  r  r  Nr   r  )r|   r   rc   re  rg  r  r  r   rJ   r  r  r  r  rd  __eq__NotImplementedr  r  )rT  r7   rq   ro   rL  r   r  rj  s   &       r:   !test_ndarray_index_getitem_single4TestBufferProtocol.test_ndarray_index_getitem_single  s$   (^MCqc#6B2q\  1 " j".."=j"..!<#C((^  (r1A$$RUEH5 & !!*bnnbA!!*bnna@ ,$ )^MCqcSIBL$=>B2q\  1 " $C((..0biim^<r1A$$RUEH5 & , U1#&R0r1ARUEH-  U1#&R-r1ARUEH- rY   c                
   \        ^4       EFZ  w  rp\        V^.V\        R7      p\        ^4       F  pW2V&   W4V&   K  	  V P	                  VP                  4       V4       V P                  \        VP                  RV4       V P                  \        VP                  ^V4       \        V4      '       g   K  \        V^.V\        R7      p\        V4      pV P	                  Wd4       \        ^4       F  pW2V&   W6V&   K  	  V P	                  VP                  4       V4       V P                  \        VP                  RV4       V P                  \        VP                  ^V4       EK]  	  \        ^4       EF  w  rp\        V^.V\        R7      p\        R^4       F%  pW%^,           ,          W%&   WE^,           ,          WE&   K'  	  V P	                  VP                  4       V4       \        V4      '       g   K  \        V^.V\        R7      p\        V4      pV P	                  Wd4       \        R^4       F%  pW%^,           ,          W%&   We^,           ,          We&   K'  	  V P	                  VP                  4       V4       EK  	  R# )r  r^  Nr  r   )r|   r   r  rc   re  rD  rg  r  r  r   rJ   )rT  r7   rq   single_itemrL  r   r  s   &      r:   !test_ndarray_index_setitem_single4TestBufferProtocol.test_ndarray_index_setitem_single  s   '21~#Cqc#[IB1X&a#1  RYY[%0j".."kJj"..![I',,qc#[IBBBR$1X&a#1  RYY[%0j".."kJj"..![I- (64 (31~#Cqc#[IB2q\ 1:Q3 " RYY[%0',,qc#[IBBBR$2q\ 1:Q3 " RYY[%0! (6rY   c           
        Rp\        V4      p\        V4       EFj  p\        V4      w  rEp^ \        3 EFK  p\	        WSWGR7      p\        WS4      p	\        V^ ,          ) V^ ,          4       F  p
V P                  W,          W,          P                  4       4       \        V^,          ) V^,          4       F  pV P                  W,          V,          W,          V,          P                  4       4       \        V^,          ) V^,          4       F=  pV P                  W,          V,          V,          W,          V,          V,          4       K?  	  K  	  K  	  \	        WSVV\        ,          R7      p\        WS4      p	\        V^ ,          ) V^ ,          4       F  p
V P                  W,          W,          P                  4       4       \        V^,          ) V^,          4       F  pV P                  W,          V,          W,          V,          P                  4       4       \        V^,          V^,          4       F=  pV P                  W,          V,          V,          W,          V,          V,          4       K?  	  K  	  K  	  EKN  	  EKm  	  R# r&   r^  Nr&   r  r  )r   r   ru   r  r   r   rc   re  rD  rw  r   )rT  r  ry   r   r7   rq   ro   r  rL  rd   r   r   ks   &            r:   #test_ndarray_index_getitem_multidim6TestBufferProtocol.test_ndarray_index_getitem_multidim&  s   g!'*E%f-MCVUIU*ay%(3A$$SVRU\\^<"E!H9eAh7((BE!HOO4EF!&ay%(!;A ,,SVAYq\258A;G "< 8 4 U#(#35U*ay%(3A$$SVRU\\^<"E!H9eAh7((BE!HOO4EF!&uQxq!:A ,,SVAYq\258A;G "; 8 4# %	 +rY   c                h   \        ^RR7      pV P                  \        \        R\	        4       4       \        V4      pV P                  W!4       V P                  \        \        R\	        4       4       \        ^4       F  w  r4p\        V^.VR7      p\        V4       F0  w  rgV P                  WtV,          4       V P                  Wq9   4       K2  	  \        V4      '       g   Kg  \        V4      p\        V4       F0  w  rgV P                  WtV,          4       V P                  Wr9   4       K2  	  K  	  R# )r   r  z1 in ndz1 in mvr_  Nr~   )r   rg  rE  evallocalsrJ   re  r|   r  rz  r   )rT  rL  r  r7   rq   ro   r   r   s   &       r:   test_ndarray_sequence(TestBufferProtocol.test_ndarray_sequenceE  s    Qb!)T9fh?^ )T9fh?(^MCqc#6B!"  !H-( & $C((^%bMDA$$Qa1OOAG, * ,rY   c           
        . ROp\        V^.\        R7      p\        V4      pV P                  \        VP
                  \        ^ ^^4      V4       V P                  \        VP
                  \        ^ ^^4      V4       \        V^.\        R7      p\        V^.\        R7      p\        V\        R7      pV P                  \        VP
                  \        ^ ^^4      V4       \        V^.R\        R7      p\        V4      pV P                  \        VP                  \        ^ ^^ 4      4       V P                  \        VP                  \        ^ ^^ 4      4       \        V^^.R\        R7      p\        V4      pV P                  \        VP                  \        ^ ^^4      \        ^ ^^ 4      34       V P                  \        VP                  \        ^ ^^ 4      \        ^ ^^4      34       V P                  \        VP                  R4       V P                  \        VP                  R\        ^ ^^4      34       V P                  \        VP                  \        ^ ^^4      / 34       V P                  \        VP                  \        ^ ^^4      \        ^ ^^ 4      34       V P                  \        VP                  R4       \        V^.R\        R7      p\        V^.RR7      p\        V4      p\        V4      pV P                  \        VP
                  \        ^ ^^4      VR	,          4       V P                  VP                  4       V4       V P                  \        VP
                  \        ^ ^^4      VR	,          4       V P                  VP                  4       V4       \        V^.R\        R7      p\        V^.RR7      p	\        V4      p\        V4      pV P                  \        VP
                  \        ^ ^^4      VR	,          4       V P                  VP                  4       V4       V P                  \        VP
                  \        ^ ^^4      VR	,          4       V P                  VP                  4       V4       \        V^^.R\        R7      p\        V^.RR7      p\        V4      p\        V4      pV P                  \        VP
                  \        ^ ^^4      VR	,          4       V P                  VP                  4       . RO. RO.4       V P                  \        VP
                  \        ^ ^^4      VR	,          4       \        V^.R\        R7      p\        V^.RR7      p\        V4      p\        V4      pV P                  \        VP
                  \        ^ ^^4      VR	,          4       V P                  VP                  4       V4       V P                  \        VP
                  \        ^ ^^4      VR	,          4       V P                  VP                  4       V4       V P                  \        \        \        ^ ^^4      / 4       V P                  \        \        R
^4       V P                  \        \        \        ^ ^^ 4      ^4       \        V^.R\        R7      p
V P                  \        V
P                   4       \        V^.RR7      p\        V\"        R7      p
V P                  \        V
P                   4       R# )r   r  r  r   r^  z@%$r   r   r_  :r3   r2   Nz###########Nr  r  )r  r  r3   r2   )r   r  rJ   rg  rE  r  r   r  rs  r   r  rF  re  rD  r   r  add_suboffsetsr  )rT  rq   xlmlrj  xrrL  r  mryrrW   s   &          r:   test_ndarray_slice_invalid-TestBufferProtocol.test_ndarray_slice_invalidX  sj   ! U1#[9^)R^^U1Qq\5I)R^^U1Qq\5I U1#[9U1#[9R)+r~~uQq|RH U1#cE^*bnneAalC*bnneAalCU1Q%;G^*bnn 1Q<q16	8*bnn 1Q<q16	8)R^^U;)R^^eU1Qq\5JK)R^^eAalB5GH 	-r~~ 1Q<q16	8)R^^U; U1#cEU1#c2^^*bnneAalBsGLe,*bnneAalBsGLe, U1#cEU1#c2^^*bnneAalBsGLe,*bnneAalBsGLe, U1a&KHU1#c2^^*bnneAalBsGLy)&<=-r~~uQq|S'	# U1#cEU1#c2^^*bnneAalBsGLe,*bnneAalBsGLe, 	)]E!AaL"E)]M1E*mU1Qq\1EE!S?)Q%5%56U1#c2B|,)Q%5%56rY   c                .   . ROp\        V^.R\        R7      p\        V^.RR7      pVR,          VR&   V P                  VP                  4       V4       \	        V4      p\	        V4      pV P                  WB4       V P                  WC4       VR,          VR&   V P                  VP                  4       V4       \        V^^.R\        R7      p\        V^^.RR7      pVR,          VR	&   V P                  VP                  4       \        V^^.4      4       R# )
r   r   r^  r_  :r  r  N:r  r  NNr  )r   r&   N:r  r  N)r<  :r&   r&   N)r   r  re  rD  rJ   r   )rT  rq   rW   r  r5  r7  s   &     r:   test_ndarray_slice_zero_shape0TestBufferProtocol.test_ndarray_slice_zero_shape  s    ,E"cEE"c23#U+]]S'3e,E!Q;GE!Q4k(VEAq6%:;rY   c           	     ^   Rp\        V4      p\        V4      p\        V4       F  p\        V4      w  rVp\        P
                  ! V4      p^ \        3 F  p	\        WdWYR7      p
\        Wd4      p\        W$4       F`  pRp \        W4      pRp W,          pV'       g	   V'       d   V P                  VV4       K@  V P                  XP                  4       X4       Kb  	  K  	  K  	  R#   \         d   pTP                  p Rp?LyRp?ii ; i  \         d   pTP                  p Rp?LRp?ii ; ir(  )r^   r   r   ru   r4   r  r  r   r   r<  r   	Exception	__class__rd  re  rD  )rT  r  r   ry   r   r7   rq   ro   r   r  rL  rd   r   listerrrW  r   nderrndsliceds   &                 r:   test_ndarray_slice_multidim.TestBufferProtocol.test_ndarray_slice_multidim  s    7|g!'*E%f-MCs+HVUIU**47F"G.!+C!8 !E,#%: eW5(():FC# 8	 % + % ."#++. % , !,s0   ?C'D'D	2D	D	D,	D'	'D,	c                   Rp\        V4      p\        V4      p\        V4       F  p\        V4      w  rVp\        P
                  ! V4      p\        WdVR7      p	V	P                  4        \        WdVR7      p
V
P                  4        \        V
4      p\        Wd4      p\        W$4       F`  pRp \        W4      pRp W,          pV'       g	   V'       d   V P                  VV4       K@  V P                  XP!                  4       X4       Kb  	  K  	  R#   \         d   pTP                  p Rp?LuRp?ii ; i  \         d   pTP                  p Rp?LRp?ii ; i)r&   r_  N)r&   r  r  r&   )r^   r   r   ru   r4   r  r   r3  rJ   r   r<  r   r@  rA  rd  re  rD  )rT  r  r   ry   r   r7   rq   ro   r   rL  rj  r  rd   r   rB  rW  r   rC  rD  s   &                  r:   'test_ndarray_slice_redundant_suboffsets:TestBufferProtocol.test_ndarray_slice_redundant_suboffsets  s   7|g!'*E%f-MCs+HC8BC8BBB&C&t3*'4F (!zH GMM%1$$X__%6?# 4 +" ! *kkG* ! (KKE(s0   ,D:D4D1D,,D14E?EEc                   \        ^4       EF  w  rp\        ^4       EF  p\        ^4       EF  p^ \        3 EF  pV\        ,          p\	        V^.WR7      p\	        V^.WR7      p	\        V	4      p
RpRpVR,          p W,          pW,          pW,          W&   \        V4      \        V4      8g  pRp W,          W&   V'       d   V P                  V\        4       M2V P                  VP                  4       V4       V P                  VV4       \        V4      '       g   K  Rp W,          W&   V'       d   V P                  V\        4       EK  V P                  V
P                  4       V4       V P                  W4       V P                  VV4       V P                  WVP                  VRVP                   VP"                  VP$                  VP                  4       R7	       EK  	  EK  	  EK  	  EK  	  R#   \         d   pTP                  p Rp?ELdRp?ii ; i  \         d   pTP                  p Rp?EL|Rp?ii ; i  \         d   pTP                  p Rp?EL0Rp?ii ; i)r  r^  NNNNFr  )r|   r,  r  r  r   rJ   r^   r@  rA  rd  r   re  rD  r   r  r   r   r   r   )rT  r7   rq   ro   lslicer2  r  r   rL  rj  r  lsterrdiff_structurerd   lvalrvalr   rC  mverrs   &                  r:    test_ndarray_slice_assign_single3TestBufferProtocol.test_ndarray_slice_assign_single  s   (^MC#A,'lF"#V!+-$U1#cK$U1#cK'^!%)-#Ah1#&;D#&;D*-+CK-0Y#d)-CN !%0)+BJ * MM%< ,,RYY[#> MM%83C88$ $0)+BJ * MM%< ,,RYY[#> ,,R4 MM%8 KK'){{e#%77"((BJJ"$))+ ( /[ "- + ' ,$  ) 1%&[[F1  ) 0$%KKE0  ) 0$%KKE0sH   1G95
H&
I9HHHI )H;;I I%I  I%c           
     r   Rp\        V4      p\        V4      p\        V4       F  p\        V4      w  rVp^ \        3 F  p\        \        4       F  p\        W$4      w  r\        WdVV\        ,          R7      p\        Wd4      pRp \        WW4      pRp W,          W&   V'       g	   V'       d   V P                  VV4       Kt  V P                  VP!                  4       X4       K  	  K  	  K  	  R#   \         d   pTP                  p Rp?L{Rp?ii ; i  \         d   pTP                  p Rp?LRp?ii ; ir(  )r^   r   r   ru   r  rc   
ITERATIONSr  r   r  r   r   r@  rA  rd  re  rD  )rT  r  r   ry   r   r7   rq   ro   r  r   r   rL  rd   rB  rl  r   rC  s   &                r:   "test_ndarray_slice_assign_multidim5TestBufferProtocol.test_ndarray_slice_assign_multidim>  s   7|g!'*E%f-MCVz*A';D'H$G C',['8:B .C"G.!23W!N !E,&(k eW5((f=- + %	 + % ."#++. % , !,s0   C1
D1D	<D	D	D6	 D1	1D6	c                   \        \        4       EF  p\        R ,           EF  p\        P                  ! V4      p\        VR\        \        R7      pV P                  \        V!  4       \        W$4      p\        WRV4      pVP                  4       p\        V4      p\        V4      '       d"   VP                  4       p	V P                  W4       V^,          ^ 8  d   \        WRV\         R7      p
V
P                  4       pV P                  W{4       \        V
4      p\        V4      '       d3   V P                  W4       VP                  4       p	V P                  W4       \"        '       g   EKK  V^,          p^ V9   d   EK^  \%        WRV4      pV P'                  VRVP(                  VRVP*                  VP,                  VP.                  VP                  4       R7	       EK  	  EK  	  R# )r=   Tr   r   r  NFr  )rc   rU  rP   r4   r  r   MAXDIMMAXSHAPErz  r   r  r  rD  rJ   r   re  r  r  r  r  r   r   r   r   )rT  ro   r7   r   r{   rq   rW   xlistr  mvlistr  ylistr   zs   &             r:   test_ndarray_random&TestBufferProtocol.test_ndarray_random_  sp   z"As||!??3/"8T&,46 0! 4508*5q9
]',,YY[F$$V3Q4!8.u1FKAHHJE$$U2#AB+C00((/!#((7;aDEEz 25qAAKKt)*u%&VV177AII$%HHJ   0C $ #rY   c           	        \        \        4       F  p\        R ,           F  p\        P                  ! V4      p\        VR\        \        R7      pV P                  \        V!  4       \        W$4      pRp \        WRV4      pV P                  V4       \        '       g   K  Rp	 \!        WRV4      p
K  	  K  	  R#   \         d   pTP                  p Rp?LTRp?ii ; i  \         d   pTP                  p	 Rp?LJRp?ii ; i)r=   FrY  N)rc   rU  rP   r4   r  r   rZ  r[  assertFalser   r  r  r@  rA  rz  r  r  )rT  ro   r7   r   r{   rq   rC  rW   r   	numpy_errr  s   &          r:   test_ndarray_random_invalid.TestBufferProtocol.test_ndarray_random_invalid  s    z"As||!??3/"8U6,46  !11!5608(.u1=A &; %I06u1E - $ # ! (KKE( % 0$%KK	0s0   6B:$C:CCCC?)C::C?c                   \        \        4       EF.  p\        R ,           EF  p\        P                  ! V4      p\        \        \        R7      w  rErg\        VRVR7      p\        VRVR7      p	V P                  \        V!  4       V P                  \        V	!  4       \        W(4      p
\        W)4      p\        WV4      p\        WV	4      pW,          W&   VP                  4       pVP                  4       p\        V4      p\        V4      pV P                  VP                  4       V4       V P                  VP                  4       V4       V^,          ^ 8  d   V	^,          ^ 8  d   \        WV\         R7      p\        WV	\         R7      pVV,          VV&   VP                  4       pVP                  4       pV P                  VV4       V P                  VV4       \        V4      p\        V4      pV P                  VP                  4       V4       V P                  VP                  4       V4       \"        '       g   EK!  ^ V9   g   ^ V9   d   EK2  \%        WV4      p\%        WV	4      pVV,          VV&   \'        V4      '       gb   \'        V	4      '       gQ   V P)                  VRVP*                  VRVP,                  VP.                  VP0                  VP                  4       R7	       V P)                  VRVP*                  VRVP,                  VP.                  VP0                  VP                  4       R7	       EK  	  EK1  	  R# )r=   rY  Tr  r  NFr  )rc   rU  rP   r4   r  r  rZ  r[  r   rz  r   r  r  rD  rJ   re  r  r  r  r   r  r   r   r   r   )rT  ro   r7   r   r   r   r   r   tltrlitemsritemsr4  r6  xllistxrlistr5  r7  ylr8  yllistyrlistzlzrs   &                       r:    test_ndarray_random_slice_assign3TestBufferProtocol.test_ndarray_random_slice_assign  s   z"As||!??3/ (vI 1#Hd&A#Hd&A 0" 56 0" 561#:1#:+F<+F< k^^  f5  f5a519A/RvNB/RvNB"$W+BwKYY[FYY[F$$VV4$$VV4#BB#BB$$RYY[&9$$RYY[&9;F{a6k 3FDB3FDB"$W+BwK)"--nR6H6H BD-/[[cE)+,.JJBIIK $ I
 KK)+#%'WWBHH(*

		   Em $ #rY   c                   . ROp\        V^^.\        R7      p\        V4      pV P                  VP                  \        ,          4       V P	                  VP
                  V4       V P                  VP                  R4       V P                  VP                  4       V P                  VP                  4       V P                  VP                  4       R# )r   r  Nr  )r   r   )r   r  rz  r  rd  rV   re  rH  rc  r  r  r  )rT  rq   rL  rj  s   &   r:   test_ndarray_re_export)TestBufferProtocol.test_ndarray_re_export  s    ,U1Q%v6R[6)*bffb!0))'rY   c           	     L   ^ \         3 EF  p\        . RO^ .VR7      p\        V4      pV P                  W24       V P                  VP	                  4       . 4       V P                  VP	                  4       . 4       \        . RO. ROVR7      pV P                  VP	                  4       . 4       \        . RO. ROVR7      pV P                  VP	                  4       . . . .4       \        . RO. ROVR7      pV P                  VP	                  4       . . . .. . . .. . . ..4       EK  	  R# )r   r  Nr  r   r  r  r  r   r  )r  r  r   r  r   rJ   re  rD  rT  r  rL  r  s   &   r:   test_ndarray_zero_shape*TestBufferProtocol.test_ndarray_zero_shape  s    [E59BBBR$RYY["-RYY["-u=BRYY["-u=BRYY[2r2,7u=BRYY[!2rlRRL2r2,GI !rY   c                   ^ \         3 Fu  p\        ^.^.^ .VR7      p\        V4      pV P                  W24       V P                  VP	                  4       . RO4       V P                  VP	                  4       . RO4       Kw  	  R# )r   r  N)r   r   r   r   r   r{  r|  s   &   r:   test_ndarray_zero_strides,TestBufferProtocol.test_ndarray_zero_strides  si    [E!QC!EBBBBR$RYY[/:RYY[/: !rY   c                    \        \        \        ^4      4      ^.^R7      pV P                  VP                  ^4       V P                  VP                  4       . RO4       R# )   r  N)r3   r2   r  )r   r   rc   re  r   rD  rT  rL  s   & r:   test_ndarray_offset&TestBufferProtocol.test_ndarray_offset  sD    T%)_QC:A&g.rY   c                    ^ \         3 FE  p\        \        \        ^4      4      ^.VR7      pVP	                  4       pV P                  W24       KG  	  R# r   r  N)r  r   r   rc   r  re  )rT  r  rL  rD   s   &   r:   #test_ndarray_memoryview_from_buffer6TestBufferProtocol.test_ndarray_memoryview_from_buffer  sD    [EeAhs%@B))+AQ# !rY   c           	         ^ \         3 FX  p\        \        \        ^4      4      ^.VR7      p\        ^4       F%  pV P	                  W#,          \        W#.4      4       K'  	  KZ  	  R# r  )r  r   r   rc   re  rq  )rT  r  rL  r   s   &   r:   test_ndarray_get_pointer+TestBufferProtocol.test_ndarray_get_pointer  sO    [EeAhs%@B1X  B(<=  !rY   c                N   \        \        \        ^4      4      . ROR7      p\        V\        \        ,          R7      pV P                  VP                  4       VP                  4       4       \        V4      pV P                  VP                  4       VP                  4       4       R# )r  r  r  N)r&   r&   r  )r   r   rc   r  r  re  rD  rJ   )rT  rj  rL  rD   s   &   r:    test_ndarray_tolist_null_strides3TestBufferProtocol.test_ndarray_tolist_null_strides  sh    T%)_G4R 56biik2rNRYY[1rY   c                   V P                  \        R R4      4       \        \        \	        ^4      4      ^^.R7      p\        \        \	        ^4      4      ^^.R7      pV P                  \        W4      4       \        ^.^.RR7      pV P                  \        VR4      4       V P                  \        RV4      4       R# )r  s   456r  r   r_  rN   N)rc  r{  r   r   rc   rz  )rT  rW   r  s   &  r:   test_ndarray_cmp_contig*TestBufferProtocol.test_ndarray_cmp_contig%  s    FF34DrOAa51DrOAa51A)*QCs3/
1g./
7A./rY   c           	        \         P                   ! R . RO4      p\        V4      pV P                  \        \        V4       \        \        \        ^4      4      4      p\        \        \        ^4      4      ^.R7      pV P                  \	        V4      \	        V4      4       \        \        \        ^4      4      ^^.R7      pV P                  \	        V4      \	        V4      4       \        \        \        ^4      4      . ROR7      pV P                  \	        V4      \	        V4      4       \        \        \        \        ^4      4      ^^.R7      4      p\        \        \        ^4      4      ^^.\        R7      pV P                  \	        V4      \	        V4      4       \        \        \        \        ^4      4      . ROR7      4      p\        \        \        ^4      4      . RO\        R7      pV P                  \	        V4      \	        V4      4       \        \        \        ^4      4      4      p\        \        \        ^4      4      . RO\        R7      pV P                  \	        V4      \	        V4      4       \        \        \        ^4      4      . ROR R7      pV P                  \	        V4      \	        VP                  4       4      4       R# )	r   r  r  r_  Nr  )r  r&   r&   r&   r  r&   r&   r&   r  )rH   r   rg  r   hashrQ   r   rc   re  r   rw  r  r#  )rT  rF   rL  r   s   &   r:   test_ndarray_hash$TestBufferProtocol.test_ndarray_hash1  s   KKW%QZ*dB/ $uRy/"T%)_RD1b47+ T%)_QqE2b47+T%)_G4b47+ )DrOAa59:T%)_QqEDb47+)DrO7;<T%)_G:Fb47+ $uRy/"T%)_G6Bb47+ T%)_GC@b4

#56rY   c                   \         \        \        \        \        \
        \        \        \        \        \        \        3pV P                  \        \        / R \
        4       \        ^	RR\         R7      pR F7  pV F.  p\        W#V4      pV P#                  WRP%                  4       4       K0  	  K9  	  \        ^.^ .R\         R7      pR F*  pV F!  p\        W#V4      pV P#                  VR4       K#  	  K,  	  \        \'        \)        ^4      4      . ROR\         R7      pR F*  pV F!  p\        W#V4      pV P#                  VR4       K#  	  K,  	  ^ \*        3 F  p\        ^.^.RV\         ,          R7      pVP%                  4       pR F)  pV F   p\        W#V4      pV P#                  WW4       K"  	  K+  	  \        . RO^.RV\         ,          R7      pVP%                  4       pR F)  pV F   p\        W#V4      pV P#                  WW4       K"  	  K+  	  K  	  \        . RO^.^.\         R7      pVP%                  4       pR F3  p\        \        3 F   p\        W#V4      pV P#                  WW4       K"  	  K5  	  VR	R	R1,          pVP%                  4       pR F*  pV F!  p \        W#V4      pT P#                  YW4       K#  	  K,  	  \'        \)        ^4      4      p^ \*        3 EFG  p\        V^^.V\         ,          R
7      p\.        '       d$   \/        \1        V4      ^^.RV^ 8X  d   RMR R7      p	V\*        8X  d2   \        \3        V^^.4      ^^.\         R
7      p
V
P%                  4       pMVP%                  4       pV F  p \        VRV4      pT P#                  Y[4       \        T Uu. uF  qNK  	  up^^.\         R
7      pT P#                  \5        T4      \5        T4      4       \.        '       g   Kw  T P#                  TX	P%                  RR7      4       K  	  V^ 8X  d"   \        \3        V^^.4      ^^.\         R
7      p
M\        V^^.\         R
7      p
V
P%                  4       p\        \
        \         \        \        3 F  p \        VR V4      pT P#                  Y[4       \        T Uu. uF  qNK  	  up^^.\*        \         ,          R
7      pT P#                  \5        T4      \5        T4      4       \.        '       g   K  T P#                  TX	P%                  R R7      4       K  	  V\*        8X  d&   \        V^^.\         R
7      p
V
P%                  4       pMVP%                  4       p\        \
        \         \        \        3 F  p \        VRV4      pT P#                  Y[4       \        T Uu. uF  qNK  	  up^^.T\         ,          R
7      pT P#                  \5        T4      \5        T4      4       \.        '       g   K~  T P#                  TX	P%                  RR7      4       K  	  EKJ  	  \        \'        \)        ^4      4      ^^.\         \6        ,          R
7      p\        VR\
        4      pV P#                  WRP%                  4       4       \        V Uu. uF  qNK  	  up^^.\         R
7      pV P#                  \5        V4      \5        V4      4       \        VR \
        4      p\        \3        V^^.4      ^^.\         R
7      p
V P#                  WZP%                  4       4       \        V Uu. uF  qNK  	  up^^.\*        \         ,          R
7      pV P#                  \5        V4      \5        V4      4       \        VR\
        4      pV P#                  WRP%                  4       4       \        V Uu. uF  qNK  	  up^^.\         R
7      pV P#                  \5        V4      \5        V4      4       R	#   \,         d     EKc  i ; i  \,         d     EK  i ; iu upi   \,         d     EK  i ; iu upi   \,         d     EK  i ; iu upi u upi u upi u upi )r\  r   r^  r   r]  rY   r   r   r  Nr  r   )r  r   r  rb  ra  r~   ro  r&   r   r3   r  r   )r  r  r  r  r  r}  r  r  r  r  r  r  rg  rE  r|  r   r  re  r#  r   rc   rw  rs  r  r  r   rJ   r  )rT  r  rL  rb  requestr   r   ndbytesrd   narW   r  r   r  s   &             r:   test_py_buffer_to_contiguous/TestBufferProtocol.test_py_buffer_to_contiguousV  s    M8\++/
 	)%<b#'	) QbK@$E#+Bw?  JJL1 $ % aSC{C$E#+Bw?  C( $ %
 T%(^9S&($E#+Bw?  C( $ % ZA!QC1[=IBjjlG('G/7CA$$Q0  ( )
 1#c;OBjjlG('G/7CA$$Q0  ( ) !  YqcA3kJ**,$E):6+Bw?  , 7 %
 "X**,$E#/7CA   , $ %P 59oZAQF!K-@B{ 	#()1vS./1fs#?
 JIcAq621a&"-/99;::<#/CAA   - N1QN1a&L  A
2?;$$Q


(=> $" AvIcAq621a&"-/ C1v[Ayy{H&~)85/CAA   - N1QN1a&
;@VW  A
2?;$$Q


(=>5" JC1v[A99;::<&~)85/CAA   -
 N1QN1a&+N  A
2?;$$Q


(=>!5w !\ T%)_QF+f:LM $B];JJL)N1QN1a&DA
27 $B];IcAq6*1a&LIIK(N1QN1a&
;8NOA
27 $B];JJL)N1QN1a&DA
27M # l #  +" #  +  #  + # # #sl   _):_<!
`>`%
`'`,(
`?
a'
a	)
a)_98_9<```$#`$,`<;`<c                D	   ^	. 3. RO^.3\        \        ^4      4      . RO3.pV EF  w  r#\        W#R7      p\        V4      pV P	                  VP
                  4       V P	                  VP                  4       \        V4      p\        Wc^R4      p\        W#4      pV P                  WT^RRWcVVR7	       \        V4      p	V P                  W^RRWcVVR7	       \        V\        \        ,          R7      p
V P                  V
P                  R4       V
P                  4       pV P                  VR^RRWcVVR7	       \        V\         R7      p
V P                  V
P"                  R4       V P                  V
P$                  R4       V P                  V
P                  R4       V
P                  4       pV^ 8X  d   V.MTpV P                  VR^RR^VP&                  .RVR7	       EK  	  V F  w  r#\        W#\(        R	7      p\        V4      pV P	                  VP*                  4       V P	                  VP                  4       \        V4      p\        Wc^R
4      p\-        W#4      pV P                  WT^RRWcVVR7	       \        V4      p	V P                  W^RRWcVVR7	       K  	  VR,           F  w  r#\        W#\.        R	7      p\        V4      p\        V4      p\        W#4      pV P                  WT^RRWcVP                  VR7	       \        V4      p	V P                  W^RRWcVP                  VR7	       K  	  V P1                  \2        \        RR4       V P1                  \2        \        / 4       \        . RO^.R7      p\        V\         R7      p
V P1                  \4        \        V
4       \        V\        \        ,          R7      p
V P1                  \4        \        V
4       \        ^.^,          ^.^,          RR7      p
V P1                  \6        \        V
4       V P1                  \6        V
P                  4       V P1                  \6        \8        V
\:        R4       V P1                  \6        \8        V
\:        R
4       V P1                  \6        \8        V
RRR1,          \:        R4       R# )r  r  r   r   Tr  r  Nr<   r  r\  r      9rW   r   r_  r  r)  r~   r   r   )r   rc   r   rJ   rz  r  r  r^   r   r   r  r  r  re  r   r  r  r  r   r!  rw  r  r   r  rg  rE  rs  r   rx  ry  )rT  items_shaperq   r   rj  rD   r   r   rd   r  rL  s   &          r:   test_memoryview_construction/TestBufferProtocol.test_memoryview_constructionF	  s   2w1#eEl1CW0MN (LE ,B2AOOANN+OOALL)u:D(a=G&CKK!"d!  ! ABKK!"d!  ! OL$@ABRZZ,))+AKKt!"d!  ! L1BRYY+RXXr*RZZ,))+A!QY5'ECKKt!"dryyk4  !S (^ (LE :>B2AOOANN+OOALL)u:D(a=G&CKK!"d!  ! ABKK!"d!  !' (2 (OOLE 6:B2Au:D&CKK!"d!

  ! ABKK!"d!

  !! ,, 	)Zs;)Z4WQC(R-+z26R <=+z26 aSWQCGC8*j"5*b&?&?@*nb*cJ*nb*cJ*nb2h
CPrY   c                   . ROp. RO. RO. RO3 FV  p\        WR7      pV P                  VP                  4       \        V4      pV P	                  \
        VP                  R4       KX  	  \        ^R4       Fc  w  p p\        R4      pVP                  V4      pV P                  VP                  4       R4       V P                  VP                  4       . 4       Ke  	  R# )	r   r  r   rJ   rY   Nr  ry  rz  )r   rz  r  rJ   rg  rE  rX  r|   re  r#  rD  )rT  rq   r   rj  msrcr7   ro   rD   s   &       r:   test_memoryview_cast_zero_shape2TestBufferProtocol.test_memoryview_cast_zero_shape	  s    
 w0E,BOOBOO,b>DiC8	 1 %Q5ICAc?D		#AQYY[#.QXXZ,	 6rY   c                   V P                   p\        P                  pR pRp\        \	        ^4      4      pV! \        R4      V! V^V,          ,           4      4       \        V^^.RR7      pV! \        V4      V! V^V,          ,           4      4       \        V. RORR7      pV! \        V4      V! V^V,          ,           4      4       R# )zPnin 2P2n2i5P P3nrY   r   r_  N)r&   r&   r&   )check_sizeofr   calcvobjsizer   rc   rJ   r   )rT  checkvsizebase_structper_dimrq   rF   s   &      r:   test_memoryview_sizeof)TestBufferProtocol.test_memoryview_sizeof	  s    !!$$'U1Xjou[1w;%>?@E!Q4jmU;W#<=>E37jmU;W#<=>rY   c                    ! R  R\         4      p ! R R\         4      pR pV! ^	4      V! ^	4      R\        R4      R\        ^^4      . RO0 Rm^^/RRRRR	\        R
R\	        R
4      \	        R4      RRRRVR .p\        ^
R4       EF  w  rVp\        V^
.V\        R7      p\        V^
.V\        R7      p	\        V4      p
\        P                  ! WY^ V4       Wz^ &   V P                  V
^ ,          V	^ ,          4       \        P                  ! V4      pRV9   d   K  V Fz  pR	p \        P                  ! WYW4       R	p W^&   V'       g	   V'       d'   V P#                  VR	4       V P#                  VR	4       KZ  V P                  V
^,          V	^,          4       K|  	  EK  	  R	#   \        P                   d    \        P                  p Li ; i  \        \        3 d   pTP                   p R	p?LR	p?ii ; i)c                   ,   a  ] tR tRt o R tR tRtV tR# )=TestBufferProtocol.test_memoryview_struct_module.<locals>.INTi	  c                    Wn         R # r   valrT  r  s   &&r:   __init__FTestBufferProtocol.test_memoryview_struct_module.<locals>.INT.__init__	      rY   c                    V P                   # r   r  rS  s   &r:   __int__ETestBufferProtocol.test_memoryview_struct_module.<locals>.INT.__int__	      xxrY   r  N)__name__
__module____qualname____firstlineno__r  r  __static_attributes____classdictcell____classdict__s   @r:   INTr  	          rY   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )=TestBufferProtocol.test_memoryview_struct_module.<locals>.IDXi	  c                    Wn         R # r   r  r  s   &&r:   r  FTestBufferProtocol.test_memoryview_struct_module.<locals>.IDX.__init__	  r  rY   c                    V P                   # r   r  rS  s   &r:   	__index__GTestBufferProtocol.test_memoryview_struct_module.<locals>.IDX.__index__	  r  rY   r  N)r  r  r  r  r  r  r  r  r  s   @r:   IDXr  	  r  rY   r  c                      ^# )r3   r~   r~   rY   r:   r   ;TestBufferProtocol.test_memoryview_struct_module.<locals>.f	  s    rY   z-21.1gffffff(@TFN   a   abcrF   abcc                     V # r   r~   )rW   s   &r:   <lambda>BTestBufferProtocol.test_memoryview_struct_module.<locals>.<lambda>	  s    qrY   rJ   r^  r   y@      @r  >   r  r  r  r~   )r  )objectr
   r   Ellipsisr  r|   r   r  rJ   r4   r  re  r  r6   rE  r   rA  assertIsNot)rT  r  r  r   valuesr7   rq   rr   rj  rL  rD   r   r   
struct_errmv_errr   s   &               r:   test_memoryview_struct_module0TestBufferProtocol.test_memoryview_struct_module	  s   	 & 	 	 & 	  	a&#a&''*D(1a.7QqE2ttX	$61BudF[" !,B =Crd3kJBrd3kJB2ASa.aDQqT2a5)s+Hcz!
.$$Sh: )aD $$Z6$$VT2$$QqT2a51#  !>" || .!'J. ":. )[[F)s*   "F!<G!%G	G	G3G..G3c                    \        . RO^.^ .R7      pV P                  VP                  4       \        V4      pV P	                  \
        VP                  R4       R# )r   r  r   Nr  )r   rc  r  rJ   rg  rE  rX  )rT  rj  r  s   &  r:   !test_memoryview_cast_zero_strides4TestBufferProtocol.test_memoryview_cast_zero_strides
  sG     WQC!5)"~)TYY4rY   c           	        \          F  p\        ^4      '       d
   RV,           MTp\        P                  ! V4      p\          F  p\        ^4      '       d
   RV,           MTp\        P                  ! V4      p\	        \        \        ^ 4      4      ^ V,          .VR7      p\        V4      pV P                  \        VP                  V^ V,          .4       K  	  K  	  \        ^4       F  w  rp
\	        V	^.VR7      p\        V4      p\        ^4       F  w  p p
\        V4      '       g-   V P                  \        VP                  V^ X,          .4       KD  \        V4      '       d   KW  \        V4      '       d   Kj  V P                  \        VP                  V^ X,          .4       K  	  K  	  \        P                  ! R4      p\        P                  ! R4      p\	        \        \        ^V,          4      4      ^^V.RR7      p\        V4      pV P                  \        VP                  ^^V.RR7       \	        \        \        ^x4      4      . ROR7      p\        V4      pV P                  \        VP                  4       V P                  \        VP                  ^^^4       V P                  \        VP                  / 4       V P                  \        VP                  R4       V P                  \        VP                  R4       V P                  \        VP                  R4       V P                  \        VP                  R	4       V P                  \        VP                  R
4       V P                  \        VP                  R4       V P                  \        VP                  R4       V P                  \        VP                  R4       V P                  \        VP                  R4       \	        RR.^.RR7      p\        V4      pV P                  \        VP                   ^ 4       V P                  \        VP"                  ^ ^4       V P                  \        VP$                  4       \	        \        \        ^x4      4      . ROR7      p\        V4      pV P                  \        VP                  R/ R7       \	        \        \        ^x4      4      ^x.R7      p\        V4      pV P                  \&        VP                  RR.R7       V P                  \        VP                  RR.R7       V P                  \        VP                  R. ROR7       V P                  \        VP                  R. ROR7       V P                  \        VP                  R. ROR7       \	        \        \        R4       U
u. uF  p
^	NK  	  up
4      . ROR7      p\        V4      pV P                  \        VP                  R. ROR7       \	        \        \        ^4      4      ^.RR7      p\        V4      pV P                  \        VP                  R^.^,          4       \	        \        \        R4       U
u. uF  p
^	NK  	  up
4      R.R7      p\        V4      pV P                  \        VP                  R. ROR7       \	        \        \        R4       U
u. uF  p
^	NK  	  up
4      R.R7      p\        V4      pV P                  \        VP                  R. ROR7       \	        \        \        ^4      4      ^.RR7      p\        V4      p\	        \        \        ^4      4      ^.RR7      p\        V4      p\(        P*                  R8X  do   V P                  \        VP                  R. R O4       V P                  \        VP                  R. R!O4       V P                  \        VP                  R. R"O4       R# V P                  \        VP                  R^R.4       V P                  \        VP                  R. R#O4       V P                  \        VP                  R. R$O4       R# u up
i u up
i u up
i )%r&   r=   r_  r   r   r  Xz@Xz@XYz=Bz!Lz<Pz>lBIxBIIIr   r   Nr  r  r  r  r   )r&   r  r  r  r  r3   r   )r&   r  r  r  r  r3   r   )r&   r  r  r  r  r3   rW   i  )r  r  r3   r  )r&   r  r  r  l    )r3   r3   I   r+   iQ  iAj i	 )   r     r  r2   )r  r  r  r  r&   )r  r  r.   r.   r&   )r  r  r.   r2   r&   )NON_BYTE_FORMATr   r4   r  r   r   rc   rJ   rg  rE  rX  r|   r   r   r   rF  r  r  rD  r  rI  maxsize)rT  sfmtsformatssizedfmtdformatdsizerj  r  sitemsro   size_hsize_drD   rL  r  r  s   &                r:   test_memoryview_cast_invalid/TestBufferProtocol.test_memoryview_cast_invalid
  s[   #D$-aLLcDjdGOOG,E'(1!#*$0T%)_RYKP!"~!!)TYYr5ykJ ( $  +1~OD!s48Bb>D)!n
a+D11%%j$))T')5yk3 *$//t8L8L)))TYY+-u9+7 -  . %%T%F
+,QqLM"~)TYYq6l3OT%*%[9rN 	)QVV,)QVVQ15 	)QVVR0 	*affc2*affd3*affe4 	*affd3*affd3*affd3*affd3*affd3*affe4 eU^A3t<rN-q}}a@-q}}aC-qxx8 T%*%[9rN)QVVS; T%*%gY7rN-UGD*affc">*affc9IJ*affcI)QVVS8IJ TeHo6o1o67zJrN)QVVS	B T%*%cU3?rN*affcA3s7; TeHo6o1o67zJrN)QVVS	B TeHo6o1o67zJrN)QVVS	B T%*%cU3?^T%*%cU3?^;;'!i#ACj"''3@Bj"''3@B i# *o/j"''3>@j"''3>@I 7 7
 7s   5a,a#a(c                  a a R R 3RR 3RR 33oVV 3R lp\         P                  ! R4      p\        ^	. RR7      p\        VR ^4      w  rE\	        V4      pVP                  R 4      pS P                  Ws^R R	^VRVR	R
7
       \         P                  ! R4      p\        ^	.V,          V.R R7      p\        VRV. R7      w  rE\	        V4      pVP                  R. R7      pS P                  WsVRR	^ RRVR	R
7
       \        ^R4       F0  w  rp\        P                  ! W4      p\	        V4      pV! W6W4       K2  	  \        ^R4       F.  w  rp\        V
^.V	\        R7      p\	        V4      pV! W6W4       K0  	  R# )r   c                 4    \        V P                  4       4      # r   r   r#  )rj  s   &r:   r  9TestBufferProtocol.test_memoryview_cast.<locals>.<lambda>
  s    4

-rY   r   c                 |    \        V P                  4       4       Uu. uF  q^8  d
   VR,
          MTNK  	  up# u upi )r+   r$   r   rj  rW   s   & r:   r  r  
  s0    T"**,=OP=OWAcE!3=OPPs   9r   c                     \        V P                  4       4       Uu. uF  p\        \        V4      R 4      NK  	  up# u upi )zlatin-1)r   r#  rQ   chrr  s   & r:   r  r  
  s.    d2::<>PQ>PE#a&)4>PQQs   =c                 Z  < \         P                  ! V4      pS
 F  w  rVVP                  V4      pV! V 4      pSP                  Wp^VR^^V,          .RVRR7
       VP                  V4      p	SP	                  W4       V P                  4       pSP                  WWCR^^.V3VRR7
       K  	  R# )r   FT	rV   r   r7   rf  r   r   r   rd   rX  Nr  )r4   r  rX  r  re  rD  )rj  rD   rq   r7   srcsizerK   to_bytelistr  rd   m3bytespecrT  s   &&&&      r:   iter_roundtrip?TestBufferProtocol.test_memoryview_cast.<locals>.iter_roundtrip
  s    ooc*G(0$VVG_!"oB%&Ge!"2g:, #$  0
 WWS\  (iikB%,!"2$
 #$  0 )1rY   r   r_  Tr  r  rH   rJ   r^  Nr  r~   )
r4   r  r   r(  rJ   rX  r  r|   rH   r  )rT  r  r  rj  	destitems	destshaperD   r  destsizer7   rq   ro   r  s   f           @r:   test_memoryview_cast'TestBufferProtocol.test_memoryview_cast
  s   -
.P
QQ
R
	0( //#&Qb-)"c15	rNVVC[BC$)T! 	 	. ??3'aS\(C@)"c82F	rNVVCrV"B%3"b! 	 	. )W5MCS(B2A2%- 6 )\:MCrd3kJB2A2%- ;rY   c                >   \        4        EF  p\        R ,           EF  pVR8X  d   K  R\        ^4      ,          V,           p\        P                  ! V4      p\        V4      V,          p\        V4      '       d   RMRp\        WV4       EFg  w  rxp	\        P                  ! V4      p
V^ 8  d   V.M. pW.,           p\        WVR7      p\        V4      p\        WWLR7      w  rVf$   V P                  \        VP                  W<4       K  VR8X  d   K  \        WVR7      pVP                  W<R7      p\        V4      pVP                  pVP!                  4       pV P#                  VVWCRVVVVRR	7
       VP                  V4      pVP                  W{R7      p\        V4      pVP                  pVP!                  4       pV P#                  VVWRVVVVRR	7
       V P#                  VVWRVVVVRR	7
       EKj  	  EK  	  EK  	  \$        '       Ed    ! R
 R\$        P&                  4      pV! ^dR4      p\        V4      pVP                  R4      pV P)                  VP*                  V4       V P)                  VP,                  ^4       V P/                  VP0                  R4       V P)                  VP2                  ^4       V P)                  VP4                  VP6                  34       V P)                  VP                  R4       V P)                  VP8                  R4       \$        P:                  ! R4      p\        V4      pVP                  R4      pV P)                  VP*                  V4       V P)                  VP,                  ^4       V P/                  VP0                  R4       V P)                  VP2                  ^4       V P)                  VP4                  VP6                  34       V P)                  VP                  R4       V P)                  VP8                  R4       R# R# )r=   r   rJ   rK   r_  r  Nr   Tr  c                   N    ] tR tRtR]P
                  3R]P                  3.tRtR# )>TestBufferProtocol.test_memoryview_cast_1D_ND.<locals>.BEPointi	  rW   r  r~   N)	r  r  r  r  ctypesc_longc_double_fields_r  r~   rY   r:   BEPointr  	  s     &--032HIrY   r  g33333i@r   F333333?r   )r<   r=   r  r~   )r*  rP   r   r4   r  r   r   r|   r   rJ   r(  rg  rE  rX  r^   r   rD  r  r  BigEndianStructurere  rV   r   rd  rf  r   r   r!  rH  r  )rT  _tshaperU   tfmttsizer   rV   r7   rq   ro   sizer   tshaperj  rD   titemsrL  r  r   r   rd   r
  m4r  pointr  rW   s   &                          r:   test_memoryview_cast_1D_ND-TestBufferProtocol.test_memoryview_cast_1D_ND
  se    %G 3; 1.5-ME)&4T&:&:l	%0%8MC!??3/D#$q5QCbE$v-F C@B"2A%/%%NNF~)))QVVTJ   !dCB3Bv;D jjG))+CKK).4%)$'d   4 B2Bu:D jjG))+CKK)-%)$'d   4
 KK)-%)$'d   4Q &9 % 'n 6J&33 JC'EE"BBRVVU+R[[!,MM"++u-RWWa(RXX		|4RZZ.R]]B/$AABBRVVQ'R[[!,MM"++u-RWWa(RXX		|4RZZ.R]]B/1 rY   c           	        \         P                   ! R \        \        R^4      4      4      p\        V4      pV P	                  W!4       V P	                  VP                  4       VP                  4       4       VR,          pVR,          pV P	                  W!4       V P	                  VP                  4       VP                  4       4       \        \        \        R	4      4      . R
ORR7      p\        V4      pV P	                  VP                  4       VP                  4       4       \        RR.^.RR7      p\        V4      pV P                  \        VP
                  4       \        R.^.RR7      p\        V4      pV P                  \        VP
                  4       \        . RO^^.RR7      p\        V4      pV P                  \        VP
                  4       R# )r   :r&   Nr  r   r_  r8      12345r   Nr  i	  )r  r&   r3   r  r  )r&   r  )r3   r  )r     b   c   d   e   f)	rH   r   rc   rJ   re  rD  r   rg  rF  )rT  rF   rD   rj  s   &   r:   test_memoryview_tolist)TestBufferProtocol.test_memoryview_tolist!  s_    KKT%A,/0qMQXXZ0dGdGQXXZ0T%
+,LMrNRYY[1fg&qc$?rN-qxx8hZs37rN-qxx84QqE#NrN-qxx8rY   c                    \        \        ^	4      4      pVP                  4       pV P                  VR4       VP	                  4        VP                  4       pV P                  VR4       R# )r  z<memoryz	<releasedN)rJ   r  __repr__assertStartsWithr  )rT  rD   r   s   &  r:   test_memoryview_repr'TestBufferProtocol.test_memoryview_repr?  sO    y|$JJLa+			JJLa-rY   c                ^   R	 Fi  p\        R4      p\        P                  ! VRVR.4      p\        V4      pV P                  RV4       V P                  RV4       V P                  RV4       Kk  	  \	        R. RR7      p\        V4      pV P                  \        \        R\        4       4       R# )
r   r   g            ?g      @g      "@r  z9.0 in mN)r   r   )	floatrH   rJ   assertInr   rg  rE  r.  r/  )rT  r7   infrj  rD   s   &    r:   test_memoryview_sequence+TestBufferProtocol.test_memoryview_sequenceH  s    C,CS3S/2B2AMM#q!MM%#MM#q!  S"S)rN)T:vx@rY   c              #     "   V P                  \        4      ;_uu_ 4       pR x  R R R 4       V P                  \        XP                  4      RV3,          4       R #   + '       g   i     L?; i5i)Nz#index out of bounds on dimension %d)rg  r  re  str	exception)rT  dimcms   && r:   assert_out_of_bounds_error-TestBufferProtocol.assert_out_of_bounds_errorV  sL     z**b +R\\*>#G	I +*s   A/A7A/A,	'A/c                D   \        R . RR7      p\        V4      pV P                  VR
,          R 4       V P                  VR,          V4       V P                  VR,          V4       V P                  \        VP
                  ^ 4       \        R. RR7      p\        V4      pV P                  \        VP
                  R
4       \        \        \        ^4      4      ^.\        R7      p\        V4      pV P                  \        VP
                  R4       V P                  \        VP
                  R4       V P                  \        VP
                  R4       V P                  \        VP
                  R4       V P                  \        VP
                  ^4       \        \        \        ^4      4      ^^.\        R7      p\        V4      pV P                  VR,          ^ 4       V P                  VR,          ^4       V P                  VR,          ^4       V P                  VR,          ^4       V P                  VR,          ^ 4       R F0  pV P                  ^R7      ;_uu_ 4        W#^ 3,           R	R	R	4       K2  	  R F1  pV P                  ^R7      ;_uu_ 4        V^ V3,           R	R	R	4       K3  	  V P                  \        VP
                  R4       V P                  \        VP
                  R4       V P                  \        VP
                  R4       V P                  \        VP
                  R4       V P                  \        VP
                  R
4       V P                  \        VP
                  ^ 4       R	#   + '       g   i     EKE  ; i  + '       g   i     EK$  ; i)      )@r   r_  .iiir         @        r?  Nr~   r  r  r   r   )r&   r   r  r   r   )r  r  r  r  r  r   r  r   r   r  r   r   r   rG  rG  )r   rJ   re  rg  rE  r  rF  r   rc   r  r  rA  )rT  rj  rD   indexs   &   r:   test_memoryview_index(TestBufferProtocol.test_memoryview_index]  s    TC0rN2%3#3$)Q]]A6WBu5rN-q}}bA T%(^A3kBrN*ammU;)Q]]C8)Q]]C8 	*ammR8*ammQ7 T%)_QqEErN4!$4!$4"%6B'6A& E00Q077( 87  E00Q077!U( 87  	*ammZ@*ammZ@)Q]]I>)Q]]J? 	-q}}bA-q}}a@ 877 877s   "M8N8N
Nc                   \        R . R\        R7      p\        V4      pRVR&   V P                  VR,          R4       RVR&   V P                  VR,          R4       V P	                  \
        VP                  ^ R4       \        \        \        ^4      4      ^.R7      p\        V4      pV P	                  \
        VP                  ^^
4       \        \        \        ^4      4      ^.\        R7      p\        V4      pV P	                  \        VP                  R^	4       V P	                  \
        VP                  R	^
4       V P	                  \
        VP                  R
^4       V P	                  \        VP                  R^4       V P	                  \        VP                  ^^4       \        R,           Fz  pVR8X  g   VR8X  d   K  \        . RO^.V\        R7      p\        V4      p\        R^4      p^W$&   V P                  W$,          ^4       V P                  W$,          W,          4       K|  	  \        . R O^.R\        R7      p\        V4      pRV^&   V P                  V^,          R4       \        . R!O^.R\        R7      p\        V4      pRV^&   V P                  V^,          R4       \        R.^.R\        R7      p\        V4      pV P	                  \
        VP                  ^ ^d4       \        \        \        ^x4      4      . R"O\        R7      p\        V4      p\        R,          P                  4        F  w  r7VR8X  d   K  VR8X  d   K  VP                  V4      pVw  rVR8X  g   VR8X  d   ^R,          ) ^R,          rVR8w  dL   V P	                  \        VP                  ^ V	^,
          4       V P	                  \
        VP                  ^ R4       V P	                  \        VP                  ^ V
4       K  	  VP                  R4      pV P	                  \        VP                  ^ R4       \        \        \        ^4      4      ^.R\        R7      p\        V4      pV P	                  \         VP                  ^ ^4       \        R.^.R\        R7      p\        V4      pV P	                  \         VP                  ^ ^4       \        \        \        ^4      4      ^^.\        R7      p\        V4      p^*VR#&   V P                  V^ ,          ^,          ^*4       ^+VR$&   V P                  V^,          ^,          ^+4       R% F,  pV P#                  ^R7      ;_uu_ 4        ^ W+^ 3&   RRR4       K.  	  R& F-  pV P#                  ^R7      ;_uu_ 4        ^ V^ V3&   RRR4       K/  	  V P	                  \        VP                  R'^ 4       V P	                  \        VP                  R(^ 4       V P	                  \
        VP                  R)^ 4       V P	                  \
        VP                  R*^ 4       V P	                  \         VP                  ^ ^^.4       R#   + '       g   i     EK#  ; i  + '       g   i     EK  ; i)+rD  r   r^  g     6@g     7@.g333338@r  r  rF  rG  r=   r   r   r  T   xr   r  r   r  s   xLr(  r   rH  Nr~   r  rI  r  r  )   1   2   3)TFTr  )r   r   rK  rL  rM  rN  rO  rP  rQ  )r   r  rJ   re  rg  rE  r  r   rc   r  rP   r   rd  rq   rX  r   rF  rA  )rT  rj  rD   r7   r   rL  r  _ranger  lohirR  s   &           r:   test_memoryview_assign)TestBufferProtocol.test_memoryview_assign  s=    TC{CrN"2%#2%)Q]]At< T%(^A3/rN)Q]]Ar: T%(^A3kBrN*ammUA>)Q]]C<)Q]]C< 	*ammR<*ammQ; 3<<CczSCZC{KB2A"a AADQT1%QT25)   's3&(rN!1t$(C&(rN!adD! dVA3s+FrN)Q]]As;T%*%[L^"3<--/KCs
czBFBczSCZT'1d7Bcz!!*bnnaAF!!)R^^QFj"..!R@ 0 WWS\*bnnaE T%(^A3t;OrN-q}}aChZs3kJrN-q}}aC T%)_QqEErN#Aq2&%Aq2&E00Q077( 87  E00Q077!U( 87  	*ammZC*ammZC)Q]]IqA)Q]]JB 	-q}}a!QH 877 877s   !YY*Y'*Y<c           
        \        \        \        ^4      4      ^.\        R7      p\	        V4      pV P                  \        VP                  \        ^ ^^ 4      4       V P                  \        VP                  \        ^ ^^ 4      \        ^^.4      4       V P                  \        VP                  R
4       \        \        \        ^4      4      ^.\        R7      p\	        V4      pV P                  \        VP                  \        ^ ^^4      \        ^ ^^4      34       V P                  \        VP                  \        ^ ^^4      \        ^ ^^4      3\        ^^.4      4       V P                  \        VP                  \        ^ ^^4      / 34       V P                  \        VP                  \        ^ ^^4      / 3\        ^^.4      4       V P                  \        VP                  \        ^ ^^4      ^.4       ^ \        3 EFd  p\        \        \        ^4      4      ^.R.^\        V,          R7      p\        \        \        ^4      4      ^.^.VR7      p\	        V4      p\	        V4      pVR,          VR&   VR,          VR&   V P                  Wd4       V P                  Wu4       VR,          R,          VR,          RRR1&   VR,          R,          VR,          RRR1&   V P                  Wd4       V P                  Wu4       VR	,          R,          V^^R1,          RRR1&   VR	,          R,          V^^R1,          RRR1&   V P                  Wd4       V P                  Wu4       EKg  	  R# )r  r  )r   r   r   r  r  :r&   r  N:r   r&   N:NNr   r   r  NN:r   r  r&   r~   r   r  )r   r   rc   r  rJ   rg  r   r  r   r  r  rF  rE  r  re  )rT  rj  rD   r  r  r  r  r  s   &       r:   test_memoryview_slice(TestBufferProtocol.test_memoryview_slice  s   T%)_RDDrN 	*ammU1Qq\B*ammU1Qq\#QqE*	, 	-q}}bA T%)_RDDrN-q}} 1Q<q16	8-q}} 1Q<q16	1Q%8H	J 	)Q]]U1Qq\24FG)Q]]U1Qq\24F#QqE*	, 	)Q]]E!AaL1#F [E$uRy/"tB +E 13C$uRy/"s%PCCBCB3xCHgBsGR%R% Xc]CHTrTNsGCLBsGDbDMR%R% #E
3C!BK"!%y~Bq2vJttR%R%/ !rY   c                   R  p\        ^^4       EF  p\        VR4       EF  w  r4p\        V4       EF  p\        V4       EF  p\        P                  ! W44      p\        P                  ! W44      p	\	        V	4      p
V P                  W4       V P                  V
P                  4       VP                  4       4       V P                  V
P                  4       VP                  4       4       V P                  \        V
4      \        V4      4       V! WWV4       RpRp W,          pW,          pW,          W&   \        V4      \        V4      8g  pRp W,          W&   V'       d   V P                  V\        4       EK:  V'       g	   V'       d   V P                  VV4       EK_  V P                  W4       V P                  V
P                  4       VP                  4       4       V P                  V
P                  4       VP                  4       4       V! WWV4       EK  	  EK  	  EK  	  EK  	  R#   \         d   pTP                  p Rp?LRp?ii ; i  \         d   pTP                  p Rp?ELRp?ii ; i)c                 j   \        V4       F  w  rVW,          pW5,          pV P                  Wx4       WAV&   WG8w  d$   V P                  W4       V P                  W4       M"V P                  W4       V P                  W4       WCV&   V P                  W4       V P                  W#4       WqV&   WV&   K  	  R # r   )r  re  assertNotEqual)	testcaserF   r   rD   
singleitemr   ro   aimis	   &&&&&    r:   cmptest9TestBufferProtocol.test_memoryview_array.<locals>.cmptest9  s    !!TT$$R,!!#++A1++A1((.((.!!$$Q*$$Q*!! %rY   rH   N)rc   r|   r,  rH   rJ   re  rD  r#  r^   r@  rA  rd  r   )rT  rk  r   r7   rq   rh  rL  r2  rF   r   rD   	array_errhave_resizealarr   m_errs   &                r:   test_memoryview_array(TestBufferProtocol.test_memoryview_array7  s   	$ q!A*5a*A&J'lF"+A,!KK3!KK3&qM((.((QXXZ@((aiikB((QQ8z:$(	&*4!"B!"B()	AI*-b'SW*<K !%0()	AI ' MM%<"i MM%; ,,Q2 ,,QXXZD ,,QYY[!))+F#DQ:>K #/ + +B .  ) 4()I4  ) 0$%KKE0s0   1H-
I-I8I		II3I..I3c                X   \         P                   ! R . RO4      p\         P                   ! R . RO4      p\        V4      p\        V4      pR	 FM  pV P                  \        W54      ! V4      \        4       V P                  \        W4      ! V4      \        4       KO  	  \        V4      pVP                  4        V P                  W34       V P                  W14       V P                  W4       \        V4      p\        V4      pVP                  4        V P                  W44       V P                  WC4       \        V4      pV P                  V. RO4       \        R
.^.R\        R7      pR\        R4      3V^ &   V P                  \        V4      V4       \        '       d    ! R R\        P                  4      pV! ^d^4      p\        V4      p\        V4      pV P                  W4       V P                  W4       V P                  W4       V P                  \        VP                  4       R# R# )r   zl x d xr^  r   c                   N    ] tR tRtR]P
                  3R]P
                  3.tRtR# )ITestBufferProtocol.test_memoryview_compare_special_cases.<locals>.BEPointi  rW   r  r~   Nr  r  r  r  r  r  r  r  r~   rY   r:   r  rv         &--032FGrY   r  Nr  )r   r&   r3   )__lt____le____gt____ge__rJ  r   )rH   rJ   rd  getattrr   r  re  rf  r   r  r7  r  r  rg  rF  rD  )	rT  rF   r   r   wattrrL  r  r$  s	   &        r:   %test_memoryview_compare_special_cases8TestBufferProtocol.test_memoryview_compare_special_casesu  s   KKY'KKY' qMqM<DMM'!*1-~>MM'!*1-~> =
 qM			A!A!qMqM			A!A! qMAy) fXaS+NU5\"1JrNB/ 6H&33 HC%E5!A5!A%))1188< rY   )categoryc                    \         P                   ! R R4      p\        V4      pV P                  W4       V P                  W!4       R# )ur  N)rH   rJ   rf  )rT  rF   r   s   &  r:   <test_memoryview_compare_special_cases_deprecated_u_type_codeOTestBufferProtocol.test_memoryview_compare_special_cases_deprecated_u_type_code  s9     KKU#qMA!A!rY   c                   \        R . RR7      p\        R . R\        R7      p\        V4      p\        V4      pV P                  W44       V P                  WC4       V P                  W24       V P                  W#4       V P                  WA4       V P                  W4       V P	                  VP                  V4      4       V P	                  VP                  V4      4       RVR
&   V P                  W44       V P                  WC4       V P                  W24       V P                  W#4       V P                  WA4       V P                  W4       V P	                  VP                  V4      4       V P	                  VP                  V4      4       \        \        \        ^4      4      ^.\        \        ,          R7      p\        \        \        ^4      4      ^.\        \        ,          R7      p\        V4      pV P                  Wu4       ^dV^	&   V P                  Wu4       \        R. RR7      p\        R. R\        R7      p\        V4      p\        V4      pV P                  W44       V P                  WC4       V P                  W24       V P                  W#4       V P                  WA4       V P                  W4       \        R. RR7      p\        R. R\        R7      p\        V4      p\        V4      pV P                  W44       V P                  WC4       V P                  W24       V P                  W#4       V P                  WA4       V P                  W4       V P                  W14       V P                  WB4       R	# )  @Lr_  r   r^  i  r  Lf5shf5sNr~   )r  r  r(  )i?r  r(  )r   r  rJ   re  rc  __ne__rf  r  r   rc   r  )rT  nd1nd2r   r~  rL  rj  rD   s   &       r:   !test_memoryview_compare_ndim_zero4TestBufferProtocol.test_memoryview_compare_ndim_zero  s   d"T2d"SDsOsO    !%!%"A!A!A#C#A#C#!%!%T%)_RDF8JKT%)_RDF8JKrN!A" +2fE+2f')sOsO     +2fE,Bv')sOsOA!A!A#C#A#C#  rY   c                   \        . RO^.RR7      p\        . RO^.RR7      p\        V4      p\        V4      pV P                  W14       V P                  WB4       V P                  W24       V P                  WA4       V P                  W44       \        . RO^.RR7      p\        . RO^.RR7      p\        V4      p\        V4      pV P                  W14       V P                  WB4       V P                  W24       V P                  WA4       V P                  W44       \        . RO^.RR7      p\        . RO^.RR7      p\        V4      p\        V4      pV P                  W2R,          4       V P                  VR,          V4       V P                  W4R,          4       V P                  VRRR1,          VRRR1,          4       \        . RO^.RR7      p\        . RO^.RR7      p\        V4      p\        V4      pV P                  W2R,          4       V P                  VR,          V4       V P                  W4R,          4       V P                  VRRR1,          VRRR1,          4       \        . RO^.RR7      p\        . RO^.R\        R	7      p\        V4      p\        V4      pV P                  W2R,          4       V P                  VR,          V4       V P                  W4R,          4       V P                  VRRR1,          VRRR1,          4       \        . RO^.R
R7      p\        . RO^.R\        R	7      p\        V4      p\        V4      pV P                  W2R,          4       V P                  VR,          V4       V P                  W4R,          4       V P                  VRRR1,          VRRR1,          4       R# )  @hr_  z<iz>hNNr&   Nz!hz<lr^  zh  0cz>  h@    ')r  r  r  r  i  )r  r  r  r   r  )r   rJ   re  rf  r  rT  r  r  r   r~  s   &    r:    test_memoryview_compare_ndim_one3TestBufferProtocol.test_memoryview_compare_ndim_one  s<    21#dK1!TJsOsO  A#A#A! 21#dK1!TJsOsO  A#A#A! (DA21#dKsOsOH%3%cF#4R4!DbD'* (DA21#dKsOsOH%3%cF#4R4!DbD'* (DA21#d"$sOsOH%3%cF#4R4!DbD'* (GD21#f"$sOsOH%3%cF#4R4!DbD'*rY   c                :   \        R R.^ .RR7      p\        RR.^ .RR7      p\        V4      p\        V4      pV P                  W14       V P                  WB4       V P                  W24       V P                  WA4       V P                  W44       \        R R.^ .RR7      p\        RR.^ .RR7      p\        V4      p\        V4      pV P                  W14       V P                  WB4       V P                  W24       V P                  WA4       V P                  W44       R# )	  r  r  r_  z= h0cz@   iNi|i?r   rJ   re  r  s   &    r:   "test_memoryview_compare_zero_shape5TestBufferProtocol.test_memoryview_compare_zero_shape4  s    sCjD9tTl1#d;sOsO     sCjG<tTl1#g>sOsO    rY   c                J   \        . RO^.RR7      p\        R .^.^ .RR7      p\        V4      p\        V4      pV P                  W14       V P                  WB4       V P                  W24       V P                  WA4       V P                  W44       \        R	.^,          ^.RR7      p\        R	.^.^ .RR7      p\        V4      p\        V4      pV P                  W14       V P                  WB4       V P                  W24       V P                  WA4       V P                  W44       R# )
r  r  r_  r   r  z@ Liz!L  hN)r  r  r  r  )r  r  r  r  s   &    r:   $test_memoryview_compare_zero_strides7TestBufferProtocol.test_memoryview_compare_zero_stridesN  s	    *1#dCseA3C@sOsO     zl1nQC?zl1#s7KsOsO    rY   c           	        ^
p\         R,           Fu  p\        VRRV4      w  r4p^ \        3 FU  p\        WA.W6R7      p\	        V4      pV P                  W4       VRRR1,          p\	        V4      pV P                  W4       KW  	  Kw  	  ^
p\        ^d4       Fr  p	\        V4      w  r4p^ \        3 FU  p\        WA.W6R7      p\	        V4      pV P                  W4       VRRR1,          p\	        V4      pV P                  W4       KW  	  Kt  	  R# )r  rE   rJ   r=   r^  Nr  )rP   ru   r  r   rJ   re  rc   )
rT  r   rU   r7   rq   rh  r  rL  rD   ro   s
   &         r:   &test_memoryview_compare_random_formats9TestBufferProtocol.test_memoryview_compare_random_formatsh  s     DMMD%.q,T%J"C
VU#cGrN  '"XrN  ' % " sA%.q\"C
VU#cGrN  '"XrN  ' % rY   c                   \        \        \        R
^4      4      . RORR7      p\        \        \        ^ ^4      4      . RORR7      p\        V4      p\        V4      pV P	                  W14       V P	                  WB4       V P                  W24       V P                  WA4       V P                  W44       \        R.^,          . RORR7      p\        R.^,          . RORR7      p\        V4      p\        V4      pV P	                  W14       V P	                  WB4       V P                  W24       V P                  WA4       V P                  W44       \        \        \        ^4      4      . RORR7      p\        \        \        ^4      4      . RORR7      p\        V4      p\        V4      pV P	                  W14       V P	                  WB4       V P                  W24       V P                  WA4       V P                  W44       \        R.^,          ^^.RR7      p\        R.^,          ^^.RR7      p\        V4      p\        V4      pV P	                  W14       V P	                  WB4       V P                  W24       V P                  WA4       V P                  W44       \        \        \        ^4      4      . RORR7      p\        \        \        ^4      4      . RORR7      p\        V4      p\        V4      pV P	                  W14       V P	                  WB4       V P	                  W24       V P	                  WA4       V P	                  W44       R	# )r1   r  r_  z=f q xxLz< f 2Qr   z! b B xLz
= Qx l xxLr   Nr  r&   r  r   r   r&   )g333333r   r&   r)  r   r   rc   rJ   re  rf  r  s   &    r:   "test_memoryview_compare_multidim_c5TestBufferProtocol.test_memoryview_compare_multidim_c  s    d5b>*)DId5B<(	$GsOsO  A#A#A! yk"nIjI|nR'yJsOsO  A#A#A! d59oYsCd59oYsCsOsO  A#A#A! yk"nQF:Fyk"nQF<HsOsO  A#A#A! d59oYsCd59oYsCsOsO    rY   c                $   \        \        \        R	^4      4      . R
OR\        R7      p\        \        \        ^ ^4      4      . R
OR\        R7      p\	        V4      p\	        V4      pV P                  W14       V P                  WB4       V P                  W24       V P                  WA4       V P                  W44       \        R.^,          ^^.R\        R7      p\        R.^,          ^^.R\        R7      p\	        V4      p\	        V4      pV P                  W14       V P                  WB4       V P                  W24       V P                  WA4       V P                  W44       \        \        \        R	^4      4      . ROR\        R7      p\        \        \        R	^4      4      . ROR\        R7      p\	        V4      p\	        V4      pV P                  W14       V P                  WB4       V P                  W24       V P                  WA4       V P                  W44       \        \        \        R	^4      4      . ROR\        R7      p\        \        \        R	^4      4      . ROR\        R7      p\	        V4      p\	        V4      pV P                  W14       V P                  WB4       V P                  W24       V P                  WA4       V P                  W44       \        \        \        ^4      4      . R
OR\        R7      p\        \        \        ^4      4      . R
OR\        R7      p\	        V4      p\	        V4      pV P                  W14       V P                  WB4       V P                  W24       V P                  WA4       V P                  W44       R# )r1   r  r^  =Qqz=qQr   0llrG   Nr  )r  r&   r      r   )r   r  r)  r  )r   r   rc   rw  rJ   re  rf  r  s   &    r:   (test_memoryview_compare_multidim_fortran;TestBufferProtocol.test_memoryview_compare_multidim_fortran  s    d5b>*)D&(d5B<(	$&(sOsO  A#A#A! }oa'1ve&(}oa'1ve&(sOsO  A#A#A! d5b>*)C&(d5b>*)C&(sOsO  A#A#A! d5b>*)E&(d5b>*)C&(sOsO  A#A#A! d59oYt&(d59oYt&(sOsO    rY   c                	   \        \        R^4      4      p\        V. RO4      p\        V. RORR7      p\        V. ROR\        R7      p\        V4      p\        V4      pV P                  WS4       V P                  Wd4       V P                  WV4       R.^,          pRV^&   \        V. RO4      p\        V. RORR7      p\        V. ROR\        R7      p\        V4      p\        V4      pV P                  WS4       V P                  Wd4       V P                  WV4       \        \        \        ^(4      4      ^^.RR7      pV^^R1RRR13,          p\        \        \        ^(4      4      ^^.R	R7      pVR
RRR13,          p\        V4      p\        V4      pV P                  WS4       V P                  Wd4       V P                  WT4       V P                  Wc4       V P                  WV4       \        R.^,          ^^.RR7      pV^^R1RRR13,          p\        R.^,          ^^.RR7      pVR
RRR13,          p\        V4      p\        V4      pV P                  WS4       V P                  Wd4       V P                  WT4       V P                  Wc4       V P                  WV4       \        \        \        ^4      4      . RORR7      pVRRRR13,          p\        \        \        ^4      4      . RORR7      pVRRRR13,          p\        V4      p\        V4      pV P                  WS4       V P                  Wd4       V P                  WT4       V P                  Wc4       V P                  WV4       \        \        \        ^4      4      . RORR7      pVRRRR13,          p\        \        \        ^4      4      . RORR7      pVRRRR13,          p\        V4      p\        V4      pV P                  WS4       V P                  Wd4       V P                  WT4       V P                  Wc4       V P                  WV4       \        R.^,          . RORR7      pVRRRR13,          p\        R.^,          . RORR7      pVRRRR13,          p\        V4      p\        V4      pV P                  WS4       V P                  Wd4       V P                  WT4       V P                  Wc4       V P                  WV4       R# )r1   @lr_  r   r^  zd b czd h c@INr   r   r  r   z=iiz>iir   ra  r   b3si3sr  r  )gffffff
rV  )gr  rV  r   r  )r  r  r)  )r&   r  r  r  r&   )r   rc   r   r   rw  rJ   re  rf  )	rT  lst1lst2r  r  r   r~  r  r  s	   &        r:   &test_memoryview_compare_multidim_mixed9TestBufferProtocol.test_memoryview_compare_multidim_mixed
  s`    E#rN#y)d)D9d)CzJsOsO   ""2%#Qy)d)G<d)G:NsOsO   d59oaVDA!Ab&$B$,d59oaVC@%2+sOsO  A#A#A! ()",RGEJ!Ab&$B$,()",RGEJ%2+sOsO     d59oYsC$"*od59oYsC$"*osOsO  A#A#A! d59oYsC$"*od59oYsC$"*osOsO  A#A#A! {mB&iF$"*o{mB&iF$"*osOsO  A#A#A!rY   c                   \        \        \        ^4      4      . RORR7      p\        \        \        ^4      4      . RORR7      p\        V4      p\        V4      pV P	                  W14       V P	                  WB4       V P                  W24       V P                  WA4       V P                  W44       \        \        \        ^4      4      . RORR7      p\        \        \        ^4      4      . RORR7      p\        V4      p\        V4      pV P	                  W14       V P	                  WB4       V P                  W24       V P                  WA4       V P                  W44       R# )   r   r_  z@iN)r   r  r&   )r  r   r&   r  r  s   &    r:   +test_memoryview_compare_multidim_zero_shape>TestBufferProtocol.test_memoryview_compare_multidim_zero_shapek  s    d59oYsCd59oYtDsOsO  A#A#A! d59oYsCd59oYtDsOsO  A#A#A!rY   c                   \        R .^P,          . RORR7      p\        R .. RO. R	ORR7      p\        V4      p\        V4      pV P                  W14       V P                  WB4       V P                  W24       V P                  WA4       V P                  W44       V P                  VP                  4       VP                  4       4       \        R
.^
,          ^^.RR7      p\        R
.^^.^ ^ .RR7      p\        V4      p\        V4      pV P                  W14       V P                  WB4       V P                  W24       V P                  WA4       V P                  W44       R# )r  r  r_  r   r  z=lQz<lQN)r  r  r  rP  r  )r   rJ   re  rD  r  s   &    r:   -test_memoryview_compare_multidim_zero_strides@TestBufferProtocol.test_memoryview_compare_multidim_zero_strides  s*    seBhi=se9iLsOsO    QXXZ0 vhrk!Q>vhq!fq!fUKsOsO    rY   c                   \        \        \        ^(4      4      ^^.RR7      pV^^R1RRR13,          p\        \        \        ^(4      4      ^^.R\        R7      pVRRRR13,          p\	        V4      p\	        V4      pV P                  WR4       V P                  Wd4       V P                  WT4       V P                  Wb4       V P                  WV4       \        R.^(,          ^^.R\        R7      pRV^,          ^&   V^^R1RRR13,          p\        R.^(,          ^^.R\        \        ,          R7      pRV^,          ^&   VRRRR13,          p\	        V4      p\	        V4      pV P                  WR4       V P                  Wd4       V P                  WT4       V P                  Wb4       V P                  WV4       \        \        \        ^4      4      . ROR	\        R7      pVR
RRR13,          p\        \        \        ^4      4      . ROR	R7      pVR
RRR13,          p\	        V4      p\	        V4      pV P                  WR4       V P                  Wd4       V P                  WT4       V P                  Wb4       V P                  WV4       \        R.^(,          . ROR\        \        ,          R7      pVRRRR13,          p\        R.^(,          . RORR7      pVRRRR13,          p\	        V4      p\	        V4      pV P                  WR4       V P                  Wd4       V P                  WT4       V P                  Wb4       V P                  WV4       \        \        \        ^4      4      . ROR\        R7      pVR
RRR13,          p\        \        \        ^4      4      . ROR\        R7      pVR
RRR13,          p\	        V4      p\	        V4      pV P                  WR4       V P                  Wd4       V P                  WT4       V P                  Wb4       V P                  WV4       \        R.^,          . ROR\        \        ,          R7      pRV^,          ^,          ^&   VR
RRR13,          p\        R.^,          . ROR\        \        ,          R7      pRV^,          ^,          ^&   VR
RRR13,          p\	        V4      p\	        V4      pV P                  WR4       V P                  Wd4       V P                  WT4       V P                  Wb4       V P                  WV4       \        \        R^4      4      p\        V. RO4      p\        V. ROR\        R7      p\        V. ROR\        \        ,          R7      p\	        V4      p\	        V4      pV P                  WR4       V P                  Wd4       V P                  WV4       R.^,          pR V^&   \        V. RO4      p\        V. ROR\        R7      p\        V. ROR\        \        ,          R7      p\	        V4      p\	        V4      pV P                  WR4       V P                  Wd4       V P                  WV4       R# )!(   r  r_  Nr   r^  r  r  z>Qqr   ra  Bbr<  r   5s0sPr  r   z
< 10p 9p dz
> 10p 9p dr   r  r  )r   r  r)  r  )   r   r  )   hellorY   r   )r  r  r  )s   sushirY   r   r  )s   sashimis   slicedg4@)s   ramens   spicygfffff"@)
r   r   rc   r  rJ   re  rf  r  r   rw  )	rT  r  r  r  r  r   r~  r  r  s	   &        r:   +test_memoryview_compare_multidim_suboffsets>TestBufferProtocol.test_memoryview_compare_multidim_suboffsets  s    d59oaVDA!Ab&$B$,d59oaVCvN%2+sOsO  A#A#A! }ob(Au')Aq	!Ab&$B$,}ob(Au";.0Aq	%2+sOsO     d59oYs"$$"*od59oYsC$"*osOsO  A#A#A! |nR'y";.0$"*o|nR'yF$"*osOsO  A#A#A! d59oYs&Q$"*od59oYt6R$"*osOsO     )*2-Yw";.0)Aq	!$"*o)*2-Yw";.0)Aq	!$"*osOsO  A#A#A! E#rN#y)d)DGd)Cz&?PQsOsO   //2-Ry)d)LOd)L&v-/sOsO  rY   c                   R EF  p\        R.^x,          . ROVR,           R7      p\        R.^x,          . ROVR,           \        \        ,          R7      p^V^,          ^,          ^,          ^,          ^&   \        V4      p\        V4      pV P	                  WB4       V P	                  WS4       V P                  WE4       V P                  WC4       V P                  WR4       \        R	.^x,          . ROVR,           R7      p\        R	.^x,          . ROVR,           \        \        ,          R7      pR
V^,          ^,          ^,          ^,          ^&   \        V4      p\        V4      pV P	                  WB4       V P	                  WS4       V P                  WE4       V P                  WC4       V P                  WR4       EK  	  R# )r@   r   r_  r^  QLHN)r@   r>   r?   rA   r)   )r  r  r&   r&   r&   )r)   r     )r   r   r   )r   r  rw  rJ   re  rf  )rT  	byteorderrW   r  rF   r   s   &     r:   !test_memoryview_compare_not_equal4TestBufferProtocol.test_memoryview_compare_not_equal!  sp    .I;y}MA;y})*46A AaDGAJqM!1A1AQ"Q"%%%./3;(0A./3;(k*6LNA(AaDGAJqM!1A1AQ"Q"%%%1 .rY   c                   \         P                   ! R . RO4      p\        V4      pVP                  4        V P                  \        \        V4       V P                  \        VP
                  R4       V P                  \        VP                  4       V P                  \        \        V4       V P                  \        VP                  4       V P                  \        VP                  4       V P                  \        \        R\        4       4       V P                  \        VP                  ^ 4       V P                  \        VP                  ^ ^4       R F$  pV P                  \        VP                  V4       K&  	  \         P                   ! R . RO4      p\        V4      p\        V4      pV P                  WV4       VP                  4        V P!                  WV4       V P!                  WQ4       V P                  WU4       R# )r   r   z1.0 in mN)g?g@gffffff
@)rV   r!  rf  r   r  r   r   r   rH  r  r  r  )rH   rJ   r  rg  r   rX  __iter__r   rD  r#  r.  r/  r  r  __getattribute__re  rf  )rT  rF   rD   r  r   r  r  s   &      r:   test_memoryview_check_released1TestBufferProtocol.test_memoryview_check_released>  sk   KK_-qM			 	*j!4*affc2*ajj1*gq1*ahh/*aii0*dJA*ammQ7*ammQ:3D j!*<*<dC3 KK_-]] 


B#B" rY   c                   R	p\        V^.RR7      p\        V4      pV P                  W24       V P                  VP                  4       VP                  4       4       \        V.^.RR7      p\        V4      pV P                  W24       V P                  VP                  4       VP                  4       4       \        \	        ^4       Uu. uF  qANK  	  up. R
ORR7      p\        V4      pV P                  W24       V P                  VP                  4       VP                  4       4       \        \	        ^x4       Uu. uF  qANK  	  up. RORR7      p\        V4      pV P                  W24       V P                  VP                  4       VP                  4       4       \
        '       dY    ! R R\
        P                  4      pV! ^d^4      p\        V4      pV P                  VP                  4       \        V4      4       R# R# u upi u upi )r  r  r_  z>hQiLlz=hQiLlz<hQiLlc                   N    ] tR tRtR]P
                  3R]P
                  3.tRtR# );TestBufferProtocol.test_memoryview_tobytes.<locals>.BEPointi  rW   r  r~   Nrw  r~   rY   r:   r  r    rx  rY   r  Nr  r  )r  r&   r&   r  r&   )r   rJ   re  r#  rc   r  r  rQ   )rT  r{   rL  rD   ro   r  r$  rF   s   &       r:   test_memoryview_tobytes*TestBufferProtocol.test_memoryview_tobytesh  s    )Qqc$/rNbjjl3aSH5rNbjjl3r+Aa+78LrNbjjl3s,Aa,K$&rNbjjl3 6H&33 HC%E5!AQYY[%,7  ,
 -s   
H :
Hc                (   V P                  \        \        / \        R 4       V P                  \        \        R\
        R4       \        . RO^.^.R7      pV P                  \        \        V\
        R4       \        ^	RRR7      pR F>  p\        V\        V4      pV P                  W14       V P                  VR,          ^	4       K@  	  \        ^	RR\        R7      pR F>  p\        V\        V4      pV P                  W14       V P                  VR,          ^	4       K@  	  R Fz  p^	VR&   \        V\
        V4      pV P                  W14       V P                  VR,          ^	4       ^
VR&   V P                  VR,          ^
4       V P                  VR,          ^
4       K|  	  \        ^.^ .R\        R7      pR Ff  p\        V\        V4      pV P                  \        VP                  ^ 4       V P                  W14       V P                  VP                  4       . 4       Kh  	  \        \        \        ^4      4      . ROR\        R7      pR F?  p\        V\        V4      pV P                  \        V4      P                  4       . . .4       KA  	  \        ^.^.R\        R7      pR FS  p\        V\
        V4      pV P                  W14       V P                  VP                  4       VP                  4       4       KU  	  \        . RO^.R	\        R7      pR FS  p\        V\
        V4      pV P                  W14       V P                  VP                  4       VP                  4       4       KU  	  \        . RO^.^.\        R
7      pR F  p\        V\        V4      pV P                  W14       V P                  VP                  4       VP                  4       4       V P                  \        VP                  ^^4       V P                  V^,          ^4       V P                  V^,          ^4       K  	  VRRR1,          pR F  p\        V\        V4      pV P                  W14       V P                  VP                  4       VP                  4       4       V P                  \        VP                  ^^4       V P                  V^,          ^4       V P                  V^,          ^4       K  	  \        \        \        ^4      4      ^^.\        R7      pR FK  p\        V\
        V4      pV P                  \        V4      P                  4       VP                  4       4       KM  	  V P                  \        \        V\
        R 4       \        V\        X4      pV P                  \        V4      P                  4       VP                  4       4       \        \        \        ^4      4      ^^.\        \        ,          R7      pR FK  p\        V\
        V4      pV P                  \        V4      P                  4       VP                  4       4       KM  	  V P                  \        \        V\
        R4       \        V\        V4      pV P                  \        V4      P                  4       VP                  4       4       \        \        \        ^4      4      ^^.\        \         ,          R7      pR Fl  pV P                  \        \        V\
        V4       \        V\        V4      pV P                  \        V4      P                  4       VP                  4       4       Kn  	  \        . RO^.^.R7      p\        V\        R4      pV P#                  VP$                  4       R# )r\  rV  r   r  r]  r   r_  r^  r   r   r  Nr  r  r~   ro  r  r   )r   r]  )r\  r]  r  )rg  rE  rx  ry  rs  PyBUF_WRITEr   re  r  r  r  rD  r   rc   r  rw  r  rz  r  )rT  rL  rb  rD   s   &   r:   test_memoryview_get_contiguous1TestBufferProtocol.test_memoryview_get_contiguous  s    	)^RSI 	+~t[#N YqcA37+~r;L Qb-$Er:u5AQ#QrUA& % QbK@$Er:u5AQ#QrUA& % %EBrFr;6AQ#QrUA&AbEQrUB'RVR( % aSC{C$Er:u5Aj!--;Q#QXXZ,	 % T%(^9S&($Er:u5AWQZ..02r(; %
 aSC{C$Er;6AQ#QXXZ5 %
 Yqc#[I$Er;6AQ#QXXZ5 % YqcA3kJ$Er:u5AQ#QXXZ5i2>QqT1%RUA& % "X$Er:u5AQ#QXXZ5i2>QqT1%RUA& % T%)_QF+FEr;6AWQZ..0"))+>   	+~r;L2z51**,biik:T%)_QF&z13Er;6AWQZ..0"))+>   	+~r;L2z51**,biik: T%)_QF+f:LM$Ek>2{#%r:u5AWQZ..0"))+>	 % [aS92z3/'rY   c                d   \         P                  ! R 4      p\        P                  ! R . RO4      p\        V4      p\        P
                  ! V4      p\        ^V,          4      pVP                  V4       V P                  VP                  4       V4       \         P                  ! R4      p\        \        \        ^4      4      . RORR7      p\        V4      p\        P
                  ! V4      p\        ^V,          4      pVP                  V4       V P                  VP                  4       V4       R# )r   r   r_  Nr  r  )r4   r  rH   rJ   ioBytesIOr  readintore  r#  r   r   rc   )rT  r   rF   rD   r  r   rL  s   &      r:   test_memoryview_serializing.TestBufferProtocol.test_memoryview_serializing   s     s#KK[)qMjjmafQa( s#T%)_GC@rNjjmeDj!Qa(rY   c                t   \        \        \        ^4      4      4      p\        V4      pV P	                  \        V4      \        V4      4       VP                  R^^.R7      pV P	                  \        V4      \        V4      4       VRRR1,          p\        \        \        ^4      4      RRR1,          4      pV P	                  \        V4      \        V4      4       \        \        \        ^4      4      . RO\        R7      p\        V4      pV P	                  \        V4      \        V4      4       \        \        \        ^4      4      . ROR7      pVRRRRR13,          p\        V4      pV P	                  \        V4      \        V4      4       \        \        \        ^4      4      . RO\        R7      pVRRRRR13,          p\        V4      pV P	                  \        V4      \        V4      4       \        \        \        ^4      4      ^.RR7      p\        V4      p\        \        \        ^4      4      ^.R	R7      p\        V4      pV P	                  Wq4       V P	                  \        V4      \        V4      4       \        \        \        ^4      4      . ROR
R7      p\        V4      pV P                  \        VP                  4       \        \        \        R^4      4      . RORR7      p\        V4      pV P                  \        VP                  4       \        \        \        ^4      4      . RORR7      p\        V4      pV P                  \        VP                  4       \        \        \        R^4      4      . RORR7      p\        V4      pV P                  \        VP                  4       R# )r  r   r  Nr  r  rK  r   r_  r   r   r   z= Lz< hr  r  r   )r&   r  r  r  r  )rQ   r   rc   rJ   re  r  rX  r   rw  r  rg  r   __hash__)	rT  r   rD   mcmxrL  rW   rF   r  s	   &        r:   test_memoryview_hash'TestBufferProtocol.test_memoryview_hash  s    $uRy/"qMa$q'* VVC!uV%b47+ ttW$uRy/$B$'(b47+ T%)_G:FrNa$r(+ T%)_G4sB"}qMa$q'* T%)_G6BsB"}qMa$q'* DrOB4<qMDrOB4<qMa$q'* T%)_GC@rN*ajj1T%A,'wsCrN*ajj1T%)_GEBrN*ajj1T%A,'wuErN*ajj1rY   c                   \        . RO4      p\        V4      p\        V4      pV P                  \        VP
                  4       ?VP                  4        \        . RO4      p\        V4      p\        V\        \        R7      p\        V\        \        R7      pV P                  VP                  V4       V P                  \        VP
                  4       ??VP                  4        \        . RO4      p\        V4      p\        V4      p\        V4      pVP                  4        V P                  \        VP
                  4       ?VP                  4        \        . RO4      p\        V4      p\        V4      p\        V\        \        R7      p\        V\        \        R7      pV P                  VP                  V4       VP                  4        V P                  \        VP
                  4       ??VP                  4        \        . RO^.\        R7      p\        V4      pVP                  . RO^.R7       \        V4      p\        V4      pV P                  VP                  4       VP                  4       4       \        V4      p	V P                  V	P                  4       VP                  4       4       V P                  V	P                  4       VP                  4       4       VP                  4        V	P                  4        VP                  4        V P                  VP                  4       VP                  4       4       ?VP                  4        VP                  4        R p
\        R4      p\        V4      ;_uu_ 4       pV
! V4       V P                  V^ ,          \        R4      4       RRR4       \        \!        \#        ^4      4      . RORR	7      p\        V\        \        R7      p	\        V	\        \        R7      pV P                  VP                  V4       \        V4      ;_uu_ 4       pV
! V4       V P                  VR
,          P                  4       . RO. RO..4       RRR4       ^ \        3 EF  p\        R4      p\        V4      ;_uu_ 4       p?\        V\        VR7      p	\        V	4      ;_uu_ 4       p?	\        V\        VR7      p\        V4      ;_uu_ 4       p?V
! V4       V
! V4       V
! V4       V P                  V^ ,          \        R4      4       V P                  V^,          \        R4      4       V P                  V^,          \        R4      4       ?RRR4       ?RRR4       ?RRR4       \        R4      p\        V4      ;_uu_ 4       p?\        V\        VR7      p	\        V	4      ;_uu_ 4       p?	\        V\        VR7      p\        V4      ;_uu_ 4       p?V
! V4       V
! V4       V
! V4       V P                  V^ ,          \        R4      4       V P                  V^,          \        R4      4       V P                  V^,          \        R4      4       ???RRR4       RRR4       RRR4       EK  	  \        R4      pV P                  \        4      ;_uu_ 4        \        V4      ;_uu_ 4       p\        V4      pV^ ,          \        R4      8H   RRR4       RRR4       R#   + '       g   i     EL[; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     EL; i  + '       g   i     EK#  ; i  + '       g   i     L; i  + '       g   i     R# ; i)r   r  r  r  r  c                 h    \        V 4      ;_uu_ 4       p R R R 4       R #   + '       g   i     R # ; ir   rJ   )r   r  s   & r:   catch22;TestBufferProtocol.test_memoryview_release.<locals>.catch22  s    A" s    1	r  rX  Nr   r_  :r   r   NrY  rZ  r  )r  r  r  r3   r2   r  r  )r  r  r  )r  rJ   r   rg  rs  r  r}  ND_REDIRECTrd  rV   r  r  re  rD  r  ordr   rc   )rT  rF   rD   rL  r  r  r  r  rW   r  r  r_  r  r
  rj  s   &              r:   test_memoryview_release*TestBufferProtocol.test_memoryview_releaseZ  sb    gqMQZ+qyy1			gqMa[Ac-{Ccggq!+qyy1			 g]^R[


+rzz2


g]^bkBc-{Ccggr"


+rzz2


 WQC|<^
A3'^rNRYY[1rNRYY[1RYY[1


			
RYY[1


			
	 f]]bBKRUCI.  DrO73?Am;?Am;?aeeQ]]aAJQsV]]_	9/E.FG 
 %E&!AA"B}EB]]b=FA#A"((AD	:((AD	:((AD	: '  # ! $ &!AA"B}EB]]b=FA#A"((AD	:((AD	:((AD	:B ' # + &L f{++A!QZ!D	!  ,+i ]] ]] ' #]] 2 ' #]] &  ,++s   +\47\']'\=+B\),	\=5	]$'^']82B]%5]8=^:^4!^!	/^4\	\&	)\:4	\==]	]]"%]50]88^		^^!^1,^44_	c                ~   \        \        ^4       Uu. uF  pRV,          NK  	  up^.RR7      p\        P                  ! R\        ^4       Uu. uF  pRV,          NK  	  up4      pW#3 EFD  p\        V\        \        R7      p\        V\        \        R7      p\        V4      pV P                  VP                  V4       V P                  VP                  V4       V P                  VP                  V4       V P                  Wa4       V P                  Wd4       V P                  We4       V P                  VR,          VR,          4       V P                  VR,          VR,          4       V P                  VR,          VR,          4       ??V P                  VR,          VR,          4       EKG  	  R# u upi u upi )r  r6  r   r_  r  ra  N)	r   rc   rH   r}  r  rJ   rd  rV   re  )rT  rW   rL  rF   r  r_  rD   s   &      r:   test_memoryview_redirect+TestBufferProtocol.test_memoryview_redirect  sR   uRy1y!cAggy1"cJKKuRy9y!cAggy9:A-{CA-{CA1AMM!%%#MM!%%#MM!%%#Q"Q"Q"QsVQsV,QsVQsV,QsVQsV,1QsVQsV,#  29s   F5F:
c                2   R p. ROpV P                  \        \        ^^^4       \        4       p\        V4      pV P	                  WC^VR^^.^.VR7	       \        ^4       F  pV P                  WE,          V4       K  	  ??\        4       p\        V4      p??\        4       p\        V\        R7      p\        V\        R7      p\        V4      pV P                  VP                  V4       V P                  VP                  V4       V P	                  Wv^VR^^.^.VR7	       ????\        4       p\        V\        \        R7      p\        V\        \        R7      p\        V4      pV P                  VP                  V4       V P                  VP                  V4       V P                  VP                  V4       V P	                  Ws^VR^^.^.VR7	       ????\        RR7      p\        V4      pV P	                  VR^VR^^.^.VR7	       \        ^4       F  pV P                  WE,          V4       K  	  ??\        RR7      p\        V4      p??\        RR7      p\        V\        R7      p\        V\        R7      p\        V4      pV P                  VP                  R4       V P                  VP                  V4       V P	                  Wv^VR^^.^.VR7	       ????\        RR7      p\        V\        \        R7      p\        V\        \        R7      p\        V4      pV P                  VP                  R4       V P                  VP                  V4       V P                  VP                  V4       V P	                  Wt^VR^^.^.VR7	       ????R# )r   Tr  r  r  )legacy_modeN)r   r   r&   r  r  r  r  r3   r2   r  r  r  )rg  rE  staticarrayrJ   r  rc   re  r   r}  rd  rV   r  )rT  r7   rd   rW   r  r   r_  rD   s   &       r:   $test_memoryview_from_static_exporter7TestBufferProtocol.test_memoryview_from_static_exporter  sL   ) 	)[!Q: MqMAC$2$ 	 	 rAQT1% MqMMAm,Am,qMaeeQaeeQAC$2$ 	 	 q!QMAm;?Am;?qMaeeQaeeQaeeQAC$2$ 	 	 q!Q D)qMA4C$2$ 	 	 rAQT1% D)qMD)Am,Am,qMaeeT"aeeQAC$2$ 	 	 q!QD)Am;?Am;?qM 	aeeT"aeeQaeeQAC$2$ 	 	 q!QrY   c                |    \        . RO^.\        \        ,          R7      pV P                  \        \
        V4       R# )r   r  Nr  )r   r  ND_GETBUF_UNDEFINEDrg  rs  rJ   r  s   & r:   #test_memoryview_getbuffer_undefined6TestBufferProtocol.test_memoryview_getbuffer_undefinedP  s,     Wqc8K)KL+z26rY   c                f    \        . RO^.\        R7      pV P                  \        \        V4       R# )r   r  Nr  )r   r  rg  rs  rJ   )rT  rW   s   & r:   test_issue_7385"TestBufferProtocol.test_issue_7385V  s$    GA3n=+z15rY   c                   \        R 4      pV P                  \        4      ;_uu_ 4        VP                  \        P
                  P                  4       RRR4       V P                  \        4      ;_uu_ 4        VP                  \        P
                  P                  4       RRR4       R#   + '       g   i     La; i  + '       g   i     R# ; ir  N)r  rg  SystemError
__buffer__inspectBufferFlagsREADWRITE)rT  rV   s   & r:   'test_bytearray_release_buffer_read_flag:TestBufferProtocol.test_bytearray_release_buffer_read_flagZ  s~    {++NN7..334 ,{++NN7..445 ,+ ,++++s   *B,8*B?,B<	?C	c                    R F=  pV P                  \        P                  ! V4      \        P                  ! V4      4       K?  	  R# )r<   N)r<   ii3s)re  	_testcapiPyBuffer_SizeFromFormatr4   r  )rT  r  s   & r:   test_pybuffer_size_from_format1TestBufferProtocol.test_pybuffer_size_from_formatb  s5     'FY>>vF#__V46 'rY   c           
     z    ^ RI HpHp RpV^,
          V^,           3 F]  pV P	                  VR7      ;_uu_ 4        V P                  \        4      ;_uu_ 4        VP                  V4       RRR4       RRR4       K_  	  R#   \         d    RpRp Li ; i  + '       g   i     L3; i  + '       g   i     K  ; i)r   )INT_MININT_MAXr  r  Nr  r  )r  r  r  ImportErrorsubTestrg  r  r  )rT  r  r  rV   r  s   &    r:   test_flags_overflow&TestBufferProtocol.test_flags_overflowi  s    	"2
 k7Q;/EE**&&}55NN5) 6 +* 0  	" G!G	" 65 +**s4   B B)B+B)BBB&!B))B:)rR  NF)_r  r  r  r  rU  r  r  r   requires_resourcer  r  r  r  r  r  r  r	  r  r  r  r!  r%  r+  r0  r9  r=  rE  rH  rR  rV  r`  re  rs  rv  r}  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r%  r.  r3  r:  
contextlibcontextmanagerrA  rS  r^  rb  rr  r  r   ignore_warningsDeprecationWarningr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r	  r  cpython_onlyr  r!  r  r  r  s   @r:   rO  rO    s    1J "'J .3JX.,` u%g< &g<R\=| $
'3*=+)Z%LN64E..`,1\H>-&W7r<(D@!@F4/l>B'0R38<E|(I&;/
$>2
0#7Jn8`sQj-$ ''L?62p5q@f:.x u%R0 &R0h9<.A I I3AjkIZ6&p<?|-=^ $$.@A" B"=!~F+P44(8<|FP_"B"46B&:(!T!8Fs(j)<:2x~"@-0\|766 6 6 * *rY   rO  c                   R  a  ] tR tRt o R tR tR tR tR tR t	]
P                  ! ]RJ R	4      R
 4       t]
P                  ! ]RJ R	4      R 4       t]
P                  ! ]RJ R	4      R 4       t]
P                  ! ]RJ R	4      R 4       tR tR tR tR tR tR tR tR tR tRtV tR# )TestPythonBufferProtocoliy  c                     ! R  R4      p\        V! 4       4      pV P                  VP                  4       R4       V P                  \        V! 4       4      R4       R# )c                   &   a  ] tR tRt o R tRtV tR# )5TestPythonBufferProtocol.test_basic.<locals>.MyBufferi{  c                    \        R 4      # r  r  rT  r  s   &&r:   r  @TestPythonBufferProtocol.test_basic.<locals>.MyBuffer.__buffer__|      !(++rY   r~   Nr  r  r  r  r  r  r  r  s   @r:   MyBufferr.  {       , ,rY   r5  r  N)rJ   re  r#  rQ   )rT  r5  r  s   &  r:   
test_basic#TestPythonBufferProtocol.test_basicz  sG    	, 	, 
#x0xz*H5rY   c                    ! R  R4      pV P                  \        \        V! 4       4        ! R R4      pV P                  \        \        V! 4       4        ! R R4      pV P                  \        \        V! 4       4       R# )c                   &   a  ] tR tRt o R tRtV tR# )ETestPythonBufferProtocol.test_bad_buffer_method.<locals>.MustReturnMVi  c                    ^*# )*   r~   r1  s   &&r:   r  PTestPythonBufferProtocol.test_bad_buffer_method.<locals>.MustReturnMV.__buffer__  s    rY   r~   Nr4  r  s   @r:   MustReturnMVr;    s      rY   r?  c                   &   a  ] tR tRt o R tRtV tR# )FTestPythonBufferProtocol.test_bad_buffer_method.<locals>.NoBytesEitheri  c                    R # r0  r~   r1  s   &&r:   r  QTestPythonBufferProtocol.test_bad_buffer_method.<locals>.NoBytesEither.__buffer__  s    rY   r~   Nr4  r  s   @r:   NoBytesEitherrA    s        rY   rD  c                   &   a  ] tR tRt o R tRtV tR# )CTestPythonBufferProtocol.test_bad_buffer_method.<locals>.WrongArityi  c                    \        R 4      # r0  r  rS  s   &r:   r  NTestPythonBufferProtocol.test_bad_buffer_method.<locals>.WrongArity.__buffer__  r3  rY   r~   Nr4  r  s   @r:   
WrongArityrF    r6  rY   rI  N)rg  rE  rJ   )rT  r?  rD  rI  s   &   r:   test_bad_buffer_method/TestPythonBufferProtocol.test_bad_buffer_method  sb    	 	 	)Z@	  	  	)ZA	, 	, 	)Z>rY   c                h    ! R  R4      pV! 4       pV P                  VP                  4       \        V4      ;_uu_ 4       pV P                  VP                  4       V P	                  VP                  4       R4       RRR4       V P                  VP                  4       R#   + '       g   i     L-; i)c                   2   a  ] tR tRt o R tR tR tRtV tR# )CTestPythonBufferProtocol.test_release_buffer.<locals>.WhatToReleasei  c                4    R V n         \        R4      V n        R# Fr  N)heldr  barS  s   &r:   r  LTestPythonBufferProtocol.test_release_buffer.<locals>.WhatToRelease.__init__  s    !	#H-rY   c                t    V P                   '       d   \        R 4      hRV n         \        V P                  4      # zalready heldT)rQ  rE  rJ   rR  r1  s   &&r:   r  NTestPythonBufferProtocol.test_release_buffer.<locals>.WhatToRelease.__buffer__  s,    999#N33 	!$''**rY   c                    R V n         R# FNrQ  rT  r  s   &&r:   __release_buffer__VTestPythonBufferProtocol.test_release_buffer.<locals>.WhatToRelease.__release_buffer__  s	    !	rY   )rR  rQ  N	r  r  r  r  r  r  r[  r  r  r  s   @r:   WhatToReleaserN    s     .+" "rY   r^  r  Nrc  rQ  rJ   rz  re  r#  rT  r^  wrr  s   &   r:   test_release_buffer,TestPythonBufferProtocol.test_release_buffer  sy    	" 	" _!^^rOOBGG$RZZ\84  	! ^    <B!!B1	c                h    ! R  R4      pV! 4       pV P                  VP                  4       \        V4      ;_uu_ 4       pV P                  VP                  4       V P	                  VP                  4       R4       RRR4       V P                  VP                  4       R#   + '       g   i     L-; i)c                   2   a  ] tR tRt o R tR tR tRtV tR# )ITestPythonBufferProtocol.test_same_buffer_returned.<locals>.WhatToReleasei  c                B    R V n         \        R4      V n        RV n        R# rP  )rQ  r  rR  
created_mvrS  s   &r:   r  RTestPythonBufferProtocol.test_same_buffer_returned.<locals>.WhatToRelease.__init__  s    !	#H-"&rY   c                    V P                   '       d   \        R 4      hRV n         \        V P                  4      V n        V P                  # rU  )rQ  rE  rJ   rR  ri  r1  s   &&r:   r  TTestPythonBufferProtocol.test_same_buffer_returned.<locals>.WhatToRelease.__buffer__  s7    999#N33 	",TWW"5&rY   c                    R V n         R# rX  rY  rZ  s   &&r:   r[  \TestPythonBufferProtocol.test_same_buffer_returned.<locals>.WhatToRelease.__release_buffer__  s	    !	rY   )rR  ri  rQ  Nr]  r  s   @r:   r^  rg    s     '
'" "rY   r^  r  Nr_  r`  s   &   r:   test_same_buffer_returned2TestPythonBufferProtocol.test_same_buffer_returned  sy    	" 	"" _!^^rOOBGG$RZZ\84  	! ^rd  c           	     *    ! R  R4      pV! RR4      pV! RR4      p\         P                  V\        P                  P                  4      ;_uu_ 4       pV P                  VP                  4       R4       \        R4      V^ &   V P                  VP                  4       R4       RRR4       \         P                  V\        P                  P                  4      ;_uu_ 4       pV P                  VP                  4       R4       V P                  \        4      ;_uu_ 4        \        R4      V^ &   RRR4       V P                  VP                  4       R4       RRR4       \         P                  V\        P                  P                  4      ;_uu_ 4       pV P                  VP                  4       R4       V P                  \        4      ;_uu_ 4        \        R4      V^ &   RRR4       V P                  VP                  4       R4       RRR4       V P                  \        4      ;_uu_ 4        \         P                  V\        P                  P                  4       RRR4       \        V4      ;_uu_ 4       pV P                  VP                  4       R4       V P                  \        4      ;_uu_ 4        \        R4      V^ &   RRR4       V P                  VP                  4       R4       RRR4       R#   + '       g   i     EL]; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL[; i  + '       g   i     ELG; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     R# ; i)	c                   8   a  ] tR tRt o V 3R lR ltR tRtV tR# )CTestPythonBufferProtocol.test_buffer_flags.<locals>.PossiblyMutablei  c                   < V ^8  d   QhRR/# )r&   returnNr~   )r  r  s   "r:   __annotate__PTestPythonBufferProtocol.test_buffer_flags.<locals>.PossiblyMutable.__annotate__  s     ( ( (rY   c                2    \        V4      V n        W n        R # r   )r  _data_mutable)rT  datamutables   &&&r:   r  LTestPythonBufferProtocol.test_buffer_flags.<locals>.PossiblyMutable.__init__  s    &t_
 'rY   c                    V\         P                  P                  ,          '       d3   V P                  '       g   \	        R 4      h\        V P                  4      # \        \        V P                  4      4      # )znot mutable)r  r  WRITABLErz  r   rJ   ry  rQ   r1  s   &&r:   r  NTestPythonBufferProtocol.test_buffer_flags.<locals>.PossiblyMutable.__buffer__  sP    7..7777===*=99%djj11%eDJJ&788rY   )ry  rz  N)r  r  r  r  r  r  r  r  r  s   @r:   PossiblyMutablers    s     ( (9 9rY   r  r  TFrV  s   xelloN   h)rJ   _from_flagsr  r  r  re  r#  r  SIMPLErg  rE  r   )rT  r  r|  	immutabler  s   &    r:   test_buffer_flags*TestPythonBufferProtocol.test_buffer_flags  sn   	9 	9 "(D1#He4	##GW-@-@-I-IJJbRZZ\84IBqERZZ\84 K ##GW-@-@-G-GHHBRZZ\84""9--D	1 .RZZ\84	 I
 ##Iw/B/B/I/IJJbRZZ\84""9--D	1 .RZZ\84	 K |,,""9g.A.A.J.JK -	""bRZZ\84""9--D	1 .RZZ\84	 #"# KJJ .-- IHH .-- KJJ -,, .- #""s   AK6 >LL
	-(L>ML2	 (M-/M7>N5M.	(N6L	
L	LL/	2M=	MM	M+	.M>9NN	c                `   \        R 4      pVP                  ^ 4      pV P                  VP                  4       R 4       VP	                  V4       V P                  \        4      ;_uu_ 4        VP                  \        P                  ^,           4       RRR4       R#   + '       g   i     R# ; i)r  N)	r  r  re  r#  r[  rg  r  rI  r  )rT  rR  r  s   &  r:   test_call_builtins+TestPythonBufferProtocol.test_call_builtins  sr    x ]]1x0
b!}--MM#++/* .---s   +'BB-	Nzrequires _testcapic                   \         P                  ! 4       pV P                  VP                  ^ 4       VP	                  ^ 4      pV P                  V\        4       V P                  VP                  4       R4       V P                  VP                  ^4       VP                  V4       V P                  VP                  ^ 4       V P                  \        4      ;_uu_ 4        VP                  4        RRR4       V P                  \        4      ;_uu_ 4        VP                  V4       RRR4       V P                  VP                  ^ 4       R#   + '       g   i     Le; i  + '       g   i     LA; i)r   s   testN)r  testBufre  
referencesr  assertIsInstancerJ   r#  r[  rg  r   )rT  r  r  s   &  r:   test_c_buffer&TestPythonBufferProtocol.test_c_buffer  s    !+^^Ab*-w/+r"+z**JJL + z**""2& ++ +* +*s   EE E	 E0	c                    \         P                  ! 4       pV P                  \        VP                  \
        4       V P                  \        VP                  \        4       R # r   )r  r  rg  r  r  ry  r  )rT  r  s   & r:   test_c_buffer_invalid_flags4TestPythonBufferProtocol.test_c_buffer_invalid_flags  s<    !+s~~zB+s~~{CrY   c                    R pV P                  \        \        P                  V^ \        4       V P                  \        \        P                  V^ \
        4       R# r  )rg  r  r  buffer_fill_infory  r  )rT  sources   & r:    test_c_fill_buffer_invalid_flags9TestPythonBufferProtocol.test_c_fill_buffer_invalid_flags  sG     +y'A'A !Z	1+y'A'A ![	2rY   c                8   R p\         P                  ! V^\        4      ;_uu_ 4       pV P                  \	        V4      R 4       V P                  VP                  4       RRR4       \         P                  ! V^ \        4      ;_uu_ 4       pV P                  \	        V4      R 4       V P                  VP                  4       RRR4       V P                  \        \         P                  V^\        4       R#   + '       g   i     L; i  + '       g   i     LP; ir  )r  r  r  re  rQ   rz  rf  r  rc  rg  rs  )rT  r  rD   s   &  r:   (test_c_fill_buffer_readonly_and_writableATestPythonBufferProtocol.test_c_fill_buffer_readonly_and_writable  s    ''<@@AU1Xv.OOAJJ' A ''>BBaU1Xv.QZZ( C 	+y'A'A !^	5 A@ CBs   7C6
7D	6D		D	c                     ! R  R\         4      pV! R4      p\        V4      pV P                  VP                  4       R4       R# )c                   2   a a ] tR tRt oV 3R ltRtVtV ;t# )4TestPythonBufferProtocol.test_inheritance.<locals>.Ai!  c                "   < \         SV `  V4      # r   superr  rT  r  rA  s   &&r:   r  ?TestPythonBufferProtocol.test_inheritance.<locals>.A.__buffer__"      w)%00rY   r~   r  r  r  r  r  r  r  __classcell__rA  r  s   @@r:   r]  r  !       1 1rY   r]  r  Nr  rJ   re  r#  )rT  r]  rF   r  s   &   r:   test_inheritance)TestPythonBufferProtocol.test_inheritance   s8    	1	 	1 hK]x0rY   c                &  a ^ o ! V3R lR\         4      pV! R4      p\        V4      ;_uu_ 4       pV P                  VP                  4       R4       V P                  S^ 4       RRR4       V P                  S^4       R#   + '       g   i     L$; i)r   c                   B   <a a ] tR tRt oV 3R ltV V3R ltRtVtV ;t# )BTestPythonBufferProtocol.test_inheritance_releasebuffer.<locals>.Bi+  c                "   < \         SV `  V4      # r   r  r  s   &&r:   r  MTestPythonBufferProtocol.test_inheritance_releasebuffer.<locals>.B.__buffer__,  r  rY   c                8   < S^,          o\         SV `  V4       R# )r   Nr  r[  )rT  viewrA  rb_call_counts   &&r:   r[  UTestPythonBufferProtocol.test_inheritance_releasebuffer.<locals>.B.__release_buffer__.  s    "*40rY   r~   	r  r  r  r  r  r[  r  r  r  )rA  r  r  s   @@r:   r   r  +  s     11 1rY   r   r  Nr  )rT  r   r   r  r  s   &   @r:   test_inheritance_releasebuffer7TestPythonBufferProtocol.test_inheritance_releasebuffer)  so    	1	 	1 hK]]bRZZ\84]A.  	* ]s   3B  B	c                  aa  ! R  R\         4      pV! R4      p\        V4      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       ^ oRo ! VV3R lR\         4      pV! R4      p\        V4      ;_uu_ 4       pV P                  VP                  4       R4       V P                  S^ 4       RRR4       V P                  S^4       V P	                  SR4       R#   + '       g   i     L; i  + '       g   i     LI; i)c                   &   a  ] tR tRt o R tRtV tR# )JTestPythonBufferProtocol.test_inherit_but_return_something_else.<locals>.Ai:  c                    \        R 4      # r0  r  r1  s   &&r:   r  UTestPythonBufferProtocol.test_inherit_but_return_something_else.<locals>.A.__buffer__;  r3  rY   r~   Nr4  r  s   @r:   r]  r  :  r6  rY   r]  r  NFc                   >   <a a ] tR tRt oR tV VV3R ltRtVtV ;t# )JTestPythonBufferProtocol.test_inherit_but_return_something_else.<locals>.BiD  c                    \        R 4      # r0  r  r1  s   &&r:   r  UTestPythonBufferProtocol.test_inherit_but_return_something_else.<locals>.B.__buffer__E  r3  rY   c                b   < S^,          o \         SV `  V4       R#   \         d    Ro R# i ; i)r   TN)r  r[  r   )rT  r  rA  r  	rb_raiseds   &&r:   r[  ]TestPythonBufferProtocol.test_inherit_but_return_something_else.<locals>.B.__release_buffer__G  s3    "%G.t4! % $I%s    ..r~   r  )rA  r  r  r  s   @@r:   r   r  D  s     ,% %rY   r   T)r  rJ   re  r#  rd  )rT  r]  rF   r  r   r   r  r  s   &     @@r:   &test_inherit_but_return_something_else?TestPythonBufferProtocol.test_inherit_but_return_something_else9  s    	,	 	, hK]]bRZZ\84  	
	% 
	%	 
	% hK]]bRZZ\84]A.  	*i&- ]$ ]s   !C)3C<)C9	<D	c                     ! R  R\         4      pV! R4      p\        V4      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       R#   + '       g   i     R# ; i)c                   2   a a ] tR tRt oV 3R ltRtVtV ;t# )>TestPythonBufferProtocol.test_override_only_release.<locals>.CiX  c                &   < \         SV `  V4       R # r   r  )rT  r  rA  s   &&r:   r[  QTestPythonBufferProtocol.test_override_only_release.<locals>.C.__release_buffer__Y  s    *62rY   r~   r  r  r  r  r[  r  r  r  r  s   @@r:   r   r  X  s     3 3rY   r   r  Nr  )rT  r   r   r  s   &   r:   test_override_only_release3TestPythonBufferProtocol.test_override_only_releaseW  sF    	3	 	3 hK]]bRZZ\84 ]]]s   !AA'	c                  a a R o ! V V3R lR\         4      pV! R4      p\        V4      ;_uu_ 4       pS P                  VP                  4       R4       R R R 4       VP	                  4        S P                  \        4      ;_uu_ 4        SP                  4        R R R 4       R #   + '       g   i     LX; i  + '       g   i     R # ; i)Nc                   D   <a a ] tR tRt oV3R lV VV3R lltRtVtV ;t# )@TestPythonBufferProtocol.test_release_saves_reference.<locals>.Cic  c                    < V ^8  d   QhRS[ /# )r&   r  r  )r  r  s   "r:   rv  MTestPythonBufferProtocol.test_release_saves_reference.<locals>.C.__annotate__d  s     3 3j 3rY   c                2  < SP                  \        4      ;_uu_ 4        \        V4       R R R 4       SP                  \        4      ;_uu_ 4        VP                  R4       R R R 4       SP                  \        4      ;_uu_ 4        VP	                  4        R R R 4       SP                  \        4      ;_uu_ 4        VR,           R R R 4       SP                  \        4      ;_uu_ 4        VP                  ^ 4       R R R 4       VoSP                  VP                  4       R4       \        SV `%  V4       R #   + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i)Nr   :Nr   Nr  )
rg  r   rJ   rX  r  r  re  r#  r  r[  )r   r  rA  rT  smuggled_buffers   &&r:   r[  STestPythonBufferProtocol.test_release_saves_reference.<locals>.C.__release_buffer__d  s    &&z22v& 3&&z22KK$ 3&&z22%%' 3&&z222J 3&&z22%%a( 3 #)  !18<*62 32222222222s;   D9EE =
E3,F9E
	E	 E0	3F	F	r~   r  )rA  r  rT  r  s   @@r:   r   r  c  s     3 3 3rY   r   r  )r  rJ   re  r#  clearrg  r   )rT  r   r   r  r  s   f   @r:   test_release_saves_reference5TestPythonBufferProtocol.test_release_saves_reference`  s    	3 	3	 	3" hK]]bRZZ\84 		z**##% +* ] +**s   !B$	B7$B4	7C	c                  a \        R 4      o ! V3R lR4      pV! 4       p\        V4      ;_uu_ 4       pV P                  VP                  4       R 4       RRR4       V P                  VP                  P                  4       R 4       V P                  \        4      ;_uu_ 4        SP                  4        RRR4       VP                  P                  4        SP                  4        R#   + '       g   i     L; i  + '       g   i     LO; i)r  c                   4   <a  ] tR tRt o V3R ltR tRtV tR# )OTestPythonBufferProtocol.test_release_saves_reference_no_subclassing.<locals>.Ci~  c                   < \        S4      # r   r  )rT  r  rR  s   &&r:   r  ZTestPythonBufferProtocol.test_release_saves_reference_no_subclassing.<locals>.C.__buffer__  s    !"~%rY   c                    Wn         R # r   r  rZ  s   &&r:   r[  bTestPythonBufferProtocol.test_release_saves_reference_no_subclassing.<locals>.C.__release_buffer__      $rY   r  Nr  r  r  r  r  r[  r  r  )r  rR  s   @r:   r   r  ~  s     &% %rY   r   N)	r  rJ   re  r#  r  rg  rs  r  r  )rT  r   r   r  rR  s   &   @r:   +test_release_saves_reference_no_subclassingDTestPythonBufferProtocol.test_release_saves_reference_no_subclassing{  s    x 	% 	% C]]bRZZ\84 ))+X6{++HHJ ,	

 ] ,+s   !C)$C<)C9	<D	c                    ! R  R4      p ! R RV\         4      pV! R4      p\        V4      ;_uu_ 4       pV P                  VP                  4       R4       RRR4        ! R R4      p ! R	 R
V\         4      pV! R4      p\        V4      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       VP	                  4        V P                  \        4      ;_uu_ 4        VP                  P                  4        RRR4       R#   + '       g   i     L; i  + '       g   i     Lu; i  + '       g   i     R# ; i)c                   &   a  ] tR tRt o R tRtV tR# )ITestPythonBufferProtocol.test_multiple_inheritance_buffer_last.<locals>.Ai  c                    \        R 4      # )   hello Ar  r1  s   &&r:   r  TTestPythonBufferProtocol.test_multiple_inheritance_buffer_last.<locals>.A.__buffer__  s    !*--rY   r~   Nr4  r  s   @r:   r]  r    s     . .rY   r]  c                   2   a a ] tR tRt oV 3R ltRtVtV ;t# )ITestPythonBufferProtocol.test_multiple_inheritance_buffer_last.<locals>.Bi  c                "   < \         SV `  V4      # r   r  r  s   &&r:   r  TTestPythonBufferProtocol.test_multiple_inheritance_buffer_last.<locals>.B.__buffer__  r  rY   r~   r  r  s   @@r:   r   r    r  rY   r   r  r  Nc                   &   a  ] tR tRt o R tRtV tR# )PTestPythonBufferProtocol.test_multiple_inheritance_buffer_last.<locals>.Releaseri  c                    Wn         R # r   r  rZ  s   &&r:   r[  cTestPythonBufferProtocol.test_multiple_inheritance_buffer_last.<locals>.Releaser.__release_buffer__  r  rY   r  N)r  r  r  r  r[  r  r  r  s   @r:   Releaserr    s     % %rY   r  c                   2   a a ] tR tRt oV 3R ltRtVtV ;t# )ITestPythonBufferProtocol.test_multiple_inheritance_buffer_last.<locals>.Ci  c                "   < \         SV `  V4      # r   r  r  s   &&r:   r  TTestPythonBufferProtocol.test_multiple_inheritance_buffer_last.<locals>.C.__buffer__  r  rY   r~   r  r  s   @@r:   r   r    r  rY   r   s   hello C)r  rJ   re  r#  r  rg  r   r  rT  r]  r   r   r  r  r   r   s   &       r:   %test_multiple_inheritance_buffer_last>TestPythonBufferProtocol.test_multiple_inheritance_buffer_last  s    	. 	.	19 	1 hK]]bRZZ\:6 	% 	%	1) 	1 jM]]bRZZ\:6 		z**HH +* ] ] +**s#   !D!D"*D5D	"D2	5E	c                "    ! R  R4      p ! R R\         V4      pV! R4      p\        V4      ;_uu_ 4       pV P                  VP                  4       R4       RRR4        ! R R4      p ! R R	\         V4      pV! R4      p\        V4      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       VP	                  4        V P                  VP                  R4       R#   + '       g   i     L; i  + '       g   i     LQ; i)
c                   ,   a  ] tR tRt o R tR tRtV tR# )QTestPythonBufferProtocol.test_multiple_inheritance_buffer_last_raising.<locals>.Ai  c                    \        R 4      hzshould not be calledr   r1  s   &&r:   r  \TestPythonBufferProtocol.test_multiple_inheritance_buffer_last_raising.<locals>.A.__buffer__      "#9::rY   c                    \        R 4      hr   r  rZ  s   &&r:   r[  dTestPythonBufferProtocol.test_multiple_inheritance_buffer_last_raising.<locals>.A.__release_buffer__  r  rY   r~   Nr  r  s   @r:   r]  r    s     ;; ;rY   r]  c                   2   a a ] tR tRt oV 3R ltRtVtV ;t# )QTestPythonBufferProtocol.test_multiple_inheritance_buffer_last_raising.<locals>.Bi  c                "   < \         SV `  V4      # r   r  r  s   &&r:   r  \TestPythonBufferProtocol.test_multiple_inheritance_buffer_last_raising.<locals>.B.__buffer__  r  rY   r~   r  r  s   @@r:   r   r    r  rY   r   r  Nc                   *   a  ] tR tRt o RtR tRtV tR# )XTestPythonBufferProtocol.test_multiple_inheritance_buffer_last_raising.<locals>.Releaseri  Nc                    Wn         R # r   r  rZ  s   &&r:   r[  kTestPythonBufferProtocol.test_multiple_inheritance_buffer_last_raising.<locals>.Releaser.__release_buffer__  r  rY   r  )r  r  r  r  r  r[  r  r  r  s   @r:   r  r    s     F% %rY   r  c                   2   a a ] tR tRt oV 3R ltRtVtV ;t# )QTestPythonBufferProtocol.test_multiple_inheritance_buffer_last_raising.<locals>.Ci  c                "   < \         SV `  V4      # r   r  r  s   &&r:   r  \TestPythonBufferProtocol.test_multiple_inheritance_buffer_last_raising.<locals>.C.__buffer__  r  rY   r~   r  r  s   @@r:   r   r    r  rY   r   )r  rJ   re  r#  r  rd  r  r  s   &       r:   -test_multiple_inheritance_buffer_last_raisingFTestPythonBufferProtocol.test_multiple_inheritance_buffer_last_raising  s    	; 	;	1	1 	1 hK]]bRZZ\84 	% 	%
	1	8 	1 hK]]bRZZ\84 		ahh%! ] ]s   !C+!C>+C;	>D	c           	     .    ! R  R4      p\        ^4      p\        V4      ;_uu_ 4        V P                  \        4      ;_uu_ 4        VP	                  V! 4       4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)c                   ,   a  ] tR tRt o R tR tRtV tR# )JTestPythonBufferProtocol.test_release_buffer_with_exception_set.<locals>.Ai  c                *    \        \        ^4      4      # )r2   )rJ   rQ   r1  s   &&r:   r  UTestPythonBufferProtocol.test_release_buffer_with_exception_set.<locals>.A.__buffer__  s    !%(++rY   c                    R # r   r~   )rT  r  s   &&r:   r[  ]TestPythonBufferProtocol.test_release_buffer_with_exception_set.<locals>.A.__release_buffer__  s    rY   r~   Nr  r  s   @r:   r]  r    s     , rY   r]  N)r  rJ   rg  rs  rr  )rT  r]  r   s   &  r:   &test_release_buffer_with_exception_set?TestPythonBufferProtocol.test_release_buffer_with_exception_set  s[    	 	 aL]]"";// 0 ]// ]]s#   BA0	B0B ;BB	r~   )r  r  r  r  r7  rJ  rb  ro  r  r  unittestskipIfr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  s   @r:   r+  r+  y  s     6?&","2%5N+ __Y$&(<=, >,  __Y$&(<=D >D
 __Y$&(<=2 >2 __Y$&(<=	5 >	51+ '<5&6(8&> rY   r+  __main__r  r%   r#   )ir*   )i r  )r   i   )r  r  )r   l        r(   rO  r'   )r<   r=   r>   r?   r@   rA   )r<   r  2r  )r   NN)r  r0   r~   )r  r0   )r   r   r#  )r  )lr%  r  testr   test.supportr   r  	itertoolsr   r   randomr   r   r	   warningsrI  rH   r  osdecimalr
   	fractionsr   r   _testbufferr  r   r4   r  EnvironmentVarGuardenvironcatch_warningsrI   r  r  
SHORT_TESTNATIVEr5   r6   STANDARDr;   rP   r7   copyr   ARRAYr*  BYTEFMTri   rk   rh   rX   ra   re   rs   ru   rw   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  r   r<  r@  rM  rU  rZ  r[  
skipUnlessTestCaserO  r+  r  main)r   s   0r:   <module>r6     sv       "  + , ,      (		&	&	(	(BJ		 	 	"	"0 
# 
)
 


q
a
Q

q
a
Q
 
 q
 a
 Q
 	
 q	
 a	
 Q	
 ss	C!ss 3y3y3z3z3z3z301d7QW	. v 
s||-c2S  [[]
 		A!H 
 ++-	A:AJ 
  	.0CD	#5	"5$5$5 -0(2$ &clDl.2C11lD%!


0CI,2<?4
=:~
*):V9;1@B	8 C
0%
	3!
& 
	
JFHI!NL 
VDE	WEFp9*** p9* G Fp9*fs\x00 \~
 zMMO sU  G
  F
  F
 
#	"	" 
)	(	(  K
  I< << L Es   M= N N "O ;ON-	!O)O 2O% O5 P&P=	N
	N
	NN	N*)N*-N>8	OO	O O 	O"!O"%	O21O25P
	P
