Your IP : 216.73.216.196


Current Path : /opt/alt/python310/lib64/python3.10/test/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/test/__pycache__/test_lltrace.cpython-310.opt-1.pyc

o

0�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�8/opt/alt/python310/lib64/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�coderZstatus�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__)rr �sysrZunittestZtest.supportrrZtest.support.script_helperr�hasattrZPy_DEBUGZ
skipUnlessZTestCaserr-�mainrrrr�<module>s

S