+
    Bi                        ^ RI t ^ RIt^ RIHt ^ RIHt ]P
                  ! R4      t]P
                  ! R4      tRt ! R R]	4      t
 ! R R4      t ! R	 R
4      t ! R R] P                  4      t]R8X  d   ] P                   ! 4        R# R# )    N)import_helper	_testcapi_testlimitedcapic                       ] tR t^tRtR# )IntSubclass N)__name__
__module____qualname____firstlineno____static_attributes__r       //usr/lib/python3.14/test/test_capi/test_long.pyr   r      s    r   r   c                   ,   a  ] tR t^t o R tR tRtV tR# )Indexc                    Wn         R # Nvalue)selfr   s   &&r   __init__Index.__init__   s    
r   c                    V P                   # r   r   r   s   &r   	__index__Index.__index__   s    zzr   r   N)r	   r
   r   r   r   r   r   __classdictcell____classdict__s   @r   r   r      s      r   r   c                   ,   a  ] tR t^t o R tR tRtV tR# )MyIndexAndIntc                    ^
# )
   r   r   s   &r   r   MyIndexAndInt.__index__       r   c                    ^# )   r   r   s   &r   __int__MyIndexAndInt.__int__   r%   r   r   N)r	   r
   r   r   r   r(   r   r   r   s   @r   r!   r!      s      r   r!   c                   T  a  ] tR t^ t o R tR tR tR tR tR t	R t
R tR	R
RRR]/R l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]P@                  ! R3R R!7      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.R0 t/R1t0V t1R2# )4	LongTestsc                   0 R  \        ^B4       4       mR \        ^B4       4       mR \        ^B4       4       mR \        ^B4       4       mR \        ^4       4       mR \        ^4       4       m FV  pV P                  VR7      ;_uu_ 4        \        P                  V4      w  r#V'       d   V P	                  W4       RRR4       KX  	  R#   + '       g   i     Km  ; i)c              3   4   "   T F  p^V,          x  K  	  R# 5i   Nr   .0ns   & r   	<genexpr>)LongTests.test_compact.<locals>.<genexpr>%   s     &IqaddI   c              3   6   "   T F  p^V,          ) x  K  	  R# 5ir.   r   r0   s   & r   r3   r4   &   s     'Yq!teY   c              3   B   "   T F  p^V,          ^,
          x  K  	  R# 5ir.   r   r0   s   & r   r3   r4   '   s     *	1adQhh	s   c              3   D   "   T F  p^V,          ) ^,           x  K  	  R# 5ir.   r   r0   s   & r   r3   r4   (   s     +Aq!teaiis    c              3   4   "   T F  p^%V,          x  K  	  R# 5i%   Nr   r0   s   & r   r3   r4   *   s     'Yb!eeYr5   c              3   6   "   T F  p^%V,          ) x  K  	  R# 5ir;   r   r0   s   & r   r3   r4   +   s     (ir1ufir7   )r2   N)rangesubTestr   call_long_compact_apiassertEqual)r   r2   
is_compactr   s   &   r   test_compactLongTests.test_compact"   s    	
&E"I&	
 (U2Y'	
 +b	*		

 ,r+	
 (U2Y'	
 )eBi(	
A ""$-$C$CA$F!
$$Q. #"	
 #""s   1CCc                J   V P                  \        P                  R4      R4       V P                  \        P                  ^ 4      R4       V P                  \        P                  R4      R4       V P                  \        P                  \        P                  4      R4       R# )      N)TrH   )Tr   )TrG   )FrH   )rA   r   r@   sysmaxsizer   s   &r   test_compact_knownLongTests.test_compact_known2   sw     	88<jI88;YG88={K88E$	&r   c                   \         P                  pV P                  V! ^4      4       V P                  V! R4      4       V P                  V! R4      4       V P                  V! R4      4       V P                  V! \        ^4      4      4       V P	                  V! R4      4       V P	                  V! \        4       4      4       R# rF   l   
~l!]c T      ?NrH   )r   pylong_check
assertTruer   assertFalseobjectr   checks   & r   test_long_checkLongTests.test_long_check;   s     --a!<=>b	"d$k!n-.s$vx)r   c                   \         P                  pV P                  V! ^4      4       V P                  V! R4      4       V P                  V! R4      4       V P                  V! R4      4       V P                  V! \	        ^4      4      4       V P                  V! R4      4       V P                  V! \        4       4      4       R# rN   )r   pylong_checkexactrQ   rR   r   rS   rT   s   & r   test_long_checkexactLongTests.test_long_checkexactG   s     22a!<=>b	"t%{1~./s$vx)r   c           	        \         P                  p\        P                  P                  pR RRR	R
RRW") 3	 FG  pV P                  VR7      ;_uu_ 4        V P                  V! V4      \        V4      4       RRR4       KI  	  V P                  \        V\        R4      4       V P                  \        V\        R4      4       V P                  \        V\        R4      4       R#   + '       g   i     K  ; i)g      @gffffff@g@g        r   Ninfz-infnangffffffgg       )r   pylong_fromdoublerI   
float_infomaxr?   rA   intassertRaisesOverflowErrorfloat
ValueError)r   
fromdouble	float_maxr   s   &   r   test_long_fromdoubleLongTests.test_long_fromdoubleS   s    %77
NN&&	3T4dIzREE**  E!2CJ? +* S 	-U5\B-U6]C*j%,?	 +**s   "C##C4c                $   \         P                  p\        4       pV! V4      pV! \        4      pV P	                  V\
        4       V P                  V^ 4       V P	                  V\
        4       V P                  V^ 4       V P                  W44       R# )r   N)	r   pylong_fromvoidptrrS   NULLassertIsInstancerb   assertGreaterEqualrA   assertNotEqual)r   fromvoidptrobjxys   &    r   test_long_fromvoidptrLongTests.test_long_fromvoidptr^   sv    &99ha%1%a%AA!r   c                6   \         P                  pV P                  V! R ^
