Ë
    v¹1h«´  ã                   óR  — d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlmZ d dlZd dlmZ	 ddl
mZ ddl
mZ ddl
mZ dd	l
mZ dd
lmZ  G d„ de«      Zd„ Zd„ Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Zedk(  r ej6                  «        yy)é    N)ÚABCMeta)Úabstractmethod)Úgreenleté   )ÚTestCase)ÚRUNNING_ON_MANYLINUX)ÚPY313)ÚPY314)Úfails_leakcheckc                   ó   — e Zd Zy)Ú	SomeErrorN©Ú__name__Ú
__module__Ú__qualname__© ó    úZ/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/greenlet/tests/test_greenlet.pyr   r      s   „ Ør   r   c                 óÀ   — 	 t        j                  «       j                  j                  «        t        ‚#  | j	                  t        j                  «       d   «       ‚ xY w©Nr   )r   Ú
getcurrentÚparentÚswitchÚappendÚsysÚexc_infor   ©Úseens    r   Úfmainr   !   sJ   € ðÜ×ÑÓ×$Ñ$×+Ñ+Ô-ô €OøðØ�‰”C—L‘L“N 1Ñ%Ô&Øús	   ‚,4 ´)Ac                 óF   — d„ }t        || ¬«      }|j                  |«       y )Nc                 ó   — | ‚©Nr   )Úexcs    r   Úcrasherzsend_exception.<locals>.crasher-   s   € Øˆ	r   ©r   ©ÚRawGreenletr   )Úgr#   r$   Úg1s       r   Úsend_exceptionr*   *   s   € òä	�W QÔ	'€BØ‡I�Iˆc…Nr   c                   óœ  — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Z ej"                  exr ed«      d„ «       Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z e!d0d„«       Z"e!d„ «       Z#d„ Z$e!d„ «       Z%d „ Z&d!„ Z'd"„ Z(d#„ Z)d$„ Z*d%„ Z+ ej"                  exr ed&«      d'„ «       Z,d(„ Z-d)„ Z.d*„ Z/d+„ Z0d,„ Z1d-„ Z2d.„ Z3y/)1ÚTestGreenletc                 ó  ‡— g Šˆfd„}t        |«      }‰j                  d«       |j                  «        ‰j                  d«       |j                  «        ‰j                  d«       | j                  ‰t	        t        d«      «      «       y )Nc                  ó¢   •— ‰ j                  d«       t        j                  «       j                  j	                  «        ‰ j                  d«       y )Nr   é   ©r   r   r   r   r   ©Úlsts   €r   Úfz'TestGreenlet._do_simple_test.<locals>.f8   s4   ø€ Ø�J‰J�qŒMÜ×ÑÓ!×(Ñ(×/Ñ/Ô1Ø�J‰J�q�Mr   r   é   é   é   )r'   r   r   ÚassertEqualÚlistÚrange)Úselfr3   r(   r2   s      @r   Ú_do_simple_testzTestGreenlet._do_simple_test5   sc   ø€ Øˆô	ô ˜‹NˆØ�
‰
�1ŒØ	�‰Œ
Ø�
‰
�1ŒØ	�‰Œ
Ø�
‰
�1ŒØ×Ñ˜œd¤5¨£8›nÕ-r   c                 ó$   — | j                  «        y r"   )r;   ©r:   s    r   Útest_simplezTestGreenlet.test_simpleD   s   € Ø×ÑÕr   c                 óÖ   — t        «       }| j                  t        «      5 }|j                  «        d d d «       | j	                  dt        j                  «      «       y # 1 sw Y   Œ/xY w©NÚrun)r'   ÚassertRaisesÚAttributeErrorr   ÚassertInÚstrÚ	exception©r:   r(   r#   s      r   Ú(test_switch_no_run_raises_AttributeErrorz5TestGreenlet.test_switch_no_run_raises_AttributeErrorG   sP   € Ü‹MˆØ×Ñœ~Ó.ð 	°#Ø�H‰HŒJ÷	ð 	�‰�eœS §¡Ó/Õ0÷	ð 	ús    AÁA(c                 óà   — t        «       }| j                  t        «      5 }|j                  t        «       d d d «       | j                  dt        j                  «      «       y # 1 sw Y   Œ/xY wr@   )r'   rB   rC   Úthrowr   rD   rE   rF   rG   s      r   Ú'test_throw_no_run_raises_AttributeErrorz4TestGreenlet.test_throw_no_run_raises_AttributeErrorN   sS   € Ü‹MˆØ×Ñœ~Ó.ð 	°#Ø�G‰G”IÔ÷	ð 	�‰�eœS §¡Ó/Õ0÷	ð 	ús    A$Á$A-c                 óš   — t        d ¬«      }| j                  |«       | j                  |j                  t	        j
                  «       «       y )Nr%   )r'   ÚassertIsNotNoneÚassertIsr   r   r   ©r:   r(   s     r   Útest_parent_equals_Nonez$TestGreenlet.test_parent_equals_NoneU   s5   € Ü˜tÔ$ˆØ×Ñ˜QÔØ�‰�a—h‘h¤× 3Ñ 3Ó 5Õ6r   c                 ót   — t        d ¬«      }| j                  |«       | j                  |j                  «       y )N)rA   )r'   rM   ÚassertIsNonerA   rO   s     r   Útest_run_equals_Nonez!TestGreenlet.test_run_equals_NoneZ   s,   € Ü˜DÔ!ˆØ×Ñ˜QÔØ×Ñ˜!Ÿ%™%Õ r   c                 ó  ‡— g Šˆfd„}t        |«      }t        |«      }|j                  «        | j                  t        ‰«      d«       |j                  «        | j                  t        ‰«      d«       |j                  «        | j                  t        ‰«      d«       | j                  |j                  d«       |j                  «        | j                  t        ‰«      d«       | j                  |j                  d«       y )Nc                  ó¦   •— ‰ j                  d«       t        j                  «       j                  j	                  «        ‰ j                  ddg«       y )Nr   )r   r   r   r   r   Úextendr1   s   €r   r3   z)TestGreenlet.test_two_children.<locals>.fb   s9   ø€ Ø�J‰J�qŒMÜ×ÑÓ!×(Ñ(×/Ñ/Ô1Ø�J‰J˜˜1�vÕr   r   r4   r5   Té   )r'   r   r7   ÚlenÚdead)r:   r3   r(   Úhr2   s       @r   Útest_two_childrenzTestGreenlet.test_two_children_   s½   ø€ Øˆô	ô ˜‹NˆÜ˜‹NˆØ	�‰Œ
Ø×Ñœ˜S› 1Ô%Ø	�‰Œ
Ø×Ñœ˜S› 1Ô%Ø	�‰Œ
Ø×Ñœ˜S› 1Ô%Ø×Ñ˜Ÿ™ Ô&Ø	�‰Œ
Ø×Ñœ˜S› 1Ô%Ø×Ñ˜Ÿ™ Õ&r   c                 ó˜  ‡‡— g Šˆfd„Šˆˆfd„}| j                  t        j                  |«      t        sdnd«       t	        |«      }| j                  t        j                  |«      t        sdnd«       |j                  «        | j                  ‰g d¢«       | j                  t        j                  |«      t        sd«       y d«       y )Nc                  ó€   •— ‰ j                  d«       t        j                  «       j                  j	                  «        y )NÚbr0   r1   s   €r   r3   z3TestGreenlet.test_two_recursive_children.<locals>.fv   s)   ø€ Ø�J‰J�sŒOÜ×ÑÓ!×(Ñ(×/Ñ/Õ1r   c                  ó€   •— ‰j                  d«       t        ‰«      } | j                  «        ‰j                  d«       y )NÚaÚc)r   r'   r   )r(   r3   r2   s    €€r   r(   z3TestGreenlet.test_two_recursive_children.<locals>.gz   s+   ø€ Ø�J‰J�sŒOÜ˜A“ˆAØ�H‰HŒJØ�J‰J�s�Or   r4   r   )r`   r^   ra   )r7   r   Úgetrefcountr
   r'   r   )r:   r(   r3   r2   s     @@r   Útest_two_recursive_childrenz(TestGreenlet.test_two_recursive_childrens   s’   ù€ Øˆô	2õ	ð
 	×ÑœŸ™¨Ó+µe©QÀÔCÜ˜‹Nˆð 	×ÑœŸ™¨Ó+µe©QÀÔCØ	�‰Œ
