+
    Biy                    Z   ^ RI t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIt^ RIt^ RI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Ht ^ RIHt ^ RIHt ^ R	IHt ^ R
IHt ^ RIHtH t H!t!  ^ RI"t" ^ RI$t$ ^ RI%t% ^ RI&t&]PP                  ! R4      t)^ RI)H*t*H+t+ ^ RI,t,^ RI-t-Rt.R t/R t0R t1 ! R R4      t2]P:                  '       g   RMRt3]Ph                   ! R R]Pj                  4      4       t6] ! R R]Pj                  4      4       t7 ! R R]Pj                  4      t8 ! R R]Pj                  4      t9]0 ! R R]Pj                  4      4       t:]0 ! R R ]Pj                  4      4       t; ! R! R"]Pj                  4      t< ! R# R$]Pj                  4      t=R=R% lt> ! R& R']Pj                  4      t? ! R( R)]Pj                  4      t@ ! R* R+]Pj                  4      tA]P                  ! 4        ! R, R-]Pj                  4      4       tC]P                  ! ]$RJ R.4       ! R/ R0]Pj                  4      4       tE ! R1 R2]Pj                  4      tF^dtG ! R3 R4]Pj                  4      tH]P                  ! ]P:                  R54       ! R6 R7]Pj                  4      4       tJ ! R8 R9]Pj                  4      tK ! R: R;]Pj                  4      tL]MR<8X  d   ]P                  ! 4        R# R#   ]# d    Rt" ELoi ; i  ]# d    Rt$ ELzi ; i  ]# d    Rt% ELi ; i  ]' d    Rt& ELi ; i)>    N)deque)support)MISSING_C_DOCSTRINGS)import_helper)threading_helper)warnings_helper)requires_limited_api) expected_failure_if_gil_disabled)Py_GIL_DISABLED)assert_python_failureassert_python_okrun_python_until_end	_testcapi)HeapCTypeSubclassHeapCTypeSubclassWithFinalizerc                 F    V P                  R R4      P                  RR4      # )utf-8replace )decoder   )errs   &//usr/lib/python3.14/test/test_capi/test_misc.pydecode_stderrr   ;   s     ::gy)11$;;    c                H    \         P                  ! \        RJ R4      ! V 4      # )z>Decorator to skip a test if subinterpreters are not supported.Nzsubinterpreters required)unittestskipIf_interpreters)meths   &r   requires_subinterpretersr!   ?   s%    ??=D0577;= =r   c                    V # )zsome doc selfs   &r   testfunctionr&   E   s    Kr   c                   Z    ] tR t^Jt]P                  ]4      t]P                  ]4      tRtR# )InstanceMethodr#   N)	__name__
__module____qualname____firstlineno__r   instancemethodidr&   __static_attributes__r#   r   r   r(   r(   J   s"    		!	!"	%B++L9Lr   r(   zCurrent thread.*:\nzStack .*:\nc                   $  a  ] tR t^Rt o R t]P                  ! 4       R 4       tR t]	P                  ! ]R4      R 4       t]	P                  ! ]R4      R 4       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]P4                  ! R4      ]P6                  ! 4       ]P8                  ! 4       R 4       4       4       t]P4                  ! R4      ]P6                  ! 4       ]P8                  ! 4       R 4       4       4       tR 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& t0R' t1R( t2R) t3R* t4R+ t5R, t6R- t7R. t8R/ t9R0 t:R1 t;R2 t<R3 t=R4 t>R5 t?R6 t@R7 tAR8tBV tCR9# ):CAPITestc                >   \        4       pV P                  \        V4      VP                  4       4       V P                  VP	                  4       VJ 4       V P                  VP                  P
                  \        P
                  4       V P                  \         P                  P
                  \        P
                  4       R \         P                  n        V P                  \        P                  R 4       V P                  \        \        VP                  RR 4       R# )test	attributeN)
r(   assertEqualr.   
assertTruer&   __doc__r4   assertRaisesAttributeErrorsetattrr%   insts   & r   test_instancemethodCAPITest.test_instancemethodU   s    D4779-))+t34**22L4H4HI44<<l>R>RS06##-//8.'43D3DkSYZr   c                *   \         P                  ! R 4      p\        RV4      w  r#Vw  rEpV P                  VR4       \        P
                  '       g   RP                  4       pMRP                  4       pV P                  VP                  4       V4       R# )z
            import _testcapi
            from test import support

            with support.SuppressCrashReport():
                _testcapi.crash_no_current_thread()
        -cr   zFatal Python error: PyThreadState_Get: the function must be called with the GIL held, after Python initialization and before Python finalization, but the GIL is released (the current Python thread state is NULL)a  Fatal Python error: PyThreadState_Get: the function must be called with an active thread state, after Python initialization and before Python finalization, but it was called without an active thread state. Are you trying to call the C API inside of a Py_BEGIN_ALLOW_THREADS block?N)	textwrapdedentr   r5   r   r   encodeassertStartsWithrstrip)r%   code
run_result	_cmd_line_rcoutr   msgs   &       r    test_no_FatalError_infinite_loop)CAPITest.test_no_FatalError_infinite_loop`   s        !5T4 @
"#c"&&&? AG	 ` bhagai	 
 	cjjlC0r   c                N    V P                  \        \        P                  4       R # N)r8   
ValueErrorr   !make_memoryview_from_NULL_pointerr$   s   &r   !test_memoryview_from_NULL_pointer*CAPITest.test_memoryview_from_NULL_pointer|   s    *i&Q&QRr   z(_posixsubprocess required for this test.c                    ! R  R\         4      pV P                  \        R4      ;_uu_ 4        \        P                  ! ^V! 4       RR^^^^^	^
^^^^RR^R^^^^4       RRR4        ! R R\         4      pV P                  \        \        P                  ^V! 4       RR^^^^^	^
^^^^RR^R^^^^4       R#   + '       g   i     L`; i)c                   &   a  ] tR t^t o R tRtV tR# )1CAPITest.test_seq_bytes_to_charp_array.<locals>.Zc                    ^#    r#   r$   s   &r   __len__9CAPITest.test_seq_bytes_to_charp_array.<locals>.Z.__len__       r   r#   Nr)   r*   r+   r,   rZ   r/   __classdictcell____classdict__s   @r   ZrV            r   ra   indexingTFNc                   ,   a  ] tR t^t o R tR tRtV tR# )rV   c                "    \         P                  # rO   )sysmaxsizer$   s   &r   rZ   r[      s    {{"r   c                    R # )   xr#   )r%   is   &&r   __getitem__=CAPITest.test_seq_bytes_to_charp_array.<locals>.Z.__getitem__       r   r#   N)r)   r*   r+   r,   rZ   rk   r/   r^   r_   s   @r   ra   rV      s     # r   rY      )objectassertRaisesRegex	TypeError_posixsubprocess	fork_execr8   MemoryErrorr%   ra   s   & r   test_seq_bytes_to_charp_array&CAPITest.test_seq_bytes_to_charp_array   s    	 	 ##Iz::&&ACVAa!AbBr"T$rRWXZ[]^`ace ;	 	
 	+'7'A'AACVAa!AbBr"T$rRWXZ[]^`ac	e ;:s   1B77C	c                     ! R  R\         4      pV P                  \        \        P                  V! 4       R.RR^^^^^	^
^^^^RR^R^^^^4       R# )c                   &   a  ] tR t^t o R tRtV tR# )-CAPITest.test_subprocess_fork_exec.<locals>.Zc                    ^# rX   r#   r$   s   &r   rZ   5CAPITest.test_subprocess_fork_exec.<locals>.Z.__len__   r\   r   r#   Nr]   r_   s   @r   ra   r{      rb   r   ra      1TFNrn   )rp   r8   rr   rs   rt   rv   s   & r   test_subprocess_fork_exec"CAPITest.test_subprocess_fork_exec   sa    	 	
 	)%5%?%?#tfT&1Qq2bBr$tTVW\]_`bcefh	jr   z6Signature information for builtins requires docstringsc                F   V P                  \        P                  P                  R 4       V P                  \        P                  P                  R 4       V P                  \        P
                  P                  R 4       V P                  \        P
                  P                  R 4       V P                  \        P                  P                  R4       V P                  \        P                  P                  R 4       V P                  \        P                  P                  R4       V P                  \        P                  P                  R 4       V P                  \        P                  P                  R4       V P                  \        P                  P                  R 4       V P                  \        P                  P                  R4       V P                  \        P                  P                  R4       V P                  \        P                  P                  R 4       V P                  \        P                  P                  R4       V P                  \        P                  P                  R4       V P                  \        P                  P                  R4       R # )Nz This docstring has no signature.z[docstring_with_invalid_signature($module, /, boo)

This docstring has an invalid signature.zedocstring_with_invalid_signature2($module, /, boo)

--

This docstring also has an invalid signature.z%This docstring has a valid signature.z($module, /, sig)z>
This docstring has a valid signature and some extra newlines.z($module, /, parameter))r5   r   no_docstringr7   __text_signature__docstring_emptydocstring_no_signature docstring_with_invalid_signature!docstring_with_invalid_signature2docstring_with_signature#docstring_with_signature_but_no_doc+docstring_with_signature_and_extra_newlinesr$   s   &r    test_docstring_signature_parsing)CAPITest.test_docstring_signature_parsing   s    	//77>//BBDI22::DA22EEtL99AA.	099LLdSCCKK7	
 	CCVVX\]DDLL<	 	DDWWY]^;;CC3	5;;NNPcdFFNNPTUFFYY	! 	NNVVM	ONNaa%	'r   c                   \         P                  pV! 4       pV! 4       pV P                  W#,          R W#34       V P                  V^*,          R V^*34       V P                  ^*V,          R ^*V34       TpWC,          pV P                  VRW#34       TpV^*,          pV P                  VRV^*34       ^*pWB,          pV P                  VR ^*V34       R# )matmulimatmulN)r   
matmulTyper5   )r%   Mm1m2os   &    r   &test_c_type_with_matrix_multiplication/CAPITest.test_c_type_with_matrix_multiplication   s      SS8R"45b8R"45b8R"45	Y/0	RYB/0	Xr2./r   c                    \         P                  4       pV P                  VP                  ^4      R4       V P                  VP                  ^^4      R4       R# )rY   NrY   N)ro   ro   )r   ipowTyper5   __ipow__)r%   r   s   & r   test_c_type_with_ipowCAPITest.test_c_type_with_ipow   sE      A	2Aq)62r   c                   \         P                  '       dW   \        P                  ! R 4      p\	        RV4      w  r#p\        V4      pV P                  VR\        ,           R,           4       R# V P                  \        4      ;_uu_ 4       p\        P                  4        RRR4       V P                  \        XP                  4      R4       R#   + '       g   i     L7; i)z
                import _testcapi
                from test import support

                with support.SuppressCrashReport():
                    _testcapi.return_null_without_error()
            r@   zFatal Python error: _Py_CheckFunctionResult: a function returned NULL without setting an exception\nPython runtime state: initialized\nSystemError: <built-in function return_null_without_error> returned NULL without setting an exception\n\nz   File .*", line 6 in <module>\nNzFreturn_null_without_error.* returned NULL without setting an exception)r   Py_DEBUGrA   rB   r   r   assertRegexCURRENT_THREAD_REGEXr8   SystemErrorr   return_null_without_errorstr	exceptionr%   rF   rcrJ   r   cms   &     r   test_return_null_without_error'CAPITest.test_return_null_without_error   s     ?? $ D 1t<LBS$CS %% 445 "";//2335 0S.JK 0/   
CC	c                   \         P                  '       dW   \        P                  ! R 4      p\	        RV4      w  r#p\        V4      pV P                  VR\        ,           R,           4       R# V P                  \        4      ;_uu_ 4       p\        P                  4        RRR4       V P                  \        XP                  4      R4       R#   + '       g   i     L7; i)z
                import _testcapi
                from test import support

                with support.SuppressCrashReport():
                    _testcapi.return_result_with_error()
            r@   a?  Fatal Python error: _Py_CheckFunctionResult: a function returned a result with an exception set\nPython runtime state: initialized\nValueError\n\nThe above exception was the direct cause of the following exception:\n\nSystemError: <built-in function return_result_with_error> returned a result with an exception set\n\nz  File .*, line 6 in <module>\nNzBreturn_result_with_error.* returned a result with an exception set)r   r   rA   rB   r   r   r   r   r8   r   r   return_result_with_errorr   r   r   s   &     r   test_return_result_with_error&CAPITest.test_return_result_with_error   s    ?? $ D 1t<LBS$CS )) 778  "";//2224 0S.GH 0/r   c                    \         P                  ! R 4      p\        RV4      w  r#p\        V4      pRV9  d'   V P	                  VR\
        ,           R,           4       R# V P                  RV4       R# )z
            import _testcapi
            from test import support

            with support.SuppressCrashReport():
                _testcapi.getitem_with_error({1: 2}, 1)
        r@   zSystemError: zFatal Python error: _Py_CheckSlotResult: Slot __getitem__ of type dict succeeded with an exception set\nPython runtime state: initialized\nValueError: bug\n\nzL  File .*, line 6 in <module>\n\nExtension modules: _testcapi \(total: 1\)\nz'returned a result with an exception setN)rA   rB   r   r   r   r   assertIn)r%   rF   r   rJ   r   s   &    r   test_getitem_with_error CAPITest.test_getitem_with_error  sx         -T48C #%S ))C	C
D MMCSIr   c           	     
   \         P                  p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      / 4       V P                  V! R4      R'. / 34       V P                  V! R^4      ^4       V P                  V! R^4      R(4       V P                  V! R^4      ^.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      ^^/4       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      R4       V P                  V! R^4      ^4       V P                  V! R^4      ^4       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      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      R)4       V P                  V! R^^4      R)4       V P                  V! R^^4      ^^.4       V P                  V! R^^4      ^^.4       V P                  V! R ^^4      ^^.4       V P                  V! R!^^4      ^^.4       V P                  V! R"^^4      ^^/4       V P                  V! R#^^^^4      ^^^^/4       V P                  V! R$^^^^4      ^^^^/4       V P                  V! R%^^^^4      ^^^^/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	\
        4       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       V P                  \        VR\
        ^4       V P                  \        VR^\
        4       V P                  \        VR\
        ^4       R# ),r   Nz()z[]z{}z()[]{}Oz(O)z[O]z{O}OOz(OO)z[OO]z{OO}z{OOOO}z((O))z((OO))z 	,:zO,z   O   z	O	zO,OzO, OzO,	OzO OzO	Oz(O,O)z(O, O,)z	 ( O O ) z		(	O	O	)	z[O,O]z[O, O,]z	 [ O O ] z	 [	O	O	] z{O:O}z	{O:O,O:O}z{O: O, O: O,}z { O O O O } z	{	O	O	O	O	}	r#   rX   rn   )rX   )rn   )r   py_buildvaluer5   r8   r   NULL)r%   
