AlkantarClanX12

Your IP : 3.140.186.189


Current Path : /opt/alt/python37/lib64/python3.7/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/asyncio/__pycache__/unix_events.cpython-37.opt-2.pyc

B

YI~d؟�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddlm
Z
ddlmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZd
Zejdkr�ed��dd�ZGdd�dej�ZGdd�dej�ZGdd�dejej �Z!Gdd�de
j"�Z#Gdd�d�Z$Gdd�de$�Z%Gdd�de%�Z&Gd d!�d!e%�Z'Gd"d#�d#ej(�Z)eZ*e)Z+dS)$�N�)�base_events)�base_subprocess)�	constants)�
coroutines)�events)�futures)�selector_events)�tasks)�
transports)�logger)�SelectorEventLoop�AbstractChildWatcher�SafeChildWatcher�FastChildWatcher�DefaultEventLoopPolicy�win32z+Signals are not really supported on WindowscCsdS)N�)�signum�framerr�8/opt/alt/python37/lib64/python3.7/asyncio/unix_events.py�_sighandler_noop'srcs�eZdZd(�fdd�	Z�fdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	d)dd�Z
d*dd�Zd+dd�Zdd�Z
d,ddddd�dd�Zd-dddddd�dd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Z�ZS).�_UnixSelectorEventLoopNcst��|�i|_dS)N)�super�__init__�_signal_handlers)�self�selector)�	__class__rrr2sz_UnixSelectorEventLoop.__init__cs^t���t��s2xFt|j�D]}|�|�qWn(|jrZtjd|�d�t	|d�|j�
�dS)NzClosing the loop z@ on interpreter shutdown stage, skipping signal handlers removal)�source)r�close�sys�
is_finalizing�listr�remove_signal_handler�warnings�warn�ResourceWarning�clear)r�sig)rrrr 6s
z_UnixSelectorEventLoop.closecCs"x|D]}|sq|�|�qWdS)N)�_handle_signal)r�datarrrr�_process_self_dataDs
z)_UnixSelectorEventLoop._process_self_datac
GsLt�|�st�|�rtd��|�|�|��yt�|j�	��Wn2t
tfk
rt}ztt
|���Wdd}~XYnXt�|||d�}||j|<yt�|t�t�|d�Wn�tk
�rF}zz|j|=|j�syt�d�Wn4t
tfk
�r}zt�d|�Wdd}~XYnX|jtjk�r4td|�d���n�Wdd}~XYnXdS)Nz3coroutines cannot be used with add_signal_handler()F���zset_wakeup_fd(-1) failed: %szsig z cannot be caught)rZiscoroutineZiscoroutinefunction�	TypeError�
_check_signalZ
_check_closed�signal�
set_wakeup_fdZ_csock�fileno�
ValueError�OSError�RuntimeError�strrZHandlerr�siginterruptr�info�errno�EINVAL)rr)�callback�args�exc�handleZnexcrrr�add_signal_handlerKs0



z)_UnixSelectorEventLoop.add_signal_handlercCs8|j�|�}|dkrdS|jr*|�|�n
|�|�dS)N)r�getZ
_cancelledr$Z_add_callback_signalsafe)rr)r>rrrr*xsz%_UnixSelectorEventLoop._handle_signalc
Cs�|�|�y|j|=Wntk
r*dSX|tjkr>tj}ntj}yt�||�WnBtk
r�}z$|jtj	kr�t
d|�d���n�Wdd}~XYnX|js�yt�d�Wn2ttfk
r�}zt
�d|�Wdd}~XYnXdS)NFzsig z cannot be caughtr-zset_wakeup_fd(-1) failed: %sT)r/r�KeyErrorr0�SIGINT�default_int_handler�SIG_DFLr4r9r:r5r1r3rr8)rr)Zhandlerr=rrrr$�s(

z,_UnixSelectorEventLoop.remove_signal_handlercCsLt|t�std|����d|kr.tjksHntd|�dtj�d���dS)Nzsig must be an int, not rzsig z out of range(1, �))�
isinstance�intr.r0�NSIGr3)rr)rrrr/�s
z$_UnixSelectorEventLoop._check_signalcCst|||||�S)N)�_UnixReadPipeTransport)r�pipe�protocol�waiter�extrarrr�_make_read_pipe_transport�sz0_UnixSelectorEventLoop._make_read_pipe_transportcCst|||||�S)N)�_UnixWritePipeTransport)rrJrKrLrMrrr�_make_write_pipe_transport�sz1_UnixSelectorEventLoop._make_write_pipe_transportc	