Ø×Ñ˜šoÔ.à×ÑœŸ™¨Ó+µe¨QÕCÀÕCr   c                 ó   ‡ ‡— g Šˆ ˆfd„}t        d«      D �cg c]  }t        j                  |¬«      ‘Œ }}|D ]  }|j                  «        Œ |D ]  }|j	                  d«       Œ ‰ j                  t        ‰«      t        |«      «       y c c}w )Nc                  óH   •— ‰ j                  «        ‰j                  d«       y ©NT)r;   r   )r:   Úsuccesss   €€r   r3   z$TestGreenlet.test_threads.<locals>.fŒ   s   ø€ Ø× Ñ Ô"Ø�N‰N˜4Õ r   é
   ©Útarget)r9   Ú	threadingÚThreadÚstartÚjoinr7   rX   )r:   r3   ÚiÚthsÚthrg   s   `    @r   Útest_threadszTestGreenlet.test_threads‰   s€   ù€ Øˆõ	!ô 49¸³9Ö=¨aŒy×Ñ qÖ)Ð=ˆÐ=Øò 	ˆBØ�H‰H�Jð	àò 	ˆBØ�G‰G�B�Kð	à×Ñœ˜W›¤s¨3£xÕ0ùò >s   ˜Bc                 ó  — g }t        t        «      }t        t        «      }|j                  |«       |j                  |«       ||_        | j	                  |g «       | j                  t        |j                  «       | j	                  |t        g«       |j                  «       }| j	                  |d«       | j	                  |t        g«       |j                  d«      }| j	                  |d«       | j	                  |t        g«       y )Nr   é   )r'   r   r   r   r7   rB   r   )r:   r   r)   Úg2Úvalues        r   Útest_exceptionzTestGreenlet.test_exception–   sÌ   € ØˆÜœÓˆÜœÓˆØ
�	‰	�$ŒØ
�	‰	�$ŒØˆŒ	à×Ñ˜˜rÔ"ð 	×Ñœ) R§Y¡YÔ/Ø×Ñ˜¤	˜{Ô+à—	‘	“ˆØ×Ñ˜ Ô#Ø×Ñ˜¤	˜{Ô+à—	‘	˜"“ˆØ×Ñ˜ Ô#Ø×Ñ˜¤	˜{Õ+r   c                 ó¶   — g }t        t        «      }|j                  |«       | j                  t        t
        |t        «       | j                  |t        g«       y r"   )r'   r   r   rB   ÚKeyErrorr*   r7   )r:   r   r)   s      r   Útest_send_exceptionz TestGreenlet.test_send_exception²   sB   € ØˆÜœÓˆØ
�	‰	�$ŒØ×Ñœ(¤N°B¼ÔAØ×Ñ˜¤˜zÕ*r   c                 ó¢  — g }t        t        «      }t        t        «      }|j                  |«       |j                  |«       | j                  |g «       ~t	        j
                  «        | j                  |t        j                  g«       ~t	        j
                  «        | j                  |t        j                  t        j                  g«       y r"   )r'   r   r   r7   ÚgcÚcollectr   ÚGreenletExit)r:   r   r)   ru   s       r   Útest_dealloczTestGreenlet.test_dealloc¹   s“   € ØˆÜœÓˆÜœÓˆØ
�	‰	�$ŒØ
�	‰	�$ŒØ×Ñ˜˜rÔ"ØÜ
�
‰
ŒØ×Ñ˜¤× 5Ñ 5Ð6Ô7ØÜ
�
‰
ŒØ×Ñ˜¤× 5Ñ 5´x×7LÑ7LÐMÕNr   c                 óV  — d„ }t        |«      }|j                  «        t        j                  }ddlm}  |«       x}t        _        	 ~|t        _        |j                  «       }| j                  d|«       | j                  d|«       | j                  d|«       y # |t        _        w xY w)Nc                  óš   — 	 t        j                  «       j                  j                  «        y # t         j                  $ r t
        d ‚w xY wr"   )r   r   r   r   r~   r   r   r   r   rA   zHTestGreenlet.test_dealloc_catches_GreenletExit_throws_other.<locals>.runÈ   s?   € ð*Ü×#Ñ#Ó%×,Ñ,×3Ñ3Õ5øÜ×(Ñ(ò *Ü TÐ)ð*ús	   ‚,/ ¯A
r   )ÚStringIOÚ	ExceptionÚignoredr   )r'   r   r   ÚstderrÚior‚   ÚgetvaluerD   )r:   rA   r(   Ú	oldstderrr‚   r…   Úvs          r   Ú.test_dealloc_catches_GreenletExit_throws_otherz;TestGreenlet.test_dealloc_catches_GreenletExit_throws_otherÇ   sˆ   € ò	*ô ˜ÓˆØ	�‰Œ
ô
 —J‘Jˆ	ÝÙ&›jÐ(ˆ””ð	#Øà"ŒCŒJà�O‰OÓˆØ�‰�k 1Ô%Ø�‰�i Ô#Ø�‰�k 1Õ%øð #ŒC�Jús   ÁB ÂB(z=Sometimes flaky (getting one GreenletExit in the second list)c                 ó&  ‡‡‡‡‡‡— g Šg Št        j                  «       Št        j                  «       Št        j                  «       Št        j                  «       Šˆˆˆˆˆˆfd„}t        j                  |¬«      }|j                  «        ‰j	                  d«       | j                  ‰g «       | j                  t        ‰«      d«       ‰d d …= t        j                  «        | j                  ‰g «       ‰j                  «        ‰j	                  d«       	 | j                  ‰t        j                  g«       ‰j                  «        |j                  d«       ‰d d …= ‰d d …= y # ‰j                  «        |j                  d«       ‰d d …= ‰d d …= w xY w)Nc                  ó>  •— t        t        «      } | j                  ‰«       ‰j                  | «       ~ t	        j
                  «        ‰j                  «        ‰j                  d«       t        «        ‰j                  «        ‰j                  d«       t        «        y )Nr/   )r'   r   r   r   r|   r}   ÚsetÚwait)r)   Ú/bg_glet_created_running_and_no_longer_ref_in_bgÚbg_should_be_clearÚfg_ref_releasedÚok_to_exit_bg_threadr   Úsomerefs    €€€€€€r   r3   z1TestGreenlet.test_dealloc_other_thread.<locals>.fò   sn   ø€ ÜœUÓ#ˆBØ�I‰I�dŒOØ�N‰N˜2ÔØÜ�J‰JŒLà;×?Ñ?ÔAØ× Ñ  Ô#äŒMØ×"Ñ"Ô$Ø ×%Ñ% aÔ(Ü�Mr   ri   rh   r   r/   )rk   ÚEventrl   rm   rŽ   r7   rX   r|   r}   r�   r   r~   rn   )	r:   r3   Útr�   r�   r‘   r’   r   r“   s	      @@@@@@r   Útest_dealloc_other_threadz&TestGreenlet.test_dealloc_other_threadâ   s?  ý€ ð ˆØˆä:C¿/¹/Ó:KÐ7Ü#Ÿ/™/Ó+ˆÜ&Ÿ_™_Ó.ÐÜ(Ÿ™Ó0Ð÷	ñ 	ô ×Ñ AÔ&ˆØ	�‰Œ	Ø7×<Ñ<¸RÔ@à×Ñ˜˜rÔ"Ø×Ñœ˜W› qÔ)Ø’AˆJÜ
�
‰
Œà×Ñ˜˜rÔ"Ø×ÑÔØ×Ñ Ô"ð	Ø×Ñ˜T¤H×$9Ñ$9Ð#:Ô;à ×$Ñ$Ô&Ø�F‰F�2ŒJØ’Q�Øš‘
øð !×$Ñ$Ô&Ø�F‰F�2ŒJØ’Q�Øš‘
ús   Ä!E# Å#-Fc                 ó@  ‡ — ˆ fd„}t        |«      }|j                  «       }‰ j                  ||j                  u «       ‰ j                  |«       |j                  «       }‰ j	                  |«       ‰ j                  |d«       ‰ j                  |j                  d «       y )Nc                  óÂ   •— t        j                  d«      } ‰j                  | j                  d «       t	        j
                  «       j                  j                  | «       y)Nr   úmeaning of life)r   Ú	_getframer7   Úf_backr   r   r   r   )r3   r:   s    €r   Úf1z#TestGreenlet.test_frame.<locals>.f1  sE   ø€ Ü—‘˜aÓ ˆAØ×Ñ˜QŸX™X tÔ,Ü×ÑÓ!×(Ñ(×/Ñ/°Ô2Ø$r   r™   )r'   r   Ú
assertTrueÚgr_frameÚassertFalser7   )r:   rœ   r(   ÚframeÚfrom_gs   `    r   Ú
test_framezTestGreenlet.test_frame  s}   ø€ ô	%ô
 ˜‹OˆØ—‘“
ˆØ�‰˜ §¡Ð+Ô,Ø�‰˜Ôà—‘“ˆØ×Ñ˜ÔØ×Ñ˜Ð!2Ô3Ø×Ñ˜Ÿ™ TÕ*r   c                 óê   — d„ }t        j                  |d¬«      }t        j                  |d¬«      }|j                  «        |j                  «        |j                  d«       |j                  d«       y )Nc                 óB   ‡ — t        ˆ fd„«      }|j                  «        y )Nc                  ó.   •— t        j                  ‰ «      S r"   )ÚtimeÚsleep©Úxs   €r   ú<lambda>z>TestGreenlet.test_thread_bug.<locals>.runner.<locals>.<lambda>'  s   ø€ ¤D§J¡J¨q£M€ r   r&   )r©   r(   s   ` r   Úrunnerz,TestGreenlet.test_thread_bug.<locals>.runner&  s   ø€ ÜÓ1Ó2ˆAØ�H‰H�Jr   )gš™™™™™É?©rj   Úargs)g333333Ó?rh   )rk   rl   rm   rn   )r:   r«   Út1Út2s       r   Útest_thread_bugzTestGreenlet.test_thread_bug%  sU   € ò	ô ×Ñ V°&Ô9ˆÜ×Ñ V°&Ô9ˆØ
�‰Œ
Ø
�‰Œ
Ø
�‰�ŒØ
�‰��r   c                 ól   ‡ — ˆ fd„}t        |«      j                  dd¬«      }‰ j                  |d«       y )Nc                 óN   •— ‰j                  | d«       ‰j                  |d«       y)Nr5   r4   é*   )r7   )r`   r^   r:   s     €r   rA   z,TestGreenlet.test_switch_kwargs.<locals>.run1  s&   ø€ Ø×Ñ˜Q Ô"Ø×Ñ˜Q Ô"Ør   r5   r4   )r`   r^   r³   ©r'   r   r7   )r:   rA   r©   s   `  r   Útest_switch_kwargszTestGreenlet.test_switch_kwargs0  s4   ø€ ô	ô ˜Ó×#Ñ# a¨1Ð#Ó-ˆØ×Ñ˜˜BÕr   c                 óî   — d„ }t        |«      }| j                  ddi|j                  d«      «       | j                  dddif|j                  «       «       | j                  d|j                  «       «       y )Nc                 óÊ   — t        j                  «       j                  j                  | ¬«       t        j                  «       j                  j                  dd¬«       | | dz  fS )Nr¨   r4   r/   ©r   r   r   r   r¨   s    r   rA   z6TestGreenlet.test_switch_kwargs_to_parent.<locals>.run9  sR   € Ü×ÑÓ!×(Ñ(×/Ñ/°!Ð/Ô4Ü×ÑÓ!×(Ñ(×/Ñ/°°QÐ/Ô7Ø�a˜1‘f�9Ðr   r©   r/   )r4   )r/   é	   )r'   r7   r   )r:   rA   r(   s      r   Útest_switch_kwargs_to_parentz)TestGreenlet.test_switch_kwargs_to_parent8  sd   € ò	ô ˜ÓˆØ×Ñ˜#˜q˜ 1§8¡8¨A£;Ô/Ø×Ñ˜$  a Ð)¨1¯8©8«:Ô6Ø×Ñ˜ §¡£Õ,r   c                 óÊ  ‡‡‡— i Št        j                  «       Št        j                  «       Šˆˆˆfd„}t        j                  |¬«      }|j                  «        ‰j	                  d«       | j                  t        j                  «      5  ‰d   j                  «        d d d «       ‰j                  «        |j                  d«       ‰j                  «        y # 1 sw Y   Œ;xY w)Nc                  óf   •— t        d„ «      ‰d<   ‰ j                  «        ‰j                  d«       y )Nc                   ó   — y r"   r   r   r   r   rª   zITestGreenlet.test_switch_to_another_thread.<locals>.run.<locals>.<lambda>H  ó   � r   r(   rh   ©r'   r�   rŽ   ©Úcreated_eventÚdataÚ
done_events   €€€r   rA   z7TestGreenlet.test_switch_to_another_thread.<locals>.runG  ó)   ø€ Ü#¡LÓ1ˆD�‰IØ×ÑÔØ�O‰O˜BÕr   ri   rh   r(   )rk   r”   rl   rm   rŽ   rB   r   Úerrorr   r�   rn   Úclear)r:   rA   ÚthreadrÁ   rÂ   rÃ   s      @@@r   Útest_switch_to_another_threadz*TestGreenlet.test_switch_to_another_threadB  s£   ú€ ØˆÜ!Ÿ™Ó)ˆÜ—_‘_Ó&ˆ
ö	 ô ×!Ñ!¨Ô-ˆØ�‰ŒØ×Ñ˜2ÔØ×ÑœxŸ~™~Ó.ñ 	Ø�‰I×ÑÔ÷	à�‰ÔØ�‰�BŒà�
‰
�÷	ð 	ús   ÂCÃC"c                 óP   ‡ ‡— ˆˆ fd„}ˆ fd„Št        |«      j                  «        y )Nc                  óÌ   •— 	 t        d«      ‚#  t        j                  «       } t        ‰«      j	                  «        ‰j                  | t        j                  «       «       Y y xY w)NÚfun)Ú
ValueErrorr   r   r'   r   r7   )r   rZ   r:   s    €€r   r3   z&TestGreenlet.test_exc_state.<locals>.fV  sK   ø€ ð;Ü  Ó'Ð'øð;ÜŸ<™<›>�Ü˜A“×%Ñ%Ô'Ø× Ñ  ¬3¯<©<«>Ö:ús
   ƒ ŽAA#c                  óN   •— ‰ j                  t        j                  «       d«       y )N)NNN)r7   r   r   r=   s   €r   rZ   z&TestGreenlet.test_exc_state.<locals>.h^  s   ø€ Ø×ÑœSŸ\™\›^Ð-?Õ@r   r&   )r:   r3   rZ   s   ` @r   Útest_exc_statezTestGreenlet.test_exc_stateU  s    ù€ õ	;ô	Aô 	�A‹×ÑÕr   c                 ó´  — d„ }d„ }d„ }t        |«      }| j                  |j                  i «       |j                  «        | j                  |j                  d«       | j                  |j                  ddi«       |j                  |_        | j                  |j                  ddi«       | j                  t        ||«       | j                  t        ||d«       y )Nc                  ó6   — dt        j                  «       _        y ©Nr³   )r   r   Útestr   r   r   r3   z*TestGreenlet.test_instance_dict.<locals>.fd  s   € Ø)+ŒH×ÑÓ!Õ&r   c                 ó   — | ` y r"   ©Ú__dict__)r(   s    r   Údeldictz0TestGreenlet.test_instance_dict.<locals>.deldictf  s   € Ø‘
r   c                 ó   — || _         y r"   rÔ   )r(   rv   s     r   Úsetdictz0TestGreenlet.test_instance_dict.<locals>.setdicth  s	   € ØˆA�Jr   r³   rÒ   )r'   r7   rÕ   r   rÒ   rB   Ú	TypeError)r:   r3   rÖ   rØ   r(   s        r   Útest_instance_dictzTestGreenlet.test_instance_dictc  s¬   € ò	,ò	ò	ä˜‹NˆØ×Ñ˜Ÿ™ RÔ(Ø	�‰Œ
Ø×Ñ˜Ÿ™ Ô$Ø×Ñ˜Ÿ™ f¨b \Ô2Ø—Z‘ZˆŒ
Ø×Ñ˜Ÿ™ f¨b \Ô2Ø×Ñœ) W¨aÔ0Ø×Ñœ) W¨a°Õ4r   c                 óp   ‡— g Šˆfd„}t        |«      }|j                  «        | j                  ‰dg«       y )Nc                  ó`   •— ‰ j                  t        t        j                  «       d«      «       y r@   )r   Úhasattrr   r   )Úhas_runs   €r   Úfuncz;TestGreenlet.test_running_greenlet_has_no_run.<locals>.funcv  s"   ø€ Ø�N‰NÜœ×+Ñ+Ó-¨uÓ5õr   Fr´   )r:   rß   r(   rÞ   s      @r   Ú test_running_greenlet_has_no_runz-TestGreenlet.test_running_greenlet_has_no_runt  s4   ø€ Øˆô	ô
 ˜ÓˆØ	�‰Œ
Ø×Ñ˜ 5 'Õ*r   c                 ó°   — dd l }| j                  t        |j                   t        «       «       | j                  t        |j                  t        «       «       y r   )ÚcopyrB   rÙ   r'   Údeepcopy)r:   râ   s     r   Útest_deepcopyzTestGreenlet.test_deepcopy  s5   € ÛØ×Ñœ) T§Y¡Y´³Ô>Ø×Ñœ) T§]¡]´K³MÕBr   c                 ó4  ‡‡‡— t        d„ «      Št        j                  «       Šg Šˆˆˆfd„}t        |‰¬«      }|j                  «        ~| j	                  ‰«       | j                  ‰d   ‰«       | j                  ‰d   j                  ‰«       ‰d d …= d Šd Šy )Nc                   ó   — y r"   r   r   r   r   rª   z;TestGreenlet.test_parent_restored_on_kill.<locals>.<lambda>…  r¾   r   c                  ó  •— 	 ‰j                  «        y # t        j                  $ rc ‰j                  t        j                  «       j
                  «       ‰j                  t        j                  «       «       ‰ j                  «        Y y w xY wr"   )r   r   r~   r   r   r   )ÚhubÚmainÚresults   €€€r   Úworkerz9TestGreenlet.test_parent_restored_on_kill.<locals>.workerˆ  s_   ø€ ðà—‘•øÜ×(Ñ(ò à—‘œh×1Ñ1Ó3×:Ñ:Ô;Ø—‘œh×1Ñ1Ó3Ô4Ø—
‘
–ð	ús   ƒ ”A3B
Â	B
r%   r   r   )r'   r   r   r   r�   rN   r   )r:   rë   r(   rè   ré   rê   s      @@@r   Útest_parent_restored_on_killz)TestGreenlet.test_parent_restored_on_kill„  sˆ   ú€ Ü™,Ó'ˆÜ×"Ñ"Ó$ˆØˆö	ô ˜ sÔ+ˆØ	�‰Œ
àØ�‰˜ÔØ�‰�f˜Q‘i Ô&Ø�‰�f˜Q‘i×&Ñ&¨Ô,ð ’1ˆIØˆØ‰r   c                 ó¨   — t        «       }t        d„ |¬«      }| j                  t        «      5  |j                  «        d d d «       y # 1 sw Y   y xY w)Nc                   ó   — y r"   r   r   r   r   rª   z9TestGreenlet.test_parent_return_failure.<locals>.<lambda>£  r¾   r   r%   )r'   rB   rC   r   )r:   r)   ru   s      r   Útest_parent_return_failurez'TestGreenlet.test_parent_return_failureŸ  sA   € ä‹]ˆä™¨bÔ1ˆà×Ñœ~Ó.ñ 	Ø�I‰IŒK÷	÷ 	ñ 	ús   ®AÁAc                 ó†   —  G d„ dt         «      } |d„ «      }| j                  t        |j                  t        «       «       y )Nc                   ó   — e Zd Zd„ Zy)ú>TestGreenlet.test_throw_exception_not_lost.<locals>.mygreenletc                 óJ   — 	 t         ‚#  Y nxY wt        j                  | |«      S r"   )rƒ   r'   Ú__getattribute__©r:   Únames     r   rô   zOTestGreenlet.test_throw_exception_not_lost.<locals>.mygreenlet.__getattribute__ª  s)   € ðÜ#�OøðÙúÜ"×3Ñ3°D¸$Ó?Ð?s   ‚ ˆN©r   r   r   rô   r   r   r   Ú
mygreenletrò   ©  s   „ ó@r   rø   c                   ó   — y r"   r   r   r   r   rª   z<TestGreenlet.test_throw_exception_not_lost.<locals>.<lambda>°  r¾   r   )r'   rB   r   rJ   )r:   rø   r(   s      r   Útest_throw_exception_not_lostz*TestGreenlet.test_throw_exception_not_lost¨  s4   € ô	@œô 	@ñ ‘|Ó$ˆØ×Ñœ) Q§W¡W¬i«kÕ:r   c                 ó²  ‡‡‡— g Šd„ Šˆˆˆfd„}t        j                  |¬«      }|j                  «        |j                  d«       ~‰r| j	                  «        | j                  t        j                  «      5 }‰d   j                  t        «       d d d «       ‰s0t        j                  «      }| j                  |dk(  xs d|v «       n%| j                  t        j                  «      d«       t        ‰d   j                  d«      r;| j                  t         «      5  ‰d   j                  j#                  «        d d d «       ‰sKt        ‰d   j                  j$                  d«      rF‰d   j                  j$                  j#                  «        n| j'                  ‰d   j                  «       ~d Š‰d d …= d	| _        y # 1 sw Y   �Œ0xY w# 1 sw Y   Œ‘xY w)
Nc                  ó\   — t        j                  «       j                  j                  «        y r"   r¸   r   r   r   rë   zGTestGreenlet._do_test_throw_to_dead_thread_doesnt_crash.<locals>.worker¶  ó   € Ü×ÑÓ!×(Ñ(×/Ñ/Õ1r   c                  ó¬   •— t        ‰«      } | j                  «        ‰j                  | «       ‰r%| j                  «        t        j                  «        y y r"   )r'   r   r   r   r   )r(   rê   Úwait_for_cleanuprë   s    €€€r   ÚcreatorzHTestGreenlet._do_test_throw_to_dead_thread_doesnt_crash.<locals>.creator¹  s?   ø€ Ü˜FÓ#ˆAØ�H‰HŒJØ�M‰M˜!ÔÙà—‘”
Ü×#Ñ#Õ%ð  r   ri   rh   r   úBcannot switch to a different thread (which happens to have exited)zCannot switchrÆ   T)rk   rl   rm   rn   Úwait_for_pending_cleanupsrB   r   rÅ   rJ   r   rE   rF   r�   r7   rÝ   rž   ÚRuntimeErrorrÆ   Úf_localsrR   Úexpect_greenlet_leak)r:   rÿ   r   r•   r#   Úsrê   rë   s    `    @@r   Ú*_do_test_throw_to_dead_thread_doesnt_crashz7TestGreenlet._do_test_throw_to_dead_thread_doesnt_crash³  s•  ú€ àˆò	2ö	&ô ×Ñ GÔ,ˆØ	�‰Œ	Ø	�‰ˆrŒ
Øñ Ø×*Ñ*Ô,Ø×ÑœxŸ~™~Ó.ð 	'°#Ø�1‰I�O‰OœIÔ&÷	'ñ  Ü�C—M‘MÓ"ˆAØ�O‰OØÐYÑYò (Ø" aÐ'õð
 ×ÑÜ�C—M‘MÓ"ØTôô
 �6˜!‘9×%Ñ% wÔ/à×"Ñ"¤<Ó0ñ +Ø�q‘	×"Ñ"×(Ñ(Ô*÷+ñ  ä�v˜a‘y×)Ñ)×2Ñ2°GÔ<Ø�q‘	×"Ñ"×+Ñ+×1Ñ1Õ3à×Ñ˜f Q™i×0Ñ0Ô1àØˆØ’1ˆIð %)ˆÕ!÷C	'ñ 	'ú÷"+ð +ús   Á9G ÄGÇ G
ÇGc                 ó$   — | j                  «        y r"   ©r  r=   s    r   Ú&test_throw_to_dead_thread_doesnt_crashz3TestGreenlet.test_throw_to_dead_thread_doesnt_crashí  s   € à×7Ñ7Õ9r   c                 ó&   — | j                  d«       y rf   r	  r=   s    r   Ú+test_throw_to_dead_thread_doesnt_crash_waitz8TestGreenlet.test_throw_to_dead_thread_doesnt_crash_waitñ  s   € Ø×7Ñ7¸Õ=r   c                 ó€   —  G d„ dt         «      } |«       }| j                  |j                  d«      d«       d| _        y )Nc                   ó   — e Zd Zd„ Zd„ Zd„ Zy)ú7TestGreenlet.test_recursive_startup.<locals>.convolutedc                 ó<   — t        j                  | «       d| _        y r   )r'   Ú__init__Úcountr=   s    r   r  z@TestGreenlet.test_recursive_startup.<locals>.convoluted.__init__÷  s   € Ü×$Ñ$ TÔ*Ø�•
r   c                 ó†   — |dk(  r'| j                   dk(  rd| _         | j                  d«       t        j                  | |«      S )NrA   r   r   é+   )r  r   r'   rô   rõ   s     r   rô   zHTestGreenlet.test_recursive_startup.<locals>.convoluted.__getattribute__ú  s8   € Ø˜5’= T§Z¡Z°1¢_Ø!"�D”JØ—K‘K ”OÜ"×3Ñ3°D¸$Ó?Ð?r   c                 ó<   — 	 | j                   j                  |«       Œr"   ©r   r   )r:   rv   s     r   rA   z;TestGreenlet.test_recursive_startup.<locals>.convoluted.runÿ  s   € ØØ—K‘K×&Ñ& uÔ-ð r   N)r   r   r   r  rô   rA   r   r   r   Ú
convolutedr  ö  s   „ òò@ó
.r   r  r³   r  T)r'   r7   r   r  )r:   r  r(   s      r   Útest_recursive_startupz#TestGreenlet.test_recursive_startupô  s9   € ô	.œô 	.ñ ‹LˆØ×Ñ˜Ÿ™ "› rÔ*ð
 %)ˆÕ!r   c                 óL  ‡‡‡— t        j                  «       Š‰j                  «        t        j                  «       Š‰j                  «         G ˆˆfd„dt        «      }d„ }ˆˆˆfd„}t	        j
                  «       }t        |«      gŠ |«       ‰d   _        ‰d   j                  «        t        j                  |¬«      }|j                  «        ‰j                  «        ‰j                  «        | j                  t	        j
                  «       |«       |j                  d«       y )Nc                   ó   •— e Zd Zˆ ˆfd„Zy)ú;TestGreenlet.test_threaded_updatecurrent.<locals>.finalizedc                 óF   •— ‰j                  «        ‰j                  «        y r"   ©ÚreleaseÚacquire)r:   Úlock1Úlock2s    €€r   Ú__del__zCTestGreenlet.test_threaded_updatecurrent.<locals>.finalized.__del__  s   ø€ ð —‘”Ø—‘•r   N©r   r   r   r"  ©r   r!  s   €€r   Ú	finalizedr    s   ø„ ö r   r%  c                  ó\   — t        j                  «       j                  j                  «        y r"   r¸   r   r   r   Údeallocatorz=TestGreenlet.test_threaded_updatecurrent.<locals>.deallocator  rý   r   c                  óÜ   •— ‰j                  «        t        j                  «        ‰ d= ‰j                  «        ‰j                  «        t        j                  «        ‰j                  «        y r   ©r  r   r   r  )r(   r   r!  s   €€€r   Úfthreadz9TestGreenlet.test_threaded_updatecurrent.<locals>.fthread  sF   ø€ Ø�M‰MŒOÜ×ÑÔ!Ø�!�Ø�M‰MŒOØ�M‰MŒOÜ×ÑÔ!Ø�M‰M�Or   r   ri   rh   )rk   ÚLockr  Úobjectr   r   r'   Úbombr   rl   rm   r  r7   rn   )	r:   r%  r'  r*  ré   r•   r(   r   r!  s	         @@@r   Útest_threaded_updatecurrentz(TestGreenlet.test_threaded_updatecurrent
  sË   ú€ ä—‘Ó ˆØ�‰Œä—‘Ó ˆØ�‰Œ÷	 œô 	 ò	2ö	ô ×"Ñ"Ó$ˆÜ˜Ó%Ð&ˆÙ“Kˆˆ!‰Œ	Ø	ˆ!‰�‰ŒÜ×Ñ GÔ,ˆØ	�‰Œ	à�‰ŒØ�‰Œð 	×Ñœ×,Ñ,Ó.°Ô5à	�‰ˆr�
r   c                 óä   ‡‡‡— g Šˆˆˆfd„Šd„ Št        ‰«      gŠ‰d   j                  «        t        ‰‰d   «      Š‰j                  «       }| j                  ‰«       | j                  |d«       y )Nc                  óœ  •— t        j                  «       j                  j                  «       } ‰d= t        j                  «       j                  ‰_        	 t        j                  «       j                  j                  | «       ‰j	                  t        j                  «       «       y # ‰j	                  t        j                  «       «       w xY wr   )r   r   r   r   r   )rv   Ú	initiatorr   rë   s    €€€r   rë   z>TestGreenlet.test_dealloc_switch_args_not_lost.<locals>.worker;  s‹   ø€ ä×'Ñ'Ó)×0Ñ0×7Ñ7Ó9ˆEà�q�	Ü'×2Ñ2Ó4×;Ñ;ˆIÔð3Ü×#Ñ#Ó%×,Ñ,×3Ñ3°EÔ:à—‘œH×/Ñ/Ó1Õ2ø�—‘œH×/Ñ/Ó1Õ2ús   Á-B& Â&%Cc                   ó   — yrÑ   r   r   r   r   r1  zATestGreenlet.test_dealloc_switch_args_not_lost.<locals>.initiatorH  ó   € Ør   r   r³   )r'   r   r�   r7   )r:   rv   r1  r   rë   s     @@@r   Ú!test_dealloc_switch_args_not_lostz.TestGreenlet.test_dealloc_switch_args_not_lost9  sk   ú€ Øˆö	3ò	ô ˜fÓ%Ð&ˆàˆq‰	×ÑÔÜ 	¨6°!©9Ó5ˆ	Ø× Ñ Ó"ˆØ�‰˜ÔØ×Ñ˜ Õ#r   c                 ó¸   ‡‡‡— d„ Š G d„ dt         «      } |«       Št        d¬«      Šˆˆˆfd„}t        |«      }| j                  |j	                  «       ‰«       y )Nc                 ó   —  | |i |¤Ž y r"   r   )rß   r`   Úks      r   Ú_applyz0TestGreenlet.test_tuple_subclass.<locals>._applya  s   € Ù�!ˆM�q‹Mr   c                   ó   — e Zd Zd„ Zy)ú1TestGreenlet.test_tuple_subclass.<locals>.mytuplec                 óp   — t        j                  «       j                  «        t        j	                  | «      S r"   )r   r   r   ÚtupleÚ__len__r=   s    r   r=  z9TestGreenlet.test_tuple_subclass.<locals>.mytuple.__len__e  s&   € Ü×#Ñ#Ó%×,Ñ,Ô.Ü—}‘} TÓ*Ð*r   N)r   r   r   r=  r   r   r   Úmytupler:  d  s   „ ó+r   r>  r³   )r`   c                  óf   •—  ‰ t        j                  «       j                  j                  ‰‰«       y r"   r¸   )r8  r­   Úkwargss   €€€r   Úswitchapplyz5TestGreenlet.test_tuple_subclass.<locals>.switchapplyj  s$   ø€ Ù”8×&Ñ&Ó(×/Ñ/×6Ñ6¸¸fÕEr   )r<  Údictr'   r7   r   )r:   r>  rA  r(   r8  r­   r@  s       @@@r   Útest_tuple_subclassz TestGreenlet.test_tuple_subclassS  sL   ú€ ò	ô	+”eô 	+ñ ‹yˆÜ˜”ˆö	Fä˜Ó$ˆØ×Ñ˜Ÿ™› VÕ,r   c                 ó¦   — t        dt        fdt        d„ «      i«      } G d„ d|«      } G d„ d|«      } |«        | j                  t        |«       y )NÚAbstractSubclassrA   c                  ó   — y r"   r   r=   s    r   rª   z7TestGreenlet.test_abstract_subclasses.<locals>.<lambda>s  r¾   r   c                   ó   — e Zd Zy)ú:TestGreenlet.test_abstract_subclasses.<locals>.BadSubclassNr   r   r   r   ÚBadSubclassrH  u  ó   „ Ør   rI  c                   ó   — e Zd Zd„ Zy)ú;TestGreenlet.test_abstract_subclasses.<locals>.GoodSubclassc                  ó   — y r"   r   r=   s    r   rA   z?TestGreenlet.test_abstract_subclasses.<locals>.GoodSubclass.runy  s   € Ør   N)r   r   r   rA   r   r   r   ÚGoodSubclassrL  x  s   „ ór   rN  )r   r'   r   rB   rÙ   )r:   rE  rI  rN  s       r   Útest_abstract_subclassesz%TestGreenlet.test_abstract_subclasseso  sT   € Ü"ØÜˆNØ”NÑ#4Ó5Ð6ó8Ðô
	Ð*ô 	ô	Ð+ô 	ñ 	ŒØ×Ñœ) [Õ1r   c                 óª   ‡ ‡— t        j                  «       sy t        j                  «       d   Š‰dk  ry ˆˆ fd„}t        d«      D ]  } |«       sŒ y  y )Nr   é2   c                  óô  •‡	‡
‡‡— t        j                  «       Š
‰
j                  «        t        j                  «       Š‰j                  «        dgŠˆ
ˆfd„} t        j                  | ¬«      }|j	                  «         G ˆ
ˆˆfd„dt
        «      Š	 G ˆ	fd„dt
        «      }g }t        ‰dz  «      }t        j                  «       } |«       }|D ]>  }d }‰d	   r|j                  d
«        yt        «       }‰d	   r n>|j                  |«       Œ@ t        j                  «        ‰d	   r|j                  d
«       y‰j                  |j                  |«       |D ]  }‰j                  |j                  |«       Œ  y)NFc                  ón   •— ‰ j                  «        t        j                  «        ‰j                  «        y r"   r)  r$  s   €€r   Úanother_threadzWTestGreenlet.test_implicit_parent_with_threads.<locals>.attempt.<locals>.another_thread‹  s!   ø€ Ø—‘”Ü×#Ñ#Ô%Ø—‘•r   ri   c                   ó   •— e Zd Zˆ ˆˆfd„Zy)úTTestGreenlet.test_implicit_parent_with_threads.<locals>.attempt.<locals>.gc_callbackc                 óP   •— ‰j                  «        ‰j                  «        d‰d<   y )NTr   r  )r:   r   r!  Úrecycleds    €€€r   r"  z\TestGreenlet.test_implicit_parent_with_threads.<locals>.attempt.<locals>.gc_callback.__del__’  s   ø€ Ø—M‘M”OØ—M‘M”OØ"&�H˜Q’Kr   Nr#  )r   r!  rX  s   €€€r   Úgc_callbackrV  ‘  s   ø„ ÷'r   rY  c                   ó   •— e Zd Zˆ fd„Zy)úPTestGreenlet.test_implicit_parent_with_threads.<locals>.attempt.<locals>.garbagec                 ó,   •— | | _          ‰«       | _        y r"   )ÚcycleÚcallback)r:   rY  s    €r   r  zYTestGreenlet.test_implicit_parent_with_threads.<locals>.attempt.<locals>.garbage.__init__—  s   ø€ Ø!%�D”JÙ$/£M�D•Mr   N)r   r   r   r  )rY  s   €r   Úgarbager[  –  s   ø„ õ2r   r_  r4   r   rh   T)rk   r+  r  rl   rm   r,  r9   r   r   rn   r'   r   r|   r}   r7   r   )rT  r•   r_  Úlr©   Úcurrentr(   Ú_ÚlastrY  r   r!  rX  ÚNr:   s            @@@@€€r   Úattemptz?TestGreenlet.test_implicit_parent_with_threads.<locals>.attempt…  s9  ü€ Ü—N‘NÓ$ˆEØ�M‰MŒOÜ—N‘NÓ$ˆEØ�M‰MŒOØ�wˆHõ ô × Ñ ¨Ô7ˆAØ�G‰GŒI÷'ð 'œfô 'ö
2œ&ô 2ð ˆAÜ�a˜‘c“
ˆAÜ×)Ñ)Ó+ˆGÙ“	ˆAØò �Ø�Ø˜A’;à—F‘F˜2”JÙ Ü"“}�Ø˜A’;ÙØ—‘˜•ðô —
‘
”Ø˜A’;Ø—F‘F˜2”JØØ×Ñ˜TŸ[™[¨'Ô2Øò 4�Ø× Ñ  §¡¨7Õ3ð4àr   r6   )r|   Ú	isenabledÚget_thresholdr9   )r:   re  rb  rd  s   `  @r   Ú!test_implicit_parent_with_threadsz.TestGreenlet.test_implicit_parent_with_threads  sO   ù€ Ü�|‰|Œ~ØÜ×ÑÓ˜qÑ!ˆØˆrŠ6Øõ,	ôZ �q“ò 	ˆAÙ�yÙñ	r   c                 ó   ‡ ‡‡— ddl mŠ ddl mŠ  G d„ dt        «      }t	        j
                  |«      }g ‰ _        ˆˆˆ fd„}t        d«      D ]  } ||«      j                  «        Œ ‰ `‰ j                  t	        j
                  |«      |«       y )Nr   ©r   )r~   c                   ó   — e Zd Zy)úTTestGreenlet.test_issue_245_reference_counting_subclass_no_threads.<locals>.GreenletNr   r   r   r   ÚGreenletrl  ¿  rJ  r   rm  c                  óœ   •— 	  ‰«       j                   j                  «        y # ‰ $ r# ‰j                  j                   ‰«       «       Y y w xY wr"   )r   r   Úgletsr   )r~   r   r:   s   €€€r   Úgreenlet_mainzYTestGreenlet.test_issue_245_reference_counting_subclass_no_threads.<locals>.greenlet_mainÈ  s?   ø€ ð0Ù“×#Ñ#×*Ñ*Õ,øØò 0Ø—
‘
×!Ñ!¡*£,Ö/ð0ús   ƒ# £%AÁ
Arh   )
r   r   r~   r'   r   rb   ro  r9   r   r7   )r:   rm  Úinitial_refsrp  rb  r~   r   s   `    @@r   Ú5test_issue_245_reference_counting_subclass_no_threadszBTestGreenlet.test_issue_245_reference_counting_subclass_no_threads¶  s{   ú€ õ 	(Ý)ô	”{ô 	ô —‘ xÓ0ˆð ˆŒ
ö	0ô �r“ò 	-ˆAÙ�]Ó#×*Ñ*Õ,ð	-ð ˆJØ×ÑœŸ™¨Ó2°LÕAr   z;The manylinux images appear to hang on this test on 3.13rc2c                 óü  ‡
‡‡‡‡— ddl m} ddl m} ddlmŠ  G d„ dt
        «      Š