buildvalues   & r   test_buildvalueCAPITest.test_buildvalue;  s   ,,
B.D)2.D)2.D)2.H-B|<C+Q/E1-t4E1-s3+z5!<D!Q/8FAq16:FAq1Aq6:FAq1Aq6:HaAq9Aq!Q<HGQ/9Ha3Y?G,d3D!,a0Iq115GQ/3E1a0&9FAq16:GQ2F;E1a0&9FAq16:GQ2F;Iq!4f=KA6?$4a;VDGQ2QF;Iq!4q!f=KA6A?NAq9Aq6BGQ2QF;KAq!<q!QlKOQ1a@1aA,OOQ1a@1aA,O$:Aq!QG!QPQSTV+z3=+z5$?+z5$?+z5$?+z4DA+z4qA+z61dC+z64C+z61dC+z64C+z61dC+z64Cr   c                   \         P                  p^ RI HpHpHpHpHpHp V P                  V! RV4      V4       V P                  V! RV4      V4       V P                  V! RV4      V4       V P                  V! RV4      V4       V P                  V! RV4      V4       V P                  V! RV4      V4       V P                  V! R^4      ^4       V P                  V! RR4      R4       V P                  V! R^4      ^4       V P                  V! R\        R	4      4      R
4       V P                  V! R^4      R4       V P                  V! RR4      R4       V P                  V! RR4      R4       V P                  V! R^4      \        ^4      4       V P                  V! RR4      \        R4      4       V P                  V! R\        P                  4      \        \        P                  4      4       V P                  \        VRR4       V P                  \        VR\        P                  ^,           4       V P                  \        VRR^4       V P                  \        VRR^4       V P                  \        VRR^^4       R# )r   )SHRT_MINSHRT_MAX	USHRT_MAXINT_MININT_MAXUINT_MAXrj   IhHbBcA   A          Cz(C )iz[C ]iz{Ci }iNi)r   py_buildvalue_intsr   r   r   r   r   r   r5   ordchrrf   
maxunicoder8   rP   )r%   r   r   r   r   r   r   r   s   &       r   test_buildvalue_intsCAPITest.test_buildvalue_intss  s   11
WWC17;C17;C2H=C2H=C2H=C3Y?C-s3C.5C-s3CS2D9C-w7C-w7C,g6C-s3x8C-s3x8C8#cnn:MN*j#r:*j#s~~a7GH 	*j'2qA*j'2qA*j(B1Er   c                .    \         P                  4        R # rO   )r   test_buildvalue_Nr$   s   &r   r   CAPITest.test_buildvalue_N  s    ##%r   c                L    ^ RI Hp Rp\        ^d4       F  pV! V34      pK  	  R# r   )MyListN)r   r   range)r%   r   Lrj   s   &   r   test_trashcan_subclassCAPITest.test_trashcan_subclass  s%     	%sAtA r   cpuc                0    V P                  \        4       R # rO   )do_test_trashcan_python_classlistr$   s   &r   test_trashcan_python_class1$CAPITest.test_trashcan_python_class1  s     	**40r   c                4    ^ RI Hp V P                  V4       R# r   )r   r   r   )r%   r   s   & r   test_trashcan_python_class2$CAPITest.test_trashcan_python_class2  s     	%**62r   c                     ! R  RV4      pR Fj  pRp\        R4       F  pV! V34      pWTn        K  	  V'       d   V3pV P                  VP                  ^ 4       ?V P	                  VP                  ^ 4       Kl  	  R# )c                   B   a a ] tR tRt o^ tV 3R ltV 3R ltRtVtV ;t	# )6CAPITest.do_test_trashcan_python_class.<locals>.PyListi  c                V   < S;P                   ^,          un         \        SV `  ! V!   R# r   )numsuper__init__)r%   args	__class__s   &*r   r   ?CAPITest.do_test_trashcan_python_class.<locals>.PyList.__init__  s    " $'r   c                :   < S;P                   ^,          un         R# r   )r   r%   r   s   &r   __del__>CAPITest.do_test_trashcan_python_class.<locals>.PyList.__del__  s    "r   r#   )
r)   r*   r+   r,   r   r   r   r/   r^   __classcell__r   r`   s   @@r   PyListr     s      C(# #r   r   N)r   rY   i   )r   attrassertGreaterr   r5   )r%   baser   parityr   rj   s   &&    r   r   &CAPITest.do_test_trashcan_python_class  sv    	#T 	# FA 5\A4L " Dvzz1-VZZ+ r   c                    V P                  \        P                  P                  R 4       V P                  \        P                  P                  R4       R# )somedocz(arg1, arg2)N)r5   r   HeapDocCTyper7   r   r$   s   &r   &test_heap_ctype_doc_and_text_signature/CAPITest.test_heap_ctype_doc_and_text_signature  s<     	//77C//BBNSr   c                Z    V P                  \        P                  P                  R 4       R # rO   )r5   r   NullTpDocTyper7   r$   s   &r   test_null_type_docCAPITest.test_null_type_doc  s    0088$?r   c                >    ! R  R\         P                  4      pV! 4       p\        P                  ! V4      pV P	                  VP
                  ^
4       V P	                  VP                  ^4       ?V P	                  V^,
          \        P                  ! V4      4       R# )c                   2   a a ] tR tRt oV 3R ltRtVtV ;t# )`CAPITest.test_subclass_of_heap_gc_ctype_with_tpdealloc_decrefs_once.<locals>.HeapGcCTypeSubclassi  c                2   < ^V n         \        SV `	  4        R#    Nvalue2r   r   r   s   &r   r   iCAPITest.test_subclass_of_heap_gc_ctype_with_tpdealloc_decrefs_once.<locals>.HeapGcCTypeSubclass.__init__        "r   r  r)   r*   r+   r,   r   r/   r^   r   r   s   @@r   HeapGcCTypeSubclassr	         # #r   r  N)r   HeapGcCTyperf   getrefcountr5   valuer  )r%   r  subclass_instancetype_refcnts   &   r   :test_subclass_of_heap_gc_ctype_with_tpdealloc_decrefs_onceCCAPITest.test_subclass_of_heap_gc_ctype_with_tpdealloc_decrefs_once  s    	#)"7"7 	#
 01oo&9: 	*00"5*1126 q#//:M*NOr   c                  aa  ! R  R\         P                  4      o ! VV3R lRS4      oS! 4       p\        P                  ! S4      p\        P                  ! S4      pV P	                  VP
                  ^
4       V P	                  VP                  ^4       ?\        P                  '       d   V P	                  VSP                  4       M#V P	                  V^,
          SP                  4       V P	                  V^,           SP                  4       V P	                  V^,
          \        P                  ! S4      4       V P	                  V\        P                  ! S4      4       R# )c                   2   a a ] tR tRt oV 3R ltRtVtV ;t# )dCAPITest.test_subclass_of_heap_gc_ctype_with_del_modifying_dunder_class_only_decrefs_once.<locals>.Ai  c                2   < ^V n         \        SV `	  4        R# r  r  r   s   &r   r   mCAPITest.test_subclass_of_heap_gc_ctype_with_del_modifying_dunder_class_only_decrefs_once.<locals>.A.__init__  r  r   r  r  r   s   @@r   r   r    r  r   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# )dCAPITest.test_subclass_of_heap_gc_ctype_with_del_modifying_dunder_class_only_decrefs_once.<locals>.Bi  c                $   < \         SV `  4        R # rO   )r   r   r   s   &r   r   mCAPITest.test_subclass_of_heap_gc_ctype_with_del_modifying_dunder_class_only_decrefs_once.<locals>.B.__init__  s     "r   c                   < SV n         \        P                  ! S4      Sn        \        P                  ! S4      Sn        R # rO   )r   rf   r  refcnt_in_del)r%   r   r   s   &r   r   lCAPITest.test_subclass_of_heap_gc_ctype_with_del_modifying_dunder_class_only_decrefs_once.<locals>.B.__del__  s*    !""%//!"4"%//!"4r   )r   )	r)   r*   r+   r,   r   r   r/   r^   r   )r   r`   r   r   s   @@r   r   r"    s     #5 5r   r   N)
r   r  rf   r  r5   r  r  r   r   r&  )r%   r  r  new_type_refcntr   r   s   &   @@r   Ptest_subclass_of_heap_gc_ctype_with_del_modifying_dunder_class_only_decrefs_onceYCAPITest.test_subclass_of_heap_gc_ctype_with_del_modifying_dunder_class_only_decrefs_once  s   	#	%% 	#
	5 	5 	5 Cooa(//!, 	*00"5*1126  [!//:[1_aoo>1,aoo> 	q#//!*<= 	#//!*<=r   c                   \         P                  \        P                  3 F  pV P	                  VR 7      ;_uu_ 4        V! 4       p^*Vn        V P                  VP
                  ^*4       V P                  VP                  VP                  4       V P                  VP                  R^*/4       V! 4       pV P                  / VP                  4       RRR4       K  	  R#   + '       g   i     K  ; i)clsfooN)	r   HeapCTypeWithDict_testlimitedcapiHeapCTypeWithRelativeDictsubTestr.  r5   dictobj__dict__)r%   r-  r<   s   &  r   test_heaptype_with_dict CAPITest.test_heaptype_with_dict	  s    ''66
C #&&u  2.  t}}=  r{;u  T]]3 '&	
 '&&s   BCC/c                |   \         P                  4       p^*Vn        V P                  VP                  ^*4       V P                  VP                  R^*/4       \         P                  4       pV P                  / VP                  4       \         P                  4       p\         P                  4       pW2n        W#n        ??R# *   r.  N)r   HeapCTypeWithManagedDictr.  r5   r4  r   a)r%   r<   r;  r   s   &   r   test_heaptype_with_managed_dict(CAPITest.test_heaptype_with_managed_dict  s    1132&4113T]]+..0..0qr   c                T     ! R  R\         P                  4      pV! 4       pW"n        ?R# )c                       ] tR tRtRtR# )2CAPITest.test_sublclassing_managed_dict.<locals>.Ci)  r#   Nr)   r*   r+   r,   r/   r#   r   r   r   r@  )      r   r   N)r   r:  spam)r%   r   rj   s   &  r   test_sublclassing_managed_dict'CAPITest.test_sublclassing_managed_dict'  s%    		22 	 Cr   c                \   \         P                  4       p^*Vn        V P                  VP                  ^*4       V P                  VP                  VP
                  4       V P                  VP                  R^*/4       \         P                  4       pV P                  / VP
                  4       R# r8  )r   HeapCTypeWithNegativeDictr.  r5   r3  r4  r;   s   & r    test_heaptype_with_negative_dict)CAPITest.test_heaptype_with_negative_dict0  s}    2242&t}}5r{3224T]]+r   c                b   \         P                  \        P                  3 Fv  pV P	                  VR 7      ;_uu_ 4        V! 4       p\
        P                  ! V4      pV P                  V! 4       V4       V P                  VP                  V4       RRR4       Kx  	  R#   + '       g   i     K  ; i)r,  N)	r   HeapCTypeWithWeakrefr0  HeapCTypeWithRelativeWeakrefr2  weakrefrefr5   weakreflist)r%   r-  r<   rN  s   &   r   test_heaptype_with_weakref#CAPITest.test_heaptype_with_weakref:  s    **99
C #&&ukk$'  -  !1!137	 '&	
 '&&s   ABB.c                    \         P                  4       p\        P                  ! V4      pV P	                  V! 4       V4       R # rO   r   HeapCTypeWithManagedWeakrefrM  rN  r5   )r%   r<   rN  s   &  r   "test_heaptype_with_managed_weakref+CAPITest.test_heaptype_with_managed_weakrefE  s0    446kk$%r   c                     ! R  R\         P                  4      pV! 4       p\        P                  ! V4      pV P	                  V! 4       V4       R# )c                       ] tR tRtRtR# )5CAPITest.test_sublclassing_managed_weakref.<locals>.CiL  r#   NrA  r#   r   r   r   rY  L  rB  r   r   NrS  )r%   r   r<   rN  s   &   r   !test_sublclassing_managed_weakref*CAPITest.test_sublclassing_managed_weakrefJ  s=    		55 	 skk$%r   c                    ! R  R\         P                  \         P                  4      p ! R R\         P                  \         P                  4      pW3 Fp  pV! 4       p\        P                  ! V4      pV P                  V! 4       V4       WDn        ?\        P                  ! V! 4       4      pV P                  V! 4       R4       Kr  	  R# )c                       ] tR tRtRtR# )3CAPITest.test_sublclassing_managed_both.<locals>.C1iU  r#   NrA  r#   r   r   C1r^  U  rB  r   r_  c                       ] tR tRtRtR# )3CAPITest.test_sublclassing_managed_both.<locals>.C2iX  r#   NrA  r#   r   r   C2ra  X  rB  r   rb  N)r   rT  r:  rM  rN  r5   rC  assertIs)r%   r_  rb  r-  r<   rN  s   &     r   test_sublclassing_managed_both'CAPITest.test_sublclassing_managed_bothS  s    	66	8Z8Z 		33Y5Z5Z 	 8C5D++d#CSUD)I++ce$CMM#%& r   c                h    \         P                  4       p\        V4      pV P                  VR 4       R# )s   1234N)r   HeapCTypeWithBufferbytesr5   )r%   r<   r   s   &  r   test_heaptype_with_buffer"CAPITest.test_heaptype_with_bufferd  s)    ,,.$KG$r   c                ^   \         P                  4       p\        P                  ! \         P                  4      pV P	                  VP
                  ^
4       V P	                  VP                  ^4       ?V P	                  V^,
          \        P                  ! \         P                  4      4       R# 
   N)r   r   rf   r  r5   r  r  )r%   r  r  s   &  r   9test_c_subclass_of_heap_ctype_with_tpdealloc_decrefs_onceBCAPITest.test_c_subclass_of_heap_ctype_with_tpdealloc_decrefs_oncei  s}    %779ooi&A&AB 	*00"5*1126 q#//):U:U*VWr   c                   \        4       p\        P                  ! \         4      p\        P                  ! \        4      pV P	                  VP
                  ^
4       V P	                  VP                  ^4       ?TpV^,           p\        '       g   V^,          pV^,          p\        P                  '       d
   V^,          pV P	                  V\         P                  4       V P	                  V\        P                  4       V P	                  V^,
          \        P                  ! \         4      4       V P	                  V\        P                  ! \        4      4       R# rl  )r   rf   r  r   r5   r  r  r   r   r   r&  )r%   r  r  r(  expected_type_refcntexpected_new_type_refcnts   &     r   Otest_c_subclass_of_heap_ctype_with_del_modifying_dunder_class_only_decrefs_onceXCAPITest.test_c_subclass_of_heap_ctype_with_del_modifying_dunder_class_only_decrefs_onceu  s   :<oo&DE//*;< 	*00"5*1126   +#2Q#6  !A% $)$ !A% -/M/[/[\13D3R3RS 	q#//:X*YZ 	#//:K*LMr   c                    \         P                  4       pV P                  VP                  ^
4       ^Vn        V P                  VP                  ^4       V=V P                  VP                  ^ 4       R# rl  )r   HeapCTypeSetattrr5   pvaluer  )r%   objs   & r   test_heaptype_with_setattro$CAPITest.test_heaptype_with_setattro  sX    ((*R(	R(IQ'r   c                   \         P                  pV P                  V\        4       \         P	                  V4      pV P                  V\        4       V P                  VP                  R 4       V P                  \        V4      V4       V! RR/ 4      pV P                  V\        4       V P                  VP                  R4       R# )HeapCTypeViaMetaclassPyClassViaMetaclassNr#   )	r   HeapCTypeMetaclassassertIsSubclasstypepytype_fromspec_metaassertIsInstancer5   r)   rc  r%   	metaclassts   &  r   #test_heaptype_with_custom_metaclass,CAPITest.test_heaptype_with_custom_metaclass  s    00	i. **95a&%<=d1gy) +R4a&%:;r   c                   \         P                  pV P                  V\        4       \         P	                  V4      pV P                  V\        4       V P                  VP                  R 4       V P                  \        V4      V4       V P                  \        R4      ;_uu_ 4        V! RR/ 4       RRR4       R#   + '       g   i     R# ; i)r|  zcannot create .* instancesr}  Nr#   )r   HeapCTypeMetaclassNullNewr  r  r  r  r5   r)   rc  rq   rr   r  s   &  r   ,test_heaptype_with_custom_metaclass_null_new5CAPITest.test_heaptype_with_custom_metaclass_null_new  s    77	i. **95a&%<=d1gy) ##I/KLL+R4 MLLLs   'B<<C	c                   \         P                  pV P                  \         P                  \        4       R pV P	                  \
        V4      ;_uu_ 4        \         P                  V4      pRRR4       R#   + '       g   i     R# ; i)1Metaclasses with custom tp_new are not supported.N)r   HeapCTypeMetaclassCustomNewr  r  rq   rr   r  )r%   r  rK   r  s   &   r   .test_heaptype_with_custom_metaclass_custom_new7CAPITest.test_heaptype_with_custom_metaclass_custom_new  sZ    99	iCCTJA##Is33..y9A 4333s   A55B	c                    \         P                  p ! R  RVR7      pRpV P                  \        V4      ;_uu_ 4        \         P	                  V4      pRRR4       R#   + '       g   i     R# ; i)c                       ] tR tRtRtR# )?CAPITest.test_heaptype_base_with_custom_metaclass.<locals>.Basei  r#   NrA  r#   r   r   Baser    rB  r   r  )r  r  N)r   r  rq   rr   make_type_with_base)r%   r  r  rK   subs   &    r   (test_heaptype_base_with_custom_metaclass1CAPITest.test_heaptype_base_with_custom_metaclass  sS    99		Y 	 B##Is33//5C 4333s   AA.	c                    \         P                  pVP                  V4      pVP                  4        V! 4       pV P	                  VP
                  ^4       V P	                  VP
                  ^4       R# ro   N)r   HeapCTypeVectorcall__new__r   r5   r  )r%   tpv0v1s   &   r    test_heaptype_with_tp_vectorcall)CAPITest.test_heaptype_with_tp_vectorcall  sR    **ZZ^
