o
    ÑtPf1  ã                   @   sò   d Z ddlZejdd… dgkr2ddlZdd„ Zz	e e¡ ¡  W n	 ey*   Y nw e d¡ dS ddl	Z	ddl
mZmZ ddl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 G dd„ dejƒZedkrwe ¡  dS dS )a  Test for GitHub issues 461 and 471.

When moving to Python 3, handling of KeyboardInterrupt exceptions caused
by a Ctrl-C raised an exception while printing the traceback for a
greenlet preventing the process from exiting. This test tests for proper
handling of KeyboardInterrupt.
é    Né   Ú
subprocessc                   C   s$   t j d¡ t j ¡  t d¡ d S )Nzready
é   )ÚsysÚstdoutÚwriteÚflushÚgeventÚsleep© r   r   úa/var/www/html/humari/django-venv/lib/python3.10/site-packages/gevent/tests/test__issues461_471.pyÚtask   s   
r   )ÚPopenÚPIPE)ÚCFFI_BACKEND)ÚRUN_COVERAGE)ÚWIN)ÚPYPY3c                   @   s,   e Zd Ze er
epeoed¡dd„ ƒZ	dS )ÚTestz;Interferes with the timing; times out waiting for the childc           
      C   s8  t rddlm} d|i}ni }ttjtdgfdti|¤Ž}|j 	¡ }t
|tƒs,| d¡}| ¡ }|  |d¡ t s;tjnttdƒ}| |¡ d	}t ¡ }||d
  }t ¡ | }	t ¡ |	k r~| ¡ d urdn&t ¡ |krs| |¡ |	d }t d¡ t ¡ |	k s]| ¡  | ¡  tdƒ‚|  t s‘|jndd¡ |j ¡  d S )Nr   )ÚCREATE_NEW_PROCESS_GROUPÚcreationflagsr   r   ÚasciiÚreadyÚCTRL_BREAK_EVENTg      9@g       @r   gš™™™™™¹?zFailed to wait for child)r   r   r   r   r   Ú
executableÚ__file__r   r   ÚreadlineÚ
isinstanceÚstrÚdecodeÚstripÚassertEqualÚsignalÚSIGINTÚgetattrÚsend_signalÚtimeÚpollr
   Ú	terminateÚwaitÚAssertionErrorÚ
returncodeÚclose)
Úselfr   ÚkwargsÚpÚlineÚsignal_to_sendÚwait_secondsÚnowÚmidtimeÚendtimer   r   r   Ú	test_hang(   s:   






ú	zTest.test_hangN)
Ú__name__Ú
__module__Ú__qualname__ÚunittestÚskipIfr   r   r   r   r6   r   r   r   r   r   &   s    þr   Ú__main__)Ú__doc__r   Úargvr	   r   ÚspawnÚgetÚKeyboardInterruptÚexitr"   r   r   r   r&   r:   Úgevent.testingÚtestingÚ	greentestÚgevent.testing.sysinfor   r   r   r   ÚTestCaser   r7   Úmainr   r   r   r   Ú<module>   s0    ÿ8ÿ