U e5d@sddlZddlZddlmZmZejs.edddlmZddlm Z ddlm Z ddlm Z d gZ Gd d d e ZGd d d e jZdS) N) reductionset_spawning_popenz,No support for sending fds between processes) forkserver) popen_fork)spawn)utilPopenc@seZdZddZddZdS)_DupFdcCs ||_dSN)ind)selfr r8/usr/lib64/python3.8/multiprocessing/popen_forkserver.py__init__sz_DupFd.__init__cCst|jSr )rZget_inherited_fdsr )r rrrdetachsz _DupFd.detachN)__name__ __module__ __qualname__rrrrrrr sr csBeZdZdZeZfddZddZddZe j fdd Z Z S) r rcsg|_t|dSr )_fdssuperr)r process_obj __class__rrr!szPopen.__init__cCs|j|t|jdS)Nr)rappendlen)r fdrrrduplicate_for_child%s zPopen.duplicate_for_childc Cst|j}t}t|zt||t||W5tdXt |j \|_ }t |}t|tj||j f|_t|ddd}||W5QRXt|j |_dS)NwbT)closefd)rZget_preparation_data_nameioBytesIOrrdumprZconnect_to_new_processrsentinelosduprZFinalizeZ close_fds finalizeropenwrite getbuffer read_signedpid)r rZ prep_dataZbufwZ _parent_wfrrr_launch)s     z Popen._launchc Csr|jdkrlddlm}|tjkr$dnd}||jg|s:dSzt|j|_Wntt fk rjd|_YnX|jS)Nr)wait) returncodeZmultiprocessing.connectionr0r%WNOHANGr$rr+OSErrorEOFError)r flagr0Ztimeoutrrrpoll=s   z Popen.poll) rrrmethodr ZDupFdrrr/r%r3r7 __classcell__rrrrr s  )r!r%contextrrZHAVE_SEND_HANDLE ImportErrorrrrr__all__objectr r rrrrs