T1%1%r   c                    \         P                  \        P                  3 F  p\         P                  \        P
                  3 F  pV P                  WR 7      ;_uu_ 4        V P                  \        4      ;_uu_ 4         ! R RW4      pRRR4       V P                  \        4      ;_uu_ 4         ! R RW!4      pRRR4       RRR4       K  	  K  	  R#   + '       g   i     LS; i  + '       g   i     L5; i  + '       g   i     K  ; i))weakref_clsdict_clsc                       ] tR tRtRtR# )MCAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict.<locals>.Both1i  r#   NrA  r#   r   r   Both1r         r   r  Nc                       ] tR tRtRtR# )MCAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict.<locals>.Both2i  r#   NrA  r#   r   r   Both2r    r  r   r  )	r   rK  r0  rL  r/  r1  r2  r8   rr   )r%   r  r  r  r  s   &    r   5test_multiple_inheritance_ctypes_with_weakref_or_dict>CAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict  s    %::,IIKK&88-GGI\\k\MM**955!K ! 6 **955!H ! 6 NMIK 65 65 NMMs<   !C<	?C%C<	0C)<C<	C&!C<	)C94C<	<Dc                   \         P                  \        P                  3 EF  p\         P                  \        P
                  3 EF{  pV P                  WR 7      ;_uu_ 4        V P                  \        4      ;_uu_ 4         ! R RV\        4      pRRR4       V P                  \        4      ;_uu_ 4         ! R RV\        4      pRRR4        ! R R\         P                  \        4      p ! R R	\         P                  \        4      pV! 4       pVP                  ^ 4       \        VP                  4       V! 4       pVP                  ^ 4       \        VP                  4       \         P                  \         P                  3 F.  pW3 F  p	 ! R
 RW4      p
K  	   ! R RWX4      p ! R RWh4      pK0  	  RRR4       EK~  	  EK  	  R#   + '       g   i     ELC; i  + '       g   i     EL!; i  + '       g   i     EK  ; i))r  r  c                       ] tR tRtRtR# )\CAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtin.<locals>.C1i  r#   NrA  r#   r   r   r_  r    r  r   r_  Nc                       ] tR tRtRtR# )\CAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtin.<locals>.C2i  r#   NrA  r#   r   r   rb  r    r  r   rb  c                       ] tR tRtRtR# )\CAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtin.<locals>.C3i
  r#   NrA  r#   r   r   C3r  
      r   r  c                       ] tR tRtRtR# )\CAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtin.<locals>.C4i  r#   NrA  r#   r   r   C4r    r  r   r  c                       ] tR tRtRtR# )[CAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtin.<locals>.Si  r#   NrA  r#   r   r   Sr    s     $r   r  c                       ] tR tRtRtR# )\CAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtin.<locals>.B1i  r#   NrA  r#   r   r   B1r    r  r   r  c                       ] tR tRtRtR# )\CAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtin.<locals>.B2i  r#   NrA  r#   r   r   B2r    r  r   r  )r   r/  r0  r1  rK  rL  r2  r8   rr   r   r:  rT  appendr   r4  __weakref__)r%   r  r  r_  rb  r  r  r<   r-  cls2r  r  r  s   &            r   Gtest_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtinPCAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtin  s   "44)CCEH ) > > 0 M M O\\8\MM**955!4 ! 6 **955!d ! 6Y?? YBBD  4DKKN&4DKKN(() ) B B ) E E G%-$;D%C % %<! !! ! G/ NM OE 655 655 NMMs=   #G4	G%G4	7G C0G4	G	G4	 G1+	G4	4Hc           
     4   \        ^4       Fa  pV P                  VR7      ;_uu_ 4        V P                  \        4      ;_uu_ 4        \        P                  V4       RRR4       RRR4       Kc  	  R#   + '       g   i     L; i  + '       g   i     K  ; i)ro   )variantN)r   r2  r8   r   r   create_type_from_repeated_slots)r%   r  s   & r   (test_pytype_fromspec_with_repeated_slots1CAPITest.test_pytype_fromspec_with_repeated_slots!  s`    QxGg..&&{33==gF 4 /.  33 /..s#   BA3B3B>BBc                     ! R  R4      pV P                  \        R4      ;_uu_ 4        \        P                  V4       RRR4       R#   + '       g   i     R# ; i)c                       ] tR tRtRtR# )CCAPITest.test_immutable_type_with_mutable_base.<locals>.MutableBasei(  r#   NrA  r#   r   r   MutableBaser  (  s    3r   r  zCreating immutable typeN)rq   rr   r   make_immutable_type_with_base)r%   r  s   & r   %test_immutable_type_with_mutable_base.CAPITest.test_immutable_type_with_mutable_base'  s:    ##I/HII33K@ JIIIs   A		A	c           
         ^ RI Hp ^{pR	p ! R R4      pR
pV F  w  rgpV P                  WgVR7      ;_uu_ 4        V P                  V! W&4      V4       V P                  V! V) V4      RV,           4       V P                  V! V! V4      V4      V4       V P                  V! W64      V4       V P                  V! V) V4      RV,           4       V P                  V! V! V4      V4      V4       RRR4       K  	  V P	                  \
        W! R4      ^
4       V P	                  \
        W! R4      ^
4       V P	                  \
        VR^
4       V P	                  \
        VR^
4       V P	                  \        V^{^ 4       R#   + '       g   i     EKt  ; i)r   )pynumber_tobasec                   ,   a  ] tR tRt o R tR tRtV tR# )*CAPITest.test_pynumber_tobase.<locals>.IDXi1  c                    Wn         R # rO   val)r%   r  s   &&r   r   3CAPITest.test_pynumber_tobase.<locals>.IDX.__init__2  s    r   c                    V P                   # rO   r  r$   s   &r   	__index__4CAPITest.test_pynumber_tobase.<locals>.IDX.__index__4  s    xxr   r  N)r)   r*   r+   r,   r   r  r/   r^   r_   s   @r   IDXr  1  s        r   r  123)r   stlt-Ng     ^@            ))ro   	0b1111011C0b10000000000000000000000000000000000000000000000000000000000000000)   0o1730o2000000000000000000000)rm  r  18446744073709551616)   0x7b0x10000000000000000)r   r  r2  r5   r8   rr   r   )	r%   r  small_numberlarge_numberr  
test_casesr   small_targetlarge_targets	   &        r   test_pynumber_tobaseCAPITest.test_pynumber_tobase-  sf   -	  	 ;
 1;,D4\JJ  !DlS  ,!Es\GYZ  \1BD!I<X  !DlS  ,!Es\GYZ  \1BD!I<X KJ 1; 	)_c%j"E)_c%j"E)_eR@)_eR@+Q? KJJs   B1E;;Fc                R    \         P                  4       pV P                  VR 4       R# z<NULL>N)r   pyobject_repr_from_nullr5   r%   ss   & r   test_pyobject_repr_from_null%CAPITest.test_pyobject_repr_from_nullK  s     --/H%r   c                R    \         P                  4       pV P                  VR 4       R# r  )r   pyobject_str_from_nullr5   r  s   & r   test_pyobject_str_from_null$CAPITest.test_pyobject_str_from_nullO  s     ,,.H%r   c                R    \         P                  4       pV P                  VR 4       R# )s   <NULL>N)r   pyobject_bytes_from_nullr5   r  s   & r   test_pyobject_bytes_from_null&CAPITest.test_pyobject_bytes_from_nullS  s     ..0I&r   c                    \         P                  pR pV! V4      p\        VRR4      pV P                  VP                  VP                  4       R# )s%   # -*- coding: latin1 -*-
print('¤')
z<string>execN)r   Py_CompileStringcompiler5   	co_consts)r%   _compilerF   resultexpecteds   &    r   test_Py_CompileStringCAPITest.test_Py_CompileStringW  sE    --?$4V4))8+=+=>r   c                   \         P                  ! R 4      p. p\        \        R4      '       d   VP	                  R4       \
        P                  R8w  d   VP	                  R4       V F  pV P                  VP                  V4       K!  	  R# )ctypesget_native_idPyThread_get_thread_native_idntPy_FrozenMainN)	r   import_modulehasattr_threadr  osnameassertHasAttr	pythonapi)r%   r  namesr  s   &   r   test_export_symbolsCAPITest.test_export_symbols_  sn     ,,X6 7O,,LL89 77d?LL)Dv//6 r   c                6    ! R  R4      pV! 4       p\         P                  V4       V P                  VP                  / 4       V! 4       pV P                  VP                  R^/4       \         P                  V4       V P                  VP                  / 4       R# )c                   &   a  ] tR tRt o R tRtV tR# )+CAPITest.test_clear_managed_dict.<locals>.Ciw  c                    ^V n         R# r   r;  r$   s   &r   r   4CAPITest.test_clear_managed_dict.<locals>.C.__init__x  s	    r   r"  N)r)   r*   r+   r,   r   r/   r^   r_   s   @r   r   r   w  s      r   r   r;  N)r   clear_managed_dictr5   r4  )r%   r   r   s   &  r   test_clear_managed_dict CAPITest.test_clear_managed_dictu  sx    	 	 C$$Q'R(Cc!W-$$Q'R(r   c                R    ! R  R\         P                  4      pV! 4       p^
Vn        ^Vn        ^Vn        V P                  VP                  ^
4       V P                  VP                  ^4       V P                  VP                  ^4       V=V P                  VP                  4       R# )c                       ] tR tRtRtRtR# );CAPITest.test_unstable_gc_new_with_extra_data.<locals>.Datai  r#   N)xy)r)   r*   r+   r,   	__slots__r/   r#   r   r   Datar)    s    "Ir   r-  N)r   ObjExtraDatar*  r+  extrar5   assertIsNone)r%   r-  ds   &  r   $test_unstable_gc_new_with_extra_data-CAPITest.test_unstable_gc_new_with_extra_data  s    	#9)) 	# Fb!b!"%G!''"r   c                x    R  pV! 4       pV P                  \        P                  V4      VP                  4       R# )c               3      "   R x  R # 5irO   r#   r#   r   r   genf(CAPITest.test_gen_get_code.<locals>.genf  s     E   	N)r5   r   gen_get_codegi_code)r%   r6  gens   &  r   test_gen_get_codeCAPITest.test_gen_get_code  s+    f//4ckkBr   r#   N)Dr)   r*   r+   r,   r=   r   requires_subprocessrL   rR   r   
skipUnlessrs   rw   r   r   r   r   r   r   r   r   r   r   r   r   r   requires_resourceskip_emscripten_stack_overflowskip_wasi_stack_overflowr   r   r   r  r  r  r)  r5  r<  rD  rH  rP  rU  rZ  rd  ri  rn  rs  ry  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r%  r2  r<  r/   r^   r_   s   @r   r1   r1   R   s9    	[   "1 #16S )+UVe We" )+UVj Wj __)MO''O''R0"3K: HDJ<6DpF@& u%++-%%'1 ( . &1 u%++-%%'3 ( . &3,8 __)MOTOT@P"&>P4,	8&
&'"%

X4Nl(<5:	6&!$!LGA@<&&'?7,)#C Cr   r1   c                   ^   a  ] tR tRt o Rt]R 4       tR tR tR t	R t
R tR	 tR
 tRtV tR# )TestHeapTypeRelativei  z-Test API for extending opaque types (PEP 697)c                l  a  V 3R  lp\        ^ ^^^^^^^{\        P                  \        P                  ^,
          \        P                  ^,           04      pV FD  pV F;  p\        VVR7      pS P                  ! R/ VB ;_uu_ 4        V! R/ VB  RRR4       K=  	  KF  	  R#   + '       g   i     KV  ; i)c                   < \         P                  ! W) 4      w  r#rErgV^ 8X  d:   S
P                  VP                  VP                  4       S
P                  V^ 4       MR
VP                  R3VR3Wa,           R3Wg,           R3VP                  R3.p\	        V\
        P                  ! ^ 4      R7      p	S
P                  WRV	 2R7       S
P                  VP                  Wg,           4       S
P                  Wq,
          \         P                  4       S
P                  V\         P                  ,          ^ 4       S
P                  V\         P                  ,          ^ 4       R	# )r   zend of base datazsubclass datazend of requested subcls datazend of reserved subcls datazend of object)keyz$Offsets not in expected order, got: rK   N)r   zstart of object)	r0  make_sized_heaptypesr5   __basicsize__sortedoperator
itemgetter
assertLessALIGNOF_MAX_ALIGN_T)extra_base_size
extra_sizer  Subinstancedata_ptrdata_offset	data_sizeoffsetsordered_offsetsr%   s   &&        r   check@TestHeapTypeRelative.test_heaptype_relative_sizes.<locals>.check  sN    55#[2 BDx;
 Q  !3!3S5F5FG  A.
 +'');< /2 -/MN ,.KL&&8 #)h6I6I!6L"M  >>OP ! R
   !2!2K4KL 	 6 0 D DF [+;+O+OOQRSY)9)M)MMqQr   rP  rQ  Nr#   )rK  rp   rJ  dictr2  )r%   rY  sizesrP  rQ  r   s   f     r   test_heaptype_relative_sizes1TestHeapTypeRelative.test_heaptype_relative_sizes  s    "	RH 1aAq!S,,,,Q.,,Q.0 1  %O#
O'13\\)D))MDM *) $  % *))s   	B"	"B3c                n    \         P                  ^^^4      pV P                  \        V4      . RO4       R# )z2Make sure HeapCCollection works properly by itselfNrY   ro      )r   HeapCCollectionr5   r   )r%   
collections   & r   test_HeapCCollection)TestHeapTypeRelative.test_HeapCCollection  s+    ..q!Q7
j)95r   c                |   \        ^ ^^^^^^^{\        P                  \        P                  ^,
          \        P                  ^,           04      pV F  pV P                  VR7      ;_uu_ 4        \        P
                  ! \        P                  V) ^ ^ 4      pV! ^^^4      pVP                  4        V P                  \        V4      . RO4       VP                  4       pV P                  \        V4      V4       V P                  \        V4      ^08*  RV: 24       RRR4       K  	  R#   + '       g   i     K  ; i)-Test HeapCCollection subclasses work properly)rQ  zgot Nra  )rK  rp   rJ  r2  r0  subclass_var_heaptyper   rc  set_data_to_3sr5   r   get_dataassertGreaterEquallenr6   set)r%   r]  rQ  rR  rd  mems   &     r   test_heaptype_inherit_itemsize3TestHeapTypeRelative.test_heaptype_inherit_itemsize  s   1aAq!S,,,,Q.,,Q.0 1  J44&<<--
{AqB Aq\
))+  j!19= ))+''C*=CQC4w@ 54  444s   .B.D**D;c                    V P                  \        RR7      ;_uu_ 4        \        P                  ! \        R^ 4       RRR4       R#   + '       g   i     R# ; i)z*Cannot extend variable-size class without rH  NzACannot extend variable-size class without Py_TPFLAGS_ITEMS_AT_END)r8   r   r0  subclass_heaptypeintr$   s   &r   !test_heaptype_invalid_inheritance6TestHeapTypeRelative.test_heaptype_invalid_inheritance  sJ    {$;  < < ..sB:< < < <s   AA	c                   \        ^ ^^^^^^^{\        P                  \        P                  ^,
          \        P                  ^,           04      pV EF  pV EF  pV EF{  pV P                  W#VR7      ;_uu_ 4        WC8  Ed   \        P
                  ! W#) VR4      pVP                  4       ^,          pV! 4       pV P                  VP                  VP                  4       4       VP                  ^4       V P                  VP                  VP                  4       4       V P                  VP                  4       ^4       ^Vn        V P                  VP                  VP                  4       4       V P                  VP                  4       ^4       V P                  VP                  4       VP                  4       V P                  VP                  4       VP                  4       V P                  \        4      ;_uu_ 4        VP!                  4        RRR4       V P                  \        4      ;_uu_ 4        VP#                  ^ 4       RRR4       M?V P                  \        4      ;_uu_ 4        \        P
                  ! W#) VR4      pRRR4       V P                  \        4      ;_uu_ 4        \        P
                  ! W#VR4      pRRR4       RRR4       EK~  	  V P                  W#R7      ;_uu_ 4        V P                  \        4      ;_uu_ 4        \        P
                  ! W#) RR4      pRRR4       RRR4       EK  	  EK  	  R#   + '       g   i     ELA; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     EKM  ; i  + '       g   i     L; i  + '       g   i     EK{  ; i)rh  )rP  rQ  offsetTNr[  r   )rK  rp   rJ  r2  r0  make_heaptype_with_membermror5   membget_membset_membrl  get_memb_offsetrN  r8   r   get_memb_relativeset_memb_relative)r%   r]  rP  rQ  ry  rR  r  rS  s   &       r   test_heaptype_relative_members3TestHeapTypeRelative.test_heaptype_relative_members  s   1aAq!S,,,,Q.,,Q.0 1  %O#
#Foekll!."2"L"L /fd#LC#&779Q<D'*uH ,,X]]H<M<M<OP$--b1 ,,X]]H<M<M<OP ,,X->->-@"E,.HM ,,X]]H<M<M<OP ,,X->->-@"E 33H4L4L4NPTPbPbc OOH,D,D,FHYHYZ!%!2!2;!?!? ( : : < "@!%!2!2;!?!? ( : :1 = "@!? "&!2!2;!?!?&6&P&P$3[&$'P "@ "..{;;"2"L"L /VT#KC </ ml $6 \\/\YY**;77.HH+["dD 8 ZY9 $  %$ "@!?!?!?!? "@!? <;/ mll6 87 ZYYs   <FNM%N8M
&N0M2
%N/NN7O 	N-/O 	M	NM/*N2N=NNNN*-N=8O 	 Oc                f   V P                  \        R 4      ;_uu_ 4        \        P                  ! ^ R^ R4       RRR4       V P                  \        R4      ;_uu_ 4        \        P                  ! ^ RRR4       RRR4       V P                  \        R4      ;_uu_ 4        \        P                  ! ^ RRR4       RRR4       \        P                  ! ^ R^ R4      pV! 4       pV P                  \        R4      ;_uu_ 4        VP	                  4        RRR4       V P                  \        R4      ;_uu_ 4        VP                  ^ 4       RRR4       R#   + '       g   i     EL"; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)	z3With Py_RELATIVE_OFFSET, basicsize must be negativei  TN.Member offset out of range \(0\.\.-basicsize\)z,PyMember_GetOne used with Py_RELATIVE_OFFSETz,PyMember_SetOne used with Py_RELATIVE_OFFSETrs  r   )rq   r   r0  rz  r  r  )r%   rR  rS  s   &  r   %test_heaptype_relative_members_errors:TestHeapTypeRelative.test_heaptype_relative_members_errors  sw   ##FH H 66q$4HH ##NP P66q"dDIP ##NP P66q"b$GP 88B4H5##LN N&&(N ##LN N&&q)N N!H H HP PP PN NN N Ns;   EE&E9?F6FE#	&E6	9F		F	F0	c                F   R
 EF  pV P                  VR7      ;_uu_ 4        V P                  \        R4      ;_uu_ 4        \        P                  ! \
        P                  ! \        4       4      ^d,           RV^ \        P                  \        P                  R7       RRR4       V P                  \        R4      ;_uu_ 4        \        P                  ! RRVR\        P                  \        P                  R7       RRR4       V P                  \        RV,          4      ;_uu_ 4        \        P                  ! RRV^ \        P                  R7       RRR4       V P                  \        R	V,          4      ;_uu_ 4        \        P                  ! RRV^ \        P                  ^ R7       RRR4       RRR4       EK  	  R#   + '       g   i     EL.; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     LY; i  + '       g   i     EK  ; i)__vectorcalloffset__)member_namez4With Py_RELATIVE_OFFSET, basicsize must be negative.T)	basicsizeadd_relative_flagr  member_offsetmember_typemember_flagsNr  z type of %s must be Py_T_PYSSIZET)r  r  r  r  r  zflags for %s must be )r  __dictoffset____weaklistoffset__rs  r   i)
r2  rq   r   r0  rz  rf   	getsizeofrp   Py_T_PYSSIZETPy_READONLY)r%   r  s   & r   -test_heaptype_relative_special_members_errorsBTestHeapTypeRelative.test_heaptype_relative_special_members_errors'  s   YK+66++#OQ Q %>>"%--"9C"?*.$/&'$4$B$B%5%A%AQ ++#IK K %>>"$*.$/&($4$B$B%5%A%AK ++#;kIK K %>>"&*.$/&'%5%A%AK ++#0;>@ @ %>>"&*.$/&'$4$B$B%&@C 76 ZQ Q QK KK K@ @C 766sl   H AG&H9G;-H(*G(-H?+G;*HG	HG% H(G83H;HHH c                @   V P                  \        4      ;_uu_ 4        \        P                  R4       RRR4       V P                  \        4      ;_uu_ 4        \        P                  ^ 4       RRR4       R#   + '       g   i     LM; i  + '       g   i     R# ; i)z4Test PyObject_GetItemData fails on unsupported typesN)r8   rr   r   pyobject_getitemdatar$   s   &r   test_pyobject_getitemdata_error4TestHeapTypeRelative.test_pyobject_getitemdata_errorV  sf    y))**40 * y)) **1- *) *) *))s   A9B9B		B	r#   N)r)   r*   r+   r,   r7   r	   r^  re  rp  rv  r  r  r  r  r/   r^   r_   s   @r   rD  rD    sG     7/" /"b6
A$;&DP**-^. .r   rD  c                   F  a  ] tR tRt o R tRRRR/R ltRR	 lt]P                  ! 4       R
 4       t	R t
R tR t ! R R]P                  4      t]P                  ! 4       R 4       t]P                  ! 4       R 4       t]]P(                  ! RRR7      R 4       4       tRtV tR# )TestPendingCallsia  c                   a V3R  lp\        V4       FQ  p\        P                  ! \        P                  ! 4       R,          4        \        P                  V4      '       g   K  KS  	  R# )c                  *   < S P                  R 4       R # rO   r  ls   r   callback;TestPendingCalls.main_pendingcalls_submit.<locals>.callbackh       HHTNr   g{Gz?N)r   timesleeprandomr   _pending_threadfunc)r%   r  nr  rj   s   &f&  r   main_pendingcalls_submit)TestPendingCalls.main_pendingcalls_submitg  sH    	
 qAJJv}}t+, 00:: r   mainTensureFc                  a V3R  lpV'       d   \         P                  WRRVR7      # \        P                  ! WRRVR7      # )c                  *   < S P                  R 4       R # rO   r  r  s   r   r  6TestPendingCalls.pendingcalls_submit.<locals>.callbackw  r  r   F)blockingensure_added)r   r  _testinternalcapipending_threadfunc)r%   r  r  r  r  r  s   &f&$$ r   pendingcalls_submit$TestPendingCalls.pendingcalls_submitv  sN    	
 00:?>D 1 F F %77AFEKM Mr   Nc                   ^ p\        V4      V8w  dx    \	        R4       F  pYU,          pK  	  T'       d#   TP
                  P                  4       '       g   KU  T^,          pT P                  TR8  RT\        T4      3,          4       K  R# )r   i  i'  z(timeout waiting for %i callbacks, got %iN)rm  r   verboseprintr   eventis_setr6   )r%   r  numaddedcontextcountrj   r;  s   &&&&   r   pendingcalls_wait"TestPendingCalls.pendingcalls_wait  su    !f  4[C !w}}3355QJEOOEEM:Hc!f;MMOr   c                <   ^ p. p ! R R\         4      pV! 4       p. Vn        ^Vn        WP                  ,          Vn        ^ Vn        \
        P                  ! 4       Vn        \
        P                  ! 4       Vn	        \        VP                  4       Uu. uF&  p\
        P                  ! V P                  V3R7      NK(  	  pp\        P                  ! V4      ;_uu_ 4        V P                  VP                  W4       RRR4       R# u upi   + '       g   i     R# ; i)    c                       ] tR tRtRtR# )=TestPendingCalls.test_main_pendingcalls_threaded.<locals>.fooi  r#   NrA  r#   r   r   r.  r    s    $r   r.  targetr   N)rp   r  r  nThreads	nFinished	threadingLocklockEventr  r   Threadmain_pendingcalls_threadr   start_threadsr  )r%   r  threadsr.  r  rj   s   &     r   test_main_pendingcalls_threaded0TestPendingCalls.test_main_pendingcalls_threaded  s     &%				> ~~'!) "'"2"2353q ##4+H+H*153 	 5 ++G44""799a9 545 544s   ,DD

D	c           	     j    V P                  VP                  VP                  4       VP                  ;_uu_ 4        V;P                  ^,          un        VP                  p RRR4       XTP                  8X  d   TP                  P                  4        R# R#   + '       g   i     L?; i  TP                  ;_uu_ 4        T;P                  ^,          un        TP                  p RRR4       M  + '       g   i     M; iXTP                  8X  d   TP                  P                  4        i i ; ir   )r  r  r  r  r  r   r  r  r  r  rn  )r%   r  r  s   && r   r  )TestPendingCalls.main_pendingcalls_thread  s    		$))'))WYY?!!Q&!#--	 
 G,,,!!# - !!Q&!#--	 
 G,,,!!# -s.   &B- 'BB*	-D2'C2	)	D22D=5D2c                R    . p^@pV P                  W4       V P                  W4       R# )@   N)r  r  )r%   r  r  s   &  r   #test_main_pendingcalls_non_threaded4TestPendingCalls.test_main_pendingcalls_non_threaded  s*    
 %%a+q$r   c                   V P                  R 4      ;_uu_ 4        ^ p. pV P                  V^RR7      pV P                  W#4       V P                  V^4       . pV P                  W!RR7      pV P                  W#4       V P                  W14       . pV P                  W!^,           RR7      pV P                  W#4       V P                  W14       RRR4       V P                  R4      ;_uu_ 4        Rp. pV P                  V^RR7      pV P                  W#4       V P                  V^4       . pV P                  W!RR7      pV P                  W#4       V P                  W14       . pV P                  W!^,           RR7      pV P                  W#4       V P                  W14       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)z	main-onlyT)r  Nznot main-onlyi,  F)r2  r  r  r5   )r%   
maxpendingr  addeds   &   r   test_max_pending!TestPendingCalls.test_max_pending  s   \\+&&JA,,Q,=E""1,UA&A,,Q,FE""1,U/A,,Q14,HE""1,U/! '$ \\/** JA,,Q,>E""1,UA&A,,Q,GE""1,U/A,,Q15,IE""1,U/% +*% '&$ +**s   B1F',B1F:'F7	:G	c                   `   a  ] tR tRt o ]P
                  tR
R ltR tR t	R t
R tR tR	tV tR# )TestPendingCalls.PendingTaski  Nc                    W n         Wn        W0n        \        P                  ! 4       V n        R V n        R V n        R V n        R # rO   )	r.   reqnotify_doner  	get_identcreator_tidrequester_tid
runner_tidr
  )r%   r  taskidr  s   &&&&r   r   %TestPendingCalls.PendingTask.__init__  s9    GH*(224D!%D"DODKr   c                    \         P                  ! 4       V n        V P                  4        V P                  e   V P	                  4        R # R # rO   )r  r  r  _runr  r$   s   &r   run TestPendingCalls.PendingTask.run  s8    '113DOIIK+  " ,r   c                (    V P                   V n        R # rO   )r  r
  r$   s   &r   r  !TestPendingCalls.PendingTask._run  s    ((DKr   c                v   a aa \         P                  ! 4       S n        VV V3R  loS P                  SRR7       R# )c                     < \         P                  ! 4       S9  d   SP                  S R R7       R# SP                  4        R# )Tr  N)r  r  _add_pendingr  )r  r%   worker_tidss   r   r  BTestPendingCalls.PendingTask.run_in_pending_call.<locals>.callback  s5    
 &&(;%%hT%B
r   Tr  N)r  r  r  r  )r%   r  r  s   ff@r   run_in_pending_call0TestPendingCalls.PendingTask.run_in_pending_call  s.    !*!4!4!6D hT:r   c                H    \         P                  ! V P                  V3R 7      # )r  )r  r  r  )r%   r  s   &&r   create_thread*TestPendingCalls.PendingTask.create_thread  s#    ##//!^ r   c                R    V P                   f   \        P                  ! R4       K&  R # N{Gz?)r
  r  r  r$   s   &r   wait_for_result,TestPendingCalls.PendingTask.wait_for_result  s    ++%

4  &r   )r  r.   r  r  r  r
  r  )NN)r)   r*   r+   r,   r  r  r  r   r  r  r  r  r  r/   r^   r_   s   @r   PendingTaskr    s3     (;;		#	#	;		! 	!r   r  c                  a R pV P                  V4      oV3R lp\        P                  ! VR7      p\        P                  ! V.4      ;_uu_ 4         RRR4       V P                  SP                  V4       R#   + '       g   i     L.; i)z1Spam spam spam spam. Lovely spam! Wonderful spam!c                     < \         P                  ! 4       p SP                  V 04      p\        P                  ! V.4      ;_uu_ 4        SP                  4        R R R 4       R #   + '       g   i     R # ; irO   )r  r  r  r   r  r  )tidr  tasks     r   do_the_workNTestPendingCalls.test_subthreads_can_handle_pending_calls.<locals>.do_the_work  sQ    %%'C""C5)A!//44$$& 5444s   A##A4	r  N)r  r  r  r   r  r5   r
  )r%   payloadr  r  r  s   &   @r   (test_subthreads_can_handle_pending_calls9TestPendingCalls.test_subthreads_can_handle_pending_calls  si    E(	'
 K0++QC00 1 	g. 10s   A99B		c           
       aaaaaa \         P                  ! 4       pV P                  \         P                  ! 4       P                  V4       \        4       o\        4       o\         P                  ! 4       oVV3R  lpV3R loVV3R lpV3R loV3R lp. p\        ^4       F3  pV P                  RV 2VVR7      pVP                  V4       V! V4       K5  	  SP                  4        VV3R lpRoVV3R	 lp	\        ^4       U
u. uF  p
\         P                  ! V	R
7      NK  	  pp
\        P                  ! V4      ;_uu_ 4         V Uu. uF  qP                  NK  	  pp\        ^4       U
u. uF  p
\         P                  ! W3R7      NK  	  pp
\        P                  ! V4      ;_uu_ 4          RRR4       T! 4        Ro RRR4       T Uu. uF  qP                  NK  	  ppT P!                  Y4       T F  pT P#                  RTP$                   24      ;_uu_ 4        T P'                  TP(                  T4       T P'                  TP(                  TP                  4       T P!                  TP(                  T4       RRR4       K  	  R# u up
i u upi u up
i   \         d    Roh i ; i  + '       g   i     EL; i  \         d    Roh i ; i  + '       g   i     EL; iu upi   + '       g   i     EK  ; i)c                 L   < SP                  V 4       SP                  R 4       R# TNr  )r  _active_queues   &r   	queue_putQTestPendingCalls.test_many_subthreads_can_handle_pending_calls.<locals>.queue_put4  s    MM$NN4 r   c                  h   <  SP                  4       p V #   \         d    \        P                  hi ; irO   )popleft
IndexErrorqueueEmpty)r  r  s    r   	queue_getQTestPendingCalls.test_many_subthreads_can_handle_pending_calls.<locals>.queue_get7  s6    "~~' K  "kk!"s    1c                     < S P                  4        S '       g    SP                  4        R # R #   \         d     R # i ; irO   )popreleaseRuntimeError)r  
_done_locks   r   queue_task_doneWTestPendingCalls.test_many_subthreads_can_handle_pending_calls.<locals>.queue_task_done=  s6    KKM3&&(  $ 3 3s   / >>c                     < S '       * # rO   r#   )r  s   r   queue_emptySTestPendingCalls.test_many_subthreads_can_handle_pending_calls.<locals>.queue_emptyD  s    :r   c                  H   < S P                  4        S P                  4        R # rO   )acquirer  )r  s   r   
queue_joinRTestPendingCalls.test_many_subthreads_can_handle_pending_calls.<locals>.queue_joinF  s      r   zrequest )r  r  r  c                    <  S'       d   R#  S! 4       pTP                  T 4       K&    \         P                   d     R# i ; ir  )r  r  r  )r  r  doner  s   & r   	add_tasksQTestPendingCalls.test_many_subthreads_can_handle_pending_calls.<locals>.add_tasksV  s@    $;D ((5 {{ s   ( A AFc                     < S! 4       '       g#   S '       d   R # \         P                  ! R4       K/  S '       g   \         P                  ! R4       K   R # r  )r  r  )r'  r   s   r   	run_tasksQTestPendingCalls.test_many_subthreads_can_handle_pending_calls.<locals>.run_tasksa  s0    !mm

4 

4  r   r  r  TNztask )r  r  r5   main_threadidentr   r  r   r  r  r#  r  r   r  BaseExceptionr  assertNotInr2  r.   assertNotEqualr  )r%   main_tidr  r  r$  tasksrj   r  r(  r+  _worker_threadsr  r  r  runner_tidsr  r  r  r'  r   r  s   &               @@@@@@r   -test_many_subthreads_can_handle_pending_calls>TestPendingCalls.test_many_subthreads_can_handle_pending_calls*  s   &&(..066A '^^%
	!		3		! rA##qcN+ $ D
 LLdO  		6 	! $)8-#+a $**)<#+ 	 -++N;;0>?1ww?$)!H.$,q %++9>R$,  .%33G<< =  <& .33U||U3/DdggY/00##D$6$6A##D$6$6H  !3!3[A 10 1-
 @.
 ) # =<< ! ! <;;& 4 100sy    JKKJK.!J K/J0	2KK*"AK/
KJ--J0	0K;	KKKK'	/Lz%gh-129824: race on assign_version_tag)threadc           	     h  a aaaaaaaaaa ^p^ o\         P                  ! 4       oS P                  V3R l4       \         P                  ! SR4       V 3R lpS P	                  R4      ;_uu_ 4        V! 4       w  ooV! 4       w  oo\
        P
                  ! 4       ^,           oVVVV3R lp\        P                  ! VR7      p\        P                  ! V.4      ;_uu_ 4        \        P                  ! S^4       \        P                  ! S4      p\        P                  ! SR4       RRR4       S P                  X\!        S4      4       RRR4       S P	                  R	4      ;_uu_ 4        V! 4       w  ooV! 4       w  oo\
        P
                  ! 4       ^,           oVVVV3R
 lp\        P                  ! VR7      p\        P                  ! V.4      ;_uu_ 4        \        P                  ! S^4       \        P                  ! S4      p\        P                  ! SR4       RRR4       S P                  X\!        S4      4       RRR4       S P	                  R4      ;_uu_ 4        V! 4       w  ooV! 4       w  ooV! 4       w  po\
        P
                  ! 4       ^,           oVVVVV3R lpRoRo\        P                  3VVV3R llp\        P                  ! VR7      p	\        P                  ! VR7      p
\        P                  ! W.4      ;_uu_ 4        S'       g   K
  \        P                  ! SR4       S'       g>   \
        P"                  ! R4       \
        P
                  ! 4       S8  g   K:  \%        R4      h\        P                  ! V^4      pRRR4       \         P'                  XR4      pS P                  V\!        S4      4       RRR4       S P	                  R4      ;_uu_ 4        V! 4       w  ooV! 4       w  ooV! 4       w  po\
        P
                  ! 4       ^,           oVVVVV3R lpRoRo\        P                  3VVV3R llpVVVV3R lp\        P                  ! VR7      p	\        P                  ! VR7      p
\        P                  ! VR7      p\        P                  ! WV.4      ;_uu_ 4         RRR4       \        P                  ! V^4      p\         P'                  VR4      pS P                  V\!        S4      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     EL; i  + '       g   i     L; i  + '       g   i     R# ; i)   c                  0   < \         P                  ! S 4      # rO   )r   destroyinterpids   r   <lambda>?TestPendingCalls.test_isolated_subinterpreter.<locals>.<lambda>  s     5 5h ?r   zif True:
            import json
            import os
            import threading
            import time
            import _testinternalcapi
            from test.support import threading_helper
            c                     <a a \         P                  ! 4       w  o oSP                  V 3R  l4       SP                  V3R l4       S S3# )c                  0   < \         P                  ! S 4      # rO   r  close)rs   r   r@  TTestPendingCalls.test_isolated_subinterpreter.<locals>.create_pipe.<locals>.<lambda>      BHHQKr   c                  0   < \         P                  ! S 4      # rO   rD  )ws   r   r@  rG    rH  r   )r  pipe
addCleanup)rF  rJ  r%   s   @@r   create_pipeBTestPendingCalls.test_isolated_subinterpreter.<locals>.create_pipe  s5    779DAqOO/0OO/0a4Kr   z"add in main, run in subinterpreterc            
      J   < \         P                  ! S R S RS RS R24       R# )a<  if True:
                    # Wait until this interp has handled the pending call.
                    waiting = False
                    done = False
                    def wait(os_read=os.read):
                        global done, waiting
                        waiting = True
                        os_read(a
  , 1)
                        done = True
                    t = threading.Thread(target=wait)
                    with threading_helper.start_threads([t]):
                        while not waiting:
                            pass
                        os.write(, b'\0')
                        # Loop to trigger the eval breaker.
                        while not done:
                            time.sleep(0.01)
                            if time.time() > zT:
                                raise Exception('timed out!')
                    Nr   
run_stringr?  r_donetimeoutw_readys   r   do_work>TestPendingCalls.test_isolated_subinterpreter.<locals>.do_work  sA    (( 8! "( )" #* +. /6Y 7#4 r   r  r   Nz-add in main, run in subinterpreter sub-threadc            
      J   < \         P                  ! S R S RS RS R24       R# )zif True:
                    waiting = False
                    done = False
                    def subthread():
                        while not waiting:
                            pass
                        os.write(rP  aO  :
                                raise Exception('timed out!')
                    t = threading.Thread(target=subthread)
                    with threading_helper.start_threads([t]):
                        # Wait until this interp has handled the pending call.
                        waiting = True
                        os.read(z=, 1)
                        done = True
                    NrQ  rS  s   r   rW  rX    sA    (( 8" #* +. /6Y 7! "( )!4 r   z"add in subinterpreter, run in mainc            
      x   < \         P                  ! S^4       \        P                  ! S RS RS RS R24       R# rY   zif True:
                    # Add the pending call and wait for it to finish.
                    actual = _testinternalcapi.pending_identify(zX)
                    # Signal the subinterpreter to stop.
                    os.write(z&, b'\0')
                    os.write(z4, actual.to_bytes(1, 'little'))
                    Nr  readr   rR  r?  main_interpidr_readyw_dataw_dones   r   add_job>TestPendingCalls.test_isolated_subinterpreter.<locals>.add_job  K    #(( 8AAN P$X &$X &4 r   Fc                 "   < R oV ! S^4       R oR# r  r#   os_readr'  rT  waitings   &r   wait;TestPendingCalls.test_isolated_subinterpreter.<locals>.wait      "r   r  
timed out!littlez(add in subinterpreter, run in sub-threadc            
      x   < \         P                  ! S^4       \        P                  ! S RS RS RS R24       R# r[  r\  r^  s   r   rc  rd    re  r   c                 "   < R oV ! S^4       R oR# r  r#   rg  s   &r   rj  rk  %  rl  r   c                     < S'       g   K
  \         P                  ! SR 4       S '       g>   \        P                  ! R4       \        P                  ! 4       S8  g   K:  \	        R4      hR# )r   r  rm  N)r  writer  r  	Exception)r'  rU  rV  ri  s   r   	subthread@TestPendingCalls.test_isolated_subinterpreter.<locals>.subthread*  sD    !%(JJt$yy{W,'55 r   )r   createrL  rR  r2  r  r  r  r   r  r  r]  r  pending_identifyrr  r5   ru  r  rs  
from_bytesstartjoin)r%   maxtextrM  rW  r  actualr_datarc  rj  t1t2textrt  t3r'  r?  r_  rT  r`  rU  ra  rb  rV  ri  s   f             @@@@@@@@@@r   test_isolated_subinterpreter-TestPendingCalls.test_isolated_subinterpreter  sB     '')?@   0 		 \\>??*}GW'MNFFiikB&G *   0A!//44#*;;HE' 5 VS]3E @H \\IJJ*}GW'MNFFiikB&G (   0A!//44#*;;HE' 5 VS]3C KF \\>??*}GW'MNFF'MNFFiikB&G  GDWW  
 !!1B!!.B!//99!%(JJt$yy{W,'55wwvq) : ^^D(3FVS%78K @N \\DEE*}GW'MNFF'MNFFiikB&G  GDWW  
6 6 !!1B!!.B!!3B!//== >7761%D^^D(3FVS%78Q FV 	} 5447 @??| 5445 KJJx :993 @??T >=G FEV 	s   0A0T) AT	%#T))A0UAT=	#U"B/U9U%	 U%	;-U%	-"U%	9U9)CV 9V	;AV T& 	T))T:	=U	UU"	%U60	U99V
	VV  V1	r#   rO   )r)   r*   r+   r,   r  r  r  r   requires_working_threadingr  r  r  r  typesSimpleNamespacer  r  r7  r!   r   skip_if_sanitizerr  r/   r^   r_   s   @r   r  r  a  s     M MU M$& 002: 3:(
$%%0N.!e++ .!` 002/ 3/ 002\B 3\B| FtT_4 U _4r   r  c                     a  ] tR tRt o ]P
                  ! ]! ]R4      R4      R 4       t]P
                  ! ]! ]R4      R4      R 4       t	]
P                  ! 4       R 4       t]]P
                  ! ]! ]R4      R4      R 4       4       t]P                  ! ]RJ R	4      ]P
                  ! ]! ]R4      R4      ]! 4       R
 4       4       4       tR t]P                  ! ]RJ R4      ]! 4       R 4       4       tRtV tR# )SubinterpreterTestim  rK  zrequires os.pipe()c                   ^ RI p\        P                  ! 4       w  r#RP                  V4      p\	        VR4      ;_uu_ 4       p\
        P                  ! V4      pV P                  V^ 4       V P                  \        P                  ! V4      \        \        P                  4      4       V P                  \        P                  ! V4      \        V4      4       RRR4       R#   + '       g   i     R# ; i)r   Nzif 1:
            import sys, builtins, pickle
            with open({:d}, "wb") as f:
                pickle.dump(id(sys.modules), f)
                pickle.dump(id(builtins), f)
            rb)builtinsr  rK  formatopenr   run_in_subinterpr5   r1  pickleloadr.   rf   modules)r%   r  rF  rJ  rF   frets   &      r   test_subinterps"SubinterpreterTest.test_subinterpso  s    wwy
 q	 	 !T]]a**40CS!$A3;;@A8=	 ]]]s   BC  C1	c           	     \   \         P                  ! 4       w  rR P                  V4      p\        VR4      ;_uu_ 4       p\        P
                  ! V4      pV P                  V^ 4       V P                  \        P                  ! V4      RRRR/4       RRR4       R#   + '       g   i     R# ; i)aa  if 1:
            import pickle
            with open({:d}, "wb") as f:

                @(lambda x:x)  # Py 3.9
                def noop(x): return x

                a = (b := f'1{{2}}3') + noop('x')  # Py 3.8 (:=) / 3.6 (f'')

                async def foo(arg): return await arg  # Py 3.5

                pickle.dump(dict(a=a, b=b), f)
            r  r;  123xr   r  N)	r  rK  r  r  r   r  r5   r  r  )r%   rF  rJ  rF   r  r  s   &     r   (test_subinterps_recent_language_features;SubinterpreterTest.test_subinterps_recent_language_features  s    wwy q	 	 !T]]a**40CS!$V[[^c63-FG ]]]s   ABB+	c                    R p\         P                  R4      pV P                  \        P                  ! V4      ^ R4       \         P                  R4      pV P                  W#R4       V P                  W#R4       R# )aU  if 1:
        import sys, _testcapi

        # Any config value would do, this happens to be the one being
        # double checked at the time this test was written.
        _testcapi.config_set('int_max_str_digits', 55555)
        sub_value = _testcapi.config_get('int_max_str_digits')
        assert sub_value == 55555, sub_value
        int_max_str_digitsz%subinterp code failure, check stderr.z7Expected get_config() to return a new dict on each callzJCAUTION: Tests executed after this may be running under an altered config.N)r   
config_getr5   r   r  assertIsNot)r%   rF   before_configafter_configs   &   r   (test_py_config_isoloated_per_interpreter;SubinterpreterTest.test_py_config_isoloated_per_interpreter  sz     ",,-AB11$7@	B ++,@AI	K 	<	=r   c           
        ^ pRpRpRpRpRpW,          V,          V,          V,          V,          p. ROpV U	u. uF  p	RV	 2NK
  	  p
p	RV
^ &   RV
R&   RV
R&   RVR3RVR3RW2,          R3/pR0p\         '       dY   \        VP                  4       4       F;  p\        \	        W4      4      pVR,          '       d   K(  W VP                  V4       K=  	  VP                  4        EF  w  r\        \	        W4      4      pVw  ppRVRV/pV P                  V4      ;_uu_ 4        \        P                  ! 4       w  pp\        P                  ! RV R	24      p\        P                  ! V4      ;_uu_ 4       p\        P                  ! V3/ VB pV P                  V^ 4       VP!                  4       pR
R
R
4       \"        P$                  ! X4      pV P                  VV4       R
R
R
4       EK  	  V F  p\        \	        W4      4      pV P                  V4      ;_uu_ 4        \        P                  ! R4      pV P'                  \(        P*                  4      ;_uu_ 4        \        P                  ! V3/ VB  R
R
R
4       R
R
R
4       K  	  R
# u up	i   + '       g   i     L; i  + '       g   i     EK  ; i  + '       g   i     LK; i  + '       g   i     K  ; i)z
The config with which an interpreter is created corresponds
1-to-1 with the new interpreter's settings.  This test verifies
that they match.
own_gilallow_use_main_obmalloccheck_multi_interp_extensionsTFfeature_flagsz
                    import _testinternalcapi, json, os
                    settings = _testinternalcapi.get_interp_settings()
                    with os.fdopen(zX, "w") as stdin:
                        json.dump(settings, stdin)
                    Nz
                    import _testinternalcapi
                    _testinternalcapi.get_interp_settings()
                    raise NotImplementedError('unreachable')
                    r               )obmallocforkr  r  daemon_threads
extensionsr  r   )TTTTTTT)TFFFFFF)FFFTFTF)FFFFFFF)r   r   keysr\  zipadditemsr2  r  rK  rA   rB   fdopenr   run_in_subinterp_with_configr5   r]  jsonloadsr8   r   InterpreterError)r%   OBMALLOC
EXTENSIONSTHREADSDAEMON_THREADSFORKEXEC	ALL_FLAGSfeaturesr  kwlistexpected_to_workexpected_to_failconfigkwargsr  	exp_flagsexp_gilrF  rJ  scriptstdoutr  rJ   settingss   &                        r   test_configured_settings+SubinterpreterTest.test_configured_settings  s    
_t+g5F!"	
 )111F1#,1'q	4r
r
 7D!<5!;%u-
 >
 ?/4467c&12=>>(0$((0	 8 !1 6 6 8F#f-.F!)Iw7H f%%wwy1! .$ %&3 '*  YYq\\V!>>vPPC$$S!, ++-C "  ::c?  84 &% !90 'F#f-.Ff%%! . 
 &&}'E'EFF88J6J G &% 'i 2V "\ &%%2 GF &%%sN   J!AJ2:J,0J>KJ41KJJJ14K?KKNz%test requires _testsinglephase modulec                  a aaa	 ^ pRoRpRpRpRpW,          V,          V,          V,          oRRRRRRRRRRRR/o	VVV	V 3R	 lpR
S n         S P                  R4      ;_uu_ 4        V! RR4       R
R
R
4       S P                  R4      ;_uu_ 4        V! R^ 4       R
R
R
4       S P                  R4      ;_uu_ 4        V! R^4       R
R
R
4       S P                  R4      ;_uu_ 4        V! RR4       R
R
R
4       S P                  R4      ;_uu_ 4        V! R^ 4       R
R
R
4       S P                  R4      ;_uu_ 4        V! R^4       R
R
R
4       R
#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R
# ; i)z
PyInterpreterConfig.check_multi_interp_extensions can be overridden
with PyInterpreterState.override_multi_interp_extensions_check.
This verifies that the override works but does not modify
the underlying setting.
r  T
allow_fork
allow_execallow_threadsallow_daemon_threadsr  Fc                   < \        SV R 7      pV '       d
   SS,          MSpRVRR/pRTR^ RTR^ RTR	TR
TRV '       * RV'       d   V^ 8  MT '       * RV '       * /
p\        P                  ! 4       w  rg\        '       d!   SP	                  \        P
                  V4       \        P                  ! RV RV R24      p\        P                  ! V4      ;_uu_ 4       p	\        P                  ! V3/ VB p
SP                  V
^ 4       V	P                  4       pRRR4       \        P                  ! X4      pSP                  W4       R#   + '       g   i     L9; i)r  r  r  F	requestedoverride__initialoverride_afteroverride_restoredsettings__initialsettings_aftersettings_restoredallowed__initialallowed_afterallowed_restoredzu
                from test.test_capi.check_config import run_singlephase_check
                run_singlephase_check(z, z)
                N)r\  r  rK  r   rL  rE  rA   rB   r  r   r  r5   r]  r  r  )enabledoverrider  flagsr  r  rF  rJ  r  r  r  rJ   results
BASE_FLAGSr  base_kwargsr%   s   &&           r   rY  TSubinterpreterTest.test_overridden_setting_extensions_subinterp_check.<locals>.check-  s7   .5F 07J+JE5H X#Q (#Q#X (#X"Kx!|g!N"KH 779DA!,__ *''/j1# 6& F 1::6LVL  a(kkm  jjoGW/ s   :EE	Nz*config: check disabled; override: disabledz,config: check disabled; override: use configz)config: check disabled; override: enabledz)config: check enabled; override: disabledz+config: check enabled; override: use configz(config: check enabled; override: enabledr   r  r  r  r  r   )maxDiffr2  )
r%   r  r  r  r  r  rY  r  r  r  s
   f      @@@r   2test_overridden_setting_extensions_subinterp_checkESubinterpreterTest.test_overridden_setting_extensions_subinterp_check  sg    
_t+g5F
$$T"Du
(	0 (	0T  \\FGG% H\\HII%O J\\EFF%O G \\EFF$O G\\GHH$N I\\DEE$N FE HGIIFF GFHHEEEsH   %
E
E#;
E6&
F	
F<
F/E 	#E3	6F		F	F,	/G 	c                r    ^ RI p\        P                  ! R4       V P                  VP                  R4       R# )z
Exceptions saved in global module state get shared between
individual module instances. This test checks whether or not
a change in one interpreter's module gets reflected into the
other ones.
Nz1import binascii; binascii.Error.foobar = 'foobar'foobar)binasciir   r  assertNotHasAttrError)r%   r  s   & r   test_mutate_exception(SubinterpreterTest.test_mutate_exceptioni  s*     	  !TUhnnh7r   $test requires _testmultiphase modulec                   \         P                  ! 4       w  rV P                  \         P                  V4       V P                  \         P                  V4       \        P
                  '       d   RpMRp\        P                  ! RV RV R24      p\        V4       \         P                  ! V^d4      p\        P                  ! V4      pV P                  V^ 4       \         P                  ! V^d4      pV P                  WW4       R# )zs
bpo-44050: Extension module state should be shared between interpreters
when it doesn't support sub-interpreters.
AppleFrameworkLoaderExtensionFileLoadera  
            import importlib.machinery
            import importlib.util
            import os

            fullname = '_test_module_state_shared'
            origin = importlib.util.find_spec('_testmultiphase').origin
            loader = importlib.machinery.z(fullname, origin)
            spec = importlib.util.spec_from_loader(fullname, loader)
            module = importlib.util.module_from_spec(spec)
            attr_id = str(id(module.Error)).encode()

            os.write(z, attr_id)
            N)r  rK  rL  rE  r   is_apple_mobilerA   rB   r  r]  r  r5   )r%   rF  rJ  loaderr  main_attr_idr  subinterp_attr_ids   &       r   "test_module_state_shared_in_global5SubinterpreterTest.test_module_state_shared_in_globalv  s     wwy!$!$ """+F*F &* +1 2
 S "  	Vwwq#&&v.a GGAsO9r   )r  )r)   r*   r+   r,   r   r?  r  r  r  r  r   requires_gil_enabledr  r!   r  r   _testsinglephaser
   r  r  _testmultiphaser  r/   r^   r_   s   @r   r  r  m  s:    V,.BC> D> V,.BCH DH, !!#= $=> V,.BCVK D VKp __%-/VWV,.BC &'R ( D X
Rh8 ___,.TU &'$: ( V$:r   r  c                      a  ] tR tRt o R]P
                  ! RRRRRRRR7      R]P
                  ! RRRRR]! ]4      RR7      R	]P
                  ! RRRRRRR
R7      /t. ROt	R t
RR ltR tR tR tR tRtV tR# )InterpreterConfigTestsi  isolatedFTownr  r  r  r  r  r  gillegacysharedemptydefaultc              #     "   R FX  pR FO  pR FF  pR F=  pR F4  pR F+  pR F"  p\         P                  ! VVVVVVVR7      x  K$  	  K-  	  K6  	  K?  	  KH  	  KQ  	  KZ  	  R# 5i)Tr  NTF)r  r  r  )r  r  )r%   r  r  r  r  allow_daemoncheckextr  s   &       r   iter_all_configs'InterpreterConfigTests.iter_all_configs  su     !.+
"/J)6,9L,9+GC*/*?*?:K3=3=6C=IFN,/+& %& ,H -: -: *7 #0 , "/s   A!A#Nc                   V P                  \        V4      \        V4      4       W8X  d   R # ^ R Ip^ R Ip^ RIHp RV! W4      ,          pRRP                  VP                  VP                  \        V4      4      P                  4       VP                  \        V4      4      P                  4       4      4      ,           pRV R2pV P                  Wx4      pV P                  V P                  W74      4       R # )N)_common_shorten_reprz%s != %s
z
namespace())r5   r  difflibpprintunittest.utilr  rz  ndiffpformatvars
splitlines_truncateMessagefail_formatMessage)	r%   ns1ns2rK   r  r  r  standardMsgdiffs	   &&&&     r   assert_ns_equal&InterpreterConfigTests.assert_ns_equal  s    cDI.:6 #7#AAtyy~~d3i0;;=~~d3i0;;="? @ @ D6#++K>		$%%c78r   c                2  a  V 3R  lpS P                  R4      ;_uu_ 4        V! RR4       RRR4       S P                   F-  pS P                  V4      ;_uu_ 4        V! W"4       RRR4       K/  	  R#   + '       g   i     LO; i  + '       g   i     KW  ; i)c                 B  < SP                   V,          pV '       d   V 3MRp\        P                  ! V!  pSP                  W14       SP	                  W14       \        P                  ! V!  pSP                  WA4       SP	                  WA4       SP	                  WC4       R # )Nr#   )	supportedr   
new_configr   r  )r  r  r   config1config2r%   s   &&   r   rY  <InterpreterConfigTests.test_predefined_config.<locals>.check  s    ~~h/H"D7D#..5G  3W/#..5G  3W/W.r   r  Nr   )r2  r$  )r%   rY  r  s   f  r   test_predefined_config-InterpreterConfigTests.test_predefined_config  sl    	/ \\)$$$
# % NNDd##d! $# # %$ $##s   
A2	B2B	Bc                F
   V P                   P                  4        EF  w  rV P                  R V R24      ;_uu_ 4        Tp\        V4      p\        P
                  ! V3/ VB pV P                  WS4       RRR4       V P                  RV R24      ;_uu_ 4        \        V4      P                  4        UUu/ uF  w  rgWg'       * bK  	  pppV P                   FX  pVP                  V8X  d   K  WR&   \        P                  ! R/ VB p\        P
                  ! V3/ VB pV P                  WS4       KZ  	  RRR4       \        V4      P                  4        F  w  rV	R8X  d%   V P                   Uu. uF  qwV
