Your IP : 18.116.19.29


Current Path : /opt/alt/python34/lib64/python3.4/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/asyncio/__pycache__/unix_events.cpython-34.pyo

�
j f؆�@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddl
mZddl
m
Z
ddl
mZddl
mZdd	l
mZdd
l
mZddl
mZddl
mZdd
l
mZddlmZddlmZdddddgZejdkreed��ndd�ZGdd�dej�Zeed�r�dd�Znddl Z dd�ZGdd �d ej!�Z"Gd!d"�d"ej#ej$�Z%eed#�rej&Z'nddl Z d$d%�Z'Gd&d'�d'ej(�Z)Gd(d�d�Z*Gd)d*�d*e*�Z+Gd+d�de+�Z,Gd,d�de+�Z-Gd-d.�d.ej.�Z/eZ0e/Z1dS)/z2Selector event loop for Unix with signal handling.�N�)�base_events)�base_subprocess)�compat)�	constants)�
coroutines)�events)�futures)�selector_events)�	selectors)�
transports)�	coroutine)�logger�SelectorEventLoop�AbstractChildWatcher�SafeChildWatcher�FastChildWatcher�DefaultEventLoopPolicy�win32z+Signals are not really supported on WindowscCsdS)zDummy signal handler.N�)�signumZframerr�8/opt/alt/python34/lib64/python3.4/asyncio/unix_events.py�_sighandler_noop%src
seZdZdZd�fdd�Zdd�Z�fdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdddd�Zdddd�Z
eddd��Zdd�Zedddddddd��Zedddd d!ddd"d#��Z�S)$�_UnixSelectorEventLoopzdUnix event loop.

    Adds signal handling and UNIX Domain Socket support to SelectorEventLoop.
    Ncst�j|�i|_dS)N)�super�__init__�_signal_handlers)�selfZselector)�	__class__rrr0sz_UnixSelectorEventLoop.__init__cCs
tj�S)N)�socketZ
socketpair)rrrr�_socketpair4sz"_UnixSelectorEventLoop._socketpaircs8t�j�x$t|j�D]}|j|�qWdS)N)r�close�listr�remove_signal_handler)r�sig)rrrr!7s
z_UnixSelectorEventLoop.closecCs.x'|D]}|sqn|j|�qWdS)N)�_handle_signal)r�datarrrr�_process_self_data<s
z)_UnixSelectorEventLoop._process_self_datac+Gs�tj|�stj|�r-td��n|j|�|j�ytj|jj	��Wn=t
tfk
r�}ztt
|���WYdd}~XnXtj|||�}||j|<y$tj|t�tj|d�Wn�tk
r�}z�|j|=|js^ytjd�Wq^t
tfk
rZ}ztjd|�WYdd}~Xq^Xn|jtjkr�tdj|���n�WYdd}~XnXdS)z�Add a handler for a signal.  UNIX only.

        Raise ValueError if the signal number is invalid or uncatchable.
        Raise RuntimeError if there is a problem setting up the handler.
        z3coroutines cannot be used with add_signal_handler()NFrzset_wakeup_fd(-1) failed: %szsig {} cannot be caught���)rZiscoroutineZiscoroutinefunction�	TypeError�
_check_signalZ
_check_closed�signal�
set_wakeup_fdZ_csock�fileno�
ValueError�OSError�RuntimeError�strrZHandlerr�siginterruptr�info�errno�EINVAL�format)rr$�callback�args�exc�handleZnexcrrr�add_signal_handlerCs0

%

	&z)_UnixSelectorEventLoop.add_signal_handlercCsL|jj|�}|dkr"dS|jr;|j|�n
|j|�dS)z2Internal helper that is the actual signal handler.N)r�getZ
_cancelledr#Z_add_callback_signalsafe)rr$r:rrrr%ps	z%_UnixSelectorEventLoop._handle_signalc&Cs |j|�y|j|=Wntk
r3dSYnX|tjkrOtj}n	tj}ytj||�WnRtk
r�}z2|jtj	kr�t
dj|���n�WYdd}~XnX|jsytjd�Wqt
tfk
r}ztjd|�WYdd}~XqXndS)zwRemove a handler for a signal.  UNIX only.

        Return True if a signal handler was removed, False if not.
        Fzsig {} cannot be caughtNrzset_wakeup_fd(-1) failed: %sTr()r*r�KeyErrorr+�SIGINT�default_int_handler�SIG_DFLr/r4r5r0r6r,r.rr3)rr$Zhandlerr9rrrr#zs(

			&z,_UnixSelectorEventLoop.remove_signal_handlercCsht|t�s'tdj|���nd|koAtjknsdtdj|tj���ndS)z�Internal helper to validate a signal.

        Raise ValueError if the signal number is invalid or uncatchable.
        Raise RuntimeError if there is a problem setting up the handler.
        zsig must be an int, not {!r}rzsig {} out of range(1, {})N)�
isinstance�intr)r6r+�NSIGr.)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)rrErFrGrHrrr�_make_write_pipe_transport�sz1_UnixSelectorEventLoop._make_write_pipe_transportc	ks�tj���}
tjd|�}t||||||||d|d||	�}|
j|j�|j|�y
|DdHWn+tk
r�}
z|
}WYdd}
~
XnXd}|dk	r�|j	�|j
�DdH|�nWdQX|S)N�looprGrH)r�get_child_watcherr	ZFuture�_UnixSubprocessTransport�add_child_handlerZget_pid�_child_watcher_callback�	Exceptionr!Z_wait)rrFr8�shell�stdin�stdout�stderr�bufsizerH�kwargs�watcherrG�transpr9�errrrr�_make_subprocess_transport�s$		


z1_UnixSelectorEventLoop._make_subprocess_transportcCs|j|j|�dS)N)Zcall_soon_threadsafeZ_process_exited)r�pid�
returncoderYrrrrP�sz._UnixSelectorEventLoop._child_watcher_callback�ssl�sock�server_hostnameccs|r$|dkr?td��q?n|dk	r?td��n|dk	r�|dk	rftd��ntjtjtjd�}y&|jd�|j||�DdHWq�|j��Yq�Xn(|dkr�td��n|jd�|j||||�DdH\}}||fS)Nz/you have to pass server_hostname when using sslz+server_hostname is only meaningful with sslz3path and sock can not be specified at the same timerFzno path and sock were specified)r.r�AF_UNIX�SOCK_STREAM�setblockingZsock_connectr!Z_create_connection_transport)r�protocol_factory�pathr^r_r`�	transportrFrrr�create_unix_connection�s.


z-_UnixSelectorEventLoop.create_unix_connection�backlog�dc	Cs�t|t�rtd��n|dk	r�|dk	rEtd��ntjtjtj�}y|j|�Wq8tk
r�}zK|j	�|j
t
jkr�dj|�}tt
j|�d�n�WYdd}~Xq8|j	��Yq8XnE|dkrtd��n|j
tjkr8tdj|���ntj||g�}|j|�|jd�|j||||�|S)Nz*ssl argument must be an SSLContext or Nonez3path and sock can not be specified at the same timezAddress {!r} is already in usez-path was not specified, and no sock specifiedz+A UNIX Domain Socket was expected, got {!r}F)rA�boolr)r.rrarbZbindr/r!r4Z
EADDRINUSEr6ZfamilyrZServerZlistenrcZ_start_serving)	rrdrer_rhr^r9�msgZserverrrr�create_unix_server�s:



z)_UnixSelectorEventLoop.create_unix_server)�__name__�
__module__�__qualname__�__doc__rr r!r'r;r%r#r*rIrKr
r[rPrgrlrr)rrr*s,-
 
 r�set_blockingcCstj|d�dS)NF)�osrq)�fdrrr�_set_nonblockingsrtcCs<tj|tj�}|tjB}tj|tj|�dS)N)�fcntlZF_GETFLrr�
O_NONBLOCKZF_SETFL)rs�flagsrrrrt$s
cs�eZdZdZdd�fdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
ejr�dd�Z
nddd�Zdd�Zdd�Z�S)rD�iNcst�j|�||jd<||_||_|j�|_tj|j�j	}t
j|�p}t
j|�p}t
j
|�s�td��nt|j�||_d|_|jj|jj|�|jj|jj|j|j�|dk	r|jjtj|d�ndS)NrEz)Pipe transport is for pipes/sockets only.F)rr�_extra�_loop�_piper-�_filenorr�fstat�st_mode�stat�S_ISFIFO�S_ISSOCK�S_ISCHRr.rt�	_protocol�_closing�	call_soon�connection_made�
add_reader�_read_readyr	�_set_result_unless_cancelled)rrLrErFrGrH�mode)rrrr.s&
		
		z_UnixReadPipeTransport.__init__cCs�|jjg}|jdkr.|jd�n|jrG|jd�n|jd|j�|jdk	r�tj|jj	|jt
j�}|r�|jd�q�|jd�n
|jd�ddj|�S)N�closed�closingzfd=%s�polling�idlez<%s>� )
rrmr{�appendr�r|r
�_test_selector_eventrz�	_selectorrZ
EVENT_READ�join)rr3r�rrr�__repr__Es		
z_UnixReadPipeTransport.__repr__cCs�ytj|j|j�}WnLttfk
r6Yn�tk
rj}z|j|d�WYdd}~Xn�X|r�|jj	|�nj|j
j�r�tj
d|�nd|_|j
j|j�|j
j|jj�|j
j|jd�dS)Nz"Fatal read error on pipe transportz%r was closed by peerT)rr�readr|�max_size�BlockingIOError�InterruptedErrorr/�_fatal_errorr�Z
data_receivedrz�	get_debugrr3r��
remove_readerr�Zeof_received�_call_connection_lost)rr&r9rrrr�Xs#	z"_UnixReadPipeTransport._read_readycCs|jj|j�dS)N)rzr�r|)rrrr�
pause_readingjsz$_UnixReadPipeTransport.pause_readingcCs|jj|j|j�dS)N)rzr�r|r�)rrrr�resume_readingmsz%_UnixReadPipeTransport.resume_readingcCs|jS)N)r�)rrrr�
is_closingpsz!_UnixReadPipeTransport.is_closingcCs|js|jd�ndS)N)r��_close)rrrrr!ss	z_UnixReadPipeTransport.closecCs7|jdk	r3tjd|t�|jj�ndS)Nzunclosed transport %r)r{�warnings�warn�ResourceWarningr!)rrrr�__del__{sz_UnixReadPipeTransport.__del__zFatal error on pipe transportcCs�t|t�rO|jtjkrO|jj�r~tjd||dd�q~n/|jji|d6|d6|d6|j	d6�|j
|�dS)Nz%r: %s�exc_infoT�message�	exceptionrfrF)rAr/r4ZEIOrzr�r�debug�call_exception_handlerr�r�)rr9r�rrrr��s!z#_UnixReadPipeTransport._fatal_errorcCs6d|_|jj|j�|jj|j|�dS)NT)r�rzr�r|r�r�)rr9rrrr��s	z_UnixReadPipeTransport._closecCsDz|jj|�Wd|jj�d|_d|_d|_XdS)N)r��connection_lostr{r!rz)rr9rrrr��s
		z,_UnixReadPipeTransport._call_connection_losti)rmrnror�rr�r�r�r�r�r!r�PY34r�r�r�r�rr)rrrD*s	rDcs�eZdZdd�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Ze
jr�dd�Zndd�Zddd�Zddd�Zdd �Z�S)!rJNcsCt�j||�||jd<||_|j�|_tj|j�j}t	j
|�}|p}t	j|�p}t	j|�s�t
d��nt|j�||_g|_d|_d|_|jj|jj|�|s�tjjd�r|jj|jj|j|j�n|dk	r?|jjtj|d�ndS)NrEz?Pipe transport is only for pipes, sockets and character devicesrF�aix)rrryr{r-r|rrr}r~rr�r�r�r.rtr��_buffer�
_conn_lostr�rzr�r��sys�platform�
startswithr�r�r	r�)rrLrErFrGrHr�Z	is_socket)rrrr�s,
	
				z _UnixWritePipeTransport.__init__cCs�|jjg}|jdkr.|jd�n|jrG|jd�n|jd|j�|jdk	r�tj|jj	|jt
j�}|r�|jd�n
|jd�|j�}|jd|�n
|jd�ddj
|�S)	Nr�r�zfd=%sr�r�z
bufsize=%sz<%s>r�)rrmr{r�r�r|r
r�rzr�rZEVENT_WRITE�get_write_buffer_sizer�)rr3r�rVrrrr��s"		

z _UnixWritePipeTransport.__repr__cCstdd�|jD��S)Ncss|]}t|�VqdS)N)�len)�.0r&rrr�	<genexpr>�sz@_UnixWritePipeTransport.get_write_buffer_size.<locals>.<genexpr>)�sumr�)rrrrr��sz-_UnixWritePipeTransport.get_write_buffer_sizecCsL|jj�r"tjd|�n|jr>|jt��n
|j�dS)Nz%r was closed by peer)rzr�rr3r�r��BrokenPipeError)rrrrr��s
	z#_UnixWritePipeTransport._read_readycCsht|t�rt|�}n|s(dS|js:|jro|jtjkr\tjd�n|jd7_dS|j	sJyt
j|j|�}Wnet
tfk
r�d}YnHtk
r�}z(|jd7_|j|d�dSWYdd}~XnX|t|�krdS|dkr.||d�}n|jj|j|j�n|j	j|�|j�dS)Nz=pipe closed by peer or os.write(pipe, data) raised exception.rrz#Fatal write error on pipe transport)rA�	bytearray�
memoryviewr�r�rZ!LOG_THRESHOLD_FOR_CONNLOST_WRITESr�warningr�rr�writer|r�r�rQr�r�rzZ
add_writer�_write_readyr�Z_maybe_pause_protocol)rr&�nr9rrrr��s2	
z_UnixWritePipeTransport.writecCsUdj|j�}|jj�ytj|j|�}Wn~ttfk
rb|jj|�Yn�t	k
r�}z7|j
d7_
|jj|j�|j
|d�WYdd}~Xn�X|t|�kr"|jj|j�|j�|jr|jr|jj|j�|jd�ndS|dkrA||d�}n|jj|�dS)N�rz#Fatal write error on pipe transportr)r�r��clearrrr�r|r�r�r�rQr�rz�
remove_writerr�r�Z_maybe_resume_protocolr�r�r�)rr&r�r9rrrr�s(
#
z$_UnixWritePipeTransport._write_readycCsdS)NTr)rrrr�
can_write_eof sz%_UnixWritePipeTransport.can_write_eofcCsO|jr
dSd|_|jsK|jj|j�|jj|jd�ndS)NT)r�r�rzr�r|r�r�)rrrr�	write_eof#s			z!_UnixWritePipeTransport.write_eofcCs|jS)N)r�)rrrrr�,sz"_UnixWritePipeTransport.is_closingcCs*|jdk	r&|jr&|j�ndS)N)r{r�r�)rrrrr!/sz_UnixWritePipeTransport.closecCs7|jdk	r3tjd|t�|jj�ndS)Nzunclosed transport %r)r{r�r�r�r!)rrrrr�8sz_UnixWritePipeTransport.__del__cCs|jd�dS)N)r�)rrrr�abort=sz_UnixWritePipeTransport.abortzFatal error on pipe transportcCs�t|ttf�rC|jj�rrtjd||dd�qrn/|jji|d6|d6|d6|jd6�|j	|�dS)Nz%r: %sr�Tr�r�rfrF)
rAr��ConnectionResetErrorrzr�rr�r�r�r�)rr9r�rrrr�@sz$_UnixWritePipeTransport._fatal_errorcCsbd|_|jr(|jj|j�n|jj�|jj|j�|jj|j|�dS)NT)	r�r�rzr�r|r�r�r�r�)rr9rrrr�Ns		
z_UnixWritePipeTransport._closecCsDz|jj|�Wd|jj�d|_d|_d|_XdS)N)r�r�r{r!rz)rr9rrrr�Vs
		z-_UnixWritePipeTransport._call_connection_lost)rmrnrorr�r�r�r�r�r�r�r�r!rr�r�r�r�r�r�rr)rrrJ�s !	!		rJ�set_inheritablecCsittdd�}tj|tj�}|sJtj|tj||B�ntj|tj||@�dS)NZ
FD_CLOEXECr)�getattrruZF_GETFDZF_SETFD)rsZinheritableZcloexec_flag�oldrrr�_set_inheritablefs
r�c@seZdZdd�ZdS)rNc	Ks�d}|tjkr@|jj�\}}t|j�d�ntj|d|d|d|d|ddd||�|_|dk	r�|j�t	|j
�dd	|�|j_ndS)
NFrRrSrTrUZuniversal_newlinesrV�wb�	buffering)�
subprocess�PIPErzr r�r-�Popen�_procr!�open�detachrS)	rr8rRrSrTrUrVrWZstdin_wrrr�_startrs
z_UnixSubprocessTransport._startN)rmrnror�rrrrrNpsrNc@s^eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)raHAbstract base class for monitoring child processes.

    Objects derived from this class monitor a collection of subprocesses and
    report their termination or interruption by a signal.

    New callbacks are registered with .add_child_handler(). Starting a new
    process must be done within a 'with' block to allow the watcher to suspend
    its activity until the new process if fully registered (this is needed to
    prevent a race condition in some implementations).

    Example:
        with watcher:
            proc = subprocess.Popen("sleep 1")
            watcher.add_child_handler(proc.pid, callback)

    Notes:
        Implementations of this class must be thread-safe.

        Since child watcher objects may catch the SIGCHLD signal and call
        waitpid(-1), there should be only one active object per process.
    cGs
t��dS)aRegister a new child handler.

        Arrange for callback(pid, returncode, *args) to be called when
        process 'pid' terminates. Specifying another callback for the same
        process replaces the previous handler.

        Note: callback() must be thread-safe.
        N)�NotImplementedError)rr\r7r8rrrrO�s	z&AbstractChildWatcher.add_child_handlercCs
t��dS)z�Removes the handler for process 'pid'.

        The function returns True if the handler was successfully removed,
        False if there was nothing to remove.N)r�)rr\rrr�remove_child_handler�sz)AbstractChildWatcher.remove_child_handlercCs
t��dS)z�Attach the watcher to an event loop.

        If the watcher was previously attached to an event loop, then it is
        first detached before attaching to the new loop.

        Note: loop may be None.
        N)r�)rrLrrr�attach_loop�sz AbstractChildWatcher.attach_loopcCs
t��dS)zlClose the watcher.

        This must be called to make sure that any underlying resource is freed.
        N)r�)rrrrr!�szAbstractChildWatcher.closecCs
t��dS)zdEnter the watcher's context and allow starting new processes

        This function must return selfN)r�)rrrr�	__enter__�szAbstractChildWatcher.__enter__cCs
t��dS)zExit the watcher's contextN)r�)r�a�b�crrr�__exit__�szAbstractChildWatcher.__exit__N)
rmrnrorprOr�r�r!r�r�rrrrr�s
c@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�BaseChildWatchercCs
d|_dS)N)rz)rrrrr�szBaseChildWatcher.__init__cCs|jd�dS)N)r�)rrrrr!�szBaseChildWatcher.closecCs
t��dS)N)r�)r�expected_pidrrr�_do_waitpid�szBaseChildWatcher._do_waitpidcCs
t��dS)N)r�)rrrr�_do_waitpid_all�sz BaseChildWatcher._do_waitpid_allcCsa|jdk	r%|jjtj�n||_|dk	r]|jtj|j�|j�ndS)N)rzr#r+�SIGCHLDr;�	_sig_chldr�)rrLrrrr��s	zBaseChildWatcher.attach_loopcCsXy|j�WnCtk
rS}z#|jjidd6|d6�WYdd}~XnXdS)Nz$Unknown exception in SIGCHLD handlerr�r�)r�rQrzr�)rr9rrrr��szBaseChildWatcher._sig_chldcCsAtj|�rtj|�Stj|�r9tj|�S|SdS)N)rr�WIFSIGNALED�WTERMSIG�	WIFEXITED�WEXITSTATUS)r�statusrrr�_compute_returncode�s

z$BaseChildWatcher._compute_returncodeN)
rmrnrorr!r�r�r�r�r�rrrrr��sr�cs�eZdZdZ�fdd�Z�fdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Z�S)rad'Safe' child watcher implementation.

    This implementation avoids disrupting other code spawning processes by
    polling explicitly each process in the SIGCHLD handler instead of calling
    os.waitpid(-1).

    This is a safe solution but it has a significant overhead when handling a
    big number of children (O(n) each time SIGCHLD is raised)
    cst�j�i|_dS)N)rr�
_callbacks)r)rrrrs
zSafeChildWatcher.__init__cs|jj�t�j�dS)N)r�r�rr!)r)rrrr!s
zSafeChildWatcher.closecCs|S)Nr)rrrrr�szSafeChildWatcher.__enter__cCsdS)Nr)rr�r�r�rrrr�szSafeChildWatcher.__exit__cGs$||f|j|<|j|�dS)N)r�r�)rr\r7r8rrrrOsz"SafeChildWatcher.add_child_handlercCs/y|j|=dSWntk
r*dSYnXdS)NTF)r�r=)rr\rrrr�$s


z%SafeChildWatcher.remove_child_handlercCs+x$t|j�D]}|j|�qWdS)N)r"r�r�)rr\rrrr�+sz SafeChildWatcher._do_waitpid_allcCsytj|tj�\}}Wn.tk
rO|}d}tjd|�YnEX|dkr`dS|j|�}|jj�r�tj	d||�ny|j
j|�\}}Wn:tk
r�|jj�r�tjd|dd�nYnX||||�dS)N�z8Unknown child process pid %d, will report returncode 255rz$process %s exited with returncode %sz'Child watcher got an unexpected pid: %rr�T)
rr�waitpid�WNOHANG�ChildProcessErrorrr�r�rzr�r�r��popr=)rr�r\r�r]r7r8rrrr�0s*
	

	zSafeChildWatcher._do_waitpid)rmrnrorprr!r�r�rOr�r�r�rr)rrrs	csveZdZdZ�fdd�Z�fdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
