Your IP : 3.141.198.75


Current Path : /opt/alt/python310/lib64/python3.10/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/multiprocessing/__pycache__/reduction.cpython-310.opt-2.pyc

o

6��f(%�@sddlmZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
gd�Zejdkp@e
ed�o@e
ed�o@e
ejd	�ZGd
d�dej�ZejZd8dd
�Zejdkr~egd�7ZddlZd9dd�dd�Zdd�Zdd�Zdd�ZGdd�de�Zn#egd�7ZddlZejdkZdd�Zdd �Zd!d�Zd"d�Zd#d$�Zd%d&�ZGd'd(�d(�Z ee!e �j"�e�d)d*�Z#ee!e$j%�e#�ee!e&j'�e#�d+d,�Z(d-d.�Z)eej*e(�ejdkr�d/d0�Z+d1d2�Z,eeje+�nd3d0�Z+d4d2�Z,eeje+�Gd5d6�d6ed7�Z-dS):�)�ABCMetaN�)�context)�send_handle�recv_handle�ForkingPickler�register�dump�win32ZCMSG_LEN�
SCM_RIGHTS�sendmsgcsHeZdZ	iZejZ�fdd�Zedd��Z	eddd��Z
ejZ�Z
S)	rcs*t�j|�|j��|_|j�|j�dS�N)�super�__init__�_copyreg_dispatch_table�copy�dispatch_table�update�_extra_reducers��self�args��	__class__��@/opt/alt/python310/lib64/python3.10/multiprocessing/reduction.pyr&szForkingPickler.__init__cCs	||j|<dSr
)r)�cls�type�reducerrrr+szForkingPickler.registerNcCs t��}|||��|�|��Sr
)�io�BytesIOr	�	getbuffer)r�obj�protocolZbufrrr�dumps0szForkingPickler.dumpsr
)�__name__�
__module__�__qualname__r�copyregrrr�classmethodrr$�pickle�loads�
__classcell__rrrrr!s
rcCs	t||��|�dSr
)rr	)r"�filer#rrrr	:sr	)�	DupHandle�	duplicate�steal_handleF)�source_processcCs8	t��}|dur|}|dur|}t�|||d|tj�S)Nr)�_winapi�GetCurrentProcess�DuplicateHandle�DUPLICATE_SAME_ACCESS)�handleZtarget_processZinheritabler1Zcurrent_processrrrr/Gs�r/c	CsL	t�tjd|�}zt�||t��ddtjtjB�Wt�|�St�|�w�NFr)r2�OpenProcess�PROCESS_DUP_HANDLEr4r3r5�DUPLICATE_CLOSE_SOURCE�CloseHandle)Z
source_pidr6Zsource_process_handlerrrr0Ss�

�r0cCs	t|tj|�}|�|�dSr
)r.r2r5�send)�connr6�destination_pidZdhrrrr_srcCs	|����Sr
)�recv�detach)r=rrrrdsrc@s eZdZ	ddd�Zdd�ZdS)r.Nc	Csf|durt��}t�tjd|�}zt�t��|||dd�|_Wt�|�nt�|�w||_	||_
dSr7)�os�getpidr2r8r9r4r3�_handler;�_access�_pid)rr6�access�pid�procrrrrjs
�
zDupHandle.__init__c	Cs`	|jt��kr|jSt�tjd|j�}zt�||jt��|j	dtj
�Wt�|�St�|�w�NF)rErArBrCr2r8r9r4r3rDr:r;)rrHrrrr@ys
�
�zDupHandle.detachr
)r%r&r'rr@rrrrr.hs
r.)�DupFd�sendfds�recvfds�darwincCs\	t�d|�}tt|�dg�}|�|gtjtj|fg�tr*|�d�dkr,t	d��dSdS)N�i�r�Az%did not receive acknowledgement of fd)
�array�bytes�lenr�socket�
SOL_SOCKETr�ACKNOWLEDGEr?�RuntimeError)�sockZfds�msgrrrrK�s�rKc	Cs	t�d�}|j|}|�dt�|��\}}}}|s|st�z[tr&|�d�t|�dkr4t	dt|���|d\}}	}
|tj
krp|	tjkrut|
�|jdkrPt�|�
|
�t|�d|dkrktd�t|�|d���t|�WSWt	d��Wt	d��ttfy�Yt	d��w)	NrNrrPzreceived %d items of ancdatarrOz Len is {0:n} but msg[0] is {1!r}zInvalid data received)rQ�itemsizeZrecvmsgrTZ
CMSG_SPACE�EOFErrorrVr<rSrWrUr�
ValueErrorZ	frombytes�AssertionError�format�list�
IndexError)rX�size�aZ
bytes_sizerYZancdata�flagsZaddrZ
cmsg_levelZ	cmsg_typeZ	cmsg_datarrrrL�sD


�


��
����rLcCsJ	t�|��tjtj��}t||g�Wd�dS1swYdSr
)rT�fromfd�fileno�AF_UNIX�SOCK_STREAMrK)r=r6r>�srrrr�s"�cCsJ	t�|��tjtj��}t|d�dWd�S1swYdS)Nrr)rTrdrerfrgrL)r=rhrrrr�s$�cCsD	t��}|dur|�|�|��Strddlm}|�|�Std��)Nr)�resource_sharerz&SCM_RIGHTS appears not to be available)rZget_spawning_popenrJZduplicate_for_child�HAVE_SEND_HANDLE�rir\)�fdZ	popen_objrirrrrJ�s
rJcCs.|jdurt|j|jjffSt|j|jjffSr
)�__self__�getattrr�__func__r%��mrrr�_reduce_method�s
rrc@seZdZdd�ZdS)�_CcCsdSr
r)rrrr�f�sz_C.fN)r%r&r'rtrrrrrs�srscCst|j|jffSr
)rn�__objclass__r%rprrr�_reduce_method_descriptor�srvcCst|j|j|jp	iffSr
)�_rebuild_partial�funcr�keywords)�prrr�_reduce_partial��r{cCstj|g|�Ri|��Sr
)�	functools�partial)rxrryrrrrw�r|rwcCsddlm}t||�ffS)Nr)�	DupSocket)rir�_rebuild_socket)rhrrrr�_reduce_socket�sr�cCs|��Sr
)r@)Zdsrrrr��sr�cCs"t|���}t||j|j|jffSr
)rJrer��familyr�proto)rh�dfrrrr��scCs|��}tj||||d�S)N)re)r@rT)r�r�rr�rlrrrr��sc@sbeZdZ	eZeZeZeZeZej	dkre
Z
eZeZne
Z
eZeZeZeZeZeZeZdd�ZdS)�AbstractReducerr
cGsNttt�j�t�tttj�t�tttj	�t�tt
jt�tt
j
t�dSr
)rrrsrtrrr_�appendrv�int�__add__r}r~r{rTr�rrrrrs
zAbstractReducer.__init__N)r%r&r'rrr	rr�sys�platformr0r/r.rKrLrJrrrvrwr�r�rrrrrr��s(
r�)�	metaclassr
rI).�abcrr(r}rrAr*rTr�rkr�__all__r��hasattrrjZPicklerrrr	r2r/r0rr�objectr.rQrVrKrLrJrrrsrrtrvr_r�r�r�r{rwr~r�r�r�rrrr�<module>sl	

�
�	

�#



?>