g Š |«       Šˆfd„Šˆ
ˆˆˆˆfd„}t        j                  ‰
«      }g }t        |d	z   «      D ]5  } |«       } |||f¬
«      }|j                  |«       |j                  «        Œ7 |D ]  }	|	j                  d«       Œ ‰d d …= ‰j                  «        | j                  «        | j                  t        j                  ‰
«      |«       y )Nr   )rl   )r”   rj  c                   ó   — e Zd Zy)úSTestGreenlet.test_issue_245_reference_counting_subclass_threads.<locals>.MyGreenletNr   r   r   r   Ú
MyGreenletru  ã  rJ  r   rv  c                  óD   •—  ‰ «       j                   j                  «        y r"   r  rj  s   €r   rp  zVTestGreenlet.test_issue_245_reference_counting_subclass_threads.<locals>.greenlet_mainé  s   ø€ Ù‹L×Ñ×&Ñ&Õ(r   c                 óª   •—  ‰‰«      }‰j                  |«       |j                  «        ~| j                  «        ‰j                  d«        ‰«        y )Nrh   )r   r   r�   rŽ   )Úgreenlet_running_eventÚminerv  r   ro  rp  Úref_cleareds     €€€€€r   Úthread_mainzTTestGreenlet.test_issue_245_reference_counting_subclass_threads.<locals>.thread_mainì  sH   ø€ Ù˜mÓ,ˆDØ�L‰L˜Ôà�K‰KŒMàà"×&Ñ&Ô(ð ×Ñ˜RÔ ñ �Lr   é-   r¬   rh   )rk   rl   r”   r   r   r'   r   rb   r9   r   rm   rŽ   r�   r  r7   )r:   rl   r”   r|  rq  Úthread_ready_eventsrb  ÚeventrÇ   rÃ   rv  r   ro  rp  r{  s             @@@@@r   Ú2test_issue_245_reference_counting_subclass_threadsz?TestGreenlet.test_issue_245_reference_counting_subclass_threadsÕ  sî   ü€ õ 	%Ý#å'ô	œô 	ð ˆÙ“gˆô	)÷	ð 	ô8 —‘ zÓ2ˆØ ÐÜØ˜rÑ!ó
ò 	ˆAñ “GˆEÙ ;°e°XÔ>ˆFØ×&Ñ& uÔ-Ø�L‰L�Nð	ð .ò 	 ˆJØ�O‰O˜BÕð	 ð ’!ˆHØ�‰Ôð 	×&Ñ&Ô(Ø×ÑœŸ™¨Ó4°lÕCr   c                 ó²   — d„ }t        |«      }d„ }t        ||«      }| j                  t        «      5  |j                  «        d d d «       y # 1 sw Y   y xY w)Nc                   ó   — y)Né   r   r   r   r   Úno_argsz\TestGreenlet.test_falling_off_end_switches_to_unstarted_parent_raises_error.<locals>.no_args   r3  r   c                   ó   — yrÑ   r   r   r   r   ÚleafzYTestGreenlet.test_falling_off_end_switches_to_unstarted_parent_raises_error.<locals>.leaf%  r3  r   )r'   rB   rÙ   r   )r:   r„  Úparent_never_startedr†  Úchilds        r   Ú>test_falling_off_end_switches_to_unstarted_parent_raises_errorzKTestGreenlet.test_falling_off_end_switches_to_unstarted_parent_raises_error  sV   € ò	ô  +¨7Ó3Ðò	ô ˜DÐ"6Ó7ˆð ×ÑœyÓ)ñ 	Ø�L‰LŒN÷	÷ 	ñ 	ús   ³AÁAc                 ó‚   — d„ }t        |«      }d„ }t        ||«      }|j                  «       }| j                  |d«       y )Nc                 ó
   — | dfS ©Né   r   r¨   s    r   Úone_argzUTestGreenlet.test_falling_off_end_switches_to_unstarted_parent_works.<locals>.one_arg/  s   € Ø�r�7ˆNr   c                   ó   — yrÑ   r   r   r   r   r†  zRTestGreenlet.test_falling_off_end_switches_to_unstarted_parent_works.<locals>.leaf4  r3  r   )r³   r�  r´   )r:   rŽ  r‡  r†  rˆ  rê   s         r   Ú7test_falling_off_end_switches_to_unstarted_parent_workszDTestGreenlet.test_falling_off_end_switches_to_unstarted_parent_works.  sC   € ò	ô  +¨7Ó3Ðò	ô ˜DÐ"6Ó7ˆà—‘“ˆØ×Ñ˜ Õ*r   c                 óˆ  ‡—  G d„ dt         «      } |«       }g Št        ˆfd„|«      }| j                  t        «      5  |j                  «        d d d «       | j	                  ‰dg«       | j                  t        «      5  |j                  «        d d d «       | j	                  ‰dg«       y # 1 sw Y   Œ^xY w# 1 sw Y   Œ)xY w)Nc                   ó   — e Zd Zd„ Zy)úXTestGreenlet.test_switch_to_dead_greenlet_with_unstarted_perverse_parent.<locals>.Parentc                 ó   — |dk(  rt         ‚y r@   )r   rõ   s     r   rô   ziTestGreenlet.test_switch_to_dead_greenlet_with_unstarted_perverse_parent.<locals>.Parent.__getattribute__>  s   € Ø˜5’=Ü#�Oð !r   Nr÷   r   r   r   ÚParentr“  =  s   „ ó$r   r•  c                  ó&   •— ‰ j                  d«      S rÑ   ©r   r   s   €r   rª   zZTestGreenlet.test_switch_to_dead_greenlet_with_unstarted_perverse_parent.<locals>.<lambda>E  ó   ø€  D§K¡K°£O€ r   r³   )r'   rB   r   r   r7   )r:   r•  r‡  rˆ  r   s       @r   Ú;test_switch_to_dead_greenlet_with_unstarted_perverse_parentzHTestGreenlet.test_switch_to_dead_greenlet_with_unstarted_perverse_parent<  s¬   ø€ ô	$”[ô 	$ñ  &›xÐØˆÜÓ3Ð5IÓJˆð ×ÑœyÓ)ñ 	Ø�L‰LŒN÷	ð 	×Ñ˜ ˜tÔ$à×ÑœyÓ)ñ 	Ø�L‰LŒN÷	à×Ñ˜ ˜tÕ$÷	ð 	ú÷
	ð 	ús   ¾B,Á?B8Â,B5Â8Cc                 ó   ‡— g Št        ˆfd„«      }t        ˆfd„«      }|j                  «        | j                  ‰dg«       ||_        |j                  «       }| j	                  |«       | j                  ‰ddg«       y )Nc                  ó&   •— ‰ j                  d«      S rŒ  r—  r   s   €r   rª   zDTestGreenlet.test_switch_to_dead_greenlet_reparent.<locals>.<lambda>S  s   ø€ °4·;±;¸r³?€ r   c                  ó&   •— ‰ j                  d«      S rÑ   r—  r   s   €r   rª   zDTestGreenlet.test_switch_to_dead_greenlet_reparent.<locals>.<lambda>T  r˜  r   r³   r�  )r'   r   r7   r   rR   )r:   r‡  rˆ  rê   r   s       @r   Ú%test_switch_to_dead_greenlet_reparentz2TestGreenlet.test_switch_to_dead_greenlet_reparentQ  sn   ø€ ØˆÜ*Ó+BÓCÐÜÓ3Ó4ˆà�‰ŒØ×Ñ˜ ˜tÔ$à+ˆŒà—‘“ˆØ×Ñ˜&Ô!Ø×Ñ˜  B˜xÕ(r   c                 ód  ‡‡— t        j                  «       Šˆfd„}ˆfd„Št        |«      }|j                  «        t        d„ «      }|j                  «        | j	                  |j
                  «       | j                  |j
                  j                  j                  d«       | j	                  |j
                  j                  «       | j                  |j
                  j                  j                  j                  d«       | j                  |j
                  j                  j                  «       y )Nc                  ó   •—  ‰ «        y r"   r   ©Úinners   €r   ÚouterzHTestGreenlet.test_can_access_f_back_of_suspended_greenlet.<locals>.outere  s   ø€ Ù�Gr   c                  óN   •— ‰ j                  t        j                  d«      «       y r   )r   r   rš   ©ré   s   €r   r¡  zHTestGreenlet.test_can_access_f_back_of_suspended_greenlet.<locals>.innerh  s   ø€ Ø�K‰KœŸ™ aÓ(Õ)r   c                   ó   — y r"   r   r   r   r   rª   zKTestGreenlet.test_can_access_f_back_of_suspended_greenlet.<locals>.<lambda>q  r¾   r   r¡  r¢  )r   r   r'   r   rM   rž   r7   Úf_codeÚco_namer›   rR   )r:   r¢  rè   Ú	unrelatedr¡  ré   s       @@r   Ú,test_can_access_f_back_of_suspended_greenletz9TestGreenlet.test_can_access_f_back_of_suspended_greenlet_  sÚ   ù€ ô ×"Ñ"Ó$ˆô	ô	*ô ˜%Ó ˆà�
‰
Œô  ¡Ó-ˆ	Ø×ÑÔð 	×Ñ˜SŸ\™\Ô*Ø×Ñ˜Ÿ™×,Ñ,×4Ñ4°gÔ>Ø×Ñ˜SŸ\™\×0Ñ0Ô1Ø×Ñ˜Ÿ™×,Ñ,×3Ñ3×;Ñ;¸WÔEà×Ñ˜#Ÿ,™,×-Ñ-×4Ñ4Õ5r   c                 ó¬  ‡‡‡— ddl mŠ ddlmŠ ˆˆˆfd„Št	        ‰«      }|j                  d«       |j                  }t        d«      D ]-  }| j                  |j                  d   |«       |j                  }Œ/ | j                  |j                  d   d«       | j                  |j                  «       | j                  |j                  d«      d	«       y )
Nr   )Úpartialr   )Ú_test_extension_cppc                 ó¢   •— | dkD  r| ‰j                   ‰‰| dz
  «      «      z  S t        j                  «       j                  j	                  «       S )Nr   r   )Ú	test_callr   r   r   r   )r‰   r¬  r«  Úrecurses    €€€r   r¯  z@TestGreenlet.test_get_stack_with_nested_c_calls.<locals>.recurse€  sJ   ø€ Ø�1ŠuØÐ.×8Ñ8¹ÀÈ!ÈaÉ%Ó9PÓQÑQÐQÜ×&Ñ&Ó(×/Ñ/×6Ñ6Ó8Ð8r   r6   r‰   rh   i°  )Ú	functoolsr«  Ú r¬  r'   r   rž   r9   r7   r  r›   rR   )r:   Úgrr    ro   r¬  r«  r¯  s       @@@r   Ú"test_get_stack_with_nested_c_callsz/TestGreenlet.test_get_stack_with_nested_c_calls|  s¨   ú€ Ý%Ý)ö	9ô
 ˜Ó!ˆØ
�	‰	�!ŒØ—‘ˆÜ�q“ò 	!ˆAØ×Ñ˜UŸ^™^¨CÑ0°!Ô4Ø—L‘L‰Eð	!ð 	×Ñ˜Ÿ™¨Ñ,¨aÔ0Ø×Ñ˜%Ÿ,™,Ô'Ø×Ñ˜Ÿ™ 2›¨Õ-r   c                 ó4  ‡‡— t        j                  «       Šˆfd„}ˆfd„Št        |«      }|j                  «       }t        d„ «      }|j                  «        | j	                  |j
                  j                  d«       | j                  |j                  «       y )Nc                  ó<   •—  ‰ t        j                  d«      «       y r   )r   rš   r   s   €r   r¢  z6TestGreenlet.test_frames_always_exposed.<locals>.outer•  s   ø€ Ù”#—-‘- Ó"Õ#r   c                 ó(   •— ‰j                  | «       y r"   )r   )r    ré   s    €r   r¡  z6TestGreenlet.test_frames_always_exposed.<locals>.inner˜  s   ø€ Ø�K‰K˜Õr   c                   ó   — y r"   r   r   r   r   rª   z9TestGreenlet.test_frames_always_exposed.<locals>.<lambda>   r¾   r   r¢  )	r   r   r'   r   r7   r¦  r§  rR   r›   )r:   r¢  r²  r    r¨  r¡  ré   s        @@r   Útest_frames_always_exposedz'TestGreenlet.test_frames_always_exposed�  sx   ù€ ô ×"Ñ"Ó$ˆô	$ô	ô ˜ÓˆØ—	‘	“ˆô  ¡Ó-ˆ	Ø×ÑÔà×Ñ˜Ÿ™×-Ñ-¨wÔ7à×Ñ˜%Ÿ,™,Õ'r   N)F)4r   r   r   r;   r>   rH   rK   rP   rS   r[   rc   rr   rw   rz   r   rŠ   ÚunittestÚskipIfr	   r   r–   r¢   r°   rµ   rº   rÈ   rÎ   rÚ   rà   rä   rì   rï   rú   r   r  r
  r  r  r.  r4  rC  rO  rh  rr  r€  r‰  r�  r™  r�  r©  r³  r¸  r   r   r   r,   r,   3   sd  „ ò.òò1ò1ò7ò
!ò
'ò(Dò,1ò,ò8+òOò&ð6 €X‡_�_ØÒ&Ð&ØGóñ*óð*òX+ò 	ò ò-òò& ò5ò"	+òCò
ò6ò	;ð ò7)ó ð7)ðr ñ:ó ð:ò>ð ñ)ó ð)ò*-ò^$ò4-ò82ò 5ònBð> €X‡_�_ØÒ&Ð&ØEóñADóðADòFò+ò%ò*)ò6ò:.ó&(r   r,   c                   óH   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zy)ÚTestGreenletSetParentErrorsc                 ó
  ‡‡‡— i Št        j                  «       Št        j                  «       Šˆˆˆfd„}d„ }t        j                  |¬«      }|j                  «        ‰j	                  d«       t        |«      }|j                  «        | j                  t        «      5 }‰d   |_	        d d d «       ‰j                  «        |j                  d«       | j                  t        j                  «      d«       y # 1 sw Y   ŒPxY w)Nc                  óf   •— t        d„ «      ‰d<   ‰ j                  «        ‰j                  d«       y )Nc                   ó   — y r"   r   r   r   r   rª   zQTestGreenletSetParentErrors.test_threaded_reparent.<locals>.run.<locals>.<lambda>¯  r¾   r   r(   rh   r¿   rÀ   s   €€€r   rA   z?TestGreenletSetParentErrors.test_threaded_reparent.<locals>.run®  rÄ   r   c                  ó\   — t        j                  «       j                  j                  «        y r"   r¸   r   r   r   ÚblankzATestGreenletSetParentErrors.test_threaded_reparent.<locals>.blank³  rý   r   ri   rh   r(   z&parent cannot be on a different thread)rk   r”   rl   rm   rŽ   r'   r   rB   rÌ   r   r�   rn   r7   rE   rF   )	r:   rA   rÁ  rÇ   r(   r#   rÁ   rÂ   rÃ   s	         @@@r   Útest_threaded_reparentz2TestGreenletSetParentErrors.test_threaded_reparent©  sÅ   ú€ ØˆÜ!Ÿ™Ó)ˆÜ—_‘_Ó&ˆ
ö	 ò
	2ô ×!Ñ!¨Ô-ˆØ�‰ŒØ×Ñ˜2ÔÜ˜ÓˆØ	�‰Œ
Ø×ÑœzÓ*ð 	!¨cØ˜C‘yˆAŒH÷	!à�‰ÔØ�‰�BŒà×Ñœ˜SŸ]™]Ó+Ð-UÕV÷	!ð 	!ús   ÂC9Ã9Dc                 óÐ  ‡— g Šˆfd„}t        j                  |¬«      }|j                  «        |j                  d«       | j	                  | j
                  dz   ¬«        G ˆfd„dt        «      } |d„ «      }| j                  t        j                  «      5 }|j                  «        d d d «       | j                  t        j                  «      d	«       ‰d d …= y # 1 sw Y   Œ4xY w)
Nc                  ó`   •— t        d„ «      } ‰j                  | «       | j                  «        y )Nc                   ó   — y r"   r   r   r   r   rª   zYTestGreenletSetParentErrors.test_unexpected_reparenting.<locals>.worker.<locals>.<lambda>Å  r¾   r   )r'   r   r   )r(   Úanothers    €r   rë   zGTestGreenletSetParentErrors.test_unexpected_reparenting.<locals>.workerÄ  s"   ø€ Ü™LÓ)ˆAØ�N‰N˜1ÔØ�H‰H�Jr   ri   rh   r   )Úinitial_main_greenletsc                   ó   •— e Zd Zˆ fd„Zy)úKTestGreenletSetParentErrors.test_unexpected_reparenting.<locals>.convolutedc                 óN   •— |dk(  r
‰d   | _         t        j                  | |«      S ©NrA   r   ©r   r'   rô   ©r:   rö   rÆ  s     €r   rô   z\TestGreenletSetParentErrors.test_unexpected_reparenting.<locals>.convoluted.__getattribute__à  ó(   ø€ Ø˜5’=Ø")¨!¡*�D”KÜ"×3Ñ3°D¸$Ó?Ð?r   Nr÷   ©rÆ  s   €r   r  rÉ  ß  ó	   ø„ õ@r   r  c                   ó   — y r"   r   r   r   r   rª   zITestGreenletSetParentErrors.test_unexpected_reparenting.<locals>.<lambda>ä  r¾   r   r  )rk   rl   rm   rn   r  Úmain_greenlets_before_testr'   rB   r   rÅ   r   r7   rE   rF   )r:   rë   r•   r  r(   r#   rÆ  s         @r   Útest_unexpected_reparentingz7TestGreenletSetParentErrors.test_unexpected_reparentingÂ  sÂ   ø€ Øˆô	ô ×Ñ FÔ+ˆØ	�‰Œ	Ø	�‰ˆrŒ
ð& 	×&Ñ&¸d×>]Ñ>]Ð`aÑ>aÐ&Ôbö	@œô 	@ñ
 ‘|Ó$ˆØ×ÑœxŸ~™~Ó.ð 	°#Ø�H‰HŒJ÷	à×Ñœ˜SŸ]™]Ó+Ø]ô	_à’A‰J÷		ð 	ús   ÂCÃC%c                 ó  ‡‡‡— g Št        j                  «       Št        j                  «       Šˆˆˆfd„} G ˆfd„dt        «      }t        j                  |¬«      }|j	                  «        ‰j                  d«       	  |d„ «      }| j                  t        j                  «      5 }|j                  «        d d d «       | j                  dt        j                  «      «       | j                  dt        |j                  «      «       | j                  d	t        |j                  «      «       ‰j                  «        |j                  d«       ‰d d …= y # 1 sw Y   ŒŸxY w# ‰j                  «        |j                  d«       ‰d d …= w xY w)
