HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //proc/thread-self/root/usr/local/lib/python3.7/test/__pycache__/test_fork1.cpython-37.pyc
B

��g��@s�dZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZm
Z
mZmZe
ed�Gdd�de
�Zdd	�Zed
kr�e��dS)z.This test checks for correct fork() behavior.
�N)�ForkWait)�
reap_children�
get_attribute�
import_module�verbose�forkc@s$eZdZdd�Zdd�Zdd�ZdS)�ForkTestcCsrt��d}x6t��|krBt�|tj�\}}||kr6Pt�d�qW|�||�|�|dd|d@|d?f�dS)Ng$@g�������?rzcause = %d, exit = %d��)�timeZ	monotonic�os�waitpid�WNOHANG�sleepZassertEqual)�selfZcpidZdeadlineZspid�status�r�+/usr/local/lib/python3.7/test/test_fork1.py�	wait_implszForkTest.wait_implcs�t���d�d�d�����fdd�}tj|d�}|�����t��}zR|s�t��}|�krlt�d�q�t	dkr|t
d	�t�d�n|��|�|�Wd
yt�
|tj�Wntk
r�YnXXd
S)zFCheck fork() in main thread works while a subthread is doing an importzfake test module�partialZcompletecs:t���tj�<���t�d��tj�<t��dS)Ng{�G�z�?)�imp�acquire_lock�sys�modules�setrr�release_lockr)�complete_module�fake_module_name�import_started�partial_modulerr�importer(s


z9ForkTest.test_threaded_import_lock_fork.<locals>.importer)�targetr�z Child encountered partial moduleN)�	threadingZEventZThread�start�waitrr�
__import__�_exitr�print�joinr�kill�signal�SIGKILL�OSError)rr �t�pid�mr)rrrrr�test_threaded_import_lock_fork"s.z'ForkTest.test_threaded_import_lock_forkcs*�fdd�}xtd�D]}||�qWdS)zJCheck fork() in main thread works while the main thread is doing an importc	s�d}d}yVz4x t|�D]}t��|d7}qWt��}|}Wdxt|�D]}t��qJWXWn4tk
r�|r�tdkr�td�t�	d��YnX|r�t�	d���
|�dS)NrFr"zRuntimeError in child)�rangerrrrr�RuntimeErrorrr(r'r)�level�releaseZin_child�ir/)rrr�fork_with_import_lockOs(


zDForkTest.test_nested_import_lock_fork.<locals>.fork_with_import_lock�N)r2)rr7r4r)rr�test_nested_import_lock_forkLsz%ForkTest.test_nested_import_lock_forkN)�__name__�
__module__�__qualname__rr1r9rrrrrs
*rcCs
t�dS)N)rrrrr�tearDownModulelsr=�__main__)�__doc__�_imprrr+rr#rZunittestZtest.fork_waitrZtest.supportrrrrrr=r:�mainrrrr�<module>s
X