�S)raW'Fast' child watcher implementation.

    This implementation reaps every terminated processes by calling
    os.waitpid(-1) directly, possibly breaking other code spawning processes
    and waiting for their termination.

    There is no noticeable overhead when handling a big number of children
    (O(1) each time a child terminates).
    cs;t�j�i|_tj�|_i|_d|_dS)Nr)rrr��	threadingZLock�_lock�_zombies�_forks)r)rrrr]s

		zFastChildWatcher.__init__cs+|jj�|jj�t�j�dS)N)r�r�r�rr!)r)rrrr!ds

zFastChildWatcher.closec
Cs'|j�|jd7_|SWdQXdS)Nr)r�r�)rrrrr�is
zFastChildWatcher.__enter__c
Csf|j�G|jd8_|js,|jr0dSt|j�}|jj�WdQXtjd|�dS)Nrz5Caught subprocesses termination from unknown pids: %s)r�r�r�r1r�rr�)rr�r�r�Zcollateral_victimsrrrr�os
zFastChildWatcher.__exit__cGsf|j�Gy|jj|�}Wn)tk
rK||f|j|<dSYnXWdQX||||�dS)N)r�r�r�r=r�)rr\r7r8r]rrrrO}s

z"FastChildWatcher.add_child_handlercCs/y|j|=dSWntk
r*dSYnXdS)NTF)r�r=)rr\rrrr��s


