Mini Shell

Direktori : /lib64/python3.9/multiprocessing/__pycache__/
Upload File :
Current File : //lib64/python3.9/multiprocessing/__pycache__/reduction.cpython-39.pyc

a

�DOg(%�@sddlmZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
gd�Zejdkp�e
ed�o�e
ed�o�e
ejd	�ZGd
d�dej�ZejZd8dd
�Zejdk�r�egd�7ZddlZd9dd�dd�Zdd�Zdd�Zdd�ZGdd�de�ZnFegd�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dk�r�d/d0�Z+d1d2�Z,eeje+�nd3d0�Z+d4d2�Z,eeje+�Gd5d6�d6ed7�Z-dS):�)�ABCMetaN�)�context)�send_handle�recv_handle�ForkingPickler�register�dump�win32�CMSG_LEN�
SCM_RIGHTS�sendmsgcsJeZdZdZiZejZ�fdd�Ze	dd��Z
e	d	dd��Zej
Z
�ZS)
rz)Pickler subclass used by multiprocessing.cs*t�j|�|j��|_|j�|j�dS�N)�super�__init__�_copyreg_dispatch_table�copy�dispatch_table�update�_extra_reducers��self�args��	__class__��1/usr/lib64/python3.9/multiprocessing/reduction.pyr&szForkingPickler.__init__cCs||j|<dS)z&Register a reduce function for a type.N)r)�cls�type�reducerrrr+szForkingPickler.registerNcCs t��}|||��|�|��Sr)�io�BytesIOr	�	getbuffer)r�obj�protocol�bufrrr�dumps0szForkingPickler.dumps)N)�__name__�
__module__�__qualname__�__doc__r�copyregrrr�classmethodrr&�pickle�loads�
__classcell__rrrrr!s
rcCst||��|�dS)z3Replacement for pickle.dump() using ForkingPickler.N)rr	)r#�filer$rrrr	:sr	)�	DupHandle�	duplicate�steal_handleF)�source_processcCs6t��}|dur|}|dur |}t�|||d|tj�S)z<Duplicate a handle.  (target_process is a handle not a pid!)Nr)�_winapi�GetCurrentProcess�DuplicateHandle�DUPLICATE_SAME_ACCESS)�handleZtarget_process�inheritabler4�current_processrrrr2Gs�r2c	CsNt�tjd|�}z,t�||t��ddtjtjB�Wt�|�St�|�0dS)z5Steal a handle from process identified by source_pid.FrN)r5�OpenProcess�PROCESS_DUP_HANDLEr7r6r8�DUPLICATE_CLOSE_SOURCE�CloseHandle)Z
source_pidr9Zsource_process_handlerrrr3Ss�

�
�r3cCst|tj|�}|�|�dS�z&Send a handle over a local connection.N)r1r5r8�send)�connr9�destination_pidZdhrrrr_srcCs|����S)�)Receive a handle over a local connection.)�recv�detach)rBrrrrdsrc@s"eZdZdZddd�Zdd�ZdS)r1zPicklable wrapper for a handle.Nc	Csf|durt��}t�tjd|�}z(t�t��|||dd�|_Wt�|�nt�|�0||_	||_
dS)NFr)�os�getpidr5r<r=r7r6�_handler?�_access�_pid)rr9�access�pid�procrrrrjs
�zDupHandle.__init__c	Csb|jt��kr|jSt�tjd|j�}z*t�||jt��|j	dtj
�Wt�|�St�|�0dS)z1Get the handle.  This should only be called once.FN)rKrGrHrIr5r<r=r7r6rJr>r?)rrNrrrrFys
�
�
�zDupHandle.detach)N)r'r(r)r*rrFrrrrr1hs
r1)�DupFd�sendfds�recvfds�darwincCsVt�d|�}tt|�dg�}|�|gtjtj|fg�trR|�d�dkrRt	d��dS)z,Send an array of fds over an AF_UNIX socket.�i�r�Az%did not receive acknowledgement of fdN)
�array�bytes�lenr
�socket�
SOL_SOCKETr�ACKNOWLEDGErE�RuntimeError)�sock�fds�msgrrrrP�s
rPc	Cst�d�}|j|}|�dt�|��\}}}}|s:|s:t�z�trJ|�d�t|�dkrft	dt|���|d\}}	}
|tj
kr�|	tjkr�t|
�|jdkr�t�|�
|
�t|�d|dkr�td�t|�|d���t|�WSWnttfy�Yn0t	d��d	S)
z/Receive an array of fds over an AF_UNIX socket.rSrrUzreceived %d items of ancdatarrTz Len is {0:n} but msg[0] is {1!r}zInvalid data receivedN)rV�itemsize�recvmsgrY�
CMSG_SPACE�EOFErrorr[rArXr\rZr�
ValueError�	frombytes�AssertionError�format�list�
IndexError)r]�size�a�
bytes_sizer_�ancdata�flags�addr�
cmsg_level�	cmsg_type�	cmsg_datarrrrQ�s:


�
�
��rQcCsFt�|��tjtj��}t||g�Wd�n1s80YdSr@)rY�fromfd�fileno�AF_UNIX�SOCK_STREAMrP)rBr9rC�srrrr�scCsHt�|��tjtj��}t|d�dWd�S1s:0YdS)rDrrN)rYrsrtrurvrQ)rBrwrrrr�scCsFt��}|dur |�|�|��Str:ddlm}|�|�Std��dS)zReturn a wrapper for an fd.Nr)�resource_sharerz&SCM_RIGHTS appears not to be available)r�get_spawning_popenrO�duplicate_for_child�HAVE_SEND_HANDLE�rxrd)�fd�	popen_objrxrrrrO�s
rOcCs2|jdurt|j|jjffSt|j|jjffSdSr)�__self__�getattrr�__func__r'��mrrr�_reduce_method�s
r�c@seZdZdd�ZdS)�_CcCsdSrr)rrrr�f�sz_C.fN)r'r(r)r�rrrrr��sr�cCst|j|jffSr)r��__objclass__r'r�rrr�_reduce_method_descriptor�sr�cCst|j|j|jpiffSr)�_rebuild_partial�funcr�keywords)�prrr�_reduce_partial�sr�cCstj|g|�Ri|��Sr)�	functools�partial)r�rr�rrrr��sr�cCsddlm}t||�ffS)Nr)�	DupSocket)rxr��_rebuild_socket)rwr�rrr�_reduce_socket�sr�cCs|��Sr)rF)Zdsrrrr��sr�cCs"t|���}t||j|j|jffSr)rOrtr��familyr�proto)rw�dfrrrr��scCs|��}tj||||d�S)N)rt)rFrY)r�r�rr�r}rrrr��sc@sdeZdZdZeZeZeZeZeZe	j
dkr8eZeZe
Z
neZeZeZeZeZeZeZeZdd�ZdS)�AbstractReducerz�Abstract base class for use in implementing a Reduction class
    suitable for use in replacing the standard reduction mechanism
    used in multiprocessing.r
cGsNttt�j�t�tttj�t�tttj	�t�tt
jt�tt
j
t�dSr)rrr�r�r�rh�appendr��int�__add__r�r�r�rYr�rrrrrs
zAbstractReducer.__init__N)r'r(r)r*rrr	rr�sys�platformr3r2r1rPrQrOr�r�r�r�r�rrrrrr��s&
r�)�	metaclass)N)NF).�abcrr+r�r rGr-rYr�r|r�__all__r��hasattrr{�Picklerrrr	r5r2r3rr�objectr1rVr[rPrQrOr�r�rr�r�rhr�r�r�r�r�r�r�r�r�rrrr�<module>
sj

�
�	
�#


Zerion Mini Shell 1.0