�s�t����}
|��}t||||||||f||d�|	��}|
�|��|j|�y|IdHWn,tk
r�|��|�	�IdH�YnXWdQRX|S)N)rLrM)
r�get_child_watcher�
create_future�_UnixSubprocessTransport�add_child_handlerZget_pid�_child_watcher_callback�	Exceptionr Z_wait)
rrKr<�shell�stdin�stdout�stderr�bufsizerM�kwargs�watcherrL�transprrr�_make_subprocess_transport�s




z1_UnixSelectorEventLoop._make_subprocess_transportcCs|�|j|�dS)N)Zcall_soon_threadsafeZ_process_exited)r�pid�
returncoder^rrrrU�sz._UnixSelectorEventLoop._child_watcher_callback)�ssl�sock�server_hostname�ssl_handshake_timeoutc	�s
|r|dkr6td��n |dk	r&td��|dk	r6td��|dk	r�|dk	rNtd��t�|�}t�tjtjd�}y |�d�|�||�IdHWq�|���Yq�Xn@|dkr�td��|j	tjks�|j
tjkr�td|����|�d�|j|||||d	�IdH\}}||fS)
Nz/you have to pass server_hostname when using sslz+server_hostname is only meaningful with sslz1ssl_handshake_timeout is only meaningful with sslz3path and sock can not be specified at the same timerFzno path and sock were specifiedz.A UNIX Domain Stream Socket was expected, got )re)r3�os�fspath�socket�AF_UNIX�SOCK_STREAM�setblockingZsock_connectr �family�typeZ_create_connection_transport)	r�protocol_factory�pathrbrcrdre�	transportrKrrr�create_unix_connection�s@



z-_UnixSelectorEventLoop.create_unix_connection�dT)rc�backlogrbre�
start_servingc
�s�t|t�rtd��|dk	r&|s&td��|dk	�rH|dk	r@td��t�|�}t�tjtj�}|ddkr�y t	�
t�	|�j�r�t�|�WnBt
k
r�Yn0tk
r�}zt�d||�Wdd}~XYnXy|�|�Wnltk
�r0}	z8|��|	jtjk�rd|�d�}
ttj|
�d�n�Wdd}	~	XYn|���YnXn<|dk�rZtd	��|jtjk�sv|jtjk�r�td
|����|�d�t�||g||||�}|�r�|��tjd|d�IdH|S)
Nz*ssl argument must be an SSLContext or Nonez1ssl_handshake_timeout is only meaningful with sslz3path and sock can not be specified at the same timer)r�z2Unable to check or remove stale UNIX socket %r: %rzAddress z is already in usez-path was not specified, and no sock specifiedz.A UNIX Domain Stream Socket was expected, got F)�loop)rF�boolr.r3rfrgrhrirj�stat�S_ISSOCK�st_mode�remove�FileNotFoundErrorr4r�errorZbindr r9Z
EADDRINUSErlrmrkrZServerZ_start_servingr
Zsleep)rrnrorcrsrbrert�errr=�msgZserverrrr�create_unix_server�sZ