8w  g   K  VNK  	  ppMV
'       * .pV F  pV P                  V RV	 RV
: RV: R24      ;_uu_ 4        W/p\        P                  ! R/ \        \        V4      3/ VB B p\        P
                  ! V3/ VB pV P                  WS4       RRR4       K  	  K  	  EK  	  V P                  R4      ;_uu_ 4        V P                    FA  pV P                  \        4      ;_uu_ 4        \        P
                  ! VR	R
7       RRR4       KC  	  RRR4       \        V P                   R,          4      P                  4        F  w  rV	R8X  d   K  ^RRRR\        4       3 Fj  pV P                  RV	 RV: R24      ;_uu_ 4        V P                  \        4      ;_uu_ 4        \        P
                  ! R/ W/B  RRR4       RRR4       Kl  	  K  	  R	^RR\        4       3 Fg  pV P                  RV: R24      ;_uu_ 4        V P                  \        4      ;_uu_ 4        \        P
                  ! VR7       RRR4       RRR4       Ki  	  R Fg  pV P                  RV: R24      ;_uu_ 4        V P                  \        4      ;_uu_ 4        \        P
                  ! VR7       RRR4       RRR4       Ki  	  R#   + '       g   i     EL; iu uppi   + '       g   i     EL(; iu upi   + '       g   i     EK  ; i  + '       g   i     EKJ  ; i  + '       g   i     EL; i  + '       g   i     EL{; i  + '       g   i     EK  ; i  + '       g   i     EL&; i  + '       g   i     EK  ; i  + '       g   i     L; i  + '       g   i     EKU  ; i)znoop (r  Nzchange all (r  .z (z -> zunsupported fieldT)rC  r  r   rC  g      ?zunsupported value (=zunsupported value(gil=)r  zunsupported value (gil=r#   )r   rC  )r$  r  r2  r  r   r%  r   gil_supportedr  r  r  r\  r8   rP   rp   rr   )r%   r  vanillar  	overridesr  kvr  fieldoldvaluesr  r  s   &             r   test_update_from_dict,InterpreterConfigTests.test_update_from_dict  s$   !^^113MDtfA.//" M	&11$D)D$$V6	 0 TF!45526w-2E2E2GH2G$!QX2G	H--C{{c) '*e$$44AyAH*55<@ODMOF((: . 6 #7m113
