3 \@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 ||_dS)N)ind)selfr r 8/usr/lib64/python3.6/multiprocessing/popen_forkserver.py__init__sz_DupFd.__init__cCstj|jS)N)rZget_inherited_fdsr )r r r rdetachsz _DupFd.detachN)__name__ __module__ __qualname__rrr r r rr sr csBeZdZdZeZfddZddZddZe j fdd Z Z S) r rcsg|_tj|dS)N)_fdssuperr)r process_obj) __class__r rr!szPopen.__init__cCs|jj|t|jdS)Nr)rappendlen)r fdr r rduplicate_for_child%s zPopen.duplicate_for_childcCstj|j}tj}t|ztj||tj||WdtdXtj |j \|_ }t j |tj|j ft|ddd}|j|jWdQRXtj|j |_dS)NwbT)closefd)rZget_preparation_data_nameioBytesIOrrdumprZconnect_to_new_processrsentinelrZFinalizeoscloseopenwrite getbuffer read_unsignedpid)r rZ prep_dataZbufwfr r r_launch)s   z Popen._launchc Csr|jdkrlddlm}|tjkr$dnd}||jg|s:dSytj|j|_Wntt fk rjd|_YnX|jS)Nr)wait) returncodeZmultiprocessing.connectionr-r#WNOHANGr"rr(OSErrorEOFError)r flagr-Ztimeoutr r rpoll9s   z Popen.poll) rrrmethodr ZDupFdrrr,r#r0r4 __classcell__r r )rrr s  )rr#contextrrZHAVE_SEND_HANDLE ImportErrorrrrr__all__objectr r r r r rs