z)_UnixSelectorEventLoop.create_unix_serverc
�s�y
tjWn,tk
r6}zt�d��Wdd}~XYnXy|��}Wn2ttjfk
rv}zt�d��Wdd}~XYnXyt�|�j	}Wn,t
k
r�}zt�d��Wdd}~XYnX|r�|n|}	|	s�dS|��}
|�|
d|||||	d�|
IdHS)Nzos.sendfile() is not availableznot a regular filer)
rf�sendfile�AttributeErrorr�SendfileNotAvailableErrorr2�io�UnsupportedOperation�fstat�st_sizer4rR�_sock_sendfile_native_impl)rrc�file�offset�countr=r2r~Zfsize�	blocksize�futrrr�_sock_sendfile_native>s(
z,_UnixSelectorEventLoop._sock_sendfile_nativec	Cs|��}	|dk	r|�|�|��r4|�|||�dS|rd||}|dkrd|�|||�|�|�dSyt�|	|||�}
W�n*ttfk
r�|dkr�|�	||�|�
|	|j||	||||||�
Y�nHtk
�rj}z�|dk	�r|j
t
jk�rt|�tk	�rtdt
j�}||_|}|dk�rBt�d�}
|�|||�|�|
�n|�|||�|�|�Wdd}~XYn�tk
�r�}z|�|||�|�|�Wdd}~XYnjX|
dk�r�|�|||�|�|�nD||
7}||
7}|dk�r�|�	||�|�
|	|j||	||||||�
dS)Nrzsocket is not connectedzos.sendfile call failed)r2�
remove_writer�	cancelled�_sock_sendfile_update_fileposZ
set_resultrfr��BlockingIOError�InterruptedError�_sock_add_cancellation_callbackZ
add_writerr�r4r9ZENOTCONNrm�ConnectionError�	__cause__rr�Z
set_exceptionrV)rr�Z
registered_fdrcr2r�r�r��
total_sent�fdZsentr=�new_excr~rrrr�Us`






z1_UnixSelectorEventLoop._sock_sendfile_native_implcCs|dkrt�||tj�dS)Nr)rf�lseek�SEEK_SET)rr2r�r�rrrr��sz4_UnixSelectorEventLoop._sock_sendfile_update_fileposcs��fdd�}|�|�dS)Ncs&|��r"���}|dkr"��|�dS)Nr-)r�r2r�)r�r�)rrcrr�cb�szB_UnixSelectorEventLoop._sock_add_cancellation_callback.<locals>.cb)Zadd_done_callback)rr�rcr�r)rrcrr��sz6_UnixSelectorEventLoop._sock_add_cancellation_callback)N)NN)NN)N)N)N)�__name__�
__module__�__qualname__rr r,r?r*r$r/rNrPr_rUrqr�r�r�r�r��
__classcell__rr)rrr,s2-
 


*?Drcs�eZdZdZd�fdd�	Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
ddd�Zdd�Zdd�Z�ZS) rIiNcs�t��|�||jd<||_||_|��|_||_d|_d|_	t
�|j�j}t
�|�s�t
�|�s�t
�|�s�d|_d|_d|_td��t
�|jd�|j�|jj|�|j�|jj|j|j�|dk	r�|j�tj|d�dS)NrJFz)Pipe transport is for pipes/sockets only.)rr�_extra�_loop�_piper2�_fileno�	_protocol�_closing�_pausedrfr�rzrx�S_ISFIFOry�S_ISCHRr3�set_blocking�	call_soon�connection_made�_add_reader�_read_readyr�_set_result_unless_cancelled)rrvrJrKrLrM�mode)rrrr�s.





z_UnixReadPipeTransport.__init__cCs�|jjg}|jdkr |�d�n|jr0|�d�|�d|j���t|jdd�}|jdk	r�|dk	r�t�	||jt
j�}|r�|�d�q�|�d�n |jdk	r�|�d�n
|�d�d�d	�
|��S)
N�closed�closingzfd=�	_selector�polling�idle�openz<{}>� )rr�r��appendr�r��getattrr�r	�_test_selector_event�	selectorsZ
EVENT_READ�format�join)rr8rr�rrr�__repr__�s"




z_UnixReadPipeTransport.__repr__c
Cs�yt�|j|j�}WnDttfk
r,Yn�tk
rX}z|�|d�Wdd}~XYn^X|rl|j�	|�nJ|j
��r�t�
d|�d|_|j
�|j�|j
�|jj�|j
�|jd�dS)Nz"Fatal read error on pipe transportz%r was closed by peerT)rf�readr��max_sizer�r�r4�_fatal_errorr�Z
data_receivedr��	get_debugrr8r��_remove_readerr�Zeof_received�_call_connection_lost)rr+r=rrrr��s
z"_UnixReadPipeTransport._read_readycCs>|js|jrdSd|_|j�|j�|j��r:t�d|�dS)NTz%r pauses reading)r�r�r�r�r�r�r�debug)rrrr�
pause_reading�s
z$_UnixReadPipeTransport.pause_readingcCsB|js|jsdSd|_|j�|j|j�|j��r>t�d|�dS)NFz%r resumes reading)	r�r�r�r�r�r�r�rr�)rrrr�resume_reading�s
z%_UnixReadPipeTransport.resume_readingcCs
||_dS)N)r�)rrKrrr�set_protocol�sz#_UnixReadPipeTransport.set_protocolcCs|jS)N)r�)rrrr�get_protocolsz#_UnixReadPipeTransport.get_protocolcCs|jS)N)r�)rrrr�
is_closingsz!_UnixReadPipeTransport.is_closingcCs|js|�d�dS)N)r��_close)rrrrr sz_UnixReadPipeTransport.closecCs.|jdk	r*tjd|��t|d�|j��dS)Nzunclosed transport )r)r�r%r&r'r )rrrr�__del__s
z_UnixReadPipeTransport.__del__�Fatal error on pipe transportcCsZt|t�r4|jtjkr4|j��rLtjd||dd�n|j�||||j	d��|�
|�dS)Nz%r: %sT)�exc_info)�message�	exceptionrprK)rFr4r9ZEIOr�r�rr��call_exception_handlerr�r�)rr=r�rrrr�s
z#_UnixReadPipeTransport._fatal_errorcCs(d|_|j�|j�|j�|j|�dS)NT)r�r�r�r�r�r�)rr=rrrr� sz_UnixReadPipeTransport._closecCs4z|j�|�Wd|j��d|_d|_d|_XdS)N)r��connection_lostr�r r�)rr=rrrr�%s
z,_UnixReadPipeTransport._call_connection_lost)NN)r�)r�r�r�r�rr�r�r�r�r�r�r�r r�r�r�r�r�rr)rrrI�s
rIcs�eZdZd%�fdd�	Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd&dd �Zd'd!d"�Zd#d$�Z�ZS)(rONc
s�t��||�||jd<||_|��|_||_t�|_d|_	d|_
t�|j�j
}t�|�}t�|�}t�|�}	|s�|s�|	s�d|_d|_d|_td��t�|jd�|j�|jj|�|	s�|r�tj�d�s�|j�|jj|j|j�|dk	r�|j�tj|d�dS)NrJrFz?Pipe transport is only for pipes, sockets and character devicesZaix)rrr�r�r2r�r��	bytearray�_buffer�
_conn_lostr�rfr�rzrxr�r�ryr3r�r�r�r�r!�platform�
startswithr�r�rr�)
rrvrJrKrLrMr�Zis_charZis_fifoZ	is_socket)rrrr2s2





z _UnixWritePipeTransport.__init__cCs�|jjg}|jdkr |�d�n|jr0|�d�|�d|j���t|jdd�}|jdk	r�|dk	r�t�	||jt
j�}|r�|�d�n
|�d�|��}|�d|���n |jdk	r�|�d�n
|�d�d	�
d
�|��S)Nr�r�zfd=r�r�r�zbufsize=r�z<{}>r�)rr�r�r�r�r�r�r�r	r�r�ZEVENT_WRITE�get_write_buffer_sizer�r�)rr8rr�r[rrrr�Ws&





z _UnixWritePipeTransport.__repr__cCs
t|j�S)N)�lenr�)rrrrr�osz-_UnixWritePipeTransport.get_write_buffer_sizecCs6|j��rt�d|�|jr*|�t��n|��dS)Nz%r was closed by peer)r�r�rr8r�r��BrokenPipeError)rrrrr�rs

z#_UnixWritePipeTransport._read_readyc
Cst|t�rt|�}|sdS|js&|jrN|jtjkr<t�d�|jd7_dS|j	s�yt
�|j|�}WnVt
tfk
r�d}Yn<tk
r�}z|jd7_|�|d�dSd}~XYnX|t|�kr�dS|dkr�t|�|d�}|j�|j|j�|j	|7_	|��dS)Nz=pipe closed by peer or os.write(pipe, data) raised exception.rrz#Fatal write error on pipe transport)rFr��
memoryviewr�r�rZ!LOG_THRESHOLD_FOR_CONNLOST_WRITESr�warningr�rf�writer�r�r�rVr�r�r�Z_add_writer�_write_readyZ_maybe_pause_protocol)rr+�nr=rrrr�{s2

z_UnixWritePipeTransport.writec
Cs�yt�|j|j�}Wnjttfk
r,Yn�tk
r~}z6|j��|jd7_|j	�
|j�|�|d�Wdd}~XYnfX|t|j�kr�|j��|j	�
|j�|�
�|jr�|j	�|j�|�d�dS|dkr�|jd|�=dS)Nrz#Fatal write error on pipe transportr)rfr�r�r�r�r�rVr(r�r��_remove_writerr�r�Z_maybe_resume_protocolr�r�r�)rr�r=rrrr��s&


z$_UnixWritePipeTransport._write_readycCsdS)NTr)rrrr�
can_write_eof�sz%_UnixWritePipeTransport.can_write_eofcCs8|jr
dSd|_|js4|j�|j�|j�|jd�dS)NT)r�r�r�r�r�r�r�)rrrr�	write_eof�sz!_UnixWritePipeTransport.write_eofcCs
||_dS)N)r�)rrKrrrr��sz$_UnixWritePipeTransport.set_protocolcCs|jS)N)r�)rrrrr��sz$_UnixWritePipeTransport.get_protocolcCs|jS)N)r�)rrrrr��sz"_UnixWritePipeTransport.is_closingcCs|jdk	r|js|��dS)N)r�r�r�)rrrrr �sz_UnixWritePipeTransport.closecCs.|jdk	r*tjd|��t|d�|j��dS)Nzunclosed transport )r)r�r%r&r'r )rrrrr��s
z_UnixWritePipeTransport.__del__cCs|�d�dS)N)r�)rrrr�abort�sz_UnixWritePipeTransport.abort�Fatal error on pipe transportcCsNt|t�r(|j��r@tjd||dd�n|j�||||jd��|�|�dS)Nz%r: %sT)r�)r�r�rprK)	rFr4r�r�rr�r�r�r�)rr=r�rrrr��s

z$_UnixWritePipeTransport._fatal_errorcCsFd|_|jr|j�|j�|j��|j�|j�|j�|j|�dS)NT)	r�r�r�r�r�r(r�r�r�)rr=rrrr��s
z_UnixWritePipeTransport._closecCs4z|j�|�Wd|j��d|_d|_d|_XdS)N)r�r�r�r r�)rr=rrrr��s
z-_UnixWritePipeTransport._call_connection_lost)NN)r�)N)r�r�r�rr�r�r�r�r�r�r�r�r�r�r r�r�r�r�r�r�rr)rrrO/s"%	!	

rOc@seZdZdd�ZdS)rSc		Ks�d}|tjkrt��\}}zPtj|f||||d|d�|��|_|dk	rh|��t|��d|d�|j_	d}Wd|dk	r�|��|��XdS)NF)rWrXrYrZZuniversal_newlinesr[�wb)�	buffering)
�
subprocess�PIPErhZ
socketpair�Popen�_procr r��detachrX)	rr<rWrXrYrZr[r\Zstdin_wrrr�_start�s
z_UnixSubprocessTransport._startN)r�r�r�r�rrrrrS�srSc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)rcGs
t��dS)N)�NotImplementedError)rr`r;r<rrrrT)s	z&AbstractChildWatcher.add_child_handlercCs
t��dS)N)r�)rr`rrr�remove_child_handler4sz)AbstractChildWatcher.remove_child_handlercCs
t��dS)N)r�)rrvrrr�attach_loop<sz AbstractChildWatcher.attach_loopcCs
t��dS)N)r�)rrrrr FszAbstractChildWatcher.closecCs
t��dS)N)r�)rrrr�	__enter__MszAbstractChildWatcher.__enter__cCs
t��dS)N)r�)r�a�b�crrr�__exit__SszAbstractChildWatcher.__exit__N)	r�r�r�rTr�r�r r�r�rrrrrs
rc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�BaseChildWatchercCsd|_i|_dS)N)r��
_callbacks)rrrrrZszBaseChildWatcher.__init__cCs|�d�dS)N)r�)rrrrr ^szBaseChildWatcher.closecCs
t��dS)N)r�)r�expected_pidrrr�_do_waitpidaszBaseChildWatcher._do_waitpidcCs
t��dS)N)r�)rrrr�_do_waitpid_alldsz BaseChildWatcher._do_waitpid_allcCsf|jdk	r$|dkr$|jr$t�dt�|jdk	r<|j�tj�||_|dk	rb|�tj|j	�|�
�dS)NzCA loop is being detached from a child watcher with pending handlers)r�r�r%r&�RuntimeWarningr$r0�SIGCHLDr?�	_sig_chldr�)rrvrrrr�gs
zBaseChildWatcher.attach_loopc
CsFy|��Wn4tk
r@}z|j�d|d��Wdd}~XYnXdS)Nz$Unknown exception in SIGCHLD handler)r�r�)r�rVr�r�)rr=rrrr�{szBaseChildWatcher._sig_chldcCs2t�|�rt�|�St�|�r*t�|�S|SdS)N)rf�WIFSIGNALED�WTERMSIG�	WIFEXITED�WEXITSTATUS)r�statusrrr�_compute_returncode�s



z$BaseChildWatcher._compute_returncodeN)
r�r�r�rr r�r�r�r�rrrrrr�Xsr�csLeZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	�Z
S)rcs|j��t���dS)N)r�r(rr )r)rrrr �s
zSafeChildWatcher.closecCs|S)Nr)rrrrr��szSafeChildWatcher.__enter__cCsdS)Nr)rr�r�r�rrrr��szSafeChildWatcher.__exit__cGs.|jdkrtd��||f|j|<|�|�dS)NzICannot add child handler, the child watcher does not have a loop attached)r�r5r�r�)rr`r;r<rrrrT�s

