�
�f�%����ddlZddlZddlZddlZddlmZmZddlmZddlm Z ddlm
Z
gd�Zejdkrd Z
d Zn@eed
d ��Z
ejo+ej����d��Zd�Zd
�Zer*eej�ejd����neej��d�Zd�Zd�Zdd�Zd�Zd�Zd�ZgZd�Z d�Z!d�Z"d�Z#dS)�N�)�get_start_method�set_start_method)�process)� reduction)�util)�_main�freeze_support�set_executable�get_executable�get_preparation_data�get_command_line�import_main_path�win32F�frozenzpythonservice.exec��|�|adStjdkrtj|��adStj|��adS)Nr)�_python_exe�sys�platform�os�fsdecode�fsencode)�exes �</opt/alt/python311/lib64/python3.11/multiprocessing/spawn.pyrr$sC��
�{����� ��� � ��k�#�&�&�����k�#�&�&����c��tS)N)r�rrrr-s���rz
python.exec�H�t|��dkr|ddkrdSdS)z=
Return whether commandline indicates we are forking
�r�--multiprocessing-forkTF)�len)�argvs r�
is_forkingr#9s,���4�y�y�A�~�~�$�q�'�%=�=�=��t��urc��ttj��rpi}tjdd�D]8}|�d��\}}|dkrd||<�&t |��||<�9tdi|��tj��dSdS)zE
Run code for process object if this in not the main process
rN�=�Noner)r#rr"�split�int�
spawn_main�exit)�kwds�arg�name�values rr
r
Cs����#�(��� ����8�A�B�B�<� (� (�C��)�)�C�.�.�K�D�%�����!��T�
�
� ��Z�Z��T�
�
����T������
�
�
�
�
� � rc�N�ttdd��r-tjdgd�|���D��zSd}|d�d�|���D����z}tj��}t��}|g|zd|dgzS) zJ
Returns prefix of command line used for spawning a child process
rFr c��g|]}d|z��S)�%s=%rr��.0�items r�
<listcomp>z$get_command_line.<locals>.<listcomp>Ys��9�9�9�D��4��9�9�9rz<from multiprocessing.spawn import spawn_main; spawn_main(%s)z, c3� K�|] }d|zV��
dS)r1Nrr2s r� <genexpr>z#get_command_line.<locals>.<genexpr>\s&����B�B�T�'�D�.�B�B�B�B�B�Brz-c)�getattrr�
executable�items�joinr�_args_from_interpreter_flagsr)r+�prog�optsrs rrrSs����s�H�e�$�$�E���!9�:�9�9�D�J�J�L�L�9�9�9�:� ;�N���� � �B�B�T�Z�Z�\�\�B�B�B�B�B�B���0�2�2�������u�t�|�t�T�+C�D�D�Drc���ttj��s
Jd���tjdkrjddl}ddl}|�%|�|j|jzd|��}nd}tj
||���}|�|tj
��}|}n(ddlm} || j_|}tj|��}t'||��}
tj|
��dS) z7
Run code specified by data received over pipe
zNot forkingrrNF)�source_processr)�resource_tracker)r#rr"r�msvcrt�_winapi�OpenProcess�SYNCHRONIZE�PROCESS_DUP_HANDLEr� duplicate�open_osfhandler�O_RDONLY�rA�_resource_tracker�_fd�dupr r*)�pipe_handle�
parent_pid�
tracker_fdrBrCr@�
new_handle�fd�parent_sentinelrA�exitcodes rr)r)bs���c�h���.�.��.�.��
�|�w����
�
�
������!�$�0�0��#�g�&@�@��z�#�#�N�N�"�N��(��8F�H�H�H�
�
�
"�
"�:�r�{�
;�
;��(���&�&�&�&�&�&�1;��*�.�
���&��-�-���R��)�)�H��H�X�����rc��tj|dd���5}dtj��_ t
j�|��}t|��t
j�|��}tj��`n#tj��`wxYw ddd��n#1swxYwY|� |��S)N�rbT)�closefd)
r�fdopenr�current_process�_inheritingr�pickle�load�prepare�
_bootstrap)rRrS�from_parent�preparation_data�selfs rr r ~s�� ��2�t�T� *� *� *�6�k�04���!�!�-� 6�(�/�4�4�[�A�A���$�%�%�%��#�(�(��5�5�D��'�)�)�5�5���'�)�)�5�5�5�5�5�5�6�6�6�6�6�6�6�6�6�6�6����6�6�6�6��?�?�?�+�+�+s)�B8�A
B�?B8�B(�(B8�8B<�?B<c�h�ttj��dd��rtd���dS)NrZFa�
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
To fix this issue, refer to the "Safe importing of main module"
section in https://docs.python.org/3/library/multiprocessing.html
)r8rrY�RuntimeErrorrrr�_check_not_importing_mainrd�s@���w�&�(�(�-��?�?�
���
�
�
�
�
rc ���t��ttjt j��j���}tj�!tj���|d<tj
���} |�d��}tj
||<n#t$rYnwxYw|�||tjtj
t#j��t'�����tjd}t+|jdd��}|�||d<n�tjd kst0s�t2s�t+|d
d��}|�wt"j
�|��s6tj
�*t"j
�tj
|��}t"j
�|��|d<|S)zM
Return info about parent needed by child to unpickle process object
)�
log_to_stderr�authkeyN� log_levelrJ)r-�sys_path�sys_argv�orig_dir�dir�start_method�__main__r-�init_main_from_namer�__file__�init_main_from_path)rd�dictr�_log_to_stderrrrYrg�_logger�getEffectiveLevelr�path�copy�index�ORIGINAL_DIR�
ValueError�updater"r�getcwdr�modulesr8�__spec__r�WINEXE�
WINSERVICE�isabsr;�normpath)r-�dri�i�main_module�
main_mod_name� main_paths rr
r
�s���������)��'�)�)�1�
�
�
�A�
�|����7�7�9�9��+��
�X�]�]�_�_�H�+��N�N�2�����*�������
�
�
���
����
�H�H�
�����%��I�K�K�%�'�'�
�
�
�
��+�j�)�K��K�0�&�$�?�?�M�� �#0��
� � � ��� � �� �
� ��K��T�:�:� �� ��G�M�M�)�,�,�
J��,�8��G�L�L��)=�y�I�I� �')�w�'7�'7� �'B�'B�A�#�$��Hs�B1�1
B>�=B>c��d|vr|dtj��_d|vr|dtj��_d|vr|drt j��d|vr,t j���|d��d|vr|dt_ d|vr|dt_
d|vrtj|d��d|vr|dt_
d |vrt|d d
���d|vrt|d��dSd
|vrt!|d
��dSdS)zE
Try to get current process ready to unpickle process object
r-rgrfrhrirjrlrkrmT)�forcerorqN)rrYr-rgrrf�
get_logger�setLevelrrvr"r�chdirryr�_fixup_main_from_name�_fixup_main_from_path)�datas rr]r]�sj����~�~�)-�f����!�!�&��D���,0��O���!�!�)��$���4��#8��������d�������"�"�4��#4�5�5�5��T����
�#����T����
�#�����}�}�
���e������T���#�J�/���������n�-�T�:�:�:�:���$�$��d�#8�9�:�:�:�:�:� �$� &� &��d�#8�9�:�:�:�:�:�
'� &rc��tjd}|dks|�d��rdSt|jdd��|krdSt
�|��tjd��}tj
|dd���}|j�|��|xtjd<tjd<dS)Nrnz .__main__r-�__mp_main__T)�run_name� alter_sys)
rr}�endswithr8r~�old_main_modules�append�types�
ModuleType�runpy�
run_module�__dict__r{)�mod_name�current_mainr��main_contents rr�r��s���
�;�z�*�L��:����!2�!2�;�!?�!?�����|�$�f�d�3�3�x�?�?���
���L�)�)�)��"�=�1�1�K��#�H�-:�.2�4�4�4�L������-�-�-�;F�F�C�K�
��c�k�-�8�8�8rc���tjd}tj�tj�|����d}|dkrdSt
|dd��|krdSt�|��tj
d��}tj|d���}|j
�|��|xtjd<tjd<dS)Nrnr�ipythonrpr�)r�)rr}rrv�splitext�basenamer8r�r�r�r�r��run_pathr�r{)r�r�� main_namer�r�s rr�r�s����;�z�*�L��� � ���!1�!1�)�!<�!<�=�=�a�@�I��I������|�Z��.�.�)�;�;���
���L�)�)�)��"�=�1�1�K��>�)�+8�:�:�:�L������-�-�-�;F�F�C�K�
��c�k�-�8�8�8rc�$�t|��dS)z<
Set sys.modules['__main__'] to module at main_path
N)r�)r�s rrr/s���)�$�$�$�$�$r)NN)$rrr�r�rJrrr�contextrr�__all__rrr�r8r9�lowerr�rrrvr;�exec_prefixr#r
rr)r rdr
r�r]r�r�rrrr�<module>r�s
��
� � � �
�
�
�
���������0�0�0�0�0�0�0�0�������������������K�K�K���<�7���
�F��J�J�
�W�S�(�E�
*�
*�F���X�C�N�$8�$8�$:�$:�$C�$C�DW�$X�$X�J�'�'�'�����#��N�2�7�<�<����>�>�?�?�?�?��N�3�>�"�"�"����
�
�
� E�E�E�����8 ,� ,� ,�
�
�
�,,
�,
�,
�d��";�";�";�LG�G�G�2G�G�G�8%�%�%�%�%r |