AlkantarClanX12

Your IP : 3.149.253.73


Current Path : /opt/alt/python312/lib64/python3.12/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/asyncio/__pycache__/unix_events.cpython-312.opt-2.pyc

�

�Q�f�����	ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZddlmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZdZe	j4dk(red��d�Zd�ZGd�dej<�ZGd�dej@�Z!Gd�dejDejF�Z$Gd�dejJ�Z&Gd�d�Z'Gd�de'�Z(Gd�d e'�Z)Gd!�d"e)�Z*Gd#�d$e)�Z+Gd%�d&e'�Z,Gd'�d(e'�Z-d)�Z.Gd*�d+ej^�Z0eZ1e0Z2y),�N�)�base_events)�base_subprocess)�	constants)�
coroutines)�events)�
exceptions)�futures)�selector_events)�tasks)�
transports)�logger)�SelectorEventLoop�AbstractChildWatcher�SafeChildWatcher�FastChildWatcher�PidfdChildWatcher�MultiLoopChildWatcher�ThreadedChildWatcher�DefaultEventLoopPolicy�win32z+Signals are not really supported on Windowsc��	y�N�)�signum�frames  �:/opt/alt/python312/lib64/python3.12/asyncio/unix_events.py�_sighandler_noopr*s����c�P�	tj|�S#t$r|cYSwxYwr)�os�waitstatus_to_exitcode�
ValueError)�statuss rr"r"/s.����(�(��0�0�����
�	�s��%�%c���eZdZ	d�fd�	Z�fd�Zd�Zd�Zd�Zd�Zd�Z			dd	�Z
		dd
�Z	dd�Zd�Z
	ddddddd
�d�Z	dddddddd�d�Zd�Zd�Zd�Zd�Z�xZS)�_UnixSelectorEventLoopNc�2��t�|�|�i|_yr)�super�__init__�_signal_handlers)�self�selector�	__class__s  �rr)z_UnixSelectorEventLoop.__init__?s���
����"� "��rc�0��t�|��tj�s,t	|j
�D]}|j
|��y|j
r;tjd|�d�t|��|j
j�yy)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+�sigr-s  �rr1z_UnixSelectorEventLoop.closeCs����
��
��� � �"��D�1�1�2���*�*�3�/�3��$�$��
�
� 1�$��:H�I�.�%)�	+�
�%�%�+�+�-�
%rc�:�|D]}|s�|j|��yr)�_handle_signal)r+�datars   r�_process_self_dataz)_UnixSelectorEventLoop._process_self_dataQs ���F�������'�	rc�T�	tj|�stj|�rtd��|j	|�|j�	t
j|jj��tj|||d�}||j |<	t
j|t"�t
j$|d�y#ttf$r}tt|���d}~wwxYw#t$r�}|j |=|j sI	t
jd�n2#ttf$r }t'j(d|�Yd}~nd}~wwxYw|j*t*j,k(rtd|�d����d}~wwxYw)Nz3coroutines cannot be used with add_signal_handler()F����set_wakeup_fd(-1) failed: %s�sig � cannot be caught)r�iscoroutine�iscoroutinefunction�	TypeError�
_check_signal�
_check_closed�signal�
set_wakeup_fd�_csock�filenor#�OSError�RuntimeError�strr�Handler*r�siginterruptr�info�errno�EINVAL)r+r:�callback�args�exc�handle�nexcs       r�add_signal_handlerz)_UnixSelectorEventLoop.add_signal_handlerXsv��	�

�"�"�8�,��.�.�x�8��8�9�
9����3������	)�

� � ����!3�!3�!5�6����x��t�T�:��%+����c�"�	�
�M�M�#�/�0�
����U�+���G�$�	)��s�3�x�(�(��	)���	��%�%�c�*��(�(�F��(�(��,��"�G�,�F��K�K� >��E�E��F���y�y�E�L�L�(�"�T�#��.?�#@�A�A���	�sZ�-C�.0D
�D�.D�D�
	F'�F"�-E�F"�E2�E-�(F"�-E2�20F"�"F'c��	|jj|�}|�y|jr|j|�y|j	|�yr)r*�get�
_cancelledr5�_add_callback_signalsafe)r+r:rXs   rr<z%_UnixSelectorEventLoop._handle_signal�sH��@��&�&�*�*�3�/���>������&�&�s�+��)�)�&�1rc��	|j|�	|j|=|tjk(rtj
}ntj}	tj||�|js	tjd�yy#t$rYywxYw#t$r2}|jtjk(rtd|�d����d}~wwxYw#ttf$r }tjd|�Yd}~yd}~wwxYw)NFrBrCr@rAT)rGr*�KeyErrorrI�SIGINT�default_int_handler�SIG_DFLrMrSrTrNrJr#rrR)r+r:�handlerrWs    rr5z,_UnixSelectorEventLoop.remove_signal_handler�s���	�	
���3��	��%�%�c�*��&�-�-���0�0�G��n�n�G�	��M�M�#�w�'��$�$�
A��$�$�R�(���-�	��	���	��y�y�E�L�L�(�"�T�#��.?�#@�A�A���		����(�
A����:�C�@�@���
A�sA�
B�B�9C�	B�B�	C�(-C�C�D�,D�Dc��	t|t�std|����|tj�vrtd|����y)Nzsig must be an int, not zinvalid signal number )�
isinstance�intrFrI�
valid_signalsr#)r+r:s  rrGz$_UnixSelectorEventLoop._check_signal�sO��	�
�#�s�#��6�s�g�>�?�?��f�*�*�,�,��5�c�U�;�<�<�-rc� �t|||||�Sr)�_UnixReadPipeTransport�r+�pipe�protocol�waiter�extras     r�_make_read_pipe_transportz0_UnixSelectorEventLoop._make_read_pipe_transport�s��%�d�D�(�F�E�J�Jrc� �t|||||�Sr)�_UnixWritePipeTransportrks     r�_make_write_pipe_transportz1_UnixSelectorEventLoop._make_write_pipe_transport�s��&�t�T�8�V�U�K�Krc	��lK�tj�5tjdt�t	j
�}
ddd�
5|
j
�std��|j�}t||||||||f||d�|	��}|
j|j�|j|�	|�d{���	ddd�|S#1swY��xYw7�#ttf$r�t$r+|j!�|j#��d{���7�wxYw#1swYSxYw�w)N�ignorezRasyncio.get_child_watcher() is not activated, subprocess support is not installed.)rnro)r6�catch_warnings�simplefilter�DeprecationWarningr�get_child_watcher�	is_activerN�
create_future�_UnixSubprocessTransport�add_child_handler�get_pid�_child_watcher_callback�
SystemExit�KeyboardInterrupt�
BaseExceptionr1�_wait)
r+rmrV�shell�stdin�stdout�stderr�bufsizero�kwargs�watcherrn�transps
             r�_make_subprocess_transportz1_UnixSelectorEventLoop._make_subprocess_transport�s/�����
$�
$�
&��!�!�(�,>�?��.�.�0�G�'���$�$�&�
#�$G�H�H��'�'�)�F�-�d�H�d�E�,1�6�6�7�6�39��6�/5�6�F�
�%�%�f�n�n�&6�$(�$@�$@�&�
J�
����!�0�
�9'�
&��(��� 1�2�
�� �
������l�l�n�$�$��
��'�0�
�se�D4�/C�
D4�A-D'�>C!�C�C!�	
D4�C�D4�C!�!;D$�D�D$�$D'�'D1�,D4c�<�|j|j|�yr)�call_soon_threadsafe�_process_exited)r+�pid�
returncoder�s    rrz._UnixSelectorEventLoop._child_watcher_callback�s���!�!�&�"8�"8�*�Er)�ssl�sock�server_hostname�ssl_handshake_timeout�ssl_shutdown_timeoutc���K�|r
|�2td��|�td��|�td��|�td��|��|�td��tj|�}tjtjtj
d�}	|j
d�|j||��d{���nf|�td��|jtjk7s|jtj
k7rtd	|����|j
d�|j||||||�
��d{���\}}	||	fS7��#|j��xYw7�#�w)Nz/you have to pass server_hostname when using sslz+server_hostname is only meaningful with ssl�1ssl_handshake_timeout is only meaningful with ssl�0ssl_shutdown_timeout is only meaningful with ssl�3path and sock can not be specified at the same timerFzno path and sock were specified�.A UNIX Domain Stream Socket was expected, got )r�r�)r#r!�fspath�socket�AF_UNIX�SOCK_STREAM�setblocking�sock_connectr1�family�type�_create_connection_transport)
r+�protocol_factory�pathr�r�r�r�r��	transportrms
          r�create_unix_connectionz-_UnixSelectorEventLoop.create_unix_connection�s�������&� �E�G�G��*� �!N�O�O�$�0� �G�I�I�#�/� �F�H�H����� �I�K�K��9�9�T�?�D��=�=�����1C�1C�Q�G�D�
�� � ��'��'�'��d�3�3�3��|� �!B�C�C����v�~�~�-��I�I��!3�!3�3� �D�T�H�M�O�O����U�#�$(�$E�$E��"�C��"7�!5�%F�%7�7��	�8��(�"�"�%4��
��
�
����7�s=�BE#�&E�7E	�8E�<BE#�=E!�>E#�	E�E�E#�dT)r��backlogr�r�r��
start_servingc	��K�t|t�rtd��|�
|std��|�
|std��|��|�td��t	j
|�}t
jtjtj�}|ddvrH	tjt	j|�j�rt	j|�	|j#|�nU|�td
��|j*tjk7s|j,tjk7rtd|����|j/d�t1j2||g|||||�}|r-|j5�t7j8d��d{���|S#t$rY��t$r!}	tj d||	�Yd}	~	��d}	~	wwxYw#t$rT}
|j%�|
j&t&j(k(r!d|�d	�}tt&j(|�d��d}
~
w|j%��xYw7���w)
Nz*ssl argument must be an SSLContext or Noner�r�r�r)r�z2Unable to check or remove stale UNIX socket %r: %rzAddress z is already in usez-path was not specified, and no sock specifiedr�F)rf�boolrFr#r!r�r�r�r��stat�S_ISSOCK�st_mode�remove�FileNotFoundErrorrMr�error�bindr1rS�
EADDRINUSEr�r�r�r�Server�_start_servingr�sleep)
r+r�r�r�r�r�r�r�r��errrW�msg�servers
             r�create_unix_serverz)_UnixSelectorEventLoop.create_unix_servers7�����c�4� ��H�I�I� �,�S��C�E�
E� �+�C��B�D�
D����� �I�K�K��9�9�T�?�D��=�=�����1C�1C�D�D��A�w�k�)�6��}�}�R�W�W�T�]�%:�%:�;��	�	�$��

��	�	�$���|� �C�E�E����v�~�~�-��I�I��!3�!3�3� �D�T�H�M�O�O�	
������#�#�D�4�&�2B�$'��2G�$8�:����!�!�#��+�+�a�.� � ��
��S)����6��L�L�"*�+/��6�6��6���
��
�
���9�9�� 0� 0�0�%�T�H�,>�?�C�!�%�"2�"2�C�8�d�B���
��
�
����&
!�si�BI�AF'�"G�3B-I� I�!I�'	G�0I�2G�:G�I�G�I�	I�'AH6�6I�Ic
��K�	tj	|j�}	tj|�j}|r|n|}|sy|j�}	|j|	d|||||d�|	�d{���S#t$rtjd��wxYw#ttjf$r}tjd��d}~wwxYw#t$rtjd��wxYw7�~�w)Nzos.sendfile() is not availableznot a regular filer)
r!�sendfile�AttributeErrorr	�SendfileNotAvailableErrorrL�io�UnsupportedOperation�fstat�st_sizerMr{�_sock_sendfile_native_impl)
r+r��file�offset�countrLr��fsize�	blocksize�futs
          r�_sock_sendfile_nativez,_UnixSelectorEventLoop._sock_sendfile_nativebs����	2��K�K�	M��[�[�]�F�	M��H�H�V�$�,�,�E�#�E��	���� � �"���'�'��T�4��(.��y�!�	E��y���%�	2��6�6�0�2�
2�	2��
�� 7� 7�8�	M��6�6�7K�L�L��	M���	M��6�6�7K�L�L�	M���sV�C<�B�B"�C�6C<�;C:�<C<�B�C<�"C�;C�C�C<�C7�7C<c	
��|j�}	|�|j|�|j�r|j|||�y|r/||z
}|dkr%|j|||�|j	|�y	tj|	|||�}
|
dk(r%|j|||�|j	|�y||
z
}||
z
}|�|j||�|j|	|j||	||||||�
y#ttf$r;|�|j||�|j|	|j||	||||||�
Yyt$r�}|�Q|jtjk(r4t|�t ur#t!dtj�}||_|}|dk(r:t%j&d�}
|j|||�|j)|
�n)|j|||�|j)|�Yd}~yYd}~yd}~wt*t,f$r�t.$r.}|j|||�|j)|�Yd}~yd}~wwxYw)Nrzsocket is not connectedzos.sendfile call failed)rL�
remove_writer�	cancelled�_sock_sendfile_update_filepos�
set_resultr!r��_sock_add_cancellation_callback�
add_writerr��BlockingIOError�InterruptedErrorrMrS�ENOTCONNr��ConnectionError�	__cause__r	r��
set_exceptionr�r�r�)r+r��
registered_fdr�rLr�r�r��
total_sent�fd�sentrW�new_excr�s              rr�z1_UnixSelectorEventLoop._sock_sendfile_native_implysT��
�[�[�]���$�

���}�-��=�=�?��.�.�v�v�z�J����
�*�I��A�~��2�2�6�6�:�N����z�*��1	F��;�;�r�6�6�9�=�D�J�q�y��2�2�6�6�:�N����z�*��$����d�"�
� �(��8�8��d�C�����D�$C�$C�S� "�D�&� &��y�*�F��[ �!1�2�	B��$��4�4�S�$�?��O�O�B�� ?� ?����f�"�E�9�j�
B��	'��)��I�I����/���I�_�4�
*�-�u�~�~�?��$'��!����Q��
!�:�:�-�/���2�2�6�6�:�N��!�!�#�&��2�2�6�6�:�N��!�!�#�&�&�'���-�.�	���	#��.�.�v�v�z�J����c�"�"��	#�s,�:C?�?AI�I�B6H�I�+$I�Ic�Z�|dkDr&tj||tj�yy�Nr)r!�lseek�SEEK_SET)r+rLr�r�s    rr�z4_UnixSelectorEventLoop._sock_sendfile_update_filepos�s"����>��H�H�V�V�R�[�[�1�rc�6�����fd�}|j|�y)Nc�v��|j�r(�j�}|dk7r�j|�yyy)Nr@)r�rLr�)r�r�r+r�s  ��r�cbzB_UnixSelectorEventLoop._sock_add_cancellation_callback.<locals>.cb�s6����}�}���[�[�]����8��&�&�r�*��r)�add_done_callback)r+r�r�r�s` ` rr�z6_UnixSelectorEventLoop._sock_add_cancellation_callback�s���	+�
	���b�!rr�NN)�__name__�
__module__�__qualname__r)r1r>rZr<r5rGrprsr�rr�r�r�r�r�r��
__classcell__�r-s@rr&r&9s�����
#�.�(�+�Z2��@
=�@D�(,�K�AE�)-�L�04��BF�*.�0#��4� �"&�!%�0#�f*.�G��s��"&�!%��G�R�.DF�L2�"rr&c���eZdZdZd�fd�	Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zej fd
�Zdd�Zd�Zd�Z�xZS)rjic�4��t�|�|�||jd<||_||_|j�|_||_d|_d|_	tj|j�j}tj|�sJtj|�s5tj |�s d|_d|_d|_t#d��tj$|jd�|jj'|jj(|�|jj'|j*|j|j,�|�,|jj't.j0|d�yy)NrlFz)Pipe transport is for pipes/sockets only.)r(r)�_extra�_loop�_piperL�_fileno�	_protocol�_closing�_pausedr!r�r�r��S_ISFIFOr��S_ISCHRr#�set_blocking�	call_soon�connection_made�_add_reader�_read_readyr
�_set_result_unless_cancelled)r+�looprlrmrnro�moder-s       �rr)z_UnixReadPipeTransport.__init__�s.���
�����"����F����
���
��{�{�}���!�����
�����x�x����%�-�-���
�
�d�#��
�
�d�#����T�"��D�J��D�L�!�D�N��H�I�I�
������e�,��
�
���T�^�^�;�;�T�B��
�
���T�-�-�!�\�\�4�+;�+;�	=����J�J� � ��!E�!E�!'��
/�rc�^�|j�sy|jj||�yr)�
is_readingr�r�)r+r�rUs   rr�z"_UnixReadPipeTransport._add_reader�s#����� ���
�
���r�8�,rc�:�|jxr
|jSr)r�r��r+s rrz!_UnixReadPipeTransport.is_reading�s���<�<��5��
�
�$5�5rc�t�|jjg}|j�|jd�n|jr|jd�|jd|j
���t
|jdd�}|j�W|�Utj||j
tj�}|r|jd�nA|jd�n/|j�|jd�n|jd�djd	j|��S)
N�closed�closing�fd=�	_selector�polling�idle�open�<{}>� )r-r�r��appendr�r��getattrr�r�_test_selector_event�	selectors�
EVENT_READ�format�join)r+rRr,r
s    r�__repr__z_UnixReadPipeTransport.__repr__�s������'�'�(���:�:���K�K��!�
�]�]��K�K�	�"����c�$�,�,��(�)��4�:�:�{�D�9���:�:�!�h�&:�%�:�:��$�,�,�	�(<�(<�>�G�����I�&����F�#�
�Z�Z�
#��K�K����K�K��!��}�}�S�X�X�d�^�,�,rc�h�	tj|j|j�}|r|jj|�y|jj�rtjd|�d|_
|jj|j�|jj|jj�|jj|jd�y#tt f$rYyt"$r}|j%|d�Yd}~yd}~wwxYw)N�%r was closed by peerTz"Fatal read error on pipe transport)r!�readr��max_sizer��
data_receivedr��	get_debugrrRr��_remove_readerr��eof_received�_call_connection_lostr�r�rM�_fatal_error)r+r=rWs   rr�z"_UnixReadPipeTransport._read_readys���	G��7�7�4�<�<����7�D�����,�,�T�2��:�:�'�'�)��K�K� 7��>� $��
��
�
�)�)�$�,�,�7��
�
�$�$�T�^�^�%@�%@�A��
�
�$�$�T�%?�%?��F�� �!1�2�	���	I����c�#G�H�H��	I�s�*C<�<D1�
D1�D,�,D1c���|j�syd|_|jj|j�|jj�rt
jd|�yy)NTz%r pauses reading)rr�r�rr�rr�debugrs r�
pause_readingz$_UnixReadPipeTransport.pause_readingsP����� ������
�
�!�!�$�,�,�/��:�:���!��L�L�,�d�3�"rc��|js|jsyd|_|jj|j|j
�|jj
�rtjd|�yy)NFz%r resumes reading)	r�r�r�r�r�r�rrr"rs r�resume_readingz%_UnixReadPipeTransport.resume_reading%s[���=�=���������
�
���t�|�|�T�-=�-=�>��:�:���!��L�L�-�t�4�"rc��||_yr�r��r+rms  r�set_protocolz#_UnixReadPipeTransport.set_protocol-�	��!��rc��|jSrr'rs r�get_protocolz#_UnixReadPipeTransport.get_protocol0����~�~�rc��|jSr�r�rs r�
is_closingz!_UnixReadPipeTransport.is_closing3����}�}�rc�@�|js|jd�yyr)r��_closers rr1z_UnixReadPipeTransport.close6s���}�}��K�K���rc�v�|j�-|d|��t|��|jj�yy�Nzunclosed transport r/�r�r8r1�r+�_warns  r�__del__z_UnixReadPipeTransport.__del__:�5���:�:�!��'��x�0�/�$�O��J�J����"rc�<�t|t�rQ|jtjk(r4|jj�rDt
jd||d��n*|jj||||jd��|j|�y�Nz%r: %sT��exc_info)�message�	exceptionr�rm)rfrMrS�EIOr�rrr"�call_exception_handlerr�r3�r+rWr?s   rr z#_UnixReadPipeTransport._fatal_error?sr���s�G�$����e�i�i�)?��z�z�#�#�%����X�t�W�t�D��J�J�-�-�"� �!� �N�N�	/�
�	
���C�rc��d|_|jj|j�|jj	|j
|�y�NT)r�r�rr�r�r�r+rWs  rr3z_UnixReadPipeTransport._closeMs9����
��
�
�!�!�$�,�,�/��
�
���T�7�7��=rc��	|jj|�|jj�d|_d|_d|_y#|jj�d|_d|_d|_wxYwr�r��connection_lostr�r1r�rFs  rrz,_UnixReadPipeTransport._call_connection_lostR�g��	��N�N�*�*�3�/��J�J�����D�J�!�D�N��D�J��
�J�J�����D�J�!�D�N��D�J���A
�
1A>r��zFatal error on pipe transport)r�r�r�rr)r�rrr�r#r%r)r,r0r1r6r7r9r r3rr�r�s@rrjrj�s]����H�/�<-�
6�-�*G�$4�5�"����%�M�M��
�>�
rrjc���eZdZd�fd�	Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zej fd
�Zd�Zdd�Zdd�Zd�Z�xZS)rrc���t�
|�||�||jd<||_|j	�|_||_t�|_d|_	d|_
tj|j
�j}tj|�}tj |�}tj"|�}	|s$|s"|	s d|_d|_d|_t%d��tj&|j
d�|j(j+|jj,|�|	s!|rdt.j0j3d�sE|j(j+|j(j4|j
|j6�|�,|j(j+t8j:|d�yy)NrlrFz?Pipe transport is only for pipes, sockets and character devices�aix)r(r)r�r�rLr�r��	bytearray�_buffer�
_conn_lostr�r!r�r�r�r�r�r�r#r�r�r�r�r2�platform�
startswithr�r�r
r�)r+r�rlrmrnror�is_char�is_fifo�	is_socketr-s          �rr)z _UnixWritePipeTransport.__init___si���
�����%�"����F����
��{�{�}���!��� �{��������
��x�x����%�-�-���,�,�t�$���-�-��%���M�M�$�'�	��7�i��D�J��D�L�!�D�N��D�E�
E�	������e�,��
�
���T�^�^�;�;�T�B�
�����)@�)@��)G��J�J� � ����!7�!7�!%���t�/?�/?�
A����J�J� � ��!E�!E�!'��
/�rc��|jjg}|j�|jd�n|jr|jd�|jd|j
���t
|jdd�}|j�{|�ytj||j
tj�}|r|jd�n|jd�|j�}|jd|���n/|j�|jd�n|jd�d	jd
j|��S)Nrrrr	r
rzbufsize=rr
r)r-r�r�rr�r�rr�rrr�EVENT_WRITE�get_write_buffer_sizerr)r+rRr,r
r�s     rrz _UnixWritePipeTransport.__repr__�s�����'�'�(���:�:���K�K��!�
�]�]��K�K�	�"����c�$�,�,��(�)��4�:�:�{�D�9���:�:�!�h�&:�%�:�:��$�,�,�	�(=�(=�?�G�����I�&����F�#��0�0�2�G��K�K�(�7�)�,�-�
�Z�Z�
#��K�K����K�K��!��}�}�S�X�X�d�^�,�,rc�,�t|j�Sr)�lenrQrs rrZz-_UnixWritePipeTransport.get_write_buffer_size�s���4�<�<� � rc���|jj�rtjd|�|jr|jt
��y|j�y)Nr)r�rrrRrQr3�BrokenPipeErrorrs rr�z#_UnixWritePipeTransport._read_ready�s@���:�:���!��K�K�/��6��<�<��K�K��)�*��K�K�Mrc��t|t�rt|�}|sy|js|jrH|jt
jk\rtjd�|xjdz
c_y|jss	tj|j|�}|t'|�k(ry|dkDrt|�|d}|j(j+|j|j,�|xj|z
c_	|j/�y#ttf$rd}Y��tt f$r�t"$r1}|xjdz
c_|j%|d�Yd}~yd}~wwxYw)Nz=pipe closed by peer or os.write(pipe, data) raised exception.rr�#Fatal write error on pipe transport)rfrP�
memoryviewrRr�r�!LOG_THRESHOLD_FOR_CONNLOST_WRITESr�warningrQr!�writer�r�r�r�r�r�r r\r��_add_writer�_write_ready�_maybe_pause_protocol)r+r=�nrWs    rrdz_UnixWritePipeTransport.write�s7���d�I�&��d�#�D����?�?�d�m�m����)�"M�"M�M���� H�I��O�O�q� �O���|�|�	
��H�H�T�\�\�4�0���C��I�~���Q��!�$�'���+���J�J�"�"�4�<�<��1B�1B�C��������"�"�$��$�%5�6�
���� 1�2�
�� �
����1�$���!�!�#�'L�M���
�s� D$�$E?�7E?�'E:�:E?c��	tj|j|j�}|t	|j�k(r�|jj�|jj|j�|j�|jr6|jj|j�|jd�y|dkDr|jd|�=yy#ttf$rYyttf$r�t $rp}|jj�|xj"dz
c_|jj|j�|j%|d�Yd}~yd}~wwxYw)Nrrr`)r!rdr�rQr\r9r��_remove_writer�_maybe_resume_protocolr�rrr�r�r�r�r�rRr )r+rhrWs   rrfz$_UnixWritePipeTransport._write_ready�s.��	%�������t�|�|�4�A��C����%�%����"�"�$��
�
�)�)�$�,�,�7��+�+�-��=�=��J�J�-�-�d�l�l�;��.�.�t�4���Q���L�L��!��$���) �!1�2�	���-�.�	���	J��L�L��� ��O�O�q� �O�
�J�J�%�%�d�l�l�3����c�#H�I�I��
	J�s�*C,�,F�=F�A&E?�?Fc��yrErrs r�
can_write_eofz%_UnixWritePipeTransport.can_write_eof����rc���|jryd|_|jsL|jj|j�|jj|jd�yyrE)r�rQr�rr�r�rrs r�	write_eofz!_UnixWritePipeTransport.write_eof�sO���=�=����
��|�|��J�J�%�%�d�l�l�3��J�J� � ��!;�!;�T�B�rc��||_yrr'r(s  rr)z$_UnixWritePipeTransport.set_protocol�r*rc��|jSrr'rs rr,z$_UnixWritePipeTransport.get_protocol�r-rc��|jSrr/rs rr0z"_UnixWritePipeTransport.is_closing�r1rc�X�|j�|js|j�yyyr)r�r�rprs rr1z_UnixWritePipeTransport.close�s$���:�:�!�$�-�-��N�N��+8�!rc�v�|j�-|d|��t|��|jj�yyr5r6r7s  rr9z_UnixWritePipeTransport.__del__r:rc�&�|jd�yr)r3rs r�abortz_UnixWritePipeTransport.aborts�����D�rc��t|t�r4|jj�rDt	j
d||d��n*|jj
||||jd��|j|�yr<)	rfrMr�rrr"rBr�r3rCs   rr z$_UnixWritePipeTransport._fatal_error	sc���c�7�#��z�z�#�#�%����X�t�W�t�D��J�J�-�-�"� �!� �N�N�	/�
�	
���C�rc�>�d|_|jr%|jj|j�|jj�|jj
|j�|jj|j|�yrE)	r�rQr�rjr�r9rr�rrFs  rr3z_UnixWritePipeTransport._closesf����
��<�<��J�J�%�%�d�l�l�3��������
�
�!�!�$�,�,�/��
�
���T�7�7��=rc��	|jj|�|jj�d|_d|_d|_y#|jj�d|_d|_d|_wxYwrrHrFs  rrz-_UnixWritePipeTransport._call_connection_lostrJrKr�rLr)r�r�r�r)rrZr�rdrfrmrpr)r,r0r1r6r7r9rwr r3rr�r�s@rrrrr\sd���#/�J-�0!��!%�F%�8�C�"����
%�M�M��
��>�rrrc��eZdZd�Zy)r|c
���d}|tjk(r6tjj	d�rtj�\}}	tj|f||||d|d�|��|_|�=|j�t|j�d|��|j_d}|�!|j�|j�yy#|�!|j�|j�wwxYw)NrOF)r�r�r�r��universal_newlinesr��wb)�	buffering)
�
subprocess�PIPEr2rSrTr��
socketpair�Popen�_procr1r�detachr�)	r+rVr�r�r�r�r�r��stdin_ws	         r�_startz_UnixSubprocessTransport._start+s������J�O�O�#����(?�(?��(F�
$�.�.�0�N�E�7�	 �#�)�)��E�!��v�f�#(�'�E�=C�E�D�J��"����
�#'����(8�$�'�#R��
�
� ����"����
��
�
��#��w�"����
��
�
��#�s
�
A!C�%C7N)r�r�r�r�rrrr|r|)s�� rr|c�@�eZdZ	d
d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
y)rNc�\�|jtk7rtjddd��yy)Nr�P{name!r} is deprecated as of Python 3.12 and will be removed in Python {remove}.����r�)r�r�r6�_deprecated)�clss r�__init_subclass__z&AbstractChildWatcher.__init_subclass__Xs,���>�>�X�%�� � �!7�;�%,�
.�&rc��	t��r��NotImplementedError�r+r�rUrVs    rr}z&AbstractChildWatcher.add_child_handler_s��	�"�#�#rc��	t��rr��r+r�s  r�remove_child_handlerz)AbstractChildWatcher.remove_child_handlerjs��	1�
"�#�#rc��	t��rr��r+r�s  r�attach_loopz AbstractChildWatcher.attach_looprs��	�"�#�#rc��	t��rr�rs rr1zAbstractChildWatcher.close|s��	�"�#�#rc��	t��rr�rs rrzzAbstractChildWatcher.is_active�s��	�"�#�#rc��	t��rr�rs r�	__enter__zAbstractChildWatcher.__enter__�s��	*�"�#�#rc��	t��rr��r+�a�b�cs    r�__exit__zAbstractChildWatcher.__exit__�s��(�!�#�#r)�returnN)r�r�r�r�r}r�r�r1rzr�r�rrrrrAs/���,.�	$�$�$�$�$�$�$rrc�>�eZdZ	d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
rc��|Srrrs rr�zPidfdChildWatcher.__enter__�����rc��yrr)r+�exc_type�	exc_value�
exc_tracebacks    rr�zPidfdChildWatcher.__exit__����rc��yrErrs rrzzPidfdChildWatcher.is_active�rnrc��yrrrs rr1zPidfdChildWatcher.close�r�rc��yrrr�s  rr�zPidfdChildWatcher.attach_loop�r�rc��tj�}tj|�}|j	||j
||||�yr)r�get_running_loopr!�
pidfd_openr��_do_wait)r+r�rUrVr��pidfds      rr}z#PidfdChildWatcher.add_child_handler�s:���&�&�(���
�
�c�"�������
�
�s�E�8�T�Jrc�$�tj�}|j|�	tj|d�\}}t|�}tj|�|||g|���y#t$rd}tjd|�Y�CwxYw)Nr�zJchild process pid %d exit status already read:  will report returncode 255)
rr�rr!�waitpidr"�ChildProcessErrorrrcr1)	r+r�r�rUrVr��_r$r�s	         rr�zPidfdChildWatcher._do_wait�s����&�&�(�����E�"�	8��
�
�3��*�I�A�v�0��7�J�
�������j�(�4�(��!�	��J��N�N�.��
�		�s�A+�+!B�Bc��yrErr�s  rr�z&PidfdChildWatcher.remove_child_handler����rN)r�r�r�r�r�rzr1r�r}r�r�rrrrr�s0��	��
��
�
�K�
)�&rrc�6�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	y)	�BaseChildWatcherc� �d|_i|_yr)r��
_callbacksrs rr)zBaseChildWatcher.__init__�s����
���rc�&�|jd�yr)r�rs rr1zBaseChildWatcher.close�s������rc�V�|jduxr|jj�Sr)r��
is_runningrs rrzzBaseChildWatcher.is_active�s#���z�z��%�A�$�*�*�*?�*?�*A�Arc��t��rr�)r+�expected_pids  r�_do_waitpidzBaseChildWatcher._do_waitpid����!�#�#rc��t��rr�rs r�_do_waitpid_allz BaseChildWatcher._do_waitpid_all�r�rc�^�|j�(|�&|jrtjdt�|j�)|jjtj�||_|�;|jtj|j�|j�yy)NzCA loop is being detached from a child watcher with pending handlers)r�r�r6r7�RuntimeWarningr5rI�SIGCHLDrZ�	_sig_chldr�r�s  rr�zBaseChildWatcher.attach_loop�s����:�:�!�d�l�t����M�M�=��
 �
�:�:�!��J�J�,�,�V�^�^�<���
����#�#�F�N�N�D�N�N�C�
� � �"�rc��	|j�y#ttf$r�t$r(}|jjd|d��Yd}~yd}~wwxYw)N�$Unknown exception in SIGCHLD handler)r?r@)r�r�r�r�r�rBrFs  rr�zBaseChildWatcher._sig_chld�sX��	�� � �"���-�.�	���	�
�J�J�-�-�A� �/�
�
��		�s��A�A�AN)
r�r�r�r)r1rzr�r�r�r�rrrr�r��s&����B�$�$�#�(rr�c�N��eZdZ	�fd�Z�fd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
�xZS)	rc�R��t�|��tjddd��y)Nrr�r�r�)r(r)r6r��r+r-s �rr)zSafeChildWatcher.__init__s'���
�������/�;�%,�	.rc�V��|jj�t�|�
�yr)r�r9r(r1r�s �rr1zSafeChildWatcher.closes���������
��
�rc��|Srrrs rr�zSafeChildWatcher.__enter__r�rc��yrrr�s    rr�zSafeChildWatcher.__exit__r�rc�H�||f|j|<|j|�yr)r�r�r�s    rr}z"SafeChildWatcher.add_child_handler"s%�� (�$�/������	
����rc�>�	|j|=y#t$rYywxYw�NTF�r�r`r�s  rr�z%SafeChildWatcher.remove_child_handler(�(��	�����$����	��	���
�	�c�Z�t|j�D]}|j|��yr�r4r�r�r�s  rr�z SafeChildWatcher._do_waitpid_all/s#������(�C����S�!�)rc��	tj|tj�\}}|dk(ryt|�}|jj�rt
jd||�		|jj|�\}}|||g|���y#t$r|}d}t
jd|�Y�OwxYw#t$r7|jj�rt
jd|d��YyYywxYw)Nr�$process %s exited with returncode %sr��8Unknown child process pid %d, will report returncode 255�'Child watcher got an unexpected pid: %rTr=)
r!r��WNOHANGr"r�rrr"r�rcr��popr`)r+r�r�r$r�rUrVs       rr�zSafeChildWatcher._do_waitpid4s���	7��*�*�\�2�:�:�>�K�C���a�x��/��7�J��z�z�#�#�%����C�)�:�7�		-�!�_�_�0�0��5�N�H�d�
�S�*�,�t�,��7!�	��C��J��N�N�J��
�	��(�	3��z�z�#�#�%����H�"�T�3�&�	3�s#�'B�-B?�#B<�;B<�?;C?�>C?)r�r�r�r)r1r�r�r}r�r�r�r�r�s@rrrs0����.���
���"�
 -rrc�H��eZdZ	�fd�Z�fd�Zd�Zd�Zd�Zd�Zd�Z	�xZ
S)rc���t�|��tj�|_i|_d|_tjddd��y)Nrrr�r�r�)	r(r)�	threading�Lock�_lock�_zombies�_forksr6r�r�s �rr)zFastChildWatcher.__init__asC���
�����^�^�%��
���
�������/�;�%,�	.rc���|jj�|jj�t�|��yr)r�r9r�r(r1r�s �rr1zFastChildWatcher.closeks,����������
�
����
��
�rc�t�|j5|xjdz
c_|cddd�S#1swYyxYw)Nr)r�r�rs rr�zFastChildWatcher.__enter__ps)��
�Z�Z��K�K�1��K��	�	�Z�Z�s�.�7c�>�|j5|xjdzc_|js|js
	ddd�yt|j�}|jj	�ddd�tjd�y#1swY� xYw)Nrz5Caught subprocesses termination from unknown pids: %s)r�r�r�rOr9rrc)r+r�r�r��collateral_victimss     rr�zFastChildWatcher.__exit__vss��
�Z�Z��K�K�1��K��{�{�$�-�-��		"�	"�"%�T�]�]�!3���M�M���!��	���C��	 ��Z�s�/B�/B�Bc���|j5	|jj|�}	ddd�||g|���y#t$r||f|j|<Yddd�ywxYw#1swY�<xYwr)r�r�r�r`r�)r+r�rUrVr�s     rr}z"FastChildWatcher.add_child_handler�sr���Z�Z�
�!�]�]�.�.�s�3�
��	��j�(�4�(��
�
�'/��~�����$��
	�	�
���Z�s&�A&�>�A#�A&�"A#�#A&�&A/c�>�	|j|=y#t$rYywxYwr�r�r�s  rr�z%FastChildWatcher.remove_child_handler�r�r�c��		tjdtj�\}}|dk(ryt|�}|j
5	|jj|�\}}|jj�rtjd||�	ddd��tjd||�n
|||g�����#t$rYywxYw#t$r\|jrK||j|<|jj�rtjd||�Yddd���4d}Y��wxYw#1swY��xYw)Nr@rr�z,unknown process %s exited with returncode %sz8Caught subprocess termination from unknown pid: %d -> %d)r!r�r�r"r�r�r�r�r�rrr"r`r�r�rc)r+r�r$r�rUrVs      rr�z FastChildWatcher._do_waitpid_all�s;���

<� �j�j��R�Z�Z�8���V�
�!�8��3�F�;�
����6�%)�_�_�%8�%8��%=�N�H�d��z�z�+�+�-����%K�%(�*�6�!�&������ #�Z�1���j�0�4�0�K��%�
��
�� �
$��{�{�-7��
�
�c�*��:�:�/�/�1�"�L�L�*>�),�j�:�!�
6�
6� $�H�
$����sN�'C�D=�	C�'2D=�	C�C�AD:�*D=�5D:�7D=�9D:�:D=�=E)r�r�r�r)r1r�r�r}r�r�r�r�s@rrrWs+����.��
� �)��(1rrc�P�eZdZ	d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)
rc�P�i|_d|_tjddd��y)Nrr�r�r�)r��_saved_sighandlerr6r�rs rr)zMultiLoopChildWatcher.__init__�s*�����!%������4�;�%,�	.rc��|jduSr)r�rs rrzzMultiLoopChildWatcher.is_active�s���%�%�T�1�1rc�Z�|jj�|j�ytjtj
�}||jk7rtjd�d|_ytjtj
|j�d|_y)Nz+SIGCHLD handler was changed by outside code)	r�r9r�rI�	getsignalr�r�rrc)r+rds  rr1zMultiLoopChildWatcher.close�sz���������!�!�)���"�"�6�>�>�2���d�n�n�$��N�N�H�I�"&���
�M�M�&�.�.�$�*@�*@�A�!%��rc��|Srrrs rr�zMultiLoopChildWatcher.__enter__�r�rc��yrr�r+r��exc_val�exc_tbs    rr�zMultiLoopChildWatcher.__exit__�r�rc�r�tj�}|||f|j|<|j|�yr)rr�r�r�)r+r�rUrVr�s     rr}z'MultiLoopChildWatcher.add_child_handler�s5���&�&�(�� $�h��5������	
����rc�>�	|j|=y#t$rYywxYwr�r�r�s  rr�z*MultiLoopChildWatcher.remove_child_handler�r�r�c�8�|j�ytjtj|j�|_|j�*t	j
d�tj|_tjtjd�y)NzaPrevious SIGCHLD handler was set by non-Python code, restore to default handler on watcher close.F)r�rIr�r�rrcrcrQr�s  rr�z!MultiLoopChildWatcher.attach_loopso��
�!�!�-��!'���v�~�~�t�~�~�!N����!�!�)��N�N�J�
K�%+�^�^�D�"�	���F�N�N�E�2rc�Z�t|j�D]}|j|��yrr�r�s  rr�z%MultiLoopChildWatcher._do_waitpid_alls#������(�C����S�!�)rc�*�	tj|tj�\}}|dk(ryt|�}d}	|jj|�\}}}|j�rtjd||�y|r'|j�rtjd||�|j|||g|���y#t$r|}d}tjd|�d}Y��wxYw#t$rtjd|d�	�YywxYw)
NrTr�r�F�%Loop %r that handles pid %r is closedr�r�r=)r!r�r�r"r�rrcr�r��	is_closedrr"r�r`)	r+r�r�r$r��	debug_logr�rUrVs	         rr�z!MultiLoopChildWatcher._do_waitpids
��	��*�*�\�2�:�:�>�K�C���a�x��/��7�J��I�	L�#'�?�?�#6�#6�s�#;� �D�(�D��~�~�����F��c�R�����!1��L�L�!G�!-�z�;�)��)�)�(�C��K�d�K��=!�	��C��J��N�N�J��
��I�	��$�	/�
�N�N�D���
/�	/�s"�'C�C.�%C+�*C+�.!D�Dc��	|j�y#ttf$r�t$rt	j
dd��YywxYw)Nr�Tr=)r�r�r�r�rrc)r+rrs   rr�zMultiLoopChildWatcher._sig_chld<sE��	R�� � �"���-�.�	���	R��N�N�A�D�Q�	R�s��/A�AN)r�r�r�r)rzr1r�r�r}r�r�r�r�r�rrrrr�sA��	�$.�2�
&��
���3�""�#L�JRrrc�b�eZdZ	d�Zd�Zd�Zd�Zd�Zejfd�Z
d�Zd�Zd	�Z
d
�Zy)rc�F�tjd�|_i|_yr�)�	itertoolsr��_pid_counter�_threadsrs rr)zThreadedChildWatcher.__init__Rs��%�O�O�A�.�����
rc��yrErrs rrzzThreadedChildWatcher.is_activeVrnrc��yrrrs rr1zThreadedChildWatcher.closeYr�rc��|Srrrs rr�zThreadedChildWatcher.__enter__\r�rc��yrrr�s    rr�zThreadedChildWatcher.__exit___r�rc���t|jj��D�cgc]}|j�r|��}}|r||j�d�t
|��yycc}w)Nz0 has registered but not finished child processesr/)r4r�values�is_aliver-r8)r+r8�thread�threadss    rr9zThreadedChildWatcher.__del__bse��(,�T�]�]�-A�-A�-C�(D�)�(D�f��o�o�'��(D��)���T�^�^�$�$T�U�!��
���)s�A!c���tj�}tj|jdt|j���||||fd��}||j|<|j�y)Nzasyncio-waitpid-T)�target�namerV�daemon)	rr�r��Threadr��nextr
r�start)r+r�rUrVr�rs      rr}z&ThreadedChildWatcher.add_child_handlerjsf���&�&�(���!�!��)9�)9�)9�$�t�?P�?P�:Q�9R�'S�(,�c�8�T�'B�)-�/��$��
�
�c�����rc��yrErr�s  rr�z)ThreadedChildWatcher.remove_child_handlersr�rc��yrrr�s  rr�z ThreadedChildWatcher.attach_loopyr�rc��	tj|d�\}}t|�}|j�rt	j
d||�	|j�rt	jd||�n|j|||g|���|jj|�y#t$r|}d}t	jd|�Y�~wxYw)Nrr�r�r�r)r!r�r"rrr"r�rcrr�rr�)r+r�r�rUrVr�r$r�s        rr�z ThreadedChildWatcher._do_waitpid|s���	7��*�*�\�1�5�K�C��0��7�J��~�~�����C�)�:�7��>�>���N�N�B�D�#�N�%�D�%�%�h��Z�G�$�G��
�
���,�'��'!�	��C��J��N�N�J��
�	�s�B'�'#C
�C
N)r�r�r�r)rzr1r�r�r6r7r9r}r�r�r�rrrrrEsB��
���
��
�%�M�M����
�(rrc��ttd�sy	tj�}tjtj|d��y#t
$rYywxYw)Nr�FrT)�hasattrr!�getpidr1r�rM)r�s r�
can_use_pidfdr"�sO���2�|�$����i�i�k��
������s�A�&�'�������s�=A�	A�Ac�@��eZdZ	eZ�fd�Zd�Z�fd�Zd�Zd�Z	�xZ
S)�_UnixDefaultEventLoopPolicyc�0��t�|��d|_yr)r(r)�_watcherr�s �rr)z$_UnixDefaultEventLoopPolicy.__init__�s���
������
rc��tj5|j�)t�rt	�|_nt�|_ddd�y#1swYyxYwr)rr�r&r"rrrs r�
_init_watcherz)_UnixDefaultEventLoopPolicy._init_watcher�s6��
�\�\��}�}�$� �?�$5�$7�D�M�$8�$:�D�M��\�\�s�6A�Ac����	t�|�|�|j�Etj�tj
�ur|jj
|�yyyr)r(�set_event_loopr&r��current_thread�main_threadr�)r+r�r-s  �rr*z*_UnixDefaultEventLoopPolicy.set_event_loop�sX���	�	���t�$��M�M�%��(�(�*�i�.C�.C�.E�E��M�M�%�%�d�+�F�
&rc��	|j�|j�tjddd��|jS)Nryr�r�r�)r&r(r6r�rs rryz-_UnixDefaultEventLoopPolicy.get_child_watcher�sE��	��=�=� ���� ����0�:�BI�	K��}�}�rc��	|j�|jj�||_tjddd��y)N�set_child_watcherr�r�r�)r&r1r6r�)r+r�s  rr/z-_UnixDefaultEventLoopPolicy.set_child_watcher�sB��2��=�=�$��M�M���!���
����0�:�BI�	Kr)r�r�r�r&�
_loop_factoryr)r(r*ryr/r�r�s@rr$r$�s%���D�*�M��;�,��Krr$)3rSr�r	r!rrIr�r�r�r2r�r6�rrrrrr	r
rrr
�logr�__all__rS�ImportErrorrr"�BaseSelectorEventLoopr&�
ReadTransportrj�_FlowControlMixin�WriteTransportrr�BaseSubprocessTransportr|rrr�rrrrr"�BaseDefaultEventLoopPolicyr$rrrrr�<module>r;se��8��	��	��
�
���
�����������������<�<�7��
�C�
D�D�	�
�P"�_�B�B�P"�fM�Z�5�5�M�`J�j�:�:�(�7�7�J�Z ��F�F� �0S$�S$�l7�,�7�t2�+�2�jN-�'�N-�bj1�'�j1�Z~R�0�~R�BO(�/�O(�b	�6K�&�"C�"C�6K�r+��4�r