Nc                  ó¢   •— t        d„ «      } ‰j                  | «       | j                  «        ‰j                  «        ‰j	                  d«       y )Nc                   ó   — y r"   r   r   r   r   rª   zhTestGreenletSetParentErrors.test_unexpected_reparenting_thread_running.<locals>.worker.<locals>.<lambda>ò  r¾   r   rh   )r'   r   r   r�   rŽ   )r(   rÆ  Úkeep_main_aliveÚswitched_to_greenlets    €€€r   rë   zVTestGreenletSetParentErrors.test_unexpected_reparenting_thread_running.<locals>.workerñ  s<   ø€ Ü™LÓ)ˆAØ�N‰N˜1ÔØ�H‰HŒJØ ×$Ñ$Ô&Ø× Ñ  Õ$r   c                   ó   •— e Zd Zˆ fd„Zy)úZTestGreenletSetParentErrors.test_unexpected_reparenting_thread_running.<locals>.convolutedc                 óN   •— |dk(  r
‰d   | _         t        j                  | |«      S rË  rÌ  rÍ  s     €r   rô   zkTestGreenletSetParentErrors.test_unexpected_reparenting_thread_running.<locals>.convoluted.__getattribute__ø  rÎ  r   Nr÷   rÏ  s   €r   r  rÚ  ÷  rÐ  r   r  ri   rh   c                   ó   — y r"   r   r   r   r   rª   zXTestGreenletSetParentErrors.test_unexpected_reparenting_thread_running.<locals>.<lambda>  r¾   r   z#Cannot switch to a different threadÚExpectedÚCurrent)rk   r”   r'   rl   rm   rŽ   rB   r   rÅ   r   rD   rE   rF   r�   rn   )	r:   rë   r  r•   r(   r#   rÆ  r×  rØ  s	         @@@r   Ú*test_unexpected_reparenting_thread_runningzFTestGreenletSetParentErrors.test_unexpected_reparenting_thread_runningë  s%  ú€ ð ˆÜ(Ÿ™Ó0ÐÜ#Ÿ/™/Ó+ˆö	%ö	@œô 	@ô ×Ñ FÔ+ˆØ	�‰Œ	à×!Ñ! "Ô%ð	Ù™<Ó(ˆAà×"Ñ"¤8§>¡>Ó2ð °cØ—‘”
÷à�M‰MÐ?ÄÀSÇ]Á]ÓASÔTØ�M‰M˜*¤c¨#¯-©-Ó&8Ô9Ø�M‰M˜)¤S¨¯©Ó%7Ô8à×ÑÔ!Ø�F‰F�2ŒJàš‘
÷ð ûð ×ÑÔ!Ø�F‰F�2ŒJàš‘
ús%   Á>(E! Â&EÂ7A7E! ÅEÅE! Å!(F	c                 ó  — t        d„ «      }| j                  |j                  t        j                  «       «       | j                  t        «      5 }|`d d d «       | j                  t        j                  «      d«       y # 1 sw Y   Œ/xY w)Nc                   ó   — y r"   r   r   r   r   rª   zGTestGreenletSetParentErrors.test_cannot_delete_parent.<locals>.<lambda>  r¾   r   úcan't delete attribute)
r'   rN   r   r   r   rB   rC   r7   rE   rF   )r:   rë   r#   s      r   Útest_cannot_delete_parentz5TestGreenletSetParentErrors.test_cannot_delete_parent  sk   € Ü™\Ó*ˆØ�‰�f—m‘m¤X×%8Ñ%8Ó%:Ô;à×Ñœ~Ó.ð 	°#Ø�÷	à×Ñœ˜SŸ]™]Ó+Ð-EÕF÷	ð 	ús   ÁBÂB
c                 óÊ   — | j                  t        «      5 }t        j                  «       `d d d «       | j                  t        j                  «      d«       y # 1 sw Y   Œ/xY w)Nrâ  ©rB   rC   r   r   r   r7   rE   rF   ©r:   r#   s     r   Ú!test_cannot_delete_parent_of_mainz=TestGreenletSetParentErrors.test_cannot_delete_parent_of_main  sP   € Ø×Ñœ~Ó.ð 	-°#Ü×#Ñ#Ó%Ð,÷	-à×Ñœ˜SŸ]™]Ó+Ð-EÕF÷	-ð 	-ús   –AÁA"c                 ó^   — | j                  t        j                  «       j                  «       y r"   )rR   r   r   r   r=   s    r   Ú!test_main_greenlet_parent_is_nonez=TestGreenletSetParentErrors.test_main_greenlet_parent_is_none  s   € à×Ñœ(×-Ñ-Ó/×6Ñ6Õ7r   c                 óÐ   ‡ — d„ }ˆ fd„}t        |«      }‰ j                  |«        ||«       |j                  «        ‰ j                  |«        ||«       |j                  «        y )Nc                  ó\   — t        j                  «       j                  j                  «        y r"   r¸   r   r   r   ÚbgzCTestGreenletSetParentErrors.test_set_parent_wrong_types.<locals>.bg"  s   € ä×ÑÓ!×(Ñ(×/Ñ/Õ1r   c                 óô   •— d d‰dfD ]b  }‰j                  t        «      5 }|| _        d d d «       ‰j                  t	        j
                  «      dt        |«      j                  z   «       Œd y # 1 sw Y   ŒGxY w)Nr   Ú42z4GreenletChecker: Expected any type of greenlet, not )rB   rÙ   r   r7   rE   rF   Útyper   )ÚgletÚpr#   r:   s      €r   ÚcheckzFTestGreenletSetParentErrors.test_set_parent_wrong_types.<locals>.check&  sy   ø€ Ø˜1˜d DÐ(ò _�Ø×&Ñ&¤yÓ1ð $°SØ"#�D”K÷$ð × Ñ Ü˜Ÿ™Ó&ØJÌTÐRSËW×M]ÑM]Ñ]õ_ñ	_÷$ð $ús    A.Á.A7	)r'   rŸ   r   r�   )r:   rì  rò  r(   s   `   r   Útest_set_parent_wrong_typesz7TestGreenletSetParentErrors.test_set_parent_wrong_types!  sW   ø€ ò	2ô	_ô ˜‹OˆØ×Ñ˜ÔÙˆaŒð 	
�‰Œ
Ø�‰˜ÔÙˆaŒð 	
�‰�
r   c                 óÈ   — t        d„ «      }| j                  t        «      5 }||_        d d d «       | j	                  t        j                  «      d«       y # 1 sw Y   Œ/xY w)Nc                   ó   — y r"   r   r   r   r   rª   z@TestGreenletSetParentErrors.test_trivial_cycle.<locals>.<lambda>>  r¾   r   úcyclic parent chain)r'   rB   rÌ   r   r7   rE   rF   )r:   rð  r#   s      r   Útest_trivial_cyclez.TestGreenletSetParentErrors.test_trivial_cycle=  sR   € Ü™<Ó(ˆØ×ÑœzÓ*ð 	¨cØˆDŒK÷	à×Ñœ˜SŸ]™]Ó+Ð-BÕC÷	ð 	ús   ¢AÁA!c                 óø   — | j                  t        «      5 }t        j                  «       t        j                  «       _        d d d «       | j                  t        j                  «      d«       y # 1 sw Y   Œ/xY w)Nz(cannot set the parent of a main greenletrå  ræ  s     r   Útest_trivial_cycle_mainz3TestGreenletSetParentErrors.test_trivial_cycle_mainC  s_   € à×Ñœ~Ó.ð 	A°#Ü+3×+>Ñ+>Ó+@ŒH×ÑÓ!Ô(÷	Aà×Ñœ˜SŸ]™]Ó+Ð-WÕX÷	Að 	Aús   –,A0Á0A9c                 ó  — t        d„ «      }t        d„ «      }t        d„ «      }||_        ||_        | j                  t        «      5 }||_        d d d «       | j	                  t        j                  «      d«       y # 1 sw Y   Œ/xY w)Nc                   ó   — y r"   r   r   r   r   rª   z?TestGreenletSetParentErrors.test_deeper_cycle.<locals>.<lambda>J  r¾   r   c                   ó   — y r"   r   r   r   r   rª   z?TestGreenletSetParentErrors.test_deeper_cycle.<locals>.<lambda>K  r¾   r   c                   ó   — y r"   r   r   r   r   rª   z?TestGreenletSetParentErrors.test_deeper_cycle.<locals>.<lambda>L  r¾   r   rö  )r'   r   rB   rÌ   r7   rE   rF   )r:   r)   ru   Úg3r#   s        r   Útest_deeper_cyclez-TestGreenletSetParentErrors.test_deeper_cycleI  st   € Ü™Ó&ˆÜ™Ó&ˆÜ™Ó&ˆàˆŒ	ØˆŒ	Ø×ÑœzÓ*ð 	¨cØˆBŒI÷	à×Ñœ˜SŸ]™]Ó+Ð-BÕC÷	ð 	ús   ÁA>Á>BN)r   r   r   rÂ  rÓ  rß  rã  rç  ré  ró  r÷  rù  rÿ  r   r   r   r¼  r¼  ¨  s<   „ òWò2'òR"òHGòGò8òò8DòYó	Dr   r¼  c                   ó6   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	y)	ÚTestReprc                 óJ   — | j                  |j                  |«      ||f«       y r"   )r�   Úendswith)r:   ÚgotÚsuffixs      r   ÚassertEndsWithzTestRepr.assertEndsWithW  s   € Ø�‰˜Ÿ™ VÓ,¨s°F¨mÕ<r   c                 ób   — t        t        j                  «       «      }| j                  |d«       y )Nú current active started main>)Úreprr   r   r  ©r:   Úrs     r   Útest_main_while_runningz TestRepr.test_main_while_runningZ  s&   € Ü”×$Ñ$Ó&Ó'ˆØ×Ñ˜AÐ>Õ?r   c                 ó’   ‡— t        j                  «       Šˆfd„}t        |«      }|j                  «       }| j	                  |d«       y )Nc                  ó   •— t        ‰ «      S r"   )r	  r¤  s   €r   rA   z-TestRepr.test_main_in_background.<locals>.run`  s   ø€ Ü˜“:Ðr   ú suspended active started main>)r   r   r'   r   r  )r:   rA   r(   r  ré   s       @r   Útest_main_in_backgroundz TestRepr.test_main_in_background^  s>   ø€ Ü×"Ñ"Ó$ˆô	ô ˜ÓˆØ�H‰H‹JˆØ×Ñ˜AÐ@ÕAr   c                 óN   — t        t        «       «      }| j                  |d«       y )Nz	 pending>)r	  r'   r  r
  s     r   Útest_initialzTestRepr.test_initialg  s   € Ü”“ÓˆØ×Ñ˜A˜{Õ+r   c                 ó&  ‡— t        j                  «       Š G ˆfd„dt        j                  «      } |«       }|j	                  «        |j                  d«       | j                  |j                  d«       | j                  |j                  d«       t        d«      D ]  }t        j                  d«       Œ t        d«      D ]N  }| j                  |j                  j                  «       t        |j                  «      }| j                  |d«       ŒP y )	Nc                   ó$   •— e Zd ZdxZZdZˆ fd„Zy)ú/TestRepr.test_main_from_other_thread.<locals>.TNc                 óŒ   •— t        ‰«      | _        t        j                  «       | _        t        | j                  «      | _        y r"   )r	  Úoriginal_mainr   r   Ú	main_gletr|  )r:   ré   s    €r   rA   z3TestRepr.test_main_from_other_thread.<locals>.T.runq  s0   ø€ Ü%)¨$£Z�Ô"Ü!)×!4Ñ!4Ó!6�”Ü#'¨¯©Ó#7�Õ r   )r   r   r   r  r|  r  rA   r¤  s   €r   ÚTr  n  s   ø„ Ø*.Ð.ˆM˜KØˆIõ8r   r  rh   r  r  r/   gü©ñÒMbP?z (thread exited) dead>)r   r   rk   rl   rm   rn   r  r  r|  r9   r¦   r§   r�   r  rY   r	  )r:   r  r•   rb  r  ré   s        @r   Útest_main_from_other_threadz$TestRepr.test_main_from_other_threadk  sÕ   ø€ Ü×"Ñ"Ó$ˆö	8”	× Ñ ô 	8ñ ‹CˆØ	�‰Œ	Ø	�‰ˆrŒ