4      R4       V P                  V! R^4      R4       V P                  V! R^$4      R4       V P                  V! R ^ 4      R4       V P                  V! R^ 4      R4       V P                  \        VR^ 4       V P                  V! R^
4      R4       V P                  V! R^
4      R4       V P                  V! R^
4      R4       V P                  \        VR^
4       V P                  \        VR^
4       V P                  \        VR ^4       V P                  \        VR R4       V P                  \        VR ^%4       V P                  \        VR	P                  4       ^ 4       V P                  \        VR	P                  4       ^4       V P                  V! R
^ 4      R4       V P                  V! R^ 4      R4       V P                  V! R
^4      R4       V P                  V! R^4      R4       R# )s   123s   cafes   xyzs   0xcafes   -123s    -123 s   1_23s   - 123r      ١٢٣٤٥٦٧٨٩٠s   123 s   123 456N){      )     )  rz   )r{      )r|   )r   r~   )ry   r|   rH   )i#  rz   )r   pylong_fromstringrA   rc   rf   encode)r   
fromstrings   & r   test_long_fromstringLongTests.test_long_fromstringj   s   %77
FB/:GR0+>FB/<FA.9Iq1;?*j'1=GR0)<Ir2I>GR0(;*j(B?*j#r:*j&!<*j&"=*j&"=*j2H2O2O2QSTU*j2H2O2O2QSUVJ2H=M15x@J3Z@M26
Cr   c                   \         P                  pV P                  V! R ^
4      ^{4       V P                  V! R^4      R4       V P                  V! R^$4      R4       V P                  V! R ^ 4      ^{4       V P                  V! R^ 4      R4       V P                  \        VR^ 4       V P                  V! R^
4      R4       V P                  V! R^
4      R4       V P                  V! R^
4      ^{4       V P                  \        VR	^
4       V P                  \        VR
^
4       V P                  \        VR ^4       V P                  \        VR R4       V P                  \        VR ^%4       V P                  V! R^ 4      R4       V P                  V! R^4      R4       V P                  \        VR^ 4       V P                  \        VR^ 4       V P                  \        VR^4       V P                  \        VR^4       R# )123cafer{   xyzr}   0xcafez-123z -123 1_23z- 123 rx   iIl   xhH z123 z123 456Nr   rH   )r   pylong_fromunicodeobjectrA   rc   rf   )r   fromunicodeobjects   & r   test_long_fromunicodeobject%LongTests.test_long_fromunicodeobject   s   %>>*5"5s;*626?*5"5u=*5!4c:*8Q7@*&7C*626=*8R8$?*626<*&7"E*&7R@*&7B*&7C*&7C*+A1EzR*+A2FU*&7AF*&7qI*&7BG*&7rJr   	use_indexTmaskFnegative_value_errorc          
        ^ ^RRV3pV^ 8  d   VR	R
RV3,          pV F  pV P                  VR7      ;_uu_ 4        V P                  V! V4      V4       V P                  V! \        V4      4      V4       V'       d"   V P                  V! \        V4      4      V4       RRR4       K  	  V'       d"   V P                  V! \	        4       4      ^
4       M?V P                  \        V\        ^*4      4       V P                  \        V\	        4       4       V'       d~   V P                  V! V^,
          4      V4       V P                  V! V^,           4      V4       V P                  V! R	R,          4      ^ 4       V P                  V! ^R,          4      ^ 4       MmV P                  WaV^,
          4       V P                  WaR	R,          4       V P                  \        W^,           4       V P                  \        V^R,          4       V P                  \        VR4       V P                  \        VR4       V P                  \        VR4       V P                  \        V\        4       R#   + '       g   i     EKZ  ; i)r        r   N  rO      23rH    i.)
r?   rA   r   r   r!   rc   	TypeErrorrd   SystemErrorrm   )	r   funcmin_valmax_valr   r   r   valuesr   s	   &&&&$$$  r   check_long_asintLongTests.check_long_asint   s   
 QT7+Q;r400FEE**  ee4  k%&8!95A$$T%,%7?	 +*  T-/2B7iuRy9i}?T'A+.8T'A+.8T"*-q1T!t)_a02'A+F2"*EmTQ;?mT19=)T3/)T40)T3/+tT23 +**s   A#I&&I8c           
     j   W#R^ ^R3 F  pV P                  VR7      ;_uu_ 4        V P                  V! V4      V^ 34       V P                  V! \        V4      4      V^ 34       V P                  V! \        V4      4      V^ 34       RRR4       K  	  V P                  V! \	        4       4      R4       V P                  V! V^,
          4      R4       V P                  V! V^,           4      R4       V P                  \        VR4       V P                  \        VR4       R#   + '       g   i     EK*  ; i)	rF   r   r   NrO   rH   )r#   r   )rH   rH   )rH   rF   )r?   rA   r   r   r!   rc   r   r   )r   r   r   r   r   s   &&&& r   check_long_asintandoverflow%LongTests.check_long_asintandoverflow   s    Aq$7EE**  euaj9  k%&8!9E1:F  eEl!3eQZ@ +* 8 	mo.8gk*H5gk*H5+tT2)T3/ +**s   A!D  D2c                Z    \         P                  p^ RIHpHp V P                  WV4       R# )r   )INT_MININT_MAXN)r   PyLong_AsIntr   r   r   r   )r   r   r   r   s   &   r   test_long_asintLongTests.test_long_asint   s     '44.lW=r   c                Z    \         P                  p^ RIHpHp V P                  WV4       R# r   )LONG_MINLONG_MAXN)r   pylong_aslongr   r   r   r   )r   aslongr   r   s   &   r   test_long_aslongLongTests.test_long_aslong   s     !//0f9r   c                Z    \         P                  p^ RIHpHp V P                  WV4       R# r   )r   pylong_aslongandoverflowr   r   r   r   )r   aslongandoverflowr   r   s   &   r   test_long_aslongandoverflow%LongTests.test_long_aslongandoverflow   s"    ,EE0(():hOr   c                \    \         P                  p^ RIHp V P	                  V^ VRR7       R# )r   	ULONG_MAXFr   N)r   pylong_asunsignedlongr   r   r   )r   asunsignedlongr   s   &  r   test_long_asunsignedlong"LongTests.test_long_asunsignedlong   s,    )??'na05 	 	7r   c                \    \         P                  p^ RIHp V P	                  V^ VRR7       R# )r   r   Tr   N)r   pylong_asunsignedlongmaskr   r   r   )r   asunsignedlongmaskr   s   &  r   test_long_asunsignedlongmask&LongTests.test_long_asunsignedlongmask   s)    -GG'0!YTJr   c                Z    \         P                  p^ RIHpHp V P                  WV4       R# r   )	LLONG_MIN	LLONG_MAXN)r   pylong_aslonglongr   r   r   r   )r   