E>)-););H);ACxaa);FHF"%gYF!CawbtC7!&LMM%*L	#(#8#8 $"4=>I>$ "/!9!9<@"ODM"O,,V> NM " 4' 4D \\-..&&z22!,,T= 32 ' / !!89??ALE~RdFH=\\$7way"JKK**955%00BE>B 6 LK >	 B AsD&(3E 6uiqABB&&y11!,,7 2 CB 4 "E 7yBCC&&z22!,,7 3 DC "k 0// I 655 I NMM 322 /.. 655 LKK 211 CBB
 32 DCCs   6P8Q6QA+Q.Q&;Q&8AQ+;-R(R RR=	R)7R=	?S&S5S&,T
S;"T8Q	QQ#+Q= R
RR&	)R:4	R=	=SS#	S&&S8;TTT c           
       a  \        R RR7      \        RRR7      \        R R R7      \        RR R7      \        RR R7      .p\        RRR7      .p\        '       d   VP                  \        RR	7      4       R
 pV 3R lpS P                  4        F  pVP                  R8X  d   K  V! WR4      '       d`   S P                  RV 24      ;_uu_ 4        S P                  \        P                  4      ;_uu_ 4        V! V4       RRR4       RRR4       K  V! WQ4      '       d0   S P                  RV 24      ;_uu_ 4        V! V4       RRR4       K  S P                  RV 24      ;_uu_ 4        V! V4       RRR4       K  	  R#   + '       g   i     L; i  + '       g   i     EK  ; i  + '       g   i     EK-  ; i  + '       g   i     EKB  ; i)TF)r  r  r  )r  r  )r  r  )r  r  r  )r  r  r  c                 V    \        V 4      pV F  p\        V3/ VB V8X  g   K   R # 	  R# r	  )r  r\  )r  override_casesnsr0  s   &&  r   match6InterpreterConfigTests.test_interp_init.<locals>.matchY  s/    fB+	(i(B. , r   c                 \   < R p\         P                  ! W4      pSP                  V^ 4       R# )passN)r  r  r5   )r  r  r   r%   s   &  r   rY  6InterpreterConfigTests.test_interp_init.<locals>.check`  s(    F"??OBR#r   r  z	invalid: Nzquestionable: zvalid: )	r\  r   r  r  r  r2  r8   r   r  )r%   questionableinvalidr<  rY  r  s   f     r   test_interp_init'InterpreterConfigTests.test_interp_init7  s      "'
 "
 #%) "&)
4 "'.3
 ?NN4eDE		$
 ++-FzzY&V%%\\IfX"677**=+I+IJJf K 87 v,,\\N6(";<<&M =< \\GF8"455&M 65 .
 KJ 877 =<< 655s<   (F6	F?F;	F)*	F>FFF&)F;>Gc           
     Z   \         P                  R  4       pV P                  R4      ;_uu_ 4        \        P                  ! R4      pRVn        \        '       d   RVn        \        P                  ! 4       vr4\        P                  ! V4      pV P                  WR4       RRR4       V P                  R4      ;_uu_ 4        \        P                  ! R4      pV! R4      ;_uu_ 4       p\        P                  ! V4      pRRR4       V P                  XV4       RRR4       V P                  R4      ;_uu_ 4        \        P                  ! R4      pV! R4      ;_uu_ 4       p\        P                  ! V4      pRRR4       V P                  XV4       RRR4       V P                  R4      ;_uu_ 4        \        P                  ! RR	R