z%FastChildWatcher.remove_child_handlercCsAx:ytjdtj�\}}Wntk
r:dSYn X|dkrKdS|j|�}|j��y|jj|�\}}WnYtk
r�|j	r�||j
|<|jj�r�t
jd||�nwnd}Yn&X|jj�rt
jd||�nWdQX|dkr)t
jd||�q||||�qWdS)Nrrz,unknown process %s exited with returncode %sz$process %s exited with returncode %sz8Caught subprocess termination from unknown pid: %d -> %dr()rrr�r�r�r�r�r�r�r=r�r�rzr�rr�r�)rr\r�r]r7r8rrrr��s6
	

	
	
	
z FastChildWatcher._do_waitpid_all)rmrnrorprr!r�r�rOr�r�rr)rrrSs	
csdeZdZdZeZ�fdd�Zdd�Z�fdd�Zdd	�Z	d
d�Z
�S)�_UnixDefaultEventLoopPolicyz:UNIX event loop policy with a watcher for child processes.cst�j�d|_dS)N)rr�_watcher)r)rrrr�s
z$_UnixDefaultEventLoopPolicy.__init__c
Csctj�T|jdkrYt�|_ttj�tj�rY|jj|j	j
�qYnWdQXdS)N)rr�r�rrAr��current_thread�_MainThreadr��_localrz)rrrr�
_init_watcher�s
z)_UnixDefaultEventLoopPolicy._init_watchercsNt�j|�|jdk	rJttj�tj�rJ|jj|�ndS)z�Set the event loop.

        As a side effect, if a child watcher was set before, then calling
        .set_event_loop() from the main thread will call .attach_loop(loop) on
        the child watcher.
        N)r�set_event_loopr�rAr�r�r�r�)rrL)rrrr��sz*_UnixDefaultEventLoopPolicy.set_event_loopcCs#|jdkr|j�n|jS)zzGet the watcher for child processes.

        If not yet set, a SafeChildWatcher object is automatically created.
        N)r�r�)rrrrrM�s
z-_UnixDefaultEventLoopPolicy.get_child_watchercCs,|jdk	r|jj�n||_dS)z$Set the watcher for child processes.N)r�r!)rrXrrr�set_child_watcher�sz-_UnixDefaultEventLoopPolicy.set_child_watcher)rmrnrorprZ
_loop_factoryrr�r�rMr�rr)rrr��s
r�)2rpr4rrr+rrr�r�r�r��rrrrrrr	r
rrr
�logr�__all__r��ImportErrorrZBaseSelectorEventLoopr�hasattrrtruZ
ReadTransportrDZ_FlowControlMixinZWriteTransportrJr�r�ZBaseSubprocessTransportrNrr�rrZBaseDefaultEventLoopPolicyr�rrrrrr�<module>s^�s�
F6Ni2

?>