aslonglongr   r   s   &   r   test_long_aslonglongLongTests.test_long_aslonglong   s     %77
2jY?r   c                Z    \         P                  p^ RIHpHp V P                  WV4       R# r   )r   pylong_aslonglongandoverflowr   r   r   r   )r   aslonglongandoverflowr   r   s   &   r   test_long_aslonglongandoverflow)LongTests.test_long_aslonglongandoverflow   s"     0 M M2(()>9Ur   c                \    \         P                  p^ RIHp V P	                  V^ VRR7       R# )r   
ULLONG_MAXFr   N)r   pylong_asunsignedlonglongr   r   r   )r   asunsignedlonglongr   s   &  r   test_long_asunsignedlonglong&LongTests.test_long_asunsignedlonglong  s)    -GG(0!Z5Qr   c                \    \         P                  p^ RIHp V P	                  V^ VRR7       R# )r   r   Tr   N)r   pylong_asunsignedlonglongmaskr   r   r   )r   asunsignedlonglongmaskr   s   &  r    test_long_asunsignedlonglongmask*LongTests.test_long_asunsignedlonglongmask
  s)    !1!O!O(4a$Or   c                ^    \         P                  p^ RIHpHp V P                  WVRR7       R# )r   )PY_SSIZE_T_MINPY_SSIZE_T_MAXFr   N)r   pylong_as_ssize_tr   r   r   r   )r   
as_ssize_tr   r   s   &   r   test_long_as_ssize_tLongTests.test_long_as_ssize_t  s*    %77
<j.(- 	 	/r   c                \    \         P                  p^ RIHp V P	                  V^ VRR7       R# )r   )SIZE_MAXFr   N)r   pylong_as_size_tr   r   r   )r   	as_size_tr   s   &  r   test_long_as_size_tLongTests.test_long_as_size_t  s'    $55	&iHFr   c           	     n   \         P                  p\        \        P                  P
                  4      pV) VR^ ^R3 Fc  pV P                  VR7      ;_uu_ 4        V P                  V! V4      \        V4      4       V P                  V! V4      \        4       RRR4       Ke  	  V P                  V! \        ^*4      4      R4       V P                  \        V\        ^*4      4       V P                  \        V\        4       4       V P                  \        V^V,          4       V P                  \        VR	V,          4       V P                  \        VR4       V P                  \        VR4       V P                  \        VR4       V P                  \         V\"        4       R#   + '       g   i     EKw  ; i)
rF   r   r   Ng      E@rO   r   r   rH   )r   pylong_asdoublerb   rI   r`   ra   r?   rA   re   rn   r   rc   r   r   r!   rd   r   rm   )r   asdoubleMAXr   s   &   r   test_long_asdoubleLongTests.test_long_asdouble  sD   #33#..$$%dCQ40EE**  %%,?%%huou= +* 1
 	+b/2D9)XuRy9)X}?-1s7;-28<)Xs3)Xt4)Xs3+x6 +**s   >F""F4c                   \         P                  p\         P                  p\        4       pV! V4      pV! \        4      pV P                  V! V4      V4       V P                  V! V4      \        4       V P                  V! \        V4      4      V4       ^\        P                  ^,          ,          pWF^,          8  d   V P                  V! WF,
          4      V4       WV^,          8  d#   V P                  V! WV,
          4      \        4       V P                  \        V\        V4      4       V P                  \        V\        4       4       V P                  \        V^R,          4       V P                  \        V^R,          ) 4       R# )rF   r   N)r   rl   pylong_asvoidptrrS   rm   assertIsr   r   SIZEOF_VOID_Prc   r   r   rd   )r   rq   	asvoidptrrr   rs   rt   Ms   &      r   test_long_asvoidptrLongTests.test_long_asvoidptr1  s   &99$55	hilC(ilD)iA/5 )))A--19MM)AE*C019MM)AE*D1)Ya9)Y9-AtG<-QWH=r   c                    ^ RI Hp ^V,          p^V^,
          ,          ) p^V^,
          ,          ^,
          pV P                  WV4       R# )r   )SIZEOF_PID_TN)r   r   r   )r   aspidr   bits	PID_T_MIN	PID_T_MAXs   &&    r   _test_long_aspidLongTests._test_long_aspidI  s?    *<a[L	QK!O	e	:r   c                D    V P                  \        P                  4       R # r   )r  r   pylong_aspidr   s   &r   test_long_aspidLongTests.test_long_aspidQ  s    i445r   c                D    V P                  \        P                  4       R # r   )r  r   r  r   s   &r   test_long_aspid_limited!LongTests.test_long_aspid_limitedT  s    .;;<r   gffffff?)memusec                   \         P                  p^V,          p\        V^,          ^,          ^
,           4      pV! W4^ R4      pV P                  WQ^,          ^,           4       V P                  VP	                  ^ 4      \        V4      4       V! W4\        V4      R4      pV P                  WQ^,          ^,           4       V P                  VP	                  ^ 4      \        V4      ^,
          4       R# )rF   NrH   )r   pylong_asnativebytes	bytearrayrA   countlen)r   sizeasnativebytesvbufferrs   &&    r   test_long_asnativebytes_huge&LongTests.test_long_asnativebytes_hugeW  s    !66I4!8r>B./!Q+AIM*a#f+6!S["5AIM*a#f+/:r   c                   ^ RI p^ RIHpHp \	        VP                  VP                  V^,           4      VP                  ^4      ,          4      ^,          4      p^V^,          ^,
          ,          ^,
          p^V^,          ,          ^,
          p\        P                  '       d   \        RV RVR RVR 24       ^ V3RV3RV3WT3Wd^,           3V) V3V) V^,           3^^,          ^,
          ^ 3^^,          ^,
          ) ^ 3^^,          ^!3^^,          ) ^!3^R,          ^,
          ^!3^R,          ^,
          ) ^!3^R,          ^!3^R,          ) ^!33 F  w  rxV P                  R	VR
 24      ;_uu_ 4        \        R4      p	V P                  W! Wy^ R 4      R4       V P                  V	RR4       V P                  W! \        V4      V	^ ^4      R4       V P                  V	RR4       RRR4       K  	  \        R!4      p	V P                  ^V! ^V	^^ 4      R4       V P                  V	R4       V P                  ^V! ^V	^^4      R4       V P                  V	R4       . R"NR#N^ R$\        ^V4      3NR%N^R&\        ^V4      3NR'N^*R(\        ^V4      3NR)NR R*\        ^V4      3NR,NR+R-\        ^V4      3NR.NR/NR0N^R1\        ^V4      3NR2NR3NR4NR5N^^,          ^,
          R6^ 3N^^,          ^,
          ) R7^ 3N^^,          ^,
          ) R8^ 3N^^,          ^,
          ) R9^ 3N^R,          ^,
          R:^!3N^R,          ^,
          R;^!3N^R,          ^,
          ) R<^!3N^R,          ^,
          ) R=^!3N^R,          ^,
          ) R>^!3N^^,          ) R?^ 3N^^,          ) R@^!3NRAN F  w  rzpV P                  VR
 R\        V
4       R24      ;_uu_ 4        \        V
4      p\        RV,          4      p	V
RRR 1,          pV P                  W! WyV^ 4      RV R24       V P                  WRV R4       V P                  W! WyV^4      RV R24       V P                  WRV R4       RRR4       K  	  RBR/RCR3^R,          ^,
          R:^ 3^R,          ^,
          R;^!33 F  w  rzpV P                  VR
 R\        V
4       R24      ;_uu_ 4        \        V
4      p\        RV,          4      p	V P                  W! WyV^4      RV R24       V P                  W! WyV^4      RV R24       RRR4       K  	  V P!                  \"        4      ;_uu_ 4        V! R V	^ ^4       RRR4       V P!                  \$        4      ;_uu_ 4        V! \        ^4      V	^ R 4       RRR4       V P!                  \$        4      ;_uu_ 4        V! \        ^4      V	^ ^4       RRR4       V P!                  \$        4      ;_uu_ 4        V! RV	^ R 4       RRR4       R#   + '       g   i     EK  ; i  + '       g   i     EK  ; i  + '       g   i     EK  ; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)Dr   Nr  r   zSIZEOF_SIZE=z
MAX_SSIZE=016Xz
MAX_USIZE=r   rG   zsizeof-X   Zz)PyLong_AsNativeBytes(v, <unknown>, 0, -1)z/buffer overwritten when it should not have beenz0PyLong_AsNativeBytes(Index(v), <unknown>, 0, -1)z5PyLong_AsNativeBytes(v, <3 byte buffer>, 2, 0)  // BEs    z5PyLong_AsNativeBytes(v, <3 byte buffer>, 2, 1)  // LEs    -bytes   z PyLong_AsNativeBytes(v, buffer, , <big>)z<big>, <little>)z<little>zbytes-unsigned, <big|unsigned>)z, <little|unsigned>)znot a numberr   rH   s   )r       rF   )r   s     r/   s           )rF      rF   s             )*      *rF   s             *)rH      rF   s
   )r'     rF   s   )   r&  r/   )r)      r/   )rG   s    r/   s          )                      	   )r+  s	           r-  )         r,     )r.  s	          r-  s    s                                  s!                                 s"                                 s    s!    s                                   s!                                  s"                                  s                                   s!                                  )i@ s    @r|   )r)  r&  rF   )r+  r,  r/  )mathr   r  r   rb   ceillogsupportverboseprintr?   r  rA   r   minr  rc   rf   r   )r   r0  r  r   SZ	MAX_SSIZE	MAX_USIZEr  expectr  	expect_beexpect_nr2   	expect_les   &             r   test_long_asnativebytes!LongTests.test_long_asnativebytesc  sP   	
 488HqL1DHHQK?@1DE"q&1*%)	"q&MA%	???LMy$&7})T9JKL G"I2JOQZZa VAXrN#vax["VRL#vYOVAXrN#vax["VRL#vYO
IA" !uo.."7+  q!R)H?A  EG   uQxF)SFH  EG /.#
> 9%M!VQ:C	E1M!VQ:C	E12'
22'
22'
 Ar
;2'
 3	2'

 .B<2'
 32'
 .B<2'
 32'
 B<2'
 32'
 .B<2'
 32'
 32'
  3!2'
" -Ar
;#2'
& 3'2'
( 6)2'
, 3-2'
. 6/2'
2 VAX2BG32'
4 #vax[<BG52'
8 #vax[@BG92'
: #vax[DbI;2'
D VAXLBGE2'
F VAX2BGG2'
H #vax[2BGI2'
J #vax[<BGK2'
L #vax[@BGM2'
T #vY2BGU2'
V #vY6BGW2'
b 2c2'
"A(f 1Qs9~&6e<==	N #719-%ddO	  =Aq+I6qcBD  2AJ@  =Aq+I6qcEG  2AJ
C >=g2'
H 3225VAX3VAX.3'
"A( 1Qs9~&6nEFF	N"719-  =Aq+I6qc9JKM  =Aq+I6qc9MNP GF'
, z**"fa+ + y))%(FAr2 *y))%(FAq1 * y)).&!R8 *) /..Z >==: GFF +* *))) *))sW   2A0W:BX<AX$?X90Y*Y$Y2:XX!$X69Y		Y	Y/	2Z	c                   ^ RI p^ RIHp ^ RIHpHp \        VP                  VP                  V^,           4      VP                  ^4      ,          4      ^,          4      pV! 4       p\        R4      p\        R4       EF  pVP                  ^R4      p	\        VP                  ^R4      .\        V	^,
          4       Uu. uF  qP                  R4      NK  	  upO4      p
V
RRR1,          p\        P                  VR4      pWY3;rV
^ ,          ^,          '       d   WY^,           3pV	3p V! W^ R4      pV P                  W4       V! W\        V4      ^ 4      pV P                  W4       V P!                  WV	) R 4       V! W\        V4      ^4      pV P                  W4       V P!                  WRV	 4       V! WV	^4      pV P                  WV
P#                  4       4       V! WV	^4      pV P                  WV
P#                  4       4       EK  	  R# u upi   \$         d   pRP'                  \)        \+        T^R	7       UUu. uF  w  ppTR
 T^,          '       d   RMR 2NK   	  Mu uppi upp4      4      P-                  R4      p\.        P0                  '       d0   \3        4        \3        T	R4       \3        RT4       \3        RT4       h \%        RT 24      ThRp?ii ; i)r   N)Randomr  i  r   rG   littler   )start02X_r  zhex =zint =z	Value: 0xrH   )r0  randomrA  r   r  r   rb   r1  r2  r  r>   	randranger  
from_bytesassertInr  rA   hexAssertionErrorjoinreversed	enumeratestripr3  r4  r5  )r   r0  rA  r  r   r7  rngr  rE  r2   bytes_bebytes_ler  expect_1expect_2actualexib	value_hexs   &                   r   test_long_asnativebytes_fuzz&LongTests.test_long_asnativebytes_fuzz
  s   !	
 488HqL1DHHQK?@1DEh3tAa%Aa% /4AEl;l--$l; H
  "~Hx2A#%')H{T!! A; 4F&q!R8f/&q#f+qAf/  1"#;7&q#f+qAf/  "1:6&q!Q7f?&q!Q7f?E 
 << " FGGH )(! <. <1 gAEEbs34 <. %  E#J  ???G!W%'9-'1%$y%<=2EFs7   >H)C HK  K I%
I%$7K>KKc                   ^ RI p^ RIHpHp \	        VP                  VP                  V^,           4      VP                  ^4      ,          4      ^,          4      p^V^,          ^,
          ,          ^,
          p^V^,          ,          ^,
          pR EF+  w  rxp	V P                  V RV	R R\        V4       R24      ;_uu_ 4        \        V4      p
VRRR1,          pV P                  W! Wz^ ^4      RV
 R24       V P                  W! W^^4      RV
 R24       V P                  W! Wz^ ^ 4      R	V
 R24       V P                  W! W^^ 4      R	V
 R24       W{8X  d=   V P                  W! WzR^4      RV
 R
24       V P                  W! WzR^ 4      R	V
 R
24       V P                  W! Wz^^4      RV
 R24       RRR4       EK.  	  R#   + '       g   i     EKD  ; i)r   N)pylong_fromnativebytesr   r  r  r  zPyLong_FromNativeBytes(buffer, r  r   z'PyLong_FromUnsignedNativeBytes(buffer, z, <native>)r!  rH   ))r"  r   r   )r#  rF   rF   )r&  rH   r)  )r*  r)  r)  )s   rH   i  )
r0  r   r]  r   rb   r1  r2  r?   r  rA   )r   r0  fromnativebytesr   r7  r8  r9  v_beexpect_sexpect_ur2   v_les   &           r   test_long_fromnativebytes#LongTests.test_long_fromnativebytesI  s   	
 488HqL1DHHQK?@1DE"q&1*%)	"q&MA%	)
$DH 
!HQ<qT5IJJIDbDz  ?4Aq+I5aSAC  ?4Aq+I5aSDF  ?4Aq+I=aSIK  ?4Aq+I=aSLN
 <$$XtA/N9!KHJ$$XtA/NA!KPR
   ?4Aq+I5aS8IJL/ KJ)
 KJJs   C0GGc                   \         P                  pV P                  V! ^4      ^4       V P                  V! R4      ^4       V P                  V! R4      R4       V P                  V! ^ 4      ^ 4       V P                  V! R4      ^4       V P                  V! \        R4      4      R4       V P                  V! R4      ^ 4       V P	                  \
        VR4       V P	                  \
        V\        ^{4      4       R# )	rF   i@ TFrO   Nr   rH   i)r   pylong_getsignrA   r   rc   r   r   )r   getsigns   & r   test_long_getsignLongTests.test_long_getsignv  s    **Q'!,b)Q'*S!12B7+)Wc2)WeCj9r   c                   \         P                  pV P                  V! ^4      ^4       V P                  V! ^{4      ^4       V P                  V! R4      ^ 4       V P                  V! ^ 4      ^ 4       V P                  V! R4      ^4       V P                  V! R4      ^ 4       V P                  V! \        R4      4      ^ 4       V P	                  \
        VR4       V P	                  \
        V\        ^{4      4       R# rF   TFrO   NrH   )r   pylong_ispositiverA   r   rc   r   r   )r   
ispositives   & r   test_long_ispositiveLongTests.test_long_ispositive      00
A*C!,B+A*D)1-E*A.KO4a8)Z5)Zs<r   c                   \         P                  pV P                  V! ^4      ^ 4       V P                  V! ^{4      ^ 4       V P                  V! R4      ^4       V P                  V! ^ 4      ^ 4       V P                  V! R4      ^ 4       V P                  V! R4      ^ 4       V P                  V! \        R4      4      ^4       V P	                  \
        VR4       V P	                  \
        V\        ^{4      4       R# rk  )r   pylong_isnegativerA   r   rc   r   r   )r   
isnegatives   & r   test_long_isnegativeLongTests.test_long_isnegative  rp  r   c                   \         P                  pV P                  V! ^4      ^ 4       V P                  V! R4      ^ 4       V P                  V! ^ 4      ^4       V P                  V! R4      ^ 4       V P                  V! R4      ^4       V P                  V! \        R4      4      ^ 4       V P                  V! \        ^ 4      4      ^4       V P	                  \
        VR4       V P	                  \
        V\        ^{4      4       R# rk  )r   pylong_iszerorA   r   rc   r   r   )r   iszeros   & r   test_long_iszeroLongTests.test_long_iszero  s    ((A&Q'A&q)*B0!4A/3)VS1)VU3Z8r   c                Z    \         P                  p^ RIHpHp V P                  WV4       R# )r   )	INT32_MIN	INT32_MAXN)r   pylong_asint32r   r|  r}  r   )r   to_int32r|  r}  s   &   r   test_long_asint32LongTests.test_long_asint32       #222h9=r   c                Z    \         P                  p^ RIHpHp V P                  WV4       R# )r   )	INT64_MIN	INT64_MAXN)r   pylong_asint64r   r  r  r   )r   as_int64r  r  s   &   r   test_long_asint64LongTests.test_long_asint64  r  r   c                d    \         P                  p^ RIHp V P	                  V^ V\
        R7       R# )r   )
UINT32_MAXr   N)r   pylong_asuint32r   r  r   rf   )r   	as_uint32r  s   &  r   test_long_asuint32LongTests.test_long_asuint32  ,    $44	(iJ3= 	 	?r   c                d    \         P                  p^ RIHp V P	                  V^ V\
        R7       R# )r   )
UINT64_MAXr  N)r   pylong_asuint64r   r  r   rf   )r   	as_uint64r  s   &  r   test_long_asuint64LongTests.test_long_asuint64  r  r   c           	         \         P                  p\        P                  4       pR VP                  RVP
                  RRR\         P                  R8X  d   RM^/pV P                  W#4       R# )bits_per_digit
digit_sizedigits_orderdigit_endiannessrB  NrH   )rI   int_infor   get_pylong_layoutr  sizeof_digit	byteorderrA   )r   r  layoutexpecteds   &   r   test_long_layoutLongTests.test_long_layout  s]    <<,,.h55(//Bcmmx&?Q	
 	*r   c                   \         P                  4       p^VR,          ,          p\         P                  pV P                  V! ^ 4      ^ 4       V P                  V! ^{4      ^{4       V P                  V! R4      R4       V P                  V! \	        ^{4      4      ^{4       V P                  V! V^
,          ^,          ^,           4      ^ . RO34       V P                  V! V^
,          ^,          ^,           ) 4      ^. RO34       V P                  V! \	        V^
,          ^,          ^,           4      4      ^ . RO34       V P                  \        VR4       V P                  \        VR4       V P                  \        VR4       R# )r/   r  rO   y              ?abcNr   )rF   r   r   r   r   r   r   r   r   r   r/   )r   r  pylong_exportrA   r   rc   r   )r   r  baser  s   &   r   test_long_exportLongTests.test_long_export  sL   ,,.F+,,!// 	q)1-s+S1t,d3{3'78#> 	tRx!|a'78>?	ArA)9':;>?	A{48a<!3C'DE>?	A 	)]C8)]D9)]E:r   c           	     r  a \         P                  4       p^VR,          ,          o\         P                  pV P                  \        V^ . 4       V P                  \        VR. 4       V P                  V! ^ ^ .4      ^ 4       V P                  V! ^ ^{.4      ^{4       V P                  V! ^^{.4      R4       V P                  V! ^^^.4      S^,          ^,           ) 4       V P                  V! ^ . R	O4      S^,          ^,          S^,          ,           ^,           4       S^,
          pV P                  V! ^ W3V.4      S^,          V,          SV,          ,           V,           4       V P                  V! ^ . R
O4      ^{4       R F3  pV P                  V! \        V^ 8  4      \        V4      ^ .4      V4       K5  	  V3R lp\         P                  p. \        ^ ^
4      ORNRN^^d,          N^^d,          ^,
          NpVP                  R \        V4       4       4       V F  pV P                  VR7      ;_uu_ 4        V! V4      p\        V\        4      '       d   Vw  rM!Tp\!        V^ 8  4      p	V! \        V4      4      p
V P                  V! W4      VW34       RRR4       K  	  R#   + '       g   i     K  ; i)r/   r  c                 b   < . p \        V S4      w  rVP                  V4       V '       d   K*   V# )T)divmodappend)numdigitsdigitr  s   &  r   	to_digits3LongTests.test_longwriter_create.<locals>.to_digits  s2    F#C.
e$sMr   i90  l   >[= c              3   &   "   T F  q) x  K	  	  R # 5ir   r   )r1   r  s   & r   r3   3LongTests.test_longwriter_create.<locals>.<genexpr>  s     5}t}s   )r  Nr   )rF   r/   rz   )ry   r   r   )r   r   rF      r$  d   )r   r  pylongwriter_createrc   rf   rA   r   boolabsr  r>   extendlistr?   
isinstancetuplerb   )r   r  r  	max_digitr  r  r  numbersdatanegativer  r   r  s   &           @r   test_longwriter_create LongTests.test_longwriter_create  st   ,,.F+,,';;*&91bA*&94D,Q4a8,Q6<,Q6=,QA7!8a<	*,Q	:q1tax/!3	51H	,Qy0QRq9,ti/??)K	M 	,Q<cB *CMM-d37mc#h]K *	 "//FE!RLF%FFQVFQVAXF5tG}55C#&&$S)dE**'+$Hf E"519~H&s5z2F  !4X!F"*!35 '& &&&s   8AJ%%J6r   Nl        )2r	   r
   r   r   rC   rK   rV   rZ   ri   ru   r   r   rd   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r3  
bigmemtestr  r>  rZ  rc  rh  rn  rt  ry  r  r  r  r  r  r  r  r   r   r   s   @r   r+   r+       s    / &	*	*	@
"D<K<"3#'"3#"3 /<"3H0>:P7K@VRP/G7(>0;6= d+	; ,	;e9N=F~+LZ: ==9>>??
+;225 25r   r+   __main__)unittestrI   test.supportr3  r   import_moduler   r   rm   rb   r   r   r!   TestCaser+   r	   mainr   r   r   <module>r     s     
  & ''4	 ../AB 	# 	  D5!! D5N zMMO r   