Hacked By AnonymousFox

Current Path : /opt/alt/python312/lib64/python3.12/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/multiprocessing/__pycache__/heap.cpython-312.opt-2.pyc

�

�Q�fj-���ddlZddlmZddlZddlZddlZddlZddlZddlm	Z	m
Z
ddlmZdgZ
ejdk(rddlZGd�d	e�Zn$Gd
�d	e�Zd�Zd�Ze	j(ee�Gd
�de�ZGd�de�Zy)�N)�defaultdict�)�	reduction�assert_spawning)�util�
BufferWrapper�win32c�B�eZdZ	ej�Zd�Zd�Zd�Zy)�Arenac�x�||_td�D]o}dtj�t	|j
�fz}t
jd||��}tj�dk(rn|j��qtd��||_||_|j|jf|_
y)N�dz	pym-%d-%s�����tagnamerzCannot find name for new mmap)�size�range�os�getpid�next�_rand�mmap�_winapi�GetLastError�close�FileExistsError�name�buffer�_state)�selfr�ir�bufs     �;/opt/alt/python312/lib64/python3.12/multiprocessing/heap.py�__init__zArena.__init__&s����D�I��3�Z��"�b�i�i�k�4��
�
�3C�%D�D���i�i��D�$�7���'�'�)�Q�.���	�	��
 �&�&E�F�F��D�I��D�K��9�9�d�i�i�0�D�K�c�0�t|�|jS�N)rr)rs r"�__getstate__zArena.__getstate__5s���D�!��;�;�r$c��|x\|_|_|_tjd|j|j��|_y)Nrr)rrrrr)r�states  r"�__setstate__zArena.__setstate__9s3��16�6� �D�I�t�y�4�;��)�)�B��	�	�4�9�9�E�D�Kr$N)	�__name__�
__module__�__qualname__�tempfile�_RandomNameSequencerr#r'r*�r$r"rrs)��	�-��,�,�.��
	1�	�	Fr$rc�F�eZdZ	ejdk(rdgZngZdd�Zd�Zy)r�linuxz/dev/shmc���||_||_|dk(r�tjdt	j
�z|j
|���\|_}t	j|�tj|tj|jf�t	j|j|�tj|j|j�|_
y)Nrzpym-%d-)�prefix�dir)r�fdr.�mkstemprr�_choose_dir�unlinkr�Finalizer�	ftruncaterr)rrr6rs    r"r#zArena.__init__Ms����D�I��D�G��R�x�!)� 0� 0�%�b�i�i�k�1��)�)�$�/�!1�
�����	�	�$���
�
�d�B�H�H�t�w�w�j�9����T�W�W�d�+��)�)�D�G�G�T�Y�Y�7�D�Kr$c��|jD]7}tj|�}|j|jz|k\s�5|cStj�Sr&)�_dir_candidatesr�statvfs�f_bavail�f_frsizer�get_temp_dir)rr�d�sts    r"r8zArena._choose_dir[sL���)�)���Z�Z��]���;�;����,��4��H�*��$�$�&�&r$N)r)r+r,r-�sys�platformr=r#r8r0r$r"rrCs+��	��<�<�7�"�)�l�O� �O�	8�	'r$c��|jdk(rtd��t|jt	j
|j�ffS)NrzDArena is unpicklable because forking was enabled when it was created)r6�
ValueError�
rebuild_arenarr�DupFd)�as r"�reduce_arenarKdsC���4�4�2�:��G�H�
H��q�v�v�y���q�t�t�'<�=�=�=r$c�6�t||j��Sr&)r�detach)r�dupfds  r"rHrHjs���T�5�<�<�>�*�*r$c�|�eZdZdZdZdZejfd�Ze	d��Z
d�Zd�Zd�Z
d�Zd	�Zd
�Zd�Zd�Zd
�Zy)�Heap�i@c��tj�|_tj�|_||_g|_i|_i|_	i|_
tt�|_
g|_g|_d|_d|_y�Nr)rr�_lastpid�	threading�Lock�_lock�_size�_lengths�_len_to_seq�_start_to_block�_stop_to_blockr�set�_allocated_blocks�_arenas�_pending_free_blocks�
_n_mallocs�_n_frees)rrs  r"r#z
Heap.__init__{sy���	�	���
��^�^�%��
���
���
���� "���!���"-�S�!1������%'��!������
r$c��|dz
}||z|zS)Nrr0)�n�	alignment�masks   r"�_roundupz
Heap._roundup�s���1�}���D��T�E�!�!r$c�H�|jt|j|�tj�}|j|j
kr|xjdzc_t
jd|�t|�}|jj|�|d|fS)N�z"allocating a new mmap of length %dr)rg�maxrXr�PAGESIZE�_DOUBLE_ARENA_SIZE_UNTILr�inforr_�append)rr�length�arenas    r"�
_new_arenazHeap._new_arena�sy�����s�4�:�:�t�4�d�m�m�D���:�:��5�5�5��J�J�!�O�J��	�	�6��?��f�
�������E�"��q�&�!�!r$c��|j}||jkry|jj|�}|j|df=|j
||f=|jj|�|j|}|j|d|f�|s)|j|=|jj|�yyrS)
r�_DISCARD_FREE_SPACE_LARGER_THANr^�popr[r\r_�removerZrY)rrpro�blocks�seqs     r"�_discard_arenazHeap._discard_arena�s��������D�8�8�8���'�'�+�+�E�2��� � �%���,�������0������E�"����v�&���
�
�E�1�f�%�&��� � ��(��M�M� � ��(�r$c�t�tj|j|�}|t|j�k(r|j	|�S|j|}|j
|}|j
�}|s|j
|=|j|=|\}}}|j||f=|j||f=|Sr&)	�bisect�bisect_leftrY�lenrqrZrtr[r\)	rrr rorw�blockrp�start�stops	         r"�_malloczHeap._malloc�s������t�}�}�d�3����D�M�M�"�"��?�?�4�(�(��]�]�1�%�F��"�"�6�*�C��G�G�I�E���$�$�V�,�d�m�m�A�.>�$����t�� � �%���0������
�.��r$c��|\}}}	|j||f}|j|�\}}	|j||f}|j|�\}}|||f}||z
}	|j|j|�||j||f<||j||f<y#t$rY�}wxYw#t$rY�fwxYw#t$r3|g|j|<t
j|j|�Y�|wxYwr&)	r\�_absorb�KeyErrorr[rZrnrz�insortrY)	rr}rpr~r�
prev_block�_�
next_blockros	         r"�_add_free_blockzHeap._add_free_block�s ��$����t�	0��,�,�e�U�^�<�J��|�|�J�/�H�E�1�	/��-�-�u�d�m�<�J��l�l�:�.�G�A�t���t�$������	1����V�$�+�+�E�2�
05����e�U�^�,�-2����U�D�M�*��-�	��	���	��	���	1�(-�w�D���V�$��M�M�$�-�-��0�	1�s4�B�B.�B=�	B+�*B+�.	B:�9B:�=9C9�8C9c���|\}}}|j||f=|j||f=||z
}|j|}|j|�|s(|j|=|jj|�||fSr&)r[r\rZrurY)rr}rpr~rrorws       r"r�zHeap._absorb�s���$����t�� � �%���0������
�.��������v�&���
�
�5���� � ��(��M�M� � ��(��d�{�r$c�|�|\}}}|j|}|j||f�|s|j|�yyr&)r^rurx)rr}rpr~rrvs      r"�_remove_allocated_blockzHeap._remove_allocated_block�sD��"���u�d��'�'��.���
�
�u�d�m�$������&�r$c��		|jj�}|j|�|j	|��>#t$rYywxYwr&)r`rt�
IndexErrorr�r��rr}s  r"�_free_pending_blockszHeap._free_pending_blockssU���
��1�1�5�5�7��
� � ��'��(�(��/�
���
��
�s�A�	A�Ac�$�tj�|jk7r7tdj	tj�|j���|j
j
d�s|jj|�y	|xjdz
c_	|j�|j|�|j|�|j
j�y#|j
j�wxYw)Nz$My pid ({0:n}) is not last pid {1:n}Fr)rrrTrG�formatrW�acquirer`rnrbr�r�r��releaser�s  r"�freez	Heap.frees����9�9�;�$�-�-�'��6�=�=��I�I�K��
�
�/�0�
0��z�z�!�!�%�(�
�%�%�,�,�U�3�
%��
�
��"�
��)�)�+��$�$�U�+��,�,�U�3��
�
�"�"�$���
�
�"�"�$�s
�AC3�3Dc��|dkrtdj|���tj|krt	dj|���tj�|jk7r|j�|j5|xjdz
c_
|j�|jt|d�|j�}|j|�\}}}||z}||kr|j!|||f�|j"|j%||f�|||fcddd�S#1swYyxYw)Nr�Size {0:n} out of range�Size {0:n} too larger)rGr�rD�maxsize�
OverflowErrorrrrTr#rWrar�rgrj�
_alignmentr�r�r^�add)rrrpr~r�	real_stops      r"�malloczHeap.malloc(s
���!�8��6�=�=�d�C�D�D��;�;�$��� 6� =� =�d� C�D�D�
�9�9�;�$�-�-�'��M�M�O�
�Z�Z��O�O�q� �O��%�%�'��=�=��T�1��t���?�D�#'�<�<��#5� �U�E�4����I��4���$�$�e�Y��%=�>��"�"�5�)�-�-�u�i�.@�A��5�)�,�	-�	-�Z�Z�s
�
B#D7�7EN)r+r,r-r�rsrlrrkr#�staticmethodrgrqrxr�r�r�r�r�r�r�r0r$r"rPrPssb���J�&3�#�,�� �M�M��:�"��"�

"�)�$�"3�<
�'�0�%�8-r$rPc�&�eZdZe�Zd�Zd�Zy)rc�N�|dkrtdj|���tj|krt	dj|���t
jj|�}||f|_tj|t
jj|f��y)Nrr�r�)�args)rGr�rDr�r�r�_heapr�rrr:r�)rrr}s   r"r#zBufferWrapper.__init__Fs����!�8��6�=�=�d�C�D�D��;�;�$��� 6� =� =�d� C�D�D��#�#�*�*�4�0���d�m����
�
�d�M�/�/�4�4�E�8�Dr$c�^�|j\\}}}}t|j�|||zSr&)r�
memoryviewr)rrpr~rrs     r"�create_memoryviewzBufferWrapper.create_memoryviewOs1��%)�[�[�"����t�d��%�,�,�'��e�D�j�9�9r$N)r+r,r-rPr�r#r�r0r$r"rrBs���F�E�E�:r$)rz�collectionsrrrrDr.rU�contextrr�r�__all__rEr�objectrrKrH�registerrPrr0r$r"�<module>r�s����#��	�
���/���
���<�<�7���F��F�H'��'�B>�+��I���u�l�+�I-�6�I-�^:�F�:r$

Hacked By AnonymousFox1.0, Coded By AnonymousFox