z"SafeChildWatcher.add_child_handlercCs&y|j|=dStk
r dSXdS)NTF)r�rA)rr`rrrr��s
z%SafeChildWatcher.remove_child_handlercCs"xt|j�D]}|�|�qWdS)N)r#r�r�)rr`rrrr��sz SafeChildWatcher._do_waitpid_allcCs�yt�|tj�\}}Wn(tk
r>|}d}t�d|�Yn0X|dkrLdS|�|�}|j��rnt�	d||�y|j
�|�\}}Wn.tk
r�|j��r�tjd|dd�YnX|||f|��dS)N�z8Unknown child process pid %d, will report returncode 255rz$process %s exited with returncode %sz'Child watcher got an unexpected pid: %rT)r�)
rf�waitpid�WNOHANG�ChildProcessErrorrr�rr�r�r�r��poprA)rr�r`rrar;r<rrrr��s*


zSafeChildWatcher._do_waitpid)r�r�r�r r�r�rTr�r�r�r�rr)rrr�srcsPeZdZ�fdd�Z�fdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	�Z
S)rcs$t���t��|_i|_d|_dS)Nr)rr�	threadingZLock�_lock�_zombies�_forks)r)rrrr�s

zFastChildWatcher.__init__cs"|j��|j��t���dS)N)r�r(r
rr )r)rrrr �s

zFastChildWatcher.closec	Cs$|j�|jd7_|SQRXdS)Nr)r	r)rrrrr��szFastChildWatcher.__enter__c	CsT|j�8|jd8_|js"|js&dSt|j�}|j��WdQRXt�d|�dS)Nrz5Caught subprocesses termination from unknown pids: %s)r	rr
r6r(rr�)rr�r�r�Zcollateral_victimsrrrr��s
zFastChildWatcher.__exit__c	Gsl|jdkrtd��|j�:y|j�|�}Wn"tk
rL||f|j|<dSXWdQRX|||f|��dS)NzICannot add child handler, the child watcher does not have a loop attached)r�r5r	r
rrAr�)rr`r;r<rarrrrT
s
z"FastChildWatcher.add_child_handlercCs&y|j|=dStk
r dSXdS)NTF)r�rA)rr`rrrr� s
z%FastChildWatcher.remove_child_handlerc	Cs�x�yt�dtj�\}}Wntk
r,dSX|dkr:dS|�|�}|j�vy|j�|�\}}WnBtk
r�|j	r�||j
|<|j��r�t
�d||�wd}YnX|j��r�t
�d||�WdQRX|dkr�t
�d||�q|||f|��qWdS)Nr-rz,unknown process %s exited with returncode %sz$process %s exited with returncode %sz8Caught subprocess termination from unknown pid: %d -> %d)rfrrrrr	r�rrArr
r�r�rr�r�)rr`rrar;r<rrrr�'s6