\        \        4      R7      pV! V4      ;_uu_ 4       p\        P                  ! V4      pRRR4       V P                  XV4       RRR4       R#   + '       g   i     EL; i  + '       g   i     ELD; i  + '       g   i     EL>; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)c              3     "   \         P                  ! V R R7      p Vx   \         P                  ! V4       R#   \         P                   d     R# i ; i   \         P                  ! T4       i   \         P                   d     i i ; i; i5i)F)reqrefsN)r   rv  r=  InterpreterNotFoundError)r  r?  s   & r   
new_interp:InterpreterConfigTests.test_get_config.<locals>.new_interpt  sv     $++FEBH!))(3$== !))(3$== sZ   BA 9 BABABB	A.-B	.BB	BB		Br  r  r  FNr   customr  Tr  )r  r  r  )
contextlibcontextmanagerr2  r   r%  r  r   r  get_main
get_configr   bool)r%   rI  r  r?  r4  r  origs   &      r   test_get_config&InterpreterConfigTests.test_get_configs  s   		"	"	 
#	 \\&!!$//9H HL9>6(113LH"--h7F  2 " \\*%%$//
;HJ''8&11(; (  2	 & \\(##$//9HH%%&11(; &  2	 $ \\(## ++"&.2?.C	D D!!X&11(; "  . $#+ "!! ('' &%% &% $# "! $##sx   A.H$?'I&H8	=I8'I3I 	6I318J)J	 J$H5	8I		II	 I0+I33J	JJJ*	r#   )r  r  r  rO   )r)   r*   r+   r,   r  r  rP  r   r$  r.  r  r   r)  r6  rC  rR  r/   r^   r_   s   @r   r  r    s      	E))#!&*.
 	%''"!%*.*?
 	&&#!&*/
'I: 1M&$9""*:8x:"x*/ */r   r  c                      a  ] tR tRt o 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V tR# )InterpreterIDTestsi  c                6   a V3R  lpV P                  V4       R# )c                  n   <  \         P                  ! S 4       R #   \         P                   d     R # i ; irO   )r   r=  rH  r>  s   r   ensure_destroyed?InterpreterIDTests.add_interp_cleanup.<locals>.ensure_destroyed  s.    %%h/ 99 s    44N)rL  )r%   r?  rX  s   &f r   add_interp_cleanup%InterpreterIDTests.add_interp_cleanup  s    	
 	()r   c                R    \         P                  ! 4       pV P                  V4       V# rO   )r   rv  rZ  )r%   r.   s   & r   new_interpreter"InterpreterIDTests.new_interpreter  s#    !!##	r   c                Z    \         P                  pV! ^
4      pV P                  V^
4       R# rl  )r  normalize_interp_idr5   )r%   convertr?  s   &  r   test_conversion_int&InterpreterIDTests.test_conversion_int  s&    #772;2&r   c                    \         P                  p ! R  R\        4      pV! V! 4       4      pV P                  V^
4       R# )c                   &   a  ] tR tRt o R tRtV tR# )9InterpreterIDTests.test_conversion_coerced.<locals>.MyInti  c                    ^
# )rm  r#   r$   s   &r   r  CInterpreterIDTests.test_conversion_coerced.<locals>.MyInt.__index__      r   r#   N)r)   r*   r+   r,   r  r/   r^   r_   s   @r   MyIntrf          r   rj  N)r  r`  r   r5   )r%   ra  rj  r?  s   &   r   test_conversion_coerced*InterpreterIDTests.test_conversion_coerced  s7    #77	C 	 57#2&r   c                x    \         P                  pV P                  4       pV! V4      pV P                  W24       R # rO   )r  r`  r]  r5   )r%   ra  r?  	converteds   &   r    test_conversion_from_interpreter3InterpreterIDTests.test_conversion_from_interpreter  s3    #77'')H%	-r   c           
     :   \         P                  p\        4       R RR3 FW  pV P                  RV: 24      ;_uu_ 4        V P	                  \
        4      ;_uu_ 4        V! V4       RRR4       RRR4       KY  	  RpV P                  RV: 24      ;_uu_ 4        V P	                  \        4      ;_uu_ 4        V! V4       RRR4       RRR4       RpV P                  RV: 24      ;_uu_ 4        V P	                  \        4      ;_uu_ 4        V! V4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     EK.  ; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     Lh; i  + '       g   i     R# ; i)g      $@10s   10zbad: Nr   r  )r  r`  rp   r2  r8   rr   rP   OverflowError)r%   ra  badids   &  r   test_conversion_bad&InterpreterIDTests.test_conversion_bad  s#   #77 H	
E eY/00&&y11EN 2 10
 \\E%+,,"":.. / - \\E%+,,""=11 2 -, 21 100 /. -, 21 -,,sk   D;	D(&D;E#7	E	 E#/F		E6	F	(D83D;;EE E##E3	6FF		F	c                p    V P                  4       pV P                  \        P                  ! V4      4       R # rO   )r]  r6   r  interpreter_existsr%   r?  s   & r   test_lookup_exists%InterpreterIDTests.test_lookup_exists  s*    '')00:	<r   c                z    \         P                  ! 4       pV P                  \         P                  ! V4      4       R # rO   )r  unused_interpreter_idassertFalsery  rz  s   & r   test_lookup_does_not_exist-InterpreterIDTests.test_lookup_does_not_exist  s,    $::<00:	<r   c                    \         P                  ! 4       p\         P                  ! V4       V P                  \        P
                  ! V4      4       R # rO   )r   rv  r=  r  r  ry  rz  s   & r   test_lookup_destroyed(InterpreterIDTests.test_lookup_destroyed  s:     '')h'00:	<r   c                F    \         P                  R  \        P                  3# )c                 2    \         P                  ! V R R7      # )F)implieslink)r   incref)r.   s   &r   r@  9InterpreterIDTests.get_refcount_helpers.<locals>.<lambda>  s    ,,RUCr   )r  get_interpreter_refcountr   decrefr$   s   &r   get_refcount_helpers'InterpreterIDTests.get_refcount_helpers  s!    66C  
 	
r   c           	     	   \         P                  p\         P                  p\         P                  p\         P                  pV P                  4       w  rVpV P                  R 4      ;_uu_ 4        \         P                  ! 4       pV P                  V! V4      4       V P                  \        P                  4      ;_uu_ 4        V! V4       RRR4       V P                  \        P                  4      ;_uu_ 4        V! V4       RRR4       V P                  \        P                  4      ;_uu_ 4        V! V4       RRR4       V P                  \        P                  4      ;_uu_ 4        V! V4       RRR4       V P                  \        P                  4      ;_uu_ 4        V! V4       RRR4       V P                  \        P                  4      ;_uu_ 4        V! V4       RRR4       RRR4       V P                  R4      ;_uu_ 4        \        P                  ! 4       p\        P                  ! V4       V P                  V! V4      4       V P                  \        P                  4      ;_uu_ 4        V! V4       RRR4       V P                  \        P                  4      ;_uu_ 4        V! V4       RRR4       V P                  \        P                  4      ;_uu_ 4        V! V4       RRR4       V P                  \        P                  4      ;_uu_ 4        V! V4       RRR4       V P                  \        P                  4      ;_uu_ 4        V! V4       RRR4       V P                  \        P                  4      ;_uu_ 4        V! V4       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LW; i  + '       g   i     EL3; i  + '       g   i     EL?; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELw; i  + '       g   i     ELS; i  + '       g   i     EL/; i  + '       g   i     EL; i  + '       g   i     R# ; i)znever existedN	destroyed)r  ry  interpreter_refcount_linkedlink_interpreter_refcountunlink_interpreter_refcountr  r2  r~  r  r8   r   rH  rv  r=  	r%   exists	is_linkedlinkunlinkget_refcountr  r  r?  s	   &        r   $test_linked_lifecycle_does_not_exist7InterpreterIDTests.test_linked_lifecycle_does_not_exist  s   "55%AA	 ::">>'+'@'@'B$f\\/**(>>@Hx """=#I#IJJ(# K""=#I#IJJX K""=#I#IJJx  K""=#I#IJJX& K""=#I#IJJx  K""=#I#IJJx  K +" \\+&&$++-H!!(+x """=#I#IJJ(# K""=#I#IJJX K""=#I#IJJx  K""=#I#IJJX& K""=#I#IJJx  K""=#I#IJJx  K '& KJJJJJJJJJJJJJJJJJ +**, KJJJJJJJJJJJJJJJJJ '&&s:  -AP 	N(	
/P 9	N<	/P 1	O	:/P )	O$	2/P !	O8	*/P 	P	"P A*R,5	P4	>/R,-	Q	6/R,%	Q	./R,	Q0	&/R,	R	/R,	R	R,(N93	P <O	P O!	P $O5/	P 8P		P P	P  P1	4Q?	R,Q	R,Q-'	R,0R;	R,R	R,R)#	R,,R=	c                    \         P                  pV P                  4       w  p pV P                  4       pV! V4      pV! V4      pV P	                  V4       V P                  V^ 4       R# r   N)r  r  r  r]  r  r5   )r%   r  r  r4  r?  linkedrefcounts   &      r   test_linked_lifecycle_initial0InterpreterIDTests.test_linked_lifecycle_initial	  sd    %AA	!668a '')8$) 1%r   c                   \         P                  p\         P                  pV P                  4       w  r4pV P	                  4       pV! V4       V P                  V! V4      4       V P                  ^V! V4      4       V! V4       V P                  V! V4      4       V P                  V! V4      4       V P                  ^ V! V4      4       R# r   )r  ry  r  r  r]  r  r5   r6   )r%   r  r  r  r  r  r?  s   &      r   "test_linked_lifecycle_never_linked5InterpreterIDTests.test_linked_lifecycle_never_linked'	  s    "55%AA	'+'@'@'B$f'') 	xh	!|H%	' 	x8	h	!|H%	'r   c                ~   \         P                  p\         P                  p\         P                  p\         P                  pV P                  4       pV! V4       V P                  V! V4      4       V P                  V! V4      4       V! V4       V P                  V! V4      4       V P                  V! V4      4       R # rO   )r  ry  r  r  r  r]  r6   r  )r%   r  r  r  r  r?  s   &     r   !test_linked_lifecycle_link_unlink4InterpreterIDTests.test_linked_lifecycle_link_unlink>	  s    "55%AA	 ::">>'') 	X8	h	! 	x8	h	!r   c                   \         P                  p\         P                  p\         P                  pV P	                  4       w  rEpV P                  4       pV! V4       V P                  V! V4      4       V P                  ^ V! V4      4       V! V4       V P                  ^V! V4      4       V! V4       V P                  V! V4      4       R# r  )	r  ry  r  r  r  r]  r6   r5   r  )r%   r  r  r  r  r  r  r?  s   &       r   (test_linked_lifecycle_link_incref_decref;InterpreterIDTests.test_linked_lifecycle_link_incref_decrefT	  s    "55%AA	 ::'+'@'@'B$f'') 	Xh	!|H%	' 	x|H%	' 	x8	r   c                :   \         P                  p\         P                  pV P                  4       w  r4pV P	                  4       pV! V4       V P                  ^V! V4      4       V! V4       V P                  V! V4      4       V P                  ^V! V4      4       R# r   )r  r  r  r  r]  r5   r6   )r%   r  r  r  r  r4  r?  s   &      r   !test_linked_lifecycle_incref_link4InterpreterIDTests.test_linked_lifecycle_incref_linkm	  s    %AA	 ::"&";";"=a'')x|H%	' 	Xh	!|H%	'r   c                &   \         P                  p\         P                  p\         P                  p\         P                  pV P                  4       w  rVpV P                  4       pV! V4       V P                  V! V4      4       V! V4       V P                  ^V! V4      4       V! V4       V P                  V! V4      4       V P                  ^V! V4      4       V! V4       V P                  V! V4      4       V P                  ^ V! V4      4       R# r   )
r  ry  r  r  r  r  r]  r6   r5   r  r  s	   &        r   /test_linked_lifecycle_link_incref_unlink_decrefBInterpreterIDTests.test_linked_lifecycle_link_incref_unlink_decref	  s    "55%AA	 ::">>'+'@'@'B$f'')Xh	! 	x|H%	' 	xh	!|H%	' 	x8	|H%	'r   r#   N)r)   r*   r+   r,   rZ  r]  rb  rl  rp  rv  r{  r  r  r  r  r  r  r  r  r  r  r/   r^   r_   s   @r   rU  rU    s`     *
'
'..<
<
<
(!T
&'.!,2'$' 'r   rU  c                   ^   a  ] tR tRt o Rt]R 4       t]P                  R 4       t	R t
RtV tR# )TestStaticTypesi	  Fc                d    V P                   '       d   \        P                  ! R 4      hRV n         R# )z%these tests do not support re-runningTN)_has_runr   SkipTestr,  s   &r   
setUpClassTestStaticTypes.setUpClass	  s&     <<<##$KLLr   c              '  >   "   \         P                  ! V!  pVx  R # 5irO   )r   get_basic_static_type)r%   r   r-  s   &* r   basic_static_type!TestStaticTypes.basic_static_type	  s     --t4	s   c                   V P                  4       ;_uu_ 4       pV P                  VP                  \        4       V P	                  VP
                  \        34       V P                  \        V4      \        \        4      4       R R R 4       V P                  \        4      ;_uu_ 4       pV P                  VP                  \        4       V P	                  VP
                  \        34       V P                  \        V4      \        \        4      4       R R R 4       R #   + '       g   i     L; i  + '       g   i     R # ; irO   )r  rc  __base__rp   r5   	__bases__r  )r%   r-  s   & r   %test_pytype_ready_always_sets_tp_type5TestStaticTypes.test_pytype_ready_always_sets_tp_type	  s     ##%%MM#,,/S]]VI6MM$s)T&\2 & ##F++sMM#,,/S]]VI6MM$s)T&\2 ,+ &% ,++s   A*D(A*D/D,	/E 	r#   N)r)   r*   r+   r,   r  classmethodr  rL  rM  r  r  r/   r^   r_   s   @r   r  r  	  s@     H   4 4r   r  c                   
  a  ] tR tRt o ]P
                  ]P                  ! 4       R 4       4       t]P
                  ]P                  ! 4       R 4       4       t]P
                  ]P                  ! 4       R 4       4       t	R t
RtV tR# )TestThreadStatei	  c                   a  V 3R  lpV! 4        \         P                  ! VR7      pVP                  4        VP                  4        R# )c                     <a . oV3R  lp \         P                  V 4       T ;r\        P                  ! ^4       SP	                  SP                  \        P                  ! 4       4      ^R4       R# )c                  P   < S P                  \        P                  ! 4       4       R # rO   )r  r  r  )identss   r   r  CTestThreadState.test_thread_state.<locals>.target.<locals>.callback	  s    i1134r   z/Couldn't find main thread correctly in the listN)r   _test_thread_stater  r  r5   r  r  r  )r  r;  r   r  r%   s      @r   r  1TestThreadState.test_thread_state.<locals>.target	  sX    F5 ((2AJJqMV\\)*=*=*?@!NPr   r  N)r  r  ry  rz  )r%   r  r  s   f  r   test_thread_state!TestThreadState.test_thread_state	  s2    	P 	F+			r   c                   aa  ! R  R4      o\         P                  ! 4       oVV3R lp\        P                  V4       R# )c                   &   a  ] tR tRt o R tRtV tR# )8TestThreadState.test_thread_gilstate_in_clear.<locals>.Ci	  c                .    \         P                  4        R # rO   )r   gilstate_ensure_releaser$   s   &r   r   @TestThreadState.test_thread_gilstate_in_clear.<locals>.C.__del__	  s    113r   r#   N)r)   r*   r+   r,   r   r/   r^   r_   s   @r   r   r  	  s     4 4r   r   c                      < S ! 4       Sn         R # rO   r*  )r   	local_vars   r   r  ?TestThreadState.test_thread_gilstate_in_clear.<locals>.callback	  s    #IKr   N)r  localr   r  )r%   r  r   r  s   & @@r   test_thread_gilstate_in_clear-TestThreadState.test_thread_gilstate_in_clear	  s0    	4 	4
 OO%		 	$$X.r   c                    \         P                  ! R 4      p\        RRRV4      pV P                  RVP                  4       R# )z
            import _testcapi

            def callback():
                print('callback called')

            _testcapi._test_thread_state(callback)
            z-Xtracemallocr@   s   callback calledN)rA   rB   r   r   rJ   )r%   rF   r  s   &  r    test_gilstate_ensure_no_deadlock0TestThreadState.test_gilstate_ensure_no_deadlock	  s<         t]D$?(#''2r   c                .    \         P                  4        R # rO   )r   test_current_tstate_matchesr$   s   &r   test_gilstate_matches_current-TestThreadState.test_gilstate_matches_current	  s    --/r   r#   N)r)   r*   r+   r,   r   reap_threadsr  r  r  r  r  r/   r^   r_   s   @r   r  r  	  s     ""002 3 #( ""002/ 3 #/ ""0023 3 #30 0r   r  c                     / p\        V 4       FF  pVP                  R 4      '       g   K  Ve   VP                  V4      '       d   K9  \        W4      W#&   KH  	  V# )test_)dir
startswithgetattr)modexclude_prefixfuncsr  s   &&  r   get_test_funcsr  	  sQ    ECw''%$//.*I*Ic(  Lr   c                      a  ] tR tRt o ]! 4       P                  ]! ]4      4       ]P                  ! ]
R7      R 4       tR tRtV tR# )Test_testcapii
  )categoryc                0    \         P                  ! 4        R # rO   )r0  test_widecharr$   s   &r   r  Test_testcapi.test_widechar
  s    &&(r   c                b    V P                  \        P                  \        P                  4       R # rO   )r5   r   
Py_Versionrf   
hexversionr$   s   &r   test_version_api_data#Test_testcapi.test_version_api_data
  s    --s~~>r   r#   N)r)   r*   r+   r,   localsupdater  r   r   ignore_warningsDeprecationWarningr  r  r/   r^   r_   s   @r   r  r  
  sC     
HOON9-. $$.@A) B)? ?r   r  c                   N    ] tR tRt]! 4       P                  ]! ]4      4       RtR# )Test_testlimitedcapii
  r#   N)	r)   r*   r+   r,   r  r  r  r0  r/   r#   r   r   r  r  
  s    
HOON#3455r   r  c                   R    ] tR tRt]! 4       P                  ]! ]RR7      4       RtR# )Test_testinternalcapii
  
test_lock_)r  r#   N)	r)   r*   r+   r,   r  r  r  r  r/   r#   r   r   r  r  
  s%    