à×Ñ˜AŸO™OÐ-NÔOØ×Ñ˜AŸM™MÐ+JÔKô �q“ò 	ˆAÜ�J‰J�uÕð	ô �q“ò 	=ˆAØ�O‰O˜AŸK™K×,Ñ,Ô-Ü�Q—[‘[Ó!ˆAØ×Ñ Ð#;Õ<ñ	=r   c                 ó  — t        d„ «      }|j                  «        | j                  t        |«      d«       | j	                  dt        |«      «       | j	                  dt        |«      «       | j	                  dt        |«      «       y )Nc                   ó   — y r"   r   r   r   r   rª   z$TestRepr.test_dead.<locals>.<lambda>�  r¾   r   z dead>Ú	suspendedÚstartedÚactive)r'   r   r  r	  ÚassertNotInrO   s     r   Ú	test_deadzTestRepr.test_deadŽ  se   € Ü™Ó%ˆØ	�‰Œ
Ø×ÑœD ›G XÔ.Ø×Ñ˜¤d¨1£gÔ.Ø×Ñ˜¤D¨£GÔ,Ø×Ñ˜¤4¨£7Õ+r   c                 óÌ   — t        d„ «      }t        d„ «      }t        j                  «       }|||fD ]0  }| j                  |›t        «       | j                  |›t        «       Œ2 y )Nc                   ó   — y r"   r   r   r   r   rª   z>TestRepr.test_formatting_produces_native_str.<locals>.<lambda>š  r¾   r   c                   ó   — y r"   r   r   r   r   rª   z>TestRepr.test_formatting_produces_native_str.<locals>.<lambda>›  r¾   r   )r'   r   r   ÚassertIsInstancerE   )r:   Úg_deadÚg_not_startedÚg_curr(   s        r   Ú#test_formatting_produces_native_strz,TestRepr.test_formatting_produces_native_str–  sf   € ô ™\Ó*ˆÜ#¡LÓ1ˆÜ×#Ñ#Ó%ˆà˜¨Ð-ò 		ˆAà×!Ñ!ÙÜôð ×!Ñ!ÙÜõñ		r   N)
r   r   r   r  r  r  r  r  r!  r)  r   r   r   r  r  U  s(   „ ò=ò@òBò,ò!=òF,ór   r  c                   ó   — e Zd Zd„ Zd„ Zd„ Zy)ÚTestMainGreenletc                 ó    — dt        t        j                  «       «      v sJ ‚t        t        j                  «       «      }dt        |«      vsJ ‚|S )Nré   )r	  r   r   rï  )r:   r•   s     r   Ú_check_current_is_mainz'TestMainGreenlet._check_current_is_main®  sH   € àœœh×1Ñ1Ó3Ó4Ñ4Ð4Ð4ä”×$Ñ$Ó&Ó'ˆØœT !›WÑ$Ð$Ð$Øˆr   c                 ób   — | j                  «       }t        d|fi «      }| j                  |«       y )NÚsubclass)r-  rï  rM   )r:   Ú	main_typer/  s      r   Ú)test_main_greenlet_type_can_be_subclassedz:TestMainGreenlet.test_main_greenlet_type_can_be_subclassed¶  s.   € Ø×/Ñ/Ó1ˆ	Ü˜
 Y L°"Ó5ˆØ×Ñ˜XÕ&r   c                 ót   — | j                  «        | j                  t        j                  «       t        «       y r"   )r-  r%  r   r   r'   r=   s    r   Útest_main_greenlet_is_greenletz/TestMainGreenlet.test_main_greenlet_is_greenlet»  s'   € Ø×#Ñ#Ô%Ø×Ñœh×1Ñ1Ó3´[ÕAr   N)r   r   r   r-  r1  r3  r   r   r   r+  r+  ª  s   „ òò'ó
Br   r+  c                   ó<   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
y	)
ÚTestBrokenGreenletsc                 óÌ   — d„ }t         j                  j                  |«      }d|_        | j	                  t
        d«      5  |j                  «        d d d «       y # 1 sw Y   y xY w)Nc                  ó   — t        d«      ‚)NzNever get here)ÚAssertionErrorr   r   r   rß   z<TestBrokenGreenlets.test_failed_to_initialstub.<locals>.funcÆ  s   € Ü Ð!1Ó2Ð2r   Tz;Failed to switch stacks into a greenlet for the first time.)r   Ú	_greenletÚUnswitchableGreenletÚforce_switch_errorÚassertRaisesRegexÚSystemErrorr   )r:   rß   r(   s      r   Útest_failed_to_initialstubz.TestBrokenGreenlets.test_failed_to_initialstubÅ  sY   € ò	3ô ×Ñ×3Ñ3°DÓ9ˆØ#ˆÔà×#Ñ#¤KØ$aócñ 	à�H‰HŒJ÷	÷ 	ñ 	ús   Á AÁA#c                 óº  ‡— g Šˆfd„}t         j                  j                  |«      }|j                  «        | j	                  ‰dg«       |j                  «        | j	                  ‰ddg«       d|_        | j                  t        d«      5  |j                  «        d d d «       d|_        |j                  «        | j	                  ‰g d¢«       y # 1 sw Y   Œ5xY w)Nc                  ó  •— ‰ j                  d«       t        j                  «       j                  j	                  «        ‰ j                  d«       t        j                  «       j                  j	                  «        ‰ j                  d«       y )Nr   r4   r/   r0   )Úrunss   €r   rß   zDTestBrokenGreenlets.test_failed_to_switch_into_running.<locals>.funcÓ  sZ   ø€ Ø�K‰K˜ŒNÜ×ÑÓ!×(Ñ(×/Ñ/Ô1Ø�K‰K˜ŒNÜ×ÑÓ!×(Ñ(×/Ñ/Ô1Ø�K‰K˜�Nr   r   r4   Tz0Failed to switch stacks into a running greenlet.F)r   r4   r/   )r   r9  r:  r   r7   r;  r<  r=  )r:   rß   r(   rA  s      @r   Ú"test_failed_to_switch_into_runningz6TestBrokenGreenlets.test_failed_to_switch_into_runningÑ  sº   ø€ Øˆô	ô ×Ñ×3Ñ3°DÓ9ˆØ	�‰Œ
Ø×Ñ˜ ˜sÔ#Ø	�‰Œ
Ø×Ñ˜  1˜vÔ&Ø#ˆÔà×#Ñ#¤KØ$VóXñ 	à�H‰HŒJ÷	ð  %ˆÔØ	�‰Œ
Ø×Ñ˜šyÕ)÷	ð 	ús   ÂCÃCc                 ó²   — | j                  d«      }| j                  d|j                  «       | j                  |j                  | j	                  «       «       y )Nzfail_slp_switch.pyzfail_slp_switch is running)ÚassertScriptRaisesrD   ÚoutputÚ
returncodeÚ,get_expected_returncodes_for_aborted_process©r:   Úexs     r   Ú&test_failed_to_slp_switch_into_runningz:TestBrokenGreenlets.test_failed_to_slp_switch_into_runningí  sA   € Ø×$Ñ$Ð%9Ó:ˆà�‰Ð2°B·I±IÔ>Ø�‰�b—m‘m T×%VÑ%VÓ%XÕYr   c                 óþ   — | j                  d«      }| j                  d|«       | j                  d|«       | j                  d|«       | j                  d|«       | j                  d|«       | j                  d|«       y )Nzfail_switch_two_greenlets.pyz	In g1_runÚTRACEzLEAVE TRACEzFalling off end of mainzFalling off end of g1_runzFalling off end of g2©Ú
run_scriptrD   ©r:   rE  s     r   Ú#test_reentrant_switch_two_greenletsz7TestBrokenGreenlets.test_reentrant_switch_two_greenletsó  sh   € à—‘Ð!?Ó@ˆØ�‰�k 6Ô*Ø�‰�g˜vÔ&Ø�‰�m VÔ,Ø�‰Ð/°Ô8Ø�‰Ð1°6Ô:Ø�‰Ð-¨vÕ6r   c                 óš   — | j                  dd¬«      }| j                  d|j                  «       | j                  d|j                  «       y )Nzfail_switch_three_greenlets.py)r   )Ú	exitcodesrÙ   zpositional arguments)rD  rD   rE  rH  s     r   Ú%test_reentrant_switch_three_greenletsz9TestBrokenGreenlets.test_reentrant_switch_three_greenletsý  s@   € ð ×$Ñ$Ð%EÐQUÐ$ÓVˆà�‰�k 2§9¡9Ô-Ø�‰Ð,¨b¯i©iÕ8r   c                 óJ   — | j                  d«      }| j                  d|«       y )Nzfail_switch_three_greenlets2.pya­  RESULTS: [('trace', 'switch'), ('trace', 'switch'), ('g2 arg', 'g2 from tracefunc'), ('trace', 'switch'), ('main g1', 'from g2_run'), ('trace', 'switch'), ('g1 arg', 'g1 from main'), ('trace', 'switch'), ('main g2', 'from g1_run'), ('trace', 'switch'), ('g1 from parent', 'g1 from main 2'), ('trace', 'switch'), ('main g1.2', 'g1 done'), ('trace', 'switch'), ('g2 from parent', ()), ('trace', 'switch'), ('main g2.2', 'g2 done')]rM  rO  s     r   Ú&test_reentrant_switch_three_greenlets2z:TestBrokenGreenlets.test_reentrant_switch_three_greenlets2  s)   € ð —‘Ð!BÓCˆØ�‰ð=ð õ		
r   c                 óJ   — | j                  d«      }| j                  d|«       y )Nz#fail_initialstub_already_started.pya!  RESULTS: ['Begin C', 'Switch to b from B.__getattribute__ in C', ('Begin B', ()), '_B_run switching to main', ('main from c', 'From B'), 'B.__getattribute__ back from main in C', ('Begin A', (None,)), ('A dead?', True, 'B dead?', True, 'C dead?', False), 'C done', ('main from c.2', None)]rM  rO  s     r   Ú4test_reentrant_switch_GreenletAlreadyStartedInPythonzHTestBrokenGreenlets.test_reentrant_switch_GreenletAlreadyStartedInPython  s'   € Ø—‘Ð!FÓGˆà�‰ð1ð
 õ	
r   c                 óJ   — | j                  d«      }| j                  d|«       y )Nzfail_clearing_run_switches.pyz„RESULTS [('G.__getattribute__', 'run'), ('RunCallable', '__del__'), ('main: g.switch()', 'from RunCallable'), ('run_func', 'enter')]rM  rO  s     r   Ú*test_reentrant_switch_run_callable_has_delz>TestBrokenGreenlets.test_reentrant_switch_run_callable_has_del$  s'   € Ø—‘Ð!@ÓAˆØ�‰ðð õ	
r   N)r   r   r   r>  rB  rJ  rP  rS  rU  rW  rY  r   r   r   r5  r5  Á  s+   „ ò
ò*ò8Zò7ò9ò
ò$

ó
r   r5  Ú__main__)r|   r   r¦   rk   r¹  Úabcr   r   r   r'   r±  r   r   r	   r
   Ú	leakcheckr   rƒ   r   r   r*   r,   r¼  r  r+  r5  r   ré   r   r   r   ú<module>r]     s«   ðÛ 	Û 
Û Û Û å Ý ã Ý ,Ý Ý "Ý Ý Ý &ô	�	ô 	òòôr(�8ô r(ôjjD (ô jDôZRˆxô RôjB�xô Bô.k
˜(ô k
ðZ ˆzÒØ€H‡M�M…Oð r   