U
    nv¨g¼  ã                   @   sn   d Z ddlZdZdZdadd„ Zdd„ Zdd	„ Ze e¡ e e¡Ze e¡Ze 	d
¡ e
dƒ e 	d¡ dS )z 
Uses a trace function to switch greenlets at unexpected times.

In the trace function, we switch from the current greenlet to another
greenlet, which switches
é    NFc                  G   s,   t d| žŽ  trdat ¡  t d| žŽ  d S )NÚTRACEFú	LEAVE TRACE)r   )r   )ÚprintÚswitch_to_g2Úg2Úswitch)Úargs© r	   úN/tmp/pip-unpacked-wheel-49pzfzc0/greenlet/tests/fail_switch_three_greenlets.pyÚ	tracefunc   s
    r   c                  C   s0   t dƒ dat ¡ j ¡ } t dƒ t d| ƒ d S )Nz	In g1_runTzReturn to g1_runzFrom parent)r   r   ÚgreenletÚ
getcurrentÚparentr   )Zfrom_parentr	   r	   r
   Úg1_run   s
    r   c                   C   s   t  ¡ j ¡  d S )N)r   r   r   r   r	   r	   r	   r
   Úg2_run   s    r   é   zBack in mainé   )Ú__doc__r   Zg1r   r   r   r   r   Úsettracer   r   r	   r	   r	   r
   Ú<module>   s   