HOON#42>@ A Ar   r  c                   \    ] tR tRt]! 4       P                  R ]! ]4       4       4       RtR# )Test_PyLocki
  c              #  x   "   T F0  pVP                  R 4      '       g   K  V\        \        V4      3x  K2  	  R# 5i)r  N)r  r  r  ).0r  s   & r   	<genexpr>Test_PyLock.<genexpr>
  s2      6 6|4 =T7#4d;< 6s   ::r#   N)	r)   r*   r+   r,   r  r  r  r  r/   r#   r   r   r   r   
  s(    
HOO 6 #$5 66 6 6r   r   r  c                   H   a  ] tR tRt o RtR tR tR tR tR t	R t
R	tV tR
# )Test_ModuleStateAccessi$
  z%Test access to module start (PEP 573)c                   R p\         P                  P                  R4      P                  p\        P
                  '       d!   \         P                  P                  W4      pM\         P                  P                  W4      p\         P                  P                  W4      p\         P                  P                  V4      pVP                  V4       WPn        R# )!_testmultiphase_meth_state_accessr  N)	importlibutil	find_specoriginr   r  	machineryr  r  spec_from_loadermodule_from_specexec_modulemodule)r%   fullnamer  r  specr  s   &     r   setUpTest_ModuleStateAccess.setUp,
  s    6))*;<CC """((==hOF((<<XNF~~..x@0066"r   c                     ! R RV P                   P                  4      pV! 4       pV P                  VP                  4       V P                   4       R# )z#PyType_GetModule for defining_classc                       ] tR tRtRtR# )QTest_ModuleStateAccess.test_subclass_get_module.<locals>.StateAccessType_Subclassi<
  r#   NrA  r#   r   r   StateAccessType_Subclassr  <
  rB  r   r  Nr  StateAccessTyperc  get_defining_moduler%   r  rS  s   &  r   test_subclass_get_module/Test_ModuleStateAccess.test_subclass_get_module:
  s=    	t{{'B'B 	 ,-h224dkkBr   c                     ! R  RV P                   P                  4      pV! 4       pV P                  VP                  4       V P                   4       R# )c                   2   a a ] tR tRt oV 3R ltRtVtV ;t# )\Test_ModuleStateAccess.test_subclass_get_module_with_super.<locals>.StateAccessType_SubclassiC
  c                    < \         SV `  4       # rO   )r   r  r   s   &r   r  pTest_ModuleStateAccess.test_subclass_get_module_with_super.<locals>.StateAccessType_Subclass.get_defining_moduleD
  s    w244r   r#   )r)   r*   r+   r,   r  r/   r^   r   r   s   @@r   r  r"  C
  s     5 5r   r  Nr  r  s   &  r   #test_subclass_get_module_with_super:Test_ModuleStateAccess.test_subclass_get_module_with_superB
  s=    	5t{{'B'B 	5 ,-h224dkkBr   c           
        V P                   P                  4       pV P                   P                  4       pRVP                  RVP                  /pVP	                  4        EF  w  rEV P                  V4      ;_uu_ 4        V P                  VP                  4       VP                  4       4       V P                  VP                  4       ^ 4       V! 4        V P                  VP                  4       VP                  4       4       V P                  VP                  4       ^4       V! ^4       V P                  VP                  4       VP                  4       4       V P                  VP                  4       ^4       V! RRR7       V P                  VP                  4       VP                  4       4       V P                  VP                  4       ^ 4       V P                  \        4      ;_uu_ 4        V! ^R7       RRR4       V P                  \        4      ;_uu_ 4        V! ^^^4       RRR4       RRR4       EK  	  R#   + '       g   i     LO; i  + '       g   i     L2; i  + '       g   i     EK  ; i)zChecks methods defined with and without argument clinic

This tests a no-arg method (get_count) and a method with
both a positional and keyword argument.
clinicnoclinicT)twice)thriceNr  )
r  r  increment_count_clinicincrement_count_noclinicr  r2  r5   	get_countr8   rr   )r%   r;  r   methodsr  increment_counts   &     r   test_state_access(Test_ModuleStateAccess.test_state_accessJ
  s    KK'')KK'') a..22

 &-]]_!Dd##  >  2!  >  2"  >  2$/  >  2&&y11#1- 2 &&y11#Aq!, 2' $# &5" 21 21' $##s=   >E/I$-
H>7%I$I'I$>I	I$I!I$$I6c                    V P                   P                  4       pV P                  \        4      ;_uu_ 4        VP	                  4        R R R 4       R #   + '       g   i     R # ; irO   )r  r  r8   rr   getmodulebydef_bad_def)r%   rS  s   & r   test_get_module_bad_def.Test_ModuleStateAccess.test_get_module_bad_defp
  sB     ;;..0y))++- *)))s   AA$	c                     ! R  R\         V P                  P                  4      pV P                  V! 4       P	                  4       V P                  4       R# )c                       ] tR tRtRtR# )FTest_ModuleStateAccess.test_get_module_static_in_mro.<locals>.Subclassi|
  r#   NrA  r#   r   r   Subclassr9  |
  rB  r   r:  N)r/  r  r  rc  r  )r%   r:  s   & r   test_get_module_static_in_mro4Test_ModuleStateAccess.test_get_module_static_in_mrox
  s7    	}dkk&A&A 	hj446Dr   )r  N)r)   r*   r+   r,   r7   r  r  r%  r1  r5  r;  r/   r^   r_   s   @r   r  r  $
  s0     /CC$-L.E Er   r  c                   B   a  ] tR tRt o ]R 4       tR tR tR tRt	V t
R# )TestInternalFrameApii
  c                 ,    \         P                  ! 4       # rO   )rf   	_getframer#   r   r   funcTestInternalFrameApi.func
  s    }}r   c                    V P                  4       p\        P                  ! V4      pV P                  W P                   P                  4       R # rO   )rA  r  iframe_getcoderc  __code__)r%   framerF   s   &  r   	test_codeTestInternalFrameApi.test_code
  s3    		 //6dII../r   c                    V P                  4       p\        P                  ! V4      pV P                  V^ 4       V P	                  V\        V P                   P                  P                  4      4       R# r  )rA  r  iframe_getlastir   rN  rm  rE  co_code)r%   rF  lastis   &  r   
test_lastiTestInternalFrameApi.test_lasti
  sP    		!11%85!$s499#5#5#=#=>?r   c                    V P                  4       p\        P                  ! V4      pV P                   P                  P                  pV P                  W#^,           4       R# r  )rA  r  iframe_getlinerE  co_firstlinenor5   )r%   rF  line	firstlines   &   r   	test_lineTestInternalFrameApi.test_line
  sD    		 //6II&&55	1}-r   r#   N)r)   r*   r+   r,   staticmethodrA  rG  rM  rT  r/   r^   r_   s   @r   r>  r>  
  s,      0
@. .r   r>  c                   J   a  ] tR tRt o R tR tR tR tR tR t	R t
R	tV tR
# )Test_Pep523APIi
  c                   . p\         pV\         ,           p \        V4       F&  pWd8X  d   \        P                  ! V4       V! 4        K(  	  \        P                  ! 4        V\         ,          pV P                  \        V4      \        V4      4       \        WsR R7       F  w  rV P                  W4       K  	  R#   \        P                  ! 4        i ; i)T)strictN)"SUFFICIENT_TO_DEOPT_AND_SPECIALIZEr   r  set_eval_frame_recordset_eval_frame_defaultr5   rm  r  )
r%   rA  r  actual_callsry  r  rj   expected_callsr  r|  s
   &&&       r   do_testTest_Pep523API.do_test
  s    2::	75\:%;;LI "
 446!CC^,c,.?@ #N NHX. !O 446s   5B; ;Cc                R   a  ! R  R4      oV3R lpRR.pV P                  W4       R# )c                   &   a  ] tR tRt o R tRtV tR# )4Test_Pep523API.test_inlined_binary_subscr.<locals>.Ci
  c                    R # rO   r#   )r%   others   &&r   rk   @Test_Pep523API.test_inlined_binary_subscr.<locals>.C.__getitem__
  rm   r   r#   N)r)   r*   r+   r,   rk   r/   r^   r_   s   @r   r   rd  
  s      r   r   c                  $   < S ! 4       ^*,           R# r9  Nr#   )r   s   r   rA  7Test_Pep523API.test_inlined_binary_subscr.<locals>.func
  s    CGGr   rA  rk   Nr`  )r%   rA  r  r   s   &  @r   test_inlined_binary_subscr)Test_Pep523API.test_inlined_binary_subscr
  s(    	 		'T!r   c                H   a RR loV3R lp. ROpV P                  W4       R# )r9  c                     R # rO   r#   r  s   &r   inner/Test_Pep523API.test_inlined_call.<locals>.inner
      r   c                  &   < S ! 4        S ! ^*4       R# ri  r#   rp  s   r   rA  .Test_Pep523API.test_inlined_call.<locals>.func
  s    G"Ir   Nr9  )rA  rp  rp  rk  r%   rA  r  rp  s   &  @r   test_inlined_call Test_Pep523API.test_inlined_call
  s     		 +T!r   c                D   a R  oV3R lpRR.pV P                  W4       R# )c                     R # rO   r#   r  s   &r   rp  ;Test_Pep523API.test_inlined_call_function_ex.<locals>.inner
  rr  r   c                     < S ! ^*.!   R# ri  r#   rt  s   r   rA  :Test_Pep523API.test_inlined_call_function_ex.<locals>.func
  s    B4Lr   rA  rp  Nrk  rw  s   &  @r   test_inlined_call_function_ex,Test_Pep523API.test_inlined_call_function_ex
  s#    		!T!r   c                D   a R  oV3R lp. ROpV P                  W4       R# )c               3      "   ^*x  R# 5iri  r#   r#   r   r   r;  1Test_Pep523API.test_inlined_for_iter.<locals>.gen
  
     Hr8  c                  $   < S! 4        F  p K  	  R # rO   r#   )r4  r;  s    r   rA  2Test_Pep523API.test_inlined_for_iter.<locals>.func
  s    U r   N)rA  r;  r;  r;  rk  )r%   rA  r  r;  s   &  @r   test_inlined_for_iter$Test_Pep523API.test_inlined_for_iter
  s     		 .T!r   c                j   aa  ! R  R4      o ! R R4      oVV3R lp. ROpV P                  W4       R# )c                   0   a  ] tR tRt o ]R 4       tRtV tR# )0Test_Pep523API.test_inlined_load_attr.<locals>.Ci
  c                    ^*# rv  r#   r$   s   &r   r;  2Test_Pep523API.test_inlined_load_attr.<locals>.C.a
  s    r   r#   N)r)   r*   r+   r,   propertyr;  r/   r^   r_   s   @r   r   r  
  s      r   r   c                   &   a  ] tR tRt o R tRtV tR# )0Test_Pep523API.test_inlined_load_attr.<locals>.Di
  c                    ^*# rv  r#   )r%   r  s   &&r   __getattribute__ATest_Pep523API.test_inlined_load_attr.<locals>.D.__getattribute__
  ri  r   r#   N)r)   r*   r+   r,   r  r/   r^   r_   s   @r   Dr  
  rk  r   r  c                  L   < S ! 4       P                    S! 4       P                    R # rO   r"  )r   r  s   r   rA  3Test_Pep523API.test_inlined_load_attr.<locals>.func
  s    CEECEEr   N)rA  r;  r  rk  )r%   rA  r  r   r  s   &  @@r   test_inlined_load_attr%Test_Pep523API.test_inlined_load_attr
  s/    	 		 		 2T!r   c                R   aa R  oV3R loV3R lp. ROpV P                  W4       R# )c               3      "   ^*x  R# 5iri  r#   r#   r   r   rp  /Test_Pep523API.test_inlined_send.<locals>.inner
  r  r8  c               3   2   <"   S ! 4        R j  xL
  R #  L5irO   r#   rt  s   r   outer/Test_Pep523API.test_inlined_send.<locals>.outer
  s     ws   c                  (   < \        S ! 4       4       R # rO   )r   )r  s   r   rA  .Test_Pep523API.test_inlined_send.<locals>.func
  s    Mr   N)rA  r  r  rp  rp  r  rp  rk  )r%   rA  r  rp  r  s   &  @@r   test_inlined_send Test_Pep523API.test_inlined_send
  s#    			NT!r   r#   N)r)   r*   r+   r,   r`  rl  rx  r  r  r  r  r/   r^   r_   s   @r   rX  rX  
  s-     / """""" "r   rX  zneed Py_GIL_DISABLEDc                   &   a  ] tR tRt o R tRtV tR# )TestPyThreadIdi
  c                  aa	 \         P                  oR o	 ! VV	3R lR\        P                  4      p^p\	        V4       Uu. uF	  q1! 4       NK  	  ppV F  pVP                  4        K  	  V F  pVP                  P                  4        K  	  S! 4       .pV F  pVP                  P                  4        K  	  V FT  pVP                  4        VP                  VP                  4       V P                  VP                  VP                  4       KV  	  V F+  pV P                  V\         4       V P#                  V^ 4       K-  	  V P                  \%        \'        V4      4      \%        V4      V4       R# u up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# )5TestPyThreadId.test_py_thread_id.<locals>.GetThreadIdi
  c                   < \         SV `  4        \        P                  ! 4       V n        V P                  P                  4        \        P                  ! 4       V n        R V n        R # rO   )	r   r   r  r  get_lockr#  r  started_lockpy_tidr   s   &r   r   >TestPyThreadId.test_py_thread_id.<locals>.GetThreadId.__init__
  sB     " ) 0%%'$-OO$5!"r   c                   < V P                   P                  4        V P                  P                  4        S! 4       V n        \
        P                  ! S4       S! 4       V n        R # rO   )r  rn  r  r#  r  r  r  py_tid2)r%   py_thread_idshort_sleeps   &r   r  9TestPyThreadId.test_py_thread_id.<locals>.GetThreadId.run
  sC    !!%%'%%'*n

;'+~r   )r  r  r  r  )	r)   r*   r+   r,   r   r  r/   r^   r   )r   r`   r  r  s   @@r   GetThreadIdr  
  s     #. .r   r  N)r  r  r  r  r   ry  r  rj  r  r  rz  r  r  r5   r  r  ru  r   rm  rn  )
r%   r  nthreadr4  r  r9  py_thread_idsr  r  r  s
   &       @@r   test_py_thread_id TestPyThreadId.test_py_thread_id
  s>    )55	. 	.)** 	. */.9.Q;=.9 FLLN F$$&  &( FOO##%  FKKM  / V^^V]];  !C!!#s+sA& ! 	S/0#m2D&	(7 :s   E4r#   N)r)   r*   r+   r,   r  r/   r^   r_   s   @r   r  r  
  s     2( 2(r   r  c                   @   a  ] tR tRt o RtR	tR tR tR tR t	Rt
V tR# )
TestVersionsi  c                    V P                    FV  Ev rV P                  \        V4      R 7      ;_uu_ 4        \        P                  ! V!  pV P                  W24       RRR4       KX  	  R#   + '       g   i     Km  ; ir  N)
full_casesr2  hexr0  pack_full_versionr5   r%   r   r  r
  s   &   r   test_pack_full_version#TestVersions.test_pack_full_version+  sW    #OTX77);;TB  2 87  /777   &A))A:c                    V P                    FV  Ev rV P                  \        V4      R 7      ;_uu_ 4        \        P                  ! V!  pV P                  W24       RRR4       KX  	  R#   + '       g   i     Km  ; ir  )xy_casesr2  r  r0  pack_versionr5   r  s   &   r   test_pack_versionTestVersions.test_pack_version1  sW    #}}OTX77)66=  2 87  -777r  c                   \         P                  ! R 4      pVP                  P                  pVP                  Vn        VP                  .^,          Vn        V P                   FH  Ev r4V P                  \        V4      R7      ;_uu_ 4        V! V!  pV P                  WT4       RRR4       KJ  	  R#   + '       g   i     K_  ; ir  r  N)r   r  r  Py_PACK_FULL_VERSIONc_uint32restypec_intargtypesr  r2  r  r5   r%   r  ctypes_funcr   r  r
  s   &     r   test_pack_full_version_ctypes*TestVersions.test_pack_full_version_ctypes7  s    ,,X6&&;;$oo &~1#OTX77$d+  2 87  /777   B11Cc                   \         P                  ! R 4      pVP                  P                  pVP                  Vn        VP                  .^,          Vn        V P                   FH  Ev r4V P                  \        V4      R7      ;_uu_ 4        V! V!  pV P                  WT4       RRR4       KJ  	  R#   + '       g   i     K_  ; ir  )r   r  r  Py_PACK_VERSIONr  r  r  r  r  r2  r  r5   r  s   &     r   test_pack_version_ctypes%TestVersions.test_pack_version_ctypesA  s    ,,X6&&66$oo &~1#}}OTX77$d+  2 87  -777r  r#   N))rb     rY   rm  ro   i)rb  rm  r      r   i 
)    i   r      i ))rb  r  i  )rb  rm  i  
)r  r  i  )r)   r*   r+   r,   r  r  r  r  r  r  r/   r^   r_   s   @r   r  r    s,     J
H3333 3r   r  c                   &   a  ] tR tRt o R tRtV tR# )	TestCEvaliL  c                   \         P                  ! R 4      p\        RV4      w  r#pVP                  R4      P	                  4       pV P                  VP                  R4      ^4       V P                  VP                  R4      ^4       R# )z
            import _testcapi
            _testcapi.toggle_reftrace_printer(True)
            l1 = []
            l2 = []
            del l1
            del l2
            _testcapi.toggle_reftrace_printer(False)
        r@   r   zCREATE listzDESTROY listN)rA   rB   r   r   r  r5   r  )r%   rF   r4  rJ   liness   &    r   test_ceval_decrefTestCEval.test_ceval_decrefM  sp        %T40	

7#..0]3Q7^4a8r   r#   N)r)   r*   r+   r,   r  r/   r^   r_   s   @r   r  r  L  s     9 9r   r  __main__rO   )Or  collectionsr   rL  importlib.machineryr	  importlib.utilr  r  r  r  r  rf   rA   r  r  r  r   rM  rL  r3   r   test.supportr   r   r   r   r	   r
   r   test.support.script_helperr   r   r   rs   ImportErrorr  r  r   ModuleNotFoundErrorr  r   r   r   r0  r  r   r   r!   r&   r(   r   force_not_colorized_test_classTestCaser1   rD  r  r  r  rU  r  r  r  r  r  r  r  r   r   r  r>  r[  rX  r?  r  r  r  r)   r  r#   r   r   <module>r     sW         	    
         - & ) ( - 9 ( d d
 ''4	 G   <=
: :
 6=5L5L5L-R`  	''ACx   AC (ACH F.8,, F. F.RI4x(( I4Xq:** q:h	 {/X.. {/ {/| {'** {' {'| 4h''  4F80h'' 80v	?H%% 	?68,, 6AH-- A
 ,,.6(## 6 /6 
D(*PQYEX.. YE RYEx.8,, .0 &) "K"X&& K"\ 
W,,.DE3(X&& 3( F3(j*38$$ *3Z9!! 9" zMMO yY    O    MsH   K- K= L L -	K:9K:=	L
	L
	LL	L*)L*