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: //usr/local/lib/python3.10/test/__pycache__/test_lltrace.cpython-310.opt-1.pyc
o

�i��@s�ddlZddlZddlZddlZddlZddlmZmZddlm	Z	e
ed�Ze�ed�Gdd�dej
��Zedkr@e��dSdS)	�N)�	os_helper�verbose)�assert_python_okZgettotalrefcountzlltrace requires Py_DEBUGc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�TestLLTracecCs`ttjddd��}|�tjtj�|�t�d��ttj�Wd�dS1s)wYdS)N�w�utf-8��encodingz�            import code

            console = code.InteractiveConsole()
            console.push('__ltrace__ = 1')
            console.push('a = [1, 2, 3]')
            console.push('a[0] = 1')
            print('unreachable if bug exists')
            )	�openr�TESTFN�
addCleanup�unlink�write�textwrap�dedentr)�self�fd�r�./usr/local/lib/python3.10/test/test_lltrace.py�1test_lltrace_does_not_crash_on_subscript_operators

"�z=TestLLTrace.test_lltrace_does_not_crash_on_subscript_operatorcCs�t�|���}ttjddd��}|�tjtj�|�|�Wd�n1s'wYt	tj�\}}}|�
|d�|�
|d�|�d�}trZt
d�t
|�t
d�t
|�t
�|S)Nrrr�rz

--- code ---z
--- stdout ---)rr�stripr
rrrr
rrZassertEqual�decoder�print)r�coder�status�stdout�stderr�resultrrr�run_code#s �
zTestLLTrace.run_codecCshtj|}t�d|�d�tj�}|r#|�|�|�d|�d|���dS|�|�|�d|�d|���dS)Nz: z($|, )z": z" not found in: z" found in: )�opcodeZopmap�re�compile�	MULTILINEZ
assertTrue�searchZassertFalse)r�oprZpresentZregexrrr�check_op4s
��zTestLLTrace.check_opcC�|�||d�dS)NT�r&�rr%rrrr�check_op_in>�zTestLLTrace.check_op_incCr')NFr(r)rrr�check_op_not_inAr+zTestLLTrace.check_op_not_incCsV|�d�}|�d|�|�d|�|�d|�|�d|�|�d|�|�d|�dS)Na�
            def dont_trace_1():
                a = "a"
                a = 10 * a
            def trace_me():
                for i in range(3):
                    +i
            def dont_trace_2():
                x = 42
                y = -x
            dont_trace_1()
            __ltrace__ = 1
            trace_me()
            del __ltrace__
            dont_trace_2()
        ZGET_ITERZFOR_ITERZUNARY_POSITIVEZPOP_TOPZBINARY_MULTIPLYZUNARY_NEGATIVE)rr*r,)rrrrr�test_lltraceDs
zTestLLTrace.test_lltraceN)	�__name__�
__module__�__qualname__rrr&r*r,r-rrrrr
s
r�__main__)r r!�sysrZunittestZtest.supportrrZtest.support.script_helperr�hasattrZPy_DEBUGZ
skipUnlessZTestCaserr.�mainrrrr�<module>s

S