z FastChildWatcher._do_waitpid_all)r�r�r�rr r�r�rTr�r�r�rr)rrr�s
rcsDeZdZeZ�fdd�Zdd�Z�fdd�Zdd�Zd	d
�Z	�Z
S)�_UnixDefaultEventLoopPolicycst���d|_dS)N)rr�_watcher)r)rrrrVs
z$_UnixDefaultEventLoopPolicy.__init__c	CsHtj�8|jdkr:t�|_tt��tj�r:|j�|j	j
�WdQRXdS)N)rr	r
rrFr�current_thread�_MainThreadr��_localr�)rrrr�
_init_watcherZs
z)_UnixDefaultEventLoopPolicy._init_watchercs6t��|�|jdk	r2tt��tj�r2|j�|�dS)N)r�set_event_loopr
rFrrrr�)rrv)rrrrbs
z*_UnixDefaultEventLoopPolicy.set_event_loopcCs|jdkr|��|jS)N)r
r)rrrrrQps
z-_UnixDefaultEventLoopPolicy.get_child_watchercCs|jdk	r|j��||_dS)N)r
r )rr]rrr�set_child_watcherzs

z-_UnixDefaultEventLoopPolicy.set_child_watcher)r�r�r�rZ
_loop_factoryrrrrQrr�rr)rrrRs
r),r9r�rfr�r0rhrxr�r!rr%�rrrrrrr	r
r�logr�__all__r��ImportErrorrZBaseSelectorEventLooprZ
ReadTransportrIZ_FlowControlMixinZWriteTransportrOZBaseSubprocessTransportrSrr�rrZBaseDefaultEventLoopPolicyrr
rrrrr�<module>sP
|
JF=On3