Sindbad~EG File Manager
�
(ΜgEe��Z�ddlZddlmZmZddlZddlZddlZddlZddl Z ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddlmZddlmZddlmZddlmZdd lm Z m!Z!m"Z" ddl#Z# ddl%Z% ddl&Z& ddl'Z(ejTd
�Z+ddl,Z,dZ-d�Z.d�Z/d
�Z0Gd�d�Z1Gd�dejd�Z3eGd�dejd��Z4Gd�dejd�Z5Gd�dejd�Z6Gd�dejd�Z7Gd�dejd�Z8Gd�dejd�Z9Gd�dejd�Z:Gd �d!ejd�Z;ejxe%dud"�Gd#�d$ejd��Z=Gd%�d&ejd�Z>d'Z?Gd(�d)ejd�Z@eAd*k(rej��yy#e$$rdZ#Y��wwxYw#e$$rdZ%Y���wxYw#e$$rdZ&Y���wxYw#e)$rdZ(Y���wxYw)+�N)�OrderedDict�deque)�support)�MISSING_C_DOCSTRINGS)�
import_helper)�threading_helper)�warnings_helper)�requires_limited_api)�assert_python_failure�assert_python_ok�run_python_until_end� _testcapic�F�|jdd�jdd�S)Nzutf-8�replace�
�)�decoder)�errs �5/usr/local/lib/python3.12/test/test_capi/test_misc.py�
decode_stderrr8s ���:�:�g�y�)�1�1�$��;�;�c�F�tjtdud�|�S)z>Decorator to skip a test if subinterpreters are not supported.Nzsubinterpreters required)�unittest�skipIf�
_interpreters)�meths r�requires_subinterpretersr<s)��7�8�?�?�=�D�0�5�7�7;�=�=rc��|S)zsome doc���selfs r�testfunctionr"Bs���Krc�P�eZdZej e�Zej e�Zy)�InstanceMethodN)�__name__�
__module__�__qualname__r�instancemethod�idr"rrrr$r$Gs"�� � !� !�"� %�B��+�+�L�9�Lrr$c�~�eZdZd�Zej
�d��Zd�Zeje
d�d��Zeje
d�d��Zejed�d��Zd �Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zejeed�d�d��Zejeed�d�ej8dddd��d���Zd�Zej>d�d��Z ej>d�d��Z!d�Z"ejed�d ��Z#d!�Z$d"�Z%d#�Z&d$�Z'd%�Z(d&�Z)d'�Z*d(�Z+d)�Z,d*�Z-d+�Z.d,�Z/d-�Z0d.�Z1d/�Z2d0�Z3d1�Z4d2�Z5d3�Z6d4�Z7d5�Z8d6�Z9e:jve<�7�d8��Z=d9�Z>d:�Z?d;�Z@d<�ZAd=�ZBd>�ZCd?�ZDd@�ZEdA�ZFdB�ZGdC�ZHdD�ZIdE�ZJdF�ZKdG�ZLdH�ZMdI�ZNyJ)K�CAPITestc�<�t�}|jt|�|j��|j|j �|u�|j|jj
tj
�|jtjj
tj
�dtj_|jtjd�|jtt|jdd�y)N�test� attribute)
r$�assertEqualr)�
assertTruer"�__doc__r.�assertRaises�AttributeError�setattr�r!�insts r�test_instancemethodzCAPITest.test_instancemethodMs����������D��4�7�7�9�-�����)�)�+�t�3�4�����*�*�2�2�L�4H�4H�I�����4�4�<�<�l�>R�>R�S�06��#�#�-�����/�/��8����.�'�4�3D�3D�k�SY�Zrc��tjd�}td|�\}}|\}}}|j|d�dj �}|j|j
�j|�|�y)Nz�
import _testcapi
from test import support
with support.SuppressCrashReport():
_testcapi.crash_no_current_thread()
�-crz�Fatal Python error: PyThreadState_Get: the function must be called with the GIL held, after Python initialization and before Python finalization, but the GIL is released (the current Python thread state is NULL))�textwrap�dedentr
r/�encoder0�rstrip�
startswith)r!�code�
run_result� _cmd_line�_rc�outr�msgs r� test_no_FatalError_infinite_loopz)CAPITest.test_no_FatalError_infinite_loopXs{����� �
��!5�T�4� @��
�I�"�
��S�#�����c�"�;�=C�F�H� �
����
�
��/�/��4�� rc�L�|jttj�y�N)r2�
ValueErrorr�!make_memoryview_from_NULL_pointerr s r�!test_memoryview_from_NULL_pointerz*CAPITest.test_memoryview_from_NULL_pointerns�����*�i�&Q�&Q�Rrz(_posixsubprocess required for this test.c�v�Gd�dt�}|jtd�5tjd|�ddddd d
ddd
dddddddddddd�ddd�Gd�dt�}|jttjd|�ddddd d
ddd
dddddddddddd�y#1swY�YxYw)Nc��eZdZd�Zy)�1CAPITest.test_seq_bytes_to_charp_array.<locals>.Zc��y�N�rr s r�__len__z9CAPITest.test_seq_bytes_to_charp_array.<locals>.Z.__len__u���rN�r%r&r'rQrrr�ZrMt���
rrT�indexingrPT�rP������ �
���
��F����c��eZdZd�Zd�Zy)rMc�"�tjSrG)�sys�maxsizer s rrQz9CAPITest.test_seq_bytes_to_charp_array.<locals>.Z.__len__|s���{�{�"rc��y)N�xr)r!�is r�__getitem__z=CAPITest.test_seq_bytes_to_charp_array.<locals>.Z.__getitem__~���rN)r%r&r'rQrorrrrTz1CAPITest.test_seq_bytes_to_charp_array.<locals>.Z{s��
#�
r)�object�assertRaisesRegex� TypeError�_posixsubprocess� fork_execr2�MemoryError�r!rTs r�test_seq_bytes_to_charp_arrayz&CAPITest.test_seq_bytes_to_charp_arrayqs��� �� ��
#�
#�I�z�
:��&�&��A�C��V�A�a��!�A�b��B�r�"�T�$�r�RW�XZ�[]�^`�ac�di�
k�;� �� �
���+�'7�'A�'A��A�C��V�A�a��!�A�b��B�r�"�T�$�r�RW�XZ�[]�^`�ac�di� k�;�
:�s�1B/�/B8c��Gd�dt�}|jttj|�dgdddddd d
ddd
ddddddddddd�y)Nc��eZdZd�Zy)�-CAPITest.test_subprocess_fork_exec.<locals>.Zc��yrOrr s rrQz5CAPITest.test_subprocess_fork_exec.<locals>.Z.__len__�rRrNrSrrrrTr{�rUrrT�1TrWrYrZr[r\r]r^r_r`rarbrcFrdrerfrg)rqr2rsrtrurws r�test_subprocess_fork_execz"CAPITest.test_subprocess_fork_exec�sd�� �� �
���)�%5�%?�%?��#�t�f�T�&��1�Q�q��2�b��B�r�$�t�TV�W\�]_�`b�ce�fh�in� prz6Signature information for builtins requires docstringsc�D�|jtjjd�|jtjjd�|jtj
jd�|jtj
jd�|jtjjd�|jtjjd�|jtjjd�|jtjjd�|jtjjd�|jtjjd�|jtjjd�|jtjjd�|jtjjd�|jtjjd�|jtjjd�|jtjjd�y)Nz This docstring has no signature.z[docstring_with_invalid_signature($module, /, boo)
This docstring has an invalid signature.zedocstring_with_invalid_signature2($module, /, boo)
--
This docstring also has an invalid signature.z%This docstring has a valid signature.z($module, /, sig)z>
This docstring has a valid signature and some extra newlines.z($module, /, parameter))r/r�no_docstringr1�__text_signature__�docstring_empty�docstring_no_signature� docstring_with_invalid_signature�!docstring_with_invalid_signature2�docstring_with_signature�#docstring_with_signature_but_no_doc�+docstring_with_signature_and_extra_newlinesr s r� test_docstring_signature_parsingz)CAPITest.test_docstring_signature_parsing�s���
����/�/�7�7��>�����/�/�B�B�D�I�����2�2�:�:�D�A�����2�2�E�E�t�L�����9�9�A�A�.� 0�����9�9�L�L�d�S�����C�C�K�K�
7� �
����C�C�V�V�X\�]�����D�D�L�L�
<� �
����D�D�W�W�Y]�^�����;�;�C�C�3� 5�����;�;�N�N�Pc�d�����F�F�N�N�PT�U�����F�F�Y�Y�� !�
����N�N�V�V�M� O�����N�N�a�a�%� 'rc�x�tj}|�}|�}|j||zd||f�|j|dzd|df�|jd|zdd|f�|}||z}|j|d||f�|}|dz}|j|d|df�d}||z}|j|dd|f�y)N�matmul�*�imatmul)r�
matmulTyper/)r!�M�m1�m2�os r�&test_c_type_with_matrix_multiplicationz/CAPITest.test_c_type_with_matrix_multiplication�s���� � ��
�S��
�S������b��8�R��"4�5�����b��8�R��"4�5�����b��8�R��"4�5��� �R�������Y��B�/�0��� �R�������Y��B�/�0��� �R�������X�r�2�.�/rc��tj�}|j|jd�d�|j|jdd�d�y)NrP)rPNrX)rXrX)r�ipowTyper/�__ipow__)r!r�s r�test_c_type_with_ipowzCAPITest.test_c_type_with_ipow�sE��
��� ��������A�� �2�������A�q�)�6�2rc�p�tjrCtjd�}t d|�\}}}t|�}|j
|d�y|jt�5}tj�ddd�|j
tj�d�y#1swY�/xYw)Nz�
import _testcapi
from test import support
with support.SuppressCrashReport():
_testcapi.return_null_without_error()
r9a#Fatal Python error: _Py_CheckFunctionResult: a function returned NULL without setting an exception\nPython runtime state: initialized\nSystemError: <built-in function return_null_without_error> returned NULL without setting an exception\n\nCurrent thread.*:\n File .*", line 6 in <module>\nzFreturn_null_without_error.* returned NULL without setting an exception)
r�Py_DEBUGr:r;rr�assertRegexr2�SystemErrorr�return_null_without_error�str� exception�r!r?�rcrCr�cms r�test_return_null_without_errorz'CAPITest.test_return_null_without_error�s�������?�?�$��D�1��t�<�L�B��S���$�C����S�4�
5��"�"�;�/�2��3�3�5�0����S����.�J�
K�0�/���)B,�,B5c�p�tjrCtjd�}t d|�\}}}t|�}|j
|d�y|jt�5}tj�ddd�|j
tj�d�y#1swY�/xYw)Nz�
import _testcapi
from test import support
with support.SuppressCrashReport():
_testcapi.return_result_with_error()
r9aqFatal Python error: _Py_CheckFunctionResult: a function returned a result with an exception set\nPython runtime state: initialized\nValueError\n\nThe above exception was the direct cause of the following exception:\n\nSystemError: <built-in function return_result_with_error> returned a result with an exception set\n\nCurrent thread.*:\n File .*, line 6 in <module>\nzBreturn_result_with_error.* returned a result with an exception set)
rr�r:r;rrr�r2r�r�return_result_with_errorr�r�r�s r�test_return_result_with_errorz&CAPITest.test_return_result_with_error�s�������?�?�$��D�1��t�<�L�B��S���$�C����S�
7�
8� �"�"�;�/�2��2�2�4�0����S����.�G�
H�0�/�r�c��tjd�}td|�\}}}t|�}d|vr|j |d�y|jd|�y)Nz�
import _testcapi
from test import support
with support.SuppressCrashReport():
_testcapi.getitem_with_error({1: 2}, 1)
r9z
SystemError: aFatal Python error: _Py_CheckSlotResult: Slot __getitem__ of type dict succeeded with an exception set\nPython runtime state: initialized\nValueError: bug\n\nCurrent thread .* \(most recent call first\):\n File .*, line 6 in <module>\n\nExtension modules: _testcapi \(total: 1\)\nz'returned a result with an exception set)r:r;rrr��assertIn�r!r?r�rCrs r�test_getitem_with_errorz CAPITest.test_getitem_with_errorse����� �
��-�T�4�8���C���C� ���#�%����S� C�
D�
�M�M�C�S�Irc �N
�tj}|j|d�d�|j|d�d�|j|d�g�|j|d�i�|j|d�dgif�|j|dd�d�|j|d d�d
�|j|dd�dg�|jt|dd�|j|d
dd�d�|j|ddd�d�|j|ddd�ddg�|j|ddd�ddi�|j|ddddd�ddd��|j|dd�d�|j|ddd�d�|j|d�d�|j|dd�d�|j|dd�d�|j|ddd�d�|j|ddd�d�|j|d dd�d�|j|d!dd�d�|j|d"dd�d�|j|d#dd�d�|j|d$dd�d�|j|d%dd�d�|j|d&dd�d�|j|d'dd�ddg�|j|d(dd�ddg�|j|d)dd�ddg�|j|d*dd�ddi�|j|d+dddd�ddd��|j|d,dddd�ddd��|j|d-dddd�ddd��|j|d.dddd�ddd��|jt|dt
�|jt|d t
�|jt|dt
�|jt|dt
�|jt|d
dt
�|jt|d
t
d�|jt|ddt
�|jt|dt
d�|jt|ddt
�|jt|dt
d�|jt|ddt
�|jt|dt
d�y)/Nr�()rz[]z{}z()[]{}�OrPz(O)�rPz[O]z{O}�OOrXrWz(OO)z[OO]z{OO}z{OOOO}��)rPr�z((O)))r�z((OO)))rWz ,:z O z O zO,OzO, OzO, OzO OzO Oz(O,O)z(O, O)z ( O O) z ( O O) z[O,O]z[O, O]z [ O O] z{O:O}z {O:O,O:O}z{O: O, O: O}z { O O O O} z { O O O O} )r�
py_buildvaluer/r2r��NULL)r!�
buildvalues r�test_buildvaluezCAPITest.test_buildvalue-s����,�,�
�����B���.�����D�)�2�.�����D�)�2�.�����D�)�2�.�����H�-��B��|�<�����C��+�Q�/�����E�1�-�t�4�����E�1�-��s�3����+�z�5�!�<�����D�!�Q�/��8�����F�A�q�1�6�:�����F�A�q�1�A�q�6�:�����F�A�q�1�A�q�6�:�����H�a��A�q�9�q�Q�<�H�����G�Q�/��9�����H�a��3�Y�?�����G�,�d�3�����I�q�1�1�5�����G�Q�/��3�����E�1�a�0�&�9�����F�A�q�1�6�:�����G�Q��2�F�;�����E�1�a�0�&�9�����F�A�q�1�6�:�����G�Q��2�F�;�����H�a��3�V�<�����J��1�5�v�>�����N�A�q�9�6�B�����G�Q��2�Q��F�;�����H�a��3�a��V�<�����J��1�5��1�v�>�����G�Q��2�Q��F�;�����K��A�q�!�<�!��l�K�����N�A�q�!�Q�?�Q�1��N�����N�A�q�!�Q�?�Q�1��N�����$8�!�Q��1�E�1�QR�|�T����+�z�3��=����+�z�5�$�?����+�z�5�$�?����+�z�5�$�?����+�z�4��D�A����+�z�4��q�A����+�z�6�1�d�C����+�z�6�4��C����+�z�6�1�d�C����+�z�6�4��C����+�z�6�1�d�C����+�z�6�4��Crc�f�tj}ddlm}m}m}m}m}m}|j|d|�|�|j|d|�|�|j|d|�|�|j|d|�|�|j|d|�|�|j|d|�|�|j|dd�d�|j|dd �d �|j|d
d�d�|j|dtd
��d�|j|dd�d�|j|dd�d�|j|dd�d�|j|dd�td��|j|dd�td��|j|dtj�ttj��|jt|dd�|jt|dtjdz�y)Nr)�SHRT_MIN�SHRT_MAX� USHRT_MAX�INT_MIN�INT_MAX�UINT_MAXrn�I�h�H�b�i�����B��c�A�A��������CrP)r�py_buildvalue_intsr�r�r�r�r�r�r/�ord�chrrj�
maxunicoder2rH)r!r�r�r�r�r�r�r�s r�test_buildvalue_intszCAPITest.test_buildvalue_intscs����1�1�
�W�W�����C��1�7�;�����C��1�7�;�����C��2�H�=�����C��2�H�=�����C��2�H�=�����C��3�Y�?�����C��-�s�3�����C��.��5�����C��-�s�3�����C��S��2�D�9�����C��-�w�7�����C��-�w�7�����C��,�g�6�����C��-�s�3�x�8�����C��-�s�3�x�8�����C����8�#�c�n�n�:M�N����*�j�#�r�:����*�j�#�s�~�~�a�7G�Hrc�,�tj�yrG)r�test_buildvalue_Nr s rr�zCAPITest.test_buildvalue_N}s���#�#�%rc�r�tj|�}td|�\}}}|j|d�y)Nr9s`_testcapimodule\.c:[0-9]+: _Py_NegativeRefcount: Assertion failed: object has negative ref count)r:r;rr�r�s r�check_negative_refcountz CAPITest.check_negative_refcount�s9�����t�$��,�T�4�8���C������;� <r�negative_refcountz"need _testcapi.negative_refcount()c�*�d}|j|�y)Nz�
import _testcapi
from test import support
with support.SuppressCrashReport():
_testcapi.negative_refcount()
�r��r!r?s r�test_negative_refcountzCAPITest.test_negative_refcount�s����
�$�$�T�*r�decref_freed_objectz$need _testcapi.decref_freed_object()zuse after free on purposeT)�address�memory�ubc�*�d}|j|�y)Nz�
import _testcapi
from test import support
with support.SuppressCrashReport():
_testcapi.decref_freed_object()
r�r�s r�test_decref_freed_objectz!CAPITest.test_decref_freed_object�s��
��
�$�$�T�*rc�F�ddlm}d}td�D]}||f�}�
y)Nr��MyList��)rr��range)r!r��Lrns r�test_trashcan_subclasszCAPITest.test_trashcan_subclass�s%�� %����t��A���t��A�r�cpuc�.�|jt�yrG)�do_test_trashcan_python_class�listr s r�test_trashcan_python_class1z$CAPITest.test_trashcan_python_class1�s���*�*�4�0rc�2�ddlm}|j|�y)Nrr�)rr�r�)r!r�s r�test_trashcan_python_class2z$CAPITest.test_trashcan_python_class2�s��$��*�*�6�2rc���Gd�d|�}dD]b}d}td�D]}||f�}||_�|r|f}|j|jd�~|j |jd��dy)Nc�,��eZdZdZ�fd�Z�fd�Z�xZS)�6CAPITest.do_test_trashcan_python_class.<locals>.PyListrc�H���xjdz
c_t�|�|�yrO)�num�super�__init__)r!�args� __class__s �rr�z?CAPITest.do_test_trashcan_python_class.<locals>.PyList.__init__�s����
�
��"�
��� �$�'rc�0���xjdzc_yrO)r��r!r�s �r�__del__z>CAPITest.do_test_trashcan_python_class.<locals>.PyList.__del__�s����
�
��"�
r)r%r&r'r�r�r��
__classcell__�r�s@r�PyListr��s����C�
(�
#�
#rr�)rrPir)r��attr�
assertGreaterr�r/)r!�baser��parityr�rns rr�z&CAPITest.do_test_trashcan_python_class�sx�� #�T� #��F��A��5�\���A�4�L�����"���D�����v�z�z�1�-�����V�Z�Z��+�rc��|jtjjd�|jtjjd�y)N�somedocz(arg1, arg2))r/r�HeapDocCTyper1r�r s r�&test_heap_ctype_doc_and_text_signaturez/CAPITest.test_heap_ctype_doc_and_text_signature�s<��
����/�/�7�7��C�����/�/�B�B�N�Src�X�|jtjjd�yrG)r/r�
NullTpDocTyper1r s r�test_null_type_doczCAPITest.test_null_type_doc�s������0�0�8�8�$�?rc�0�Gd�dtj�}|�}tj|�}|j |j
d�|j |jd�~|j |dz
tj|��y)Nc���eZdZ�fd�Z�xZS)�`CAPITest.test_subclass_of_heap_gc_ctype_with_tpdealloc_decrefs_once.<locals>.HeapGcCTypeSubclassc�0��d|_t�|� �y�Nre��value2r�r�r�s �rr�ziCAPITest.test_subclass_of_heap_gc_ctype_with_tpdealloc_decrefs_once.<locals>.HeapGcCTypeSubclass.__init__����� ����� �"r�r%r&r'r�r�r�s@r�HeapGcCTypeSubclassr
��
���
#�
#rrr^rerP)r�HeapGcCTyperj�getrefcountr/�valuer)r!r�subclass_instance�type_refcnts r�:test_subclass_of_heap_gc_ctype_with_tpdealloc_decrefs_oncezCCAPITest.test_subclass_of_heap_gc_ctype_with_tpdealloc_decrefs_once�s��� #�)�"7�"7� #�
0�1���o�o�&9�:��
���*�0�0�"�5����*�1�1�2�6�
�����q��#�/�/�:M�*N�Orc����Gd�dtj��G��fd�d�����}tj��}tj��}|j |j
d�|j |jd�~tjr|j |�j�n|j |dz
�j�|j |dz�j�|j |dz
tj���|j |tj���y)Nc���eZdZ�fd�Z�xZS)�dCAPITest.test_subclass_of_heap_gc_ctype_with_del_modifying_dunder_class_only_decrefs_once.<locals>.Ac�0��d|_t�|� �yrr
r�s �rr�zmCAPITest.test_subclass_of_heap_gc_ctype_with_del_modifying_dunder_class_only_decrefs_once.<locals>.A.__init__�rrrr�s@rr�r�rrr�c�,���eZdZ�fd�Z��fd�Z�xZS)�dCAPITest.test_subclass_of_heap_gc_ctype_with_del_modifying_dunder_class_only_decrefs_once.<locals>.Bc�"��t�|��yrG)r�r�r�s �rr�zmCAPITest.test_subclass_of_heap_gc_ctype_with_del_modifying_dunder_class_only_decrefs_once.<locals>.B.__init__�s����� �"rc�|���|_tj���_tj���_yrG)r�rjr�
refcnt_in_del)r!r�r�s ��rr�zlCAPITest.test_subclass_of_heap_gc_ctype_with_del_modifying_dunder_class_only_decrefs_once.<locals>.B.__del__�s*���!"���"%�/�/�!�"4���"%�/�/�!�"4��r)r%r&r'r�r�r�)r�r�r�s@��rr�r�s���
#�
5�
5rr�r^rerP)
rrrjrr/rrrr�r!)r!rr�new_type_refcntr�r�s @@r�Ptest_subclass_of_heap_gc_ctype_with_del_modifying_dunder_class_only_decrefs_oncezYCAPITest.test_subclass_of_heap_gc_ctype_with_del_modifying_dunder_class_only_decrefs_once�s��� #� �%�%� #�
5�� 5��C���o�o�a�(���/�/�!�,��
���*�0�0�"�5����*�1�1�2�6�����
���[�!�/�/�:����[�1�_�a�o�o�>�����1�,�a�o�o�>�
����q��#�/�/�!�*<�=�
����#�/�/�!�*<�=rc�Z�tj�}d|_|j|jd�|j|j|j
�|j|jddi�tj�}|ji|j
�y�Nr��foo)r�HeapCTypeWithDictr&r/�dictobj�__dict__r5s r�test_heaptype_with_dictz CAPITest.test_heaptype_with_dicts}���*�*�,�����������2�&�������t�}�}�5��������r�{�3��*�*�,������T�]�]�+rc�~�tj�}d|_|j|jd�|j|jddi�tj�}|ji|j�tj�}tj�}||_||_~~yr%)r�HeapCTypeWithManagedDictr&r/r)r��a)r!r6r-r�s r�test_heaptype_with_managed_dictz(CAPITest.test_heaptype_with_managed_dicts����1�1�3�����������2�&����������4��1�1�3������T�]�]�+��.�.�0���.�.�0��������
�qrc�T�Gd�dtj�}|�}||_~y)Nc��eZdZy)�2CAPITest.test_sublclassing_managed_dict.<locals>.CN�r%r&r'rrrr�r1.���rr�)rr,�spam)r!r�rns r�test_sublclassing_managed_dictz'CAPITest.test_sublclassing_managed_dict,s'�� � �2�2� �
�C�����
rc�Z�tj�}d|_|j|jd�|j|j|j
�|j|jddi�tj�}|ji|j
�yr%)r�HeapCTypeWithNegativeDictr&r/r(r)r5s r� test_heaptype_with_negative_dictz)CAPITest.test_heaptype_with_negative_dict5s}���2�2�4�����������2�&�������t�}�}�5��������r�{�3��2�2�4������T�]�]�+rc��tj�}tj|�}|j |�|�|j |j
|�yrG)r�HeapCTypeWithWeakref�weakref�refr/�weakreflist�r!r6r<s r�test_heaptype_with_weakrefz#CAPITest.test_heaptype_with_weakref?sF���-�-�/���k�k�$���������%�����)�)�3�/rc��tj�}tj|�}|j |�|�yrG�r�HeapCTypeWithManagedWeakrefr;r<r/r>s r�"test_heaptype_with_managed_weakrefz+CAPITest.test_heaptype_with_managed_weakrefEs0���4�4�6���k�k�$���������%rc��Gd�dtj�}|�}tj|�}|j |�|�y)Nc��eZdZy)�5CAPITest.test_sublclassing_managed_weakref.<locals>.CNr2rrrr�rFLr3rr�rA)r!r�r6r<s r�!test_sublclassing_managed_weakrefz*CAPITest.test_sublclassing_managed_weakrefJs=�� � �5�5� ��s���k�k�$���������%rc��Gd�dtjtj�}Gd�dtjtj�}||fD]n}|�}tj|�}|j|�|�||_~tj|��}|j|�d��py)Nc��eZdZy)�3CAPITest.test_sublclassing_managed_both.<locals>.C1Nr2rrr�C1rJUr3rrKc��eZdZy)�3CAPITest.test_sublclassing_managed_both.<locals>.C2Nr2rrr�C2rMXr3rrN)rrBr,r;r<r/r4�assertIs)r!rKrN�clsr6r<s r�test_sublclassing_managed_bothz'CAPITest.test_sublclassing_managed_bothSs��� ��6�6� �8Z�8Z� � ��3�3�Y�5Z�5Z� ���8�C��5�D��+�+�d�#�C����S�U�D�)��D�I���+�+�c�e�$�C��M�M�#�%��&�rc�f�tj�}t|�}|j|d�y)Ns1234)r�HeapCTypeWithBuffer�bytesr/)r!r6r�s r�test_heaptype_with_bufferz"CAPITest.test_heaptype_with_bufferds)���,�,�.���$�K������G�$rc�P�tj�}tjtj�}|j |j
d�|j |jd�~|j |dz
tjtj��y�Nr^rerP)r�HeapCTypeSubclassrjrr/rr)r!rrs r�9test_c_subclass_of_heap_ctype_with_tpdealloc_decrefs_oncezBCAPITest.test_c_subclass_of_heap_ctype_with_tpdealloc_decrefs_onceis}��%�7�7�9���o�o�i�&A�&A�B��
���*�0�0�"�5����*�1�1�2�6�
�����q��#�/�/�)�:U�:U�*V�Wrc�&�tj�}tjtj�}tjtj�}|j|jd�|j|jd�~tjr+|j|tjj�n-|j|dz
tjj�|j|dztjj�|j|dz
tjtj��|j|tjtj��yrW)r�HeapCTypeSubclassWithFinalizerrjrrXr/rrrr�r!)r!rrr"s r�Otest_c_subclass_of_heap_ctype_with_del_modifying_dunder_class_only_decrefs_oncezXCAPITest.test_c_subclass_of_heap_ctype_with_del_modifying_dunder_class_only_decrefs_onceus��%�D�D�F���o�o�i�&N�&N�O���/�/�)�*E�*E�F��
���*�0�0�"�5����*�1�1�2�6�
����
���[�)�*R�*R�*`�*`�a����[�1�_�i�.V�.V�.d�.d�e�����1�,�i�.I�.I�.W�.W�X�
����q��#�/�/�)�:b�:b�*c�d�
����#�/�/�)�:U�:U�*V�Wrc���tj�}|j|jd�d|_|j|jd�|`|j|jd�y)Nr^r`r)r�HeapCTypeSetattrr/�pvaluer)r!�objs r�test_heaptype_with_setattroz$CAPITest.test_heaptype_with_setattro�sX���(�(�*��������R�(��� �������R�(��I�������Q�'rc��tj}|jt|t��tj|�}|j
|t�|j|jd�|jt |�|�|ddi�}|j
|t�|j|jd�y)N�HeapCTypeViaMetaclass�PyClassViaMetaclassr)
r�HeapCTypeMetaclassr0�
issubclass�type�pytype_fromspec_meta�assertIsInstancer/r%rO�r!� metaclass�ts r�#test_heaptype_with_custom_metaclassz,CAPITest.test_heaptype_with_custom_metaclass�s����0�0� ����
�9�d�3�4�
�*�*�9�5�����a��&�������%<�=��
�
�d�1�g�y�)�
�+�R��4�����a��&�������%:�;rc��tj}|jt|t��tj|�}|j
|t�|j|jd�|jt |�|�|jtd�5|ddi�ddd�y#1swYyxYw)Nrczcannot create .* instancesrdr)r�HeapCTypeMetaclassNullNewr0rfrgrhrir/r%rOrrrsrjs r�,test_heaptype_with_custom_metaclass_null_newz5CAPITest.test_heaptype_with_custom_metaclass_null_new�s����7�7� ����
�9�d�3�4�
�*�*�9�5�����a��&�������%<�=��
�
�d�1�g�y�)��
#�
#�I�/K�
L��+�R��4�M�
L�
L�s�(B<�<Cc��tj}|jttjt��d}|jt|�5tj|�}ddd�y#1swYyxYw)Nz1Metaclasses with custom tp_new are not supported.)r�HeapCTypeMetaclassCustomNewr0rfrgrrrsrh)r!rkrDrls r�.test_heaptype_with_custom_metaclass_custom_newz7CAPITest.test_heaptype_with_custom_metaclass_custom_new�sW���9�9� ����
�9�#H�#H�$�O�P�A��
�
#�
#�I�s�
3��.�.�y�9�A�4�
3�
3�s�A5�5A>c� �tj}Gd�d|��}tjdtf�5tj|�}ddd�|j
t|��|j||�y#1swY�7xYw)Nc��eZdZy)�FCAPITest.test_heaptype_with_custom_metaclass_deprecation.<locals>.BaseNr2rrr�Baserv�r3rrw)rkz8.* _testcapi.Subclass .* custom tp_new.*in Python 3.14.*) rrrr �check_warnings�DeprecationWarning�make_type_with_baser0rfri)r!rkrw�subs r�/test_heaptype_with_custom_metaclass_deprecationz8CAPITest.test_heaptype_with_custom_metaclass_deprecation�sy���9�9� �
�Y� ��
+�
+�K�M_�`���/�/��5�C��
���
�3��-�.����c�9�-���s�B�B
c�L�|jt�5Gd�dtjtj�}ddd�|jt�5Gd�dtjtj�}ddd�y#1swY�PxYw#1swYyxYw)Nc��eZdZy)�MCAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict.<locals>.Both1Nr2rrr�Both1r����rr�c��eZdZy)�MCAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict.<locals>.Both2Nr2rrr�Both2r��r�rr�)r2rsrr:r')r!r�r�s r�5test_multiple_inheritance_ctypes_with_weakref_or_dictz>CAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict�ss��
�
�
�y�
)�
� �6�6� �8S�8S�
�*��
�
�y�
)�
� �3�3�Y�5S�5S�
�*�
)�*�
)��*�
)�s�)B�)B�B�B#c�0�|jt�5Gd�dtjt�}ddd�|jt�5Gd�dtj
t�}ddd�Gd�dtjt�}Gd�dtjt�}|�}|jd �t|j�|�}|jd �t|j�tjtjfD]K}tjtj
fD]}Gd
�d||�}�Gd�d
||�} Gd�d||�}
�My#1swY��KxYw#1swY��xYw)Nc��eZdZy)�\CAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtin.<locals>.C1Nr2rrrrKr��r�rrKc��eZdZy)�\CAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtin.<locals>.C2Nr2rrrrNr��r�rrNc��eZdZy)�\CAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtin.<locals>.C3Nr2rrr�C3r��r3rr�c��eZdZy)�\CAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtin.<locals>.C4Nr2rrr�C4r��r3rr�rc��eZdZy)�[CAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtin.<locals>.SNr2rrr�Sr��s��rr�c��eZdZy)�\CAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtin.<locals>.B1Nr2rrr�B1r��r�rr�c��eZdZy)�\CAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtin.<locals>.B2Nr2rrr�B2r��r�rr�)r2rsrr'r�r:r,rB�appendr�r)�__weakref__)r!rKrNr�r�r6rP�cls2r�r�r�s r�Gtest_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtinzPCAPITest.test_multiple_inheritance_ctypes_with_weakref_or_dict_and_other_builtin�s.��
�
�
�y�
)�
�Y�0�0�$�
�*��
�
�y�
)�
�Y�3�3�T�
�*� ��3�3�T� � ��6�6�� ��t�����A���D�M�M���t�����A���D�����6�6� �8]�8]�^�C�"�4�4�i�6T�6T�U����T��V�
�R��
�
�R��
�
_�+*�
)��*�
)�s�E>�F�>F�Fc���td�D]P}|j|��5|jt�5tj|�ddd�ddd��Ry#1swY�xYw#1swY�ixYw)NrX)�variant)r��subTestr2r�r�create_type_from_repeated_slots)r!r�s r�(test_pytype_fromspec_with_repeated_slotsz1CAPITest.test_pytype_fromspec_with_repeated_slots�sW���Q�x�G����g��.��&�&�{�3��=�=�g�F�4�/�.� �3�3��/�.�s"�A,�A �
A,� A)�%A,�,A5 ��categoryc��tjdd��Gd�d�}|jt�5tj|�}ddd��}|j
|j�d�|jtd�5d�|_ddd�|j
|j�d�d �|_|j
|j�d
�y#1swY��xYw#1swY�^xYw)Nz-creating immutable classes with mutable bases)r�rb)�removec��eZdZd�Zy)�CCAPITest.test_immutable_type_with_mutable_base.<locals>.MutableBasec��y)N�originalrr s rrzHCAPITest.test_immutable_type_with_mutable_base.<locals>.MutableBase.meths��!rN)r%r&r'rrrr�MutableBaser�s��
"rr�r�z-cannot set 'meth' attribute of immutable typec��y)N�
overriddenrr s r�<lambda>z@CAPITest.test_immutable_type_with_mutable_base.<locals>.<lambda>s��,rc��y)N�changedrr s rr�z@CAPITest.test_immutable_type_with_mutable_base.<locals>.<lambda>s�� rr�)
�warnings�_deprecated�assertWarnsryr�make_immutable_type_with_baser/rrrrs)r!r��ImmutableSubclass�instances r�%test_immutable_type_with_mutable_basez.CAPITest.test_immutable_type_with_mutable_base�s��� ���;�G� M� "� "��
�
�0�
1� )� G� G��!��2�%�&���������*�5��
#�
#��?�A�&?��"�A�
�������*�5�2����������)�4�!2�
1��A�A�s�C,� C8�,C5�8Dc ��ddlm}d}d}Gd�d�}d}|D]�\}}}|j|||��5|j|||�|�|j|||�d |z�|j|||�|�|�|j|||�|�|j|||�d |z�|j|||�|�|�ddd���|j t
||d
�d�|j t
||d�d�|j t
|d
d�|j t
|dd�|j t|dd�y#1swY��_xYw)
Nr)�pynumber_tobase�{lc��eZdZd�Zd�Zy)�*CAPITest.test_pynumber_tobase.<locals>.IDXc��||_yrG��val)r!r�s rr�z3CAPITest.test_pynumber_tobase.<locals>.IDX.__init__ s ����rc��|jSrGr�r s r� __index__z4CAPITest.test_pynumber_tobase.<locals>.IDX.__index__"s���x�x�rN)r%r&r'r�r�rrr�IDXr�s��
�
rr�))rX� 0b1111011�C0b10000000000000000000000000000000000000000000000000000000000000000)r\�0o173�0o2000000000000000000000)r^�123�18446744073709551616)��0x7b�0x10000000000000000)r��st�lt�-g�^@r^r�)rr�r�r/r2rsr�) r!r��small_number�large_numberr��
test_casesr��small_target�large_targets r�test_pynumber_tobasezCAPITest.test_pynumber_tobasesh��-����� � �;�
�1;�,�D�,�����4�L�\��J�� � ���t�!D�l�S�� � ��,���!E�s�\�GY�Z�� � ���\�1B�D�!I�<�X�� � ���t�!D�l�S�� � ��,���!E�s�\�GY�Z�� � ���\�1B�D�!I�<�X�K�J�1;�
���)�_�c�%�j�"�E����)�_�c�%�j�"�E����)�_�e�R�@����)�_�e�R�@����+���Q�?�K�J�s�B+E.�.E8 c�P�tj�}|j|d�y�Nz<NULL>)r�pyobject_repr_from_nullr/�r!�ss r�test_pyobject_repr_from_nullz%CAPITest.test_pyobject_repr_from_null9s ���-�-�/������H�%rc�P�tj�}|j|d�yr�)r�pyobject_str_from_nullr/r�s r�test_pyobject_str_from_nullz$CAPITest.test_pyobject_str_from_null=s ���,�,�.������H�%rc�P�tj�}|j|d�y)Ns<NULL>)r�pyobject_bytes_from_nullr/r�s r�test_pyobject_bytes_from_nullz&CAPITest.test_pyobject_bytes_from_nullAs ���.�.�0������I�&rc��tj}d}||�}t|dd�}|j|j|j�y)Ns%# -*- coding: latin1 -*-
print('¤')
z<string>�exec)r�Py_CompileString�compiler/� co_consts)r!�_compiler?�result�expecteds r�test_Py_CompileStringzCAPITest.test_Py_CompileStringEsE���-�-��?���$����4��V�4������)�)�8�+=�+=�>rc�b�tjd�}g}ttd�r|j d�t
jdk7r|j d�|D]B}|j|��5|jt|j|��ddd��Dy#1swY�OxYw)N�ctypes�
get_native_id�PyThread_get_thread_native_id�nt�
Py_FrozenMain)�name)
r�
import_module�hasattr�_threadr��osr�r�r0� pythonapi)r!r��namesr�s r�test_export_symbolszCAPITest.test_export_symbolsMs����,�,�X�6�����7�O�,��L�L�8�9��7�7�d�?��L�L��)��D����4��(������(8�(8�$� ?�@�)�(��(�(�s�4&B%�%B. c�4�Gd�d�}|�}tj|�|j|ji�|�}|j|jddi�tj|�|j|ji�y)Nc��eZdZd�Zy)�+CAPITest.test_clear_managed_dict.<locals>.Cc��d|_yrO�r-r s rr�z4CAPITest.test_clear_managed_dict.<locals>.C.__init__gs ����rN)r%r&r'r�rrrr�r�fs��
rr�r-rP)r�clear_managed_dictr/r))r!r�r�s r�test_clear_managed_dictz CAPITest.test_clear_managed_dictdsx�� � �
�C���$�$�Q�'�������R�(�
�C��������c�!�W�-��$�$�Q�'�������R�(rc���d�}Gd�d�}|jtj|�d�|jtj|j�d�|jtj|�j�d�|jtjt�d�|jtj|�d�y)Nc��yrGrrrr�function_examplez:CAPITest.test_eval_get_func_name.<locals>.function_examples���rc��eZdZd�Zy)�+CAPITest.test_eval_get_func_name.<locals>.Ac��yrGrr s r�method_examplez:CAPITest.test_eval_get_func_name.<locals>.A.method_examplev���crN�r%r&r'rrrrr�ru���)rr�rr�sumrg)r/r�eval_get_func_namerr
�r!rr�s r�test_eval_get_func_namez CAPITest.test_eval_get_func_namers���#� *� *�
����5�5�6F�G�+� -�����5�5�a�6F�6F�G�)� +�����5�5�a�c�6H�6H�I�)� +�����5�5�c�:�E�B�����5�5�a�8�&�Arc���d�}Gd�d�}|jtj|�d�|jtj|j�d�|jtj|�j�d�|jtjt�d�|jtj|�d�y)Nc��yrGrrrrrz:CAPITest.test_eval_get_func_desc.<locals>.function_example�rrc��eZdZd�Zy)�+CAPITest.test_eval_get_func_desc.<locals>.Ac��yrGrr s rrz:CAPITest.test_eval_get_func_desc.<locals>.A.method_example�rrNrrrrr�r�r rr�r�z object)r/r�eval_get_func_descrr
rs r�test_eval_get_func_descz CAPITest.test_eval_get_func_desc�s���#� *� *�
����5�5�6F�G�� �����5�5�a�6F�6F�G�� �����5�5�a�c�6H�6H�I�� �����5�5�c�:�D�A�����5�5�a�8�)�Drc�*�ddl}d�}tj|�}|j||j�|j||j�|jt�5tjd�ddd�y#1swYyxYw)Nrc��yrGrrrr�somez-CAPITest.test_function_get_code.<locals>.some����r) �typesr�function_get_coderi�CodeTyper/�__code__r2r�)r!rrr?s r�test_function_get_codezCAPITest.test_function_get_code�sl��� ��*�*�4�0�����d�E�N�N�3�����t�}�}�-�
�
�
�{�
+��'�'��-�,�
+�
+�s�*B � Bc��d�}tj|�}|j|t�|j ||j
�|j
t�5tjd�ddd�y#1swYyxYw)Nc��yrGrrrrrz0CAPITest.test_function_get_globals.<locals>.some�rr)r�function_get_globalsri�dictr/�__globals__r2r�)r!r�globals_s r�test_function_get_globalsz"CAPITest.test_function_get_globals�sg�� ��1�1�$�7�����h��-�����4�#3�#3�4�
�
�
�{�
+��*�*�4�0�,�
+�
+��� A?�?Bc��d�}tj|�}|j|t�|j ||j
�|j
t�5tjd�ddd�y#1swYyxYw)Nc��yrGrrrrrz/CAPITest.test_function_get_module.<locals>.some�rr)r�function_get_modulerir�r/r&r2r�)r!r�modules r�test_function_get_modulez!CAPITest.test_function_get_module�se�� ��.�.�t�4�����f�c�*��������1�
�
�
�{�
+��)�)�$�/�,�
+�
+�r%c�� ddd�d�}tj|�}|j|d�|j||j�|j t
�5tjd�ddd�y#1swYyxYw)NT��kw2c��yrGr�� pos_only1� pos_only2�zero�optional�kw1r-s rrz1CAPITest.test_function_get_defaults.<locals>.some����
r��prN)r�function_get_defaultsr/�__defaults__r2r��r!r�defaultss r�test_function_get_defaultsz#CAPITest.test_function_get_defaults�sw��!$�!� ��
��2�2�4�8������>�2�����4�#4�#4�5�
�
�
�{�
+��+�+�D�1�,�
+�
+�s�"B�B
c�� ddd�d�}d}|jtj|�|�|j|j|�|j t
�5tj
|d�ddd�|jtj|�|�|j|j|�|j t
�5tj
dd�ddd�|jtj|�|�|j|j|�d}tj
||�|jtj|�|�|j|j|�d}tj
||�|jtj|�|�|j|j|�Gd�d t�}|d
ddgdf�}tj
||�|jtj|�|�|j|j|�tj
|d�|jtj|�d�|j|jd�y#1swY��=xYw#1swY���xYw)
NTr,c��yrGrr/s rrz1CAPITest.test_function_set_defaults.<locals>.some�r5rr6rPr)�qrPNc��eZdZy)�5CAPITest.test_function_set_defaults.<locals>.tuplesubNr2rrr�tuplesubrA���rrBrWr-r�)r/rr8r9r2r��function_set_defaults�tuple)r!r�old_defaults�new_defaultsrBs r�test_function_set_defaultsz#CAPITest.test_function_set_defaults�s9��!$�!� ��
�&������8�8��>��M�����*�*�L�9�
�
�
�{�
+��+�+�D�!�4�,�����8�8��>��M�����*�*�L�9�
�
�
�{�
+��+�+�A�r�2�,�����8�8��>��M�����*�*�L�9�%���'�'��l�;�����8�8��>��M�����*�*�L�9����'�'��l�;�����8�8��>��M�����*�*�L�9�"�u�"���#�s��T� :�;���'�'��l�;�����8�8��>��M�����*�*�L�9� �'�'��d�3�����8�8��>��E�����*�*�D�1�A,�
+��
,�
+�s�"J4�K�4J>�Kc�� ddd�d�}tj|�}|j|ddi�|j||j�|j t
�5tjd�ddd�y#1swYyxYw)NTr,c��yrGrr/s rrz4CAPITest.test_function_get_kw_defaults.<locals>.some�r5rr-r6)r�function_get_kw_defaultsr/�__kwdefaults__r2r�r:s r�test_function_get_kw_defaultsz&CAPITest.test_function_get_kw_defaults�s{��!$�!� ��
��5�5�d�;������E�4�=�1�����4�#6�#6�7�
�
�
�{�
+��.�.�t�4�,�
+�
+�s�$B�Bc�� d dd�d�}ddi}|jtj|�|�|j|j|�|j t
�5tj
|d�ddd�|jtj|�|�|j|j|�|j t
�5tj
di�ddd�|jtj|�|�|j|j|�ddi}tj
||�|jtj|�|�|j|j|�i}tj
||�|jtj|�|�|j|j|�Gd�dt�}|ddi�}tj
||�|jtj|�|�|j|j|�tj
|d�|jtj|�d�|j|jd�y#1swY��<xYw#1swY���xYw)
NTr,c��yrGrr/s rrz4CAPITest.test_function_set_kw_defaults.<locals>.some r5rr-rP�rPrXr�c��eZdZy)�7CAPITest.test_function_set_kw_defaults.<locals>.dictsubNr2rrr�dictsubrR,rCrrSr6)r/rrKrLr2r��function_set_kw_defaultsr!)r!rrFrGrSs r�test_function_set_kw_defaultsz&CAPITest.test_function_set_kw_defaultss;��!$�!� ��
��t�}������;�;�D�A�<�P�����,�,�l�;�
�
�
�{�
+��.�.�t�Q�7�,�����;�;�D�A�<�P�����,�,�l�;�
�
�
�{�
+��.�.�q�"�5�,�����;�;�D�A�<�P�����,�,�l�;��y�)���*�*�4��>�����;�;�D�A�<�P�����,�,�l�;����*�*�4��>�����;�;�D�A�<�P�����,�,�l�;� �d� ���t�}�-���*�*�4��>�����;�;�D�A�<�P�����,�,�l�;� �*�*�4��6�����;�;�D�A�4�H�����,�,�d�3�A,�
+��
,�
+�s�$J5�K�5J?�Kc�P�Gd�dtj�}|�}d|_d|_d|_|j|jd�|j|jd�|j|jd�|`|j
|j�y)Nc��eZdZdZy)�;CAPITest.test_unstable_gc_new_with_extra_data.<locals>.Data)�x�yN)r%r&r'� __slots__rrr�DatarX:s��"�Irr\r^re�)r�ObjExtraDatarYrZ�extrar/�assertIsNone)r!r\�ds r�$test_unstable_gc_new_with_extra_dataz-CAPITest.test_unstable_gc_new_with_extra_data9s��� #�9�)�)� #�
�F�����������������b�!�������b�!�������"�%�
�G����!�'�'�"rN)Or%r&r'r7r�requires_subprocessrErJr�
skipUnlessrtrxr~rrr�r�r�r�r�r�r�r�r�r�r�rr��skip_if_sanitizerr�r��requires_resourcer�r�r�rrrr#r*r.r5r8r?rCrGrQrUrYr\rarmrprsr|r�r�r�r �ignore_warningsryr�r�r�r�r�r�r�r�r
rrr$r*r<rHrMrUrbrrrr+r+Ks��� [�!�W� � �"��#��*S��X���)�+U�V�k�W�k�"�X���)�+U�V�p�W�p��X�_�_�)�M�O�''�O�''�R0�"3�K�: H�DJ�<4D�lI�4&�<��X�����,?�@�=�?�+�?�+��X�����,A�B�?�A��W���:�'+�D�T�C�+�C�A�+���W���u�%�1�&�1��W���u�%�3�&�3�,�8�X�_�_�)�M�O�T�O�T�@�P�"&>�P,�
��,�0�&�
&�'�"%�
X�X�6(�
<�
5�:�.�"��@G�%�_�$�$�.@�A�5�B�5�6@�<&�&�'�?�A�.)�
B�
E�.� 1� 0�2�$/2�b5�$/4�b#rr+c�D�eZdZdZed��Zd�Zd�Zd�Zd�Z d�Z
d�Zy )
�TestHeapTypeRelativez-Test API for extending opaque types (PEP 697)c�0���fd�}tdddddddd tjtjdz
tjdzh�}|D]9}|D]2}t||�
�}�jdi|��5|di|��ddd��4�;y#1swY�AxYw)Nc���tj||�\}}}}}}|dk(r9�
j|j|j��
j|d�n�d|jdf|df||zdf||zdf|jdfg}t |tjd���} �
j|| d | ���
��
j|j||z��
j||z
tj��
j|tjzd��
j|tjzd�y)Nr)rzstart of objectzend of base dataz
subclass datazend of requested subcls datazend of reserved subcls dataz
end of object)�keyz$Offsets not in expected order, got: �rD) r�make_sized_heaptypesr/�
__basicsize__�sorted�operator�
itemgetter�
assertLess�ALIGNOF_MAX_ALIGN_T)�extra_base_size�
extra_sizerw�Subr��data_ptr�data_offset� data_size�offsets�ordered_offsetsr!s �r�checkz@TestHeapTypeRelative.test_heaptype_relative_sizes.<locals>.checkOs\����.�.�#�j�[�2�
B�D�#�x��;� �
�Q��� � ��!3�!3�S�5F�5F�G�� � ��A�.�
+��'�'�);�<� �/�2� �:�-�/M�N� �9�,�.K�L��&�&��8�
��#)��h�6I�6I�!�6L�"M��� � ��_�>��>O�P�!�R�
� � ��!2�!2�K�)�4K�L���� �J� 6� )� =� =�?�
���[�9�+H�+H�H�!�L����Y��)F�)F�F��JrrrPrXr�r�r[r\r��rurvr)rprqror!r�)r!r}�sizesrurvr�s` r�test_heaptype_relative_sizesz1TestHeapTypeRelative.test_heaptype_relative_sizesLs����" K�H��1�a��A�q�!�S��,�,��,�,�Q�.��,�,�Q�.�0�1�� %�O�#�
��O�'1�3��!�T�\�\�)�D�)��M�D�M�*�)�$� %�*�)�s�6 B�Bc�l�tjddd�}|jt|�gd��y)z2Make sure HeapCCollection works properly by itselfrPrXr�rPN)r�HeapCCollectionr/r�)r!�
collections r�test_HeapCCollectionz)TestHeapTypeRelative.test_HeapCCollection~s+���.�.�q�!�Q�7�
�����j�)�9�5rc�B�tddddddddtjtjdz
tjdzh�}|D]�}|j|� �5tjtj|dd�}|ddd�}|j�|jt|�gd
��|j�}|jt|�|�|jt|�dhkd|���ddd���y#1swY��xYw)
�-Test HeapCCollection subclasses work properlyrrPrXr�r�r[r\r�)rvrPzgot N)rprqror�r�subclass_var_heaptyper��set_data_to_3sr/r��get_data�assertGreaterEqual�lenr0�set)r!rrvrwr��mems r�test_heaptype_inherit_itemsizez3TestHeapTypeRelative.test_heaptype_inherit_itemsize�s�����1�a��A�q�!�S��,�,��,�,�Q�.��,�,�Q�.�0�1�� �J������4��5�5��-�-�
�{�A�q�B�� ��A�q�\�
��)�)�+�� � ��j�!1�9�=� �)�)�+���'�'��C��*�=�����C��Q�C��4��w��@�5�4� �4�4�s
�B,D�D c��|jtd��5tjtdd�ddd�y#1swYyxYw)NzACannot extend variable-size class without Py_TPFLAGS_ITEMS_AT_ENDrm���r)r2r�r�subclass_heaptype�intr s r�!test_heaptype_invalid_inheritancez6TestHeapTypeRelative.test_heaptype_invalid_inheritance�s@��
�
�
�{�$;��<�
�'�'��R��3�<�<�<�s �=�Ac��tddddddddtjtjdz
tjdzh�}|D�]�}|D�]�}|D�]N}|j|||� �5||k�r�tj|||d
�}|j
�d}|�}|j|j|j��|jd�|j|j|j��|j|j�d�d|_|j|j|j��|j|j�d�|j|j�|j�|j|j�|j�|jt�5|j!�d
d
d
�|jt�5|j#d�d
d
d
�n7|jt�5tj|||d
�}d
d
d
�|jt�5tj|||d
�}d
d
d
�d
d
d
���Q|j||��5|jt�5tj||dd
�}d
d
d
�d
d
d
�������y
#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY���xYw#1swY�VxYw#1swY��xYw)r�rrPrXr�r�r[r\r�)rurv�offsetTrarbNr~r�)rprqror�r�make_heaptype_with_member�mror/�memb�get_memb�set_membr��get_memb_offsetrsr2r��get_memb_relative�set_memb_relative)r!rrurvr�rwrwr�s r�test_heaptype_relative_membersz3TestHeapTypeRelative.test_heaptype_relative_members�s�����1�a��A�q�!�S��,�,��,�,�Q�.��,�,�Q�.�0�1�� %�O�#�
�#�F����o�R\�ek��l�!�J�.�"+�"E�"E� /�*��f�d�#L�C�#&�7�7�9�Q�<�D�'*�u�H� �,�,�X�]�]�H�<M�<M�<O�P�$�-�-�b�1� �,�,�X�]�]�H�<M�<M�<O�P� �,�,�X�->�->�-@�"�E�,.�H�M� �,�,�X�]�]�H�<M�<M�<O�P� �,�,�X�->�->�-@�"�E� �3�3�H�4L�4L�4N�PT�Pb�Pb�c� �O�O�H�,D�,D�,F��HY�HY�Z�!%�!2�!2�;�!?� (� :� :� <�"@�!%�!2�!2�;�!?� (� :� :�1� =�"@�!?�"&�!2�!2�;�!?�&/�&I�&I�$3�j�[�&�$�'P��"@�"�.�.�{�;�"+�"E�"E� /��V�T�#K�C�<�/m�l�$�6�\�\�/�j�\�Y��*�*�;�7�'�A�A�+�j�[�"�d�D��8�Z�Y�9$� %�$"@�!?��!?�!?��"@�!?��<�;��/m�l��68�7��Z�Y�s��-E9L2 �&L�7L2 �L�&L2 �L�L2 �;L&�L2 �:M�L? �*M�L�L2 �L�L2 �L#�L2 �&L/�+L2 �2L<
�?M
�M�Mc���|jtd�5tjdddd�ddd�|jtd�5tjdddd�ddd�|jtd�5tjdddd�ddd�tjdddd�}|�}|jtd�5|j �ddd�|jtd �5|jd�ddd�y#1swY��xYw#1swY��xYw#1swY��xYw#1swY�^xYw#1swYyxYw)
Nz3With Py_RELATIVE_OFFSET, basicsize must be negativeri�Tz.Member offset out of range \(0\.\.-basicsize\)r�r�z,PyMember_GetOne used with Py_RELATIVE_OFFSETz,PyMember_SetOne used with Py_RELATIVE_OFFSET)rrr�rr�r�r�)r!rwr�s r�%test_heaptype_relative_members_errorsz:TestHeapTypeRelative.test_heaptype_relative_members_errors�sM��
�
#�
#��F�H�
�/�/��4��D�A�H��
#�
#��N�P��/�/��2�t�T�B�P��
#�
#��N�P��/�/��2�r�4�@�P��1�1�!�R��D�A���5��
�
#�
#��L�N��&�&�(�N��
#�
#��L�N��&�&�q�)�N�N�!H�H��P�P��P�P��N�N��N�N�s;�D%�D1�D=�E �
E�%D.�1D:�=E� E�Ec��|jt�5tjd�ddd�|jt�5tjd�ddd�y#1swY�=xYw#1swYyxYw)z4Test PyObject_GetItemData fails on unsupported typesNr)r2rsr�pyobject_getitemdatar s r�test_pyobject_getitemdata_errorz4TestHeapTypeRelative.test_pyobject_getitemdata_error�s]��
�
�
�y�
)��*�*�4�0�*��
�
�y�
)�
�*�*�1�-�*�
)�*�
)��*�
)�s�A(� A4�(A1�4A=N)r%r&r'r1r
r�r�r�r�r�r�r�rrrririHs9��7��/"��/"�b6�
A�$4�&D�P*�*.rric���eZdZd�Zd
d�Zej�d��Zd�Zd�Z d�Z
Gd�d ej�Z
ej�d
��Zej�d��Zed��Zy)�TestPendingCallsc����fd�}t|�D]C}tjtj�dz� tj|�r�D�y)Nc�(���jd�yrG�r�)�ls�r�callbackz6TestPendingCalls.pendingcalls_submit.<locals>.callback�s���
�H�H�T�Nrg{�G�z�?)r��time�sleep�randomr�_pending_threadfunc)r!r��nr�rns ` r�pendingcalls_submitz$TestPendingCalls.pendingcalls_submit�sJ��� �
�q��A��J�J�v�}�}��t�+�,���0�0��:���rNc��d}t|�|k7rj t d�D]}||z}� |r|j
j
�s�A|dz
}|j|dkd|t|�fz�t|�|k7r�jy)Nrr�rPi'z(timeout waiting for %i callbacks, got %i)r�r�verbose�printr��event�is_setr0)r!r�r��context�countrnr-s r�pendingcalls_waitz"TestPendingCalls.pendingcalls_wait�s������!�f��k���4�[���a�C��!��w�}�}�3�3�5���Q�J�E��O�O�E�E�M�:�A�s�1�v�;�F�
H��!�f��k�rc�
�d}g}Gd�dt�}|�}g|_d|_||jz|_d|_tj�|_tj�|_ t|j�D�cgc]$}tj|j|f����&}}tj|�5|j|j||�ddd�ycc}w#1swYyxYw)N� c��eZdZy)�8TestPendingCalls.test_pendingcalls_threaded.<locals>.fooNr2rrrr&r�rCrr&rXr��targetr�)rqr�r��nThreads� nFinished� threading�Lock�lock�Eventr�r��Thread�pendingcalls_threadr�
start_threadsr�)r!r��threadsr&r�rns r�test_pendingcalls_threadedz+TestPendingCalls.test_pendingcalls_threadeds���
�����&���%���� ��� ��� � �>������ �~�~�'���!���)��
�"�'�"2�"2�3�5�3�q��#�#�4�+C�+C�*1��5�3� �5��
+�
+�G�
4��"�"�7�9�9�a��9�5�
4��5�5�
4�s�
)C4�
C9�9Dc�� |j|j|j�|j5|xjdz
c_|j} ddd�|jk(r|jj�yy#1swY�4xYw#|j5|xjdz
c_|j} ddd�n#1swYnxYw|jk(r|jj�wwxYwrO)r�r�r�r�r�rr�r�r�r�r�)r!r�r�s rr�z$TestPendingCalls.pendingcalls_thread s��� $��$�$�W�Y�Y�� � �:�����!�!�Q�&�!�#�-�-� ���
�G�,�,�,��
�
�!�!�#�-��������!�!�Q�&�!�#�-�-� ������
�G�,�,�,��
�
�!�!�#�-�s.�&B�"B
�
B�
D�#"C� D�C�2Dc�T�g}d}|j||�|j||�y)N�@)r�r�)r!r�r�s r�test_pendingcalls_non_threadedz/TestPendingCalls.test_pendingcalls_non_threaded,s.��
����� � ��A�&����q�!�$rc�v�d�}|�}|jtj|�|j�y)Nc3�K�d��y�wrGrrrr�genfz0TestPendingCalls.test_gen_get_code.<locals>.genf7s����E���)r/r�gen_get_code�gi_code)r!r��gens r�test_gen_get_codez"TestPendingCalls.test_gen_get_code6s+����f������/�/��4�c�k�k�Brc�J�eZdZejZdd�Zd�Zd�Zd�Z d�Z
d�Zy) �TestPendingCalls.PendingTaskNc��||_||_||_tj�|_d|_d|_d|_yrG) r)�req�notify_doner�� get_ident�creator_tid�
requester_tid�
runner_tidr�)r!r��taskidr�s rr�z%TestPendingCalls.PendingTask.__init__?s?���D�G��D�H�*�D��(�2�2�4�D��!%�D��"�D�O��D�Krc��|j�J�tj�|_|j �|j
�|j�yyrG)r�r�r�r��_runr�r s r�runz TestPendingCalls.PendingTask.runIsH���;�;�&�&�&�'�1�1�3�D�O��I�I�K����+�� � �"�,rc�&�|j|_yrG)r�r�r s rr�z!TestPendingCalls.PendingTask._runPs
���(�(�D�Krc������jtjusJ�tj��_���fd���j�d��y)Nc����j�J�tj��vr�j�d��y�j �y)NT��ensure_added)r�r�r��_add_pendingr�)r�r!�worker_tidss���rr�zBTestPendingCalls.PendingTask.run_in_pending_call.<locals>.callbackVsE����{�{�*�*�*��&�&�(��;��%�%�h�T�%�B�����
rTr�)r��_testinternalcapi�pending_threadfuncr�r�r�)r!r�r�s``@r�run_in_pending_callz0TestPendingCalls.PendingTask.run_in_pending_callSsI����$�$�(9�(L�(L�L�L�L�!*�!4�!4�!6�D��
�
���h�T��:rc�F�tj|j|f��S)Nr�)r�r�r�)r!r�s r�
create_threadz*TestPendingCalls.PendingTask.create_threadas#���#�#��/�/�!�^��
rc�b�|j�#tjd�|j��"yy�N�{�G�z�?)r�r�r�r s r�wait_for_resultz,TestPendingCalls.PendingTask.wait_for_resultgs$���+�+�%��
�
�4� ��+�+�%r)NN)r%r&r'r�r�r�r�r�r�r�r�r�rrr�PendingTaskr�;s+��(�;�;�� � #� #� ;� � !rr�c����d}|j|���fd�}tj|��}tj|g�5 ddd�|j�j|�y#1swY�&xYw)Nz1Spam spam spam spam. Lovely spam! Wonderful spam!c����tj�}�j|h�}tj|g�5�j�ddd�y#1swYyxYwrG)r�r�r�rr�r�)�tidrl�tasks �r�do_the_workzNTestPendingCalls.test_subthreads_can_handle_pending_calls.<locals>.do_the_workpsK����%�%�'�C��"�"�C�5�)�A�!�/�/���4��$�$�&�5�4�4�s�A�A!�r�)r�r�r�rr�r/r�)r!�payloadr�rlr�s @r�(test_subthreads_can_handle_pending_callsz9TestPendingCalls.test_subthreads_can_handle_pending_callsksf���E������(�� '�
���K�0��
�
+�
+�Q�C�
0��1�
������g�.�1�
0�s�A-�-A6c�p�������tj�}|jtj�j|�t��t��tj����fd�}�fd����fd�}�fd���fd�}g}td�D]2}|jd|��||��}|j|�||��4�j���fd �}d
���fd�} td�D�
cgc]}
tj| �
���}}
tj|�5 |D�cgc]}|j��}
}td�D�
cgc]}
tj||
f����}}
tj|�5 ddd�|�d� ddd�|D�cgc]}|j��}}|j!||�|D]�}|j#d|j$���5|j'|j(|�|j'|j(|j�|j!|j(|�ddd���ycc}
wcc}wcc}
w#t$rd��wxYw#1swY��xYw#t$rd��wxYw#1swY��xYwcc}w#1swY��xYw)Nc�J���j|��jd�y)NTr�)r��_active�_queues ��r� queue_putzQTestPendingCalls.test_many_subthreads_can_handle_pending_calls.<locals>.queue_put�s����M�M�$���N�N�4� rc�d�� �j�}|S#t$rtj�wxYwrG)�popleft�
IndexError�queue�Empty)r�r�s �r� queue_getzQTestPendingCalls.test_many_subthreads_can_handle_pending_calls.<locals>.queue_get�s6���
"��~�~�'���K���
"��k�k�!�
"�s��/c����j��s �j�yy#t$r�j�rJ�YywxYwrG)�pop�release�RuntimeError�locked)r��
_done_locks��r�queue_task_donezWTestPendingCalls.test_many_subthreads_can_handle_pending_calls.<locals>.queue_task_done�sK����K�K�M��3��&�&�(���$�3�)�0�0�2�2�2�2�3�s�'�A�Ac�
���SrGr)r�s�r�queue_emptyzSTestPendingCalls.test_many_subthreads_can_handle_pending_calls.<locals>.queue_empty�s����:�rc�F���j��j�yrG)�acquirer )rs�r�
queue_joinzRTestPendingCalls.test_many_subthreads_can_handle_pending_calls.<locals>.queue_join�s������ ���� rrezrequest )r�r�r�c�r�� �ry ��}|j|��#tj$rYywxYwrG)rrr�)r�r��doners ��r� add_taskszQTestPendingCalls.test_many_subthreads_can_handle_pending_calls.<locals>.add_tasks�sE�������$�;�D��(�(��5���
�{�{����s� �6�6Fc�����s �rytjd���s� �stjd��s�yyr�)r�r�)rrs��r� run_taskszQTestPendingCalls.test_many_subthreads_can_handle_pending_calls.<locals>.run_tasks�s7���!�m����
�
�4� �"�m�
��
�
�4� �rr�r�r�Tztask )r�r�r/�main_thread�identrr�r�r�r�rr�rr��
BaseExceptionr��assertNotInr�r)�assertNotEqualr�)r!�main_tidrr
r�tasksrnr�rr�_�worker_threadsrlr�r��runner_tidsr�rr�rrrs @@@@@@r�-test_many_subthreads_can_handle_pending_callsz>TestPendingCalls.test_many_subthreads_can_handle_pending_calls{s�����&�&�(������.�.�0�6�6��A�����'���^�^�%�
� !� � 3� � !����r��A��#�#��q�c�N��+�$��D�
�L�L����d�O�� ���� 6��� !�$)��8�-�#+�a�$�*�*�)�<�#+� �-�
�
+�
+�N�
;�
�0>�?��1�q�w�w���?�$)�!�H�.�$,�q�%�+�+�9�K�>�R�$,��.�%�3�3�G�<���=�����<�&.3�3�U��q�|�|�U��3�����;�/��D�����d�g�g�Y�/�0��#�#�D�$6�$6��A��#�#�D�$6�$6����H�� � ��!3�!3�[�A�1�0���1-��
@��.��
)��#�����=�<��!�
����
��!<�
;��&4�1�0�sy�9I �-J�/J�3I%�J�I*�4J�I?�J�,J'�6AJ,�%
J�/
I<�<I?�?J �J�
J�J�J$�,J5 c�� ������������d}d�tj��tj�d��fd�}�jd�5|�\��|�\��t j�dz�����fd�}tj|��}tj|g�5tj�d �tj��}tj�d
�ddd��jt���ddd��jd�5|�\��|�\��t j�dz�����fd�}tj|��}tj|g�5tj�d �tj��}tj�d
�ddd��jt���ddd��jd
�5|�\��|�\��|�\}�t j�dz������fd�}d�d�tjf���fd� }tj|��} tj|��}
tj| |
g�5�s �s�tj�d
��s:t j d�t j��kDrt#d���s�:tj|d �}ddd�tj%d�}�j|t���ddd��jd�5|�\��|�\��|�\}�t j�dz������fd�}d�d�tjf���fd� }����fd�}tj|��} tj|��}
tj|��}
tj| |
|
g�5 ddd�tj|d �}tj%|d�}�j|t���ddd�y#1swY���xYw#1swY��zxYw#1swY���xYw#1swY���xYw#1swY���xYw#1swY��rxYw#1swY��xYw#1swYyxYw)N�rz�if True:
import json
import os
import threading
import time
import _testinternalcapi
from test.support import threading_helper
c�����tj�\���j�fd���j�fd����fS)Nc�.��tj��SrG�r��close)�rs�rr�zTTestPendingCalls.test_isolated_subinterpreter.<locals>.create_pipe.<locals>.<lambda>��
���B�H�H�Q�Krc�.��tj��SrGr')�ws�rr�zTTestPendingCalls.test_isolated_subinterpreter.<locals>.create_pipe.<locals>.<lambda>�r*r)r��pipe�
addCleanup)r)r,r!s@@�r�create_pipezBTestPendingCalls.test_isolated_subinterpreter.<locals>.create_pipe�s5����7�7�9�D�A�q��O�O�/�0��O�O�/�0��a�4�Krz"add in main, run in subinterpreterr]c
�F��tj�d��d��d��d��y)Na<if True:
# Wait until this interp has handled the pending call.
waiting = False
done = False
def wait(os_read=os.read):
global done, waiting
waiting = True
os_read(a
, 1)
done = True
t = threading.Thread(target=wait)
with threading_helper.start_threads([t]):
while not waiting:
pass
os.write(��, b'\0')
# Loop to trigger the eval breaker.
while not done:
time.sleep(0.01)
if time.time() > zT:
raise Exception('timed out!')
�r�
run_string��interpid�r_done�timeout�w_readys����r�do_workz>TestPendingCalls.test_isolated_subinterpreter.<locals>.do_work�sA����(�(��8!�"(��)"�#*��+.�/6�Y�7�#4�rr�rPr�z-add in main, run in subinterpreter sub-threadc
�F��tj�d��d��d��d��y)Nz�if True:
waiting = False
done = False
def subthread():
while not waiting:
pass
os.write(r1aO:
raise Exception('timed out!')
t = threading.Thread(target=subthread)
with threading_helper.start_threads([t]):
# Wait until this interp has handled the pending call.
waiting = True
os.read(z=, 1)
done = True
r2r4s����rr9z>TestPendingCalls.test_isolated_subinterpreter.<locals>.do_worksA����(�(��8"�#*��+.�/6�Y�7!�"(��)�!4�rz"add in subinterpreter, run in mainc
�r��tj�d�tj�d��d��d��d��y�NrPz�if True:
# Add the pending call and wait for it to finish.
actual = _testinternalcapi.pending_identify(zX)
# Signal the subinterpreter to stop.
os.write(z&, b'\0')
os.write(z4, actual.to_bytes(1, 'little'))
�r��readrr3�r5�
main_interpid�r_ready�w_data�w_dones�����r�add_jobz>TestPendingCalls.test_isolated_subinterpreter.<locals>.add_jobA�K��������#��(�(��8A�AN��P�$�X�&�$�X�&�4�rFc� ��d�|�d�d�y�NTrPr��os_readrr6�waitings ���r�waitz;TestPendingCalls.test_isolated_subinterpreter.<locals>.waitM���������"��rr��
timed out!�littlez(add in subinterpreter, run in sub-threadc
�r��tj�d�tj�d��d��d��d��yr<r=r?s�����rrDz>TestPendingCalls.test_isolated_subinterpreter.<locals>.add_jobhrErc� ��d�|�d�d�yrGrrHs ���rrKz;TestPendingCalls.test_isolated_subinterpreter.<locals>.waittrLrc����s �s�tj�d��s;tjd�tj��kDrt d���s�:yy)Nr�r�rM)r��writer�r�� Exception)rr7r8rJs����r� subthreadz@TestPendingCalls.test_isolated_subinterpreter.<locals>.subthreadysI���!��"�����%�(���J�J�t�$��y�y�{�W�,�'��5�5�r)r�creater3r�r�r�r�rr�r�r>r��pending_identifyrRr/r�r�rS�
from_bytes�start�join)r!�maxtextr/r9rl�actual�r_datarDrK�t1�t2�textrT�t3rr5r@r6rAr7rBrCr8rJs` @@@@@@@@@@r�test_isolated_subinterpreterz-TestPendingCalls.test_isolated_subinterpreter�s��������
� �'�'�)��� � ��0
� � ��\�\�>�
?�*�}��G�W�'�M�N�F�F��i�i�k�B�&�G�
�*� � ��0�A�!�/�/���4������#�*�;�;�H�E�������'�5�
���V�S��]�3�E@�H�\�\�I�
J�*�}��G�W�'�M�N�F�F��i�i�k�B�&�G�
�(� � ��0�A�!�/�/���4������#�*�;�;�H�E�������'�5�
���V�S��]�3�CK�F�\�\�>�
?�*�}��G�W�'�M�N�F�F�'�M�N�F�F��i�i�k�B�&�G�
�
��G��D��W�W�
�
�!�!��1�B��!�!��.�B�!�/�/��R��9�!��"�����%�(���J�J�t�$��y�y�{�W�,�'��5�5���w�w�v�q�)��:��^�^�D�(�3�F����V�S��%7�8�K@�N�\�\�D�
E�*�}��G�W�'�M�N�F�F�'�M�N�F�F��i�i�k�B�&�G�
�
��G��D��W�W�
�
6��!�!��1�B��!�!��.�B��!�!��3�B�!�/�/��R���=��>��7�7�6�1�%�D��^�^�D�(�3�F����V�S��%7�8�QF�V �}5�4��7@�
?��|5�4��5K�
J��x:�9��3@�
?��T>�=��GF�V �s��A R
�0AR�2#R
�.A R'�AR�#R'�BS�)R4�0AR4�R4�9S�*B<S�&S�(AS�R
�R
�
R�R$ �R'�'R1�4R> �9S�S�S �S�S#rG)r%r&r'r�r�r�requires_working_threadingr�r�r�r�r�SimpleNamespacer�r�r"rrarrrr�r��s���
�$�&1��0�0�2�:�3�:�(
$�%�C�
.!�e�+�+�.!�`1��0�0�2�
/�3�
/�1��0�0�2�\B�3�\B�|�^4��^4rr�c�~�eZdZejeed�d�d��Zejeed�d�d��Zd�Z ejeed�d�d��Z
ejedud�ejeed�d�d ���Z
d
�Zejedud�d��Zy)
�SubinterpreterTestr-zrequires os.pipe()c��ddl}tj�\}}dj|�}t |d�5}tj|�}|j|d�|jtj|�ttj��|jtj|�t|��ddd�y#1swYyxYw)Nrz�if 1:
import sys, builtins, pickle
with open({:d}, "wb") as f:
pickle.dump(id(sys.modules), f)
pickle.dump(id(builtins), f)
�rb)�builtinsr�r-�format�openr�run_in_subinterpr/r�pickle�loadr)rj�modules)r!rhr)r,r?�f�rets r�test_subinterpsz"SubinterpreterTest.test_subinterps�s�����w�w�y���1��
��q� �
��!�T�]�a��*�*�4�0�C����S�!�$�������A���3�;�;��@�������A���8��=� �]�]�s�BC�Cc�4�tj�\}}dj|�}t|d�5}t j
|�}|j
|d�|j
tj|�ddd��ddd�y#1swYyxYw)Naaif 1:
import pickle
with open({:d}, "wb") as f:
@(lambda x:x) # Py 3.9
def noop(x): return x
a = (b := f'1{{2}}3') + noop('x') # Py 3.8 (:=) / 3.6 (f'')
async def foo(arg): return await arg # Py 3.5
pickle.dump(dict(a=a, b=b), f)
rgr�123xr�)r-r�) r�r-rirjrrkr/rlrm)r!r)r,r?rorps r�(test_subinterps_recent_language_featuresz;SubinterpreterTest.test_subinterps_recent_language_features�sz���w�w�y���1����q� �
��!�T�]�a��*�*�4�0�C����S�!�$����V�[�[��^�6��-F�G��]�]�s�AB�Bc��d}tj�}|ddk7sJ�|jtj|�dd�tj�}|j||d�|j||d�y)Na�if 1:
import sys, _testinternalcapi
# Any config value would do, this happens to be the one being
# double checked at the time this test was written.
config = _testinternalcapi.get_config()
config['int_max_str_digits'] = 55555
config['parse_argv'] = 0
_testinternalcapi.set_config(config)
sub_value = _testinternalcapi.get_config()['int_max_str_digits']
assert sub_value == 55555, sub_value
�int_max_str_digitsi�rz%subinterp code failure, check stderr.z7Expected get_config() to return a new dict on each callzJCAUTION: Tests executed after this may be running under an altered config.)r��
get_configr/rrk�assertIsNot)r!r?�
before_config�after_configs r�(test_py_config_isoloated_per_interpreterz;SubinterpreterTest.test_py_config_isoloated_per_interpreter�s���
��*�4�4�6�
��1�2�e�;�;�;�����1�1�$�7��@� B�(�3�3�5������|�I� K�
�����<� =rc�
�ddl}d}d}d}d}d}d}||z|z|z|z|z}gd �} | D�
cgc]}
d
|
���� }}
d|d<d|d
<d|d<|df|df||zdfd�j�D]�\}}
tt||��}|
\}}||d�}
|j |�5tj�\}}tjd|�d��}tj|�5}tj|fi|��}|j|d�|j�}ddd�|j�}|j||
�ddd���dD]z}tt||��}|j |�5tjd�}|jt �5tj|fi|��ddd�ddd��|ycc}
w#1swY��xYw#1swY���xYw#1swY�2xYw#1swY��xYw)z�
The config with which an interpreter is created corresponds
1-to-1 with the new interpreter's settings. This test verifies
that they match.
rNr�r������)�obmalloc�forkr�r��daemon_threads�
extensions�own_gil�allow_�use_main_obmalloc�check_multi_interp_extensions���r�r�TF))TTTTTTT)TFFFFFF)FFFTFTF��
feature_flagsr�z�
import _testinternalcapi, json, os
settings = _testinternalcapi.get_interp_settings()
with os.fdopen(zX, "w") as stdin:
json.dump(settings, stdin)
))FFFFFFFz�
import _testinternalcapi
_testinternalcapi.get_interp_settings()
raise NotImplementedError('unreachable')
)�json�itemsr!�zipr�r�r-r:r;�fdopenr�run_in_subinterp_with_configr/r>�loadsr2r
)r!r��OBMALLOC�
EXTENSIONS�THREADS�DAEMON_THREADS�FORK�EXEC� ALL_FLAGS�featuresr��kwlist�configr��kwargs� exp_flags�exp_gilr)r,�script�stdoutrprC�settingss r�test_configured_settingsz+SubinterpreterTest.test_configured_settingss0�� ����
�����������_�t�+�g�5��F�!�"� �
��)1�1��1�F�1�#�,���1�'��q� �4��r�
���r�
�
�D�!��5�!��:�%�u�-�
!
��%�'�!��F�H��#�f�f�-�.�F�!)��I�w�!*�"��H����f�%��w�w�y���1�!���.$�%&�3�'�*����Y�Y�q�\�V�!�>�>�v�P��P�C��$�$�S�!�,� �+�+�-�C�"�&�4�:�:�c�?��� � ��8�4�&�%�!�>
�F��#�f�f�-�.�F����f�%�!���.���
�&�&�|�4��8�8��J�6�J�5�
&�%�
��K2�8"�\��&�%��65�4��
&�%�sN�G�AG � 9G�,G �:+G9�%G-�<G9�G�G � G* �-G6�2G9�9H Nz%test requires _testsinglephase modulec����� �
�ddl�
d}d�d}d}d}d}||z|z|z|z�d d d d d d
d�� ��� �
�fd�}d�_�jd
�5|d
d�ddd��jd�5|d
d�ddd��jd�5|d
d�ddd��jd�5|d d�ddd��jd�5|d d�ddd��jd�5|d d�ddd�y#1swY��xYw#1swY��xYw#1swY��xYw#1swY�txYw#1swY�]xYw#1swYyxYw)z�
PyInterpreterConfig.check_multi_interp_extensions can be overridden
with PyInterpreterState.override_multi_interp_extensions_check.
This verifies that the override works but does not modify
the underlying setting.
rNr�r�r}r~rr�TF)r��
allow_fork�
allow_exec�
allow_threads�allow_daemon_threadsr�c����t�|��}|r�
�zn�
}|dd�}|d|d|||||r|dkDn||d�
}tj�\}}tjd|�d|�d��}tj
|�5} t
j|fi|��}
�j|
d�| j�}ddd��j�}�j||�y#1swY�.xYw) N)r�Fr�r)
� requested�override__initial�override_after�override_restored�settings__initial�settings_after�settings_restored�allowed__initial�
allowed_after�allowed_restoredzu
from test.test_capi.check_config import run_singlephase_check
run_singlephase_check(z, z)
)r!r�r-r:r;r�rr�r/r>r�)�enabled�overrider��flagsr�r�r)r,r�r�rprC�results�
BASE_FLAGSr��base_kwargsr�r!s �����rr}zTSubinterpreterTest.test_overridden_setting_extensions_subinterp_check.<locals>.checkns�����.5��F�07�J��+�J�E�!&� ��H�&�%&�"*�%&�%-�"*�%-�(/�K�8@�x�!�|�g�!N�(/�K�
�H��7�7�9�D�A�q��_�_�*'�'/�j��1�#�6�&��F����1����:�:�6�L�V�L��� � ��a�(��k�k�m���!�d�j�j��o�G����W�h�/�
��s�<9C"�"C+z*config: check disabled; override: disabledr�z,config: check disabled; override: use configz)config: check disabled; override: enabledrPz)config: check enabled; override: disabledz+config: check enabled; override: use configz(config: check enabled; override: enabled)r��maxDiffr�)r!r�r�r�r�r�r}r�r�r�r�s` @@@@r�2test_overridden_setting_extensions_subinterp_checkzESubinterpreterTest.test_overridden_setting_extensions_subinterp_checkSsK��� ����
�����������_�t�+�g�5��F�
�!%���!�$(��
��% 0�% 0�N����\�\�F�
G��%���H�
�\�\�H�
I��%��O�J�
�\�\�E�
F��%��O�G��\�\�E�
F��$��O�G�
�\�\�G�
H��$��N�I�
�\�\�D�
E��$��N�F�
E�H�
G��
I�
I��
F�
F��G�
F��
H�
H��
E�
E�sH�
D�1
D�
D(�7
D4�
E�=
E�D�D%�(D1�4D=�E �Ec��ddl}tjd�|jt |j
d��y)z�
Exceptions saved in global module state get shared between
individual module instances. This test checks whether or not
a change in one interpreter's module gets reflected into the
other ones.
rNz1import binascii; binascii.Error.foobar = 'foobar'�foobar)�binasciirrk�assertFalser��Error)r!r�s r�test_mutate_exceptionz(SubinterpreterTest.test_mutate_exception�s/�� �� � �!T�U���������:�;r�$test requires _testmultiphase modulec���tj�\}}|jtj|�|jtj|�t j
d|�d��}t
|�tj|d�}tj|�}|j|d�tj|d�}|j||�y)z�
bpo-44050: Extension module state should be shared between interpreters
when it doesn't support sub-interpreters.
a�
import importlib.machinery
import importlib.util
import os
fullname = '_test_module_state_shared'
origin = importlib.util.find_spec('_testmultiphase').origin
loader = importlib.machinery.ExtensionFileLoader(fullname, origin)
spec = importlib.util.spec_from_loader(fullname, loader)
module = importlib.util.module_from_spec(spec)
attr_id = str(id(module.Error)).encode()
os.write(z, attr_id)
�drN)r�r-r.r(r:r;r�r>rrkr/)r!r)r,r��main_attr_idrp�subinterp_attr_ids r�"test_module_state_shared_in_globalz5SubinterpreterTest.test_module_state_shared_in_global�s����w�w�y���1�������!�$�������!�$����&��S�
�
"�
��
�V���w�w�q�#����&�&�v�.������a� ��G�G�A�s�O������'8�9r)r%r&r'rrdr�r�rqrtr{r�r�_testsinglephaser�r��_testmultiphaser�rrrrere�s
���X�����V�,�.B�C�
>�D�
>��X�����V�,�.B�C�H�D�H�*=�D�X�����V�,�.B�C�JK�D�JK�X�X�_�_�%��-�/V�W��X�����V�,�.B�C�P�D�X�P�d<��X�_�_�_��,�.T�U�:�V�:rrec�>�eZdZeeeeeed�ee e
eegZ
d�Zd�Zy)�BuiltinStaticTypesTestsNc��|jD]C}|j|�5tj|�}|j |d�ddd��Ey#1swY�PxYwrG)�TYPESr�r�type_get_tp_basesrx)r!�typeobj�basess r�test_tp_bases_is_setz,BuiltinStaticTypesTests.test_tp_bases_is_set�sM���z�z�G����g�&�!�3�3�G�<��� � ���-�'�&�"�&�&���(A�A c��|jD]C}|j|�5tj|�}|j |d�ddd��Ey#1swY�PxYwrG)r�r�r�type_get_tp_mrorx)r!r�r�s r�test_tp_mro_is_setz*BuiltinStaticTypesTests.test_tp_mro_is_set�sM���z�z�G����g�&��/�/��8��� � ��d�+�'�&�"�&�&�r�)r%r&r'rqrgr�r�r!�boolrrS�Warningryr�r�r�rrrr�r��s:�� ������T�
������
�E�.�,rr�c�J�eZdZdZed��Zejd��Zd�Z y)�TestStaticTypesFc�T�|jrtjd��d|_y)Nz%these tests do not support re-runningT)�_has_runr�SkipTest)rPs r�
setUpClasszTestStaticTypes.setUpClass�s$���<�<��#�#�$K�L�L���rc'�8K�tj|�}|��y�wrG)r�get_basic_static_type)r!r�rPs r�basic_static_typez!TestStaticTypes.basic_static_types�����-�-�t�4��� �s�c�F�|j�5}|j|jt�|j |j
tf�|jt
|�t
t��ddd�|jt�5}|j|jt�|j |j
tf�|jt
|�t
t��ddd�y#1swY��xYw#1swYyxYwrG)r�rO�__base__rqr/� __bases__rg)r!rPs r�%test_pytype_ready_always_sets_tp_typez5TestStaticTypes.test_pytype_ready_always_sets_tp_types����
#�
#�
%���M�M�#�,�,��/����S�]�]�V�I�6��M�M�$�s�)�T�&�\�2�&��
#�
#�F�
+�s��M�M�#�,�,��/����S�]�]�V�I�6��M�M�$�s�)�T�&�\�2�,�
+�
&�
%��,�
+�s�A*D�A*D�D�D N)
r%r&r'r��classmethodr��
contextlib�contextmanagerr�r�rrrr�r��s8���H�����������4rr�c��eZdZejej
�d���Zejej
�d���Zejej
�d���Zd�Z y)�TestThreadStatec����fd�}|�tj|��}|j�|j�y)Nc�����g��fd�}tj|�|x}}tjd��j �jt
j��dd�y)Nc�L���jtj��yrG)r�r�r�)�identss�rr�zCTestThreadState.test_thread_state.<locals>.target.<locals>.callback"s����
�
�i�1�1�3�4rrPr�z/Couldn't find main thread correctly in the list)r�_test_thread_stater�r�r/r�r�r�)r�r-r�r�r!s @�rr�z1TestThreadState.test_thread_state.<locals>.targetsZ����F�
5�
�(�(��2���A���J�J�q�M����V�\�\�)�*=�*=�*?�@�!�N�
Prr�)r�r�rXrY)r!r�rls` r�test_thread_statez!TestThreadState.test_thread_states2��� P� �����F�+�� ��� � ���rc�z���Gd�d��tj����fd�}tj|�y)Nc��eZdZd�Zy)�8TestThreadState.test_thread_gilstate_in_clear.<locals>.Cc�,�tj�yrG)r�gilstate_ensure_releaser s rr�z@TestThreadState.test_thread_gilstate_in_clear.<locals>.C.__del__6s���1�1�3rN)r%r&r'r�rrrr�r�5s��
4rr�c������_yrG�rY)r�� local_vars��rr�z?TestThreadState.test_thread_gilstate_in_clear.<locals>.callback<s����#�I�Kr)r��localrr�)r!r�r�r�s @@r�test_thread_gilstate_in_clearz-TestThreadState.test_thread_gilstate_in_clear1s0��� 4� 4�
�O�O�%� � � �$�$�X�.rc��tjd�}tddd|�}|jd|j�y)Nz�
import _testcapi
def callback():
print('callback called')
_testcapi._test_thread_state(callback)
z-X�tracemallocr9scallback called)r:r;rr�rC)r!r?rps r� test_gilstate_ensure_no_deadlockz0TestThreadState.test_gilstate_ensure_no_deadlockAs<����� ����t�]�D�$�?���
�
�(�#�'�'�2rc�,�tj�yrG)r�test_current_tstate_matchesr s r�test_gilstate_matches_currentz-TestThreadState.test_gilstate_matches_currentPs���-�-�/rN)
r%r&r'r�reap_threadsrbr�r�r�r�rrrr�r�s����"�"�0��0�0�2��3�#��(�"�"�0��0�0�2�/�3�#�/��"�"�0��0�0�2�3�3�#�3�0rr�c��eZdZe�j d�ee�D��eje ��d��Z
d�Zy)�
Test_testcapic#�K�|]8}|jd�r%|jd�s|tt|�f���:y�w)�test_�_codeN)r>�endswith�getattrr��.0r�s r� <genexpr>zTest_testcapi.<genexpr>Us<����P� .�����w�/��
�
�g�8N��7�9�d�3�4� .�s�>Ar�c�,�tj�yrG)r�
test_widecharr s rrzTest_testcapi.test_widecharZs�����!rc�`�|jtjtj�yrG)r/r�
Py_Versionrj�
hexversionr s r�test_version_api_dataz#Test_testcapi.test_version_api_data^s������-�-�s�~�~�>rN)r%r&r'�locals�update�dirrr rgryrrrrrrrTsL��
�H�O�O�P� #�I��P�P�
%�_�$�$�.@�A�"�B�"�?rrc�R�eZdZe�j d�ee�D��y)�Test_testinternalcapic#�bK�|]'}|jd�r|tt|�f���)y�w)rN)r>rr�rs rr zTest_testinternalcapi.<genexpr>cs1����1� 6�����w�/��7�#4�d�;�<� 6�s�-/N)r%r&r'rrrr�rrrrrbs#��
�H�O�O�1� #�$5� 6�1�1rrr�c�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z y) �Test_ModuleStateAccessz%Test access to module start (PEP 573)c�H�d}tjjd�j}tjj||�}tjj
||�}tjj|�}|j|�||_ y)N�!_testmultiphase_meth_state_accessr�)
� importlib�util� find_spec�origin� machinery�ExtensionFileLoader�spec_from_loader�module_from_spec�exec_moduler))r!�fullnamer�loader�specr)s r�setUpzTest_ModuleStateAccess.setUppsy��6�����)�)�*;�<�C�C���$�$�8�8��6�J���~�~�.�.�x��@�����0�0��6�����6�"���rc��Gd�d|jj�}|�}|j|j�|j�y)z#PyType_GetModule for defining_classc��eZdZy)�QTest_ModuleStateAccess.test_subclass_get_module.<locals>.StateAccessType_SubclassNr2rrr�StateAccessType_Subclassr){r3rr*N�r)�StateAccessTyperO�get_defining_module�r!r*r�s r�test_subclass_get_modulez/Test_ModuleStateAccess.test_subclass_get_moduleys=�� �t�{�{�'B�'B� �,�-���
�
�h�2�2�4�d�k�k�Brc��Gd�d|jj�}|�}|j|j�|j�y)Nc���eZdZ�fd�Z�xZS)�\Test_ModuleStateAccess.test_subclass_get_module_with_super.<locals>.StateAccessType_Subclassc� ��t�|��SrG)r�r-r�s �rr-zpTest_ModuleStateAccess.test_subclass_get_module_with_super.<locals>.StateAccessType_Subclass.get_defining_module�s����w�2�4�4r)r%r&r'r-r�r�s@rr*r2�s
���
5�
5rr*r+r.s r�#test_subclass_get_module_with_superz:Test_ModuleStateAccess.test_subclass_get_module_with_super�s=�� 5�t�{�{�'B�'B� 5�,�-���
�
�h�2�2�4�d�k�k�Brc��|jj�}|jj�}|j|jd�}|j �D�]�\}}|j|�5|j
|j�|j��|j
|j�d�|�|j
|j�|j��|j
|j�d�|d�|j
|j�|j��|j
|j�d�|dd��|j
|j�|j��|j
|j�d�|jt�5|d� �d
d
d
�|jt�5|ddd�d
d
d
�d
d
d
����y
#1swY�=xYw#1swY�!xYw#1swY���xYw)z�Checks methods defined with and without argument clinic
This tests a no-arg method (get_count) and a method with
both a positional and keyword argument.
)�clinic�noclinicrrPr�r�r�T)�twice)�thriceNrX)
r)r,�increment_count_clinic�increment_count_noclinicr�r�r/� get_countr2rs)r!r-r��methodsr��increment_counts r�test_state_accessz(Test_ModuleStateAccess.test_state_access�s���
�K�K�'�'�)���K�K�'�'�)���.�.��2�2�
��
&-�]�]�_�!�D�/����d�#�� � ��������
�>�� � ������2��!�� � ��������
�>�� � ������2���"�� � ��������
�>�� � ������2���$�/�� � ��������
�>�� � ������2��&�&�y�1�#�1�-�2��&�&�y�1�#�A�q�!�,�2�'$�#�&5�"2�1��2�1��'$�#�s=�6E'H;�
H#�'H;�H/�H;�#H,�(H;�/H8�4H;�;I c��|jj�}|jt�5|j �ddd�y#1swYyxYwrG)r)r,r2rs�getmodulebydef_bad_def)r!r�s r�test_get_module_bad_defz.Test_ModuleStateAccess.test_get_module_bad_def�s<���;�;�.�.�0��
�
�
�y�
)��+�+�-�*�
)�
)�s�A
�
Ac��Gd�dt|jj�}|j|�j �|j�y)Nc��eZdZy)�FTest_ModuleStateAccess.test_get_module_static_in_mro.<locals>.SubclassNr2rrr�SubclassrE�r3rrF)rr)r,rOr-)r!rFs r�test_get_module_static_in_mroz4Test_ModuleStateAccess.test_get_module_static_in_mro�s7�� �}�d�k�k�&A�&A� ��
�
�h�j�4�4�6����DrN)
r%r&r'r1r&r/r4r?rBrGrrrrrhs'��/��C�C�$-�L.�Errc�.�eZdZed��Zd�Zd�Zd�Zy)�TestInternalFrameApic�*�tj�SrG)rj� _getframerrr�funczTestInternalFrameApi.func�s���}�}��rc��|j�}tj|�}|j||jj�yrG)rLr��iframe_getcoderOr)r!�framer?s r� test_codezTestInternalFrameApi.test_code�s5��� � ��� �/�/��6���
�
�d�D�I�I�.�.�/rc���|j�}tj|�}|j|d�|j |t|jjj��y)Nr)rLr��iframe_getlastir�rsr�r�co_code)r!rO�lastis r�
test_lastizTestInternalFrameApi.test_lasti�sP��� � ���!�1�1�%�8�����5�!�$�����s�4�9�9�#5�#5�#=�#=�>�?rc��|j�}tj|�}|jjj}|j||dz�y)NrX)rLr��iframe_getliner�co_firstlinenor/)r!rO�line� firstlines r� test_linezTestInternalFrameApi.test_line�sF��� � ��� �/�/��6���I�I�&�&�5�5� �����y�1�}�-rN)r%r&r'�staticmethodrLrPrUr[rrrrIrI�s$������0�
@�.rrIr�c�6�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z y) �Test_Pep523APIc��g}t}|tz} t|�D]#}||k(rtj|�|��% tj�|tz}|jt
|�t
|��t||d��D]\}} |j|| ��y#tj�wxYw)NT)�strict)�"SUFFICIENT_TO_DEOPT_AND_SPECIALIZEr�r��set_eval_frame_record�set_eval_frame_defaultr/r�r�)
r!rLr��actual_callsrXr�rn�expected_callsr�r[s
r�do_testzTest_Pep523API.do_test�s�����2���:�:�� 7��5�\����:�%�;�;�L�I���"�
�4�4�6��!C�C������^�,�c�,�.?�@� #�N�L�� N��H�f����X�v�.�!O��
�4�4�6�s�1B/�/Cc�P��Gd�d���fd�}ddg}|j||�y)Nc��eZdZd�Zy)�4Test_Pep523API.test_inlined_binary_subscr.<locals>.Cc��yrGr)r!�others rroz@Test_Pep523API.test_inlined_binary_subscr.<locals>.C.__getitem__�rprN)r%r&r'rorrrr�ri�s��
rr�c�����dy�Nr�r)r�s�rrLz7Test_Pep523API.test_inlined_binary_subscr.<locals>.func�s���
�C��GrrLro�rf)r!rLr�r�s @r�test_inlined_binary_subscrz)Test_Pep523API.test_inlined_binary_subscr�s*��� � � ���'�����T�5�!rc�D��dd���fd�}gd�}|j||�y)Nc��yrGrr�s r�innerz/Test_Pep523API.test_inlined_call.<locals>.inner�rrc�$�����d�yrmr�rrs�rrLz.Test_Pep523API.test_inlined_call.<locals>.func�s����G��"�Ir)rLrrrr)r�rn�r!rLr�rrs @r�test_inlined_callz Test_Pep523API.test_inlined_call�s"��� � �+�����T�5�!rc�B��d���fd�}ddg}|j||�y)Nc��yrGrr�s rrrz;Test_Pep523API.test_inlined_call_function_ex.<locals>.inner�rrc����dg�yrmrrts�rrLz:Test_Pep523API.test_inlined_call_function_ex.<locals>.func s����B�4�LrrLrrrnrus @r�test_inlined_call_function_exz,Test_Pep523API.test_inlined_call_function_ex�s%��� � ���!�����T�5�!rc�B��d���fd�}gd�}|j||�y)Nc3�K�d��y�wrmrrrrr�z1Test_Pep523API.test_inlined_for_iter.<locals>.gen ������H�r�c�����D]}�yrGr)rr�s �rrLz2Test_Pep523API.test_inlined_for_iter.<locals>.func s����U���r)rLr�r�r�rn)r!rLr�r�s @r�test_inlined_for_iterz$Test_Pep523API.test_inlined_for_iter s"��� � �.�����T�5�!rc�h���Gd�d��Gd�d����fd�}gd�}|j||�y)Nc��eZdZed��Zy)�0Test_Pep523API.test_inlined_load_attr.<locals>.Cc��yrmrr s rr-z2Test_Pep523API.test_inlined_load_attr.<locals>.C.a s��rN)r%r&r'�propertyr-rrrr�r� s��
�
��
rr�c��eZdZd�Zy)�0Test_Pep523API.test_inlined_load_attr.<locals>.Dc��yrmr)r!r�s r�__getattribute__zATest_Pep523API.test_inlined_load_attr.<locals>.D.__getattribute__ s��rN)r%r&r'r�rrr�Dr� s��
rr�c�J����j��jyrGr�)r�r�s��rrLz3Test_Pep523API.test_inlined_load_attr.<locals>.func s���
�C�E�E�
�C�E�Er)rLr-r�rn)r!rLr�r�r�s @@r�test_inlined_load_attrz%Test_Pep523API.test_inlined_load_attr s1��� � � � � �2�����T�5�!rc�N���d���fd���fd�}gd�}|j||�y)Nc3�K�d��y�wrmrrrrrrz/Test_Pep523API.test_inlined_send.<locals>.inner r}r�c3�0�K���Ed{���y7��wrGrrts�r�outerz/Test_Pep523API.test_inlined_send.<locals>.outer s������w���s���c�&��t���yrG)r�)r�s�rrLz.Test_Pep523API.test_inlined_send.<locals>.func" s������Mr)rLr�r�rrrrr�rrrn)r!rLr�rrr�s @@r�test_inlined_sendz Test_Pep523API.test_inlined_send s%��� � � �N�����T�5�!rN)
r%r&r'rfrorvrzrr�r�rrrr^r^�s%��/� "�"�"�"�"�"rr^�__main__)Cr��collectionsrrr��importlib.machineryr�importlib.utilr�r�rlrr��
subprocessrjr:r�r�rrr�r;rqr-r�test.supportrrrr r
�test.support.script_helperrrr
rt�ImportErrorr�r��_xxsubinterpretersr�ModuleNotFoundErrorr�rr�r�rrr"r$�TestCaser+rir�rer�r�r�rrrrrIrar^r%�mainrrr�<module>r�sQ���*����� �
��
��
����������-�&�)�(�-�d�d��������.�
(�M�'�'��4� ����<�=��
:�:�z#�x� � �z#�z�W.�8�,�,�W.��W.�tV4�x�(�(�V4�rV:��*�*�V:�r,�h�/�/�,�B 4�h�'�'� 4�F80�h�'�'�80�v?�H�%�%�?�1�H�-�-�1������D�(�*P�Q�TE�X�.�.�TE�R�TE�n.�8�,�,�.�0&)�"�K"�X�&�&�K"�\�z���H�M�M�O���OH���������O������������M��sH�G5� H�H�H�5H�?H�H�
H�H�H�H*�)H*
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists