Sindbad~EG File Manager
�
'Μgj� � � � d dl Z d dlmZmZ d dlZd dlZd dlZd dlmZ d dl m
Z
mZ d� Zd� Z
G d� de
� Z G d � d
ej � Z G d� de
� Z G d
� de� Zedk( r ej( � yy)� N)�combinations�product)�support)�BytecodeTestCase�CfgOptimizationTestCasec �n � t j d| � d�� }i }t ||� |d j S )Nz=
def f(x):
match x:
case z#:
pass
�f)�textwrap�dedent�exec�__code__)�pattern�source� namespaces �0/usr/local/lib/python3.12/test/test_peepholer.py� compile_pattern_with_fast_localsr sG � �
�_�_�
� �Y� � ��F� �I������S�>�"�"�"� c �� � d}t j | � D ] }|j |k( s�|dz
}� t | d� r| j } | j
D ] }t |d� s�|t
||� z
}� |S )Nr � r
�co_code)�dis�get_instructions�opname�hasattrr
� co_consts�count_instr_recursively)r r �count�instr�cs r r r sw � �
�E��%�%�a�(���<�<�6�!��Q�J�E� )� �q�*��
�J�J��
�[�[���1�i� ��,�Q��7�7�E� � �Lr c � � e Zd Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z
d � Zd
� Zd� Z
d� Zd
� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z ej@ d� d� � Z!d� Z"d � Z#d!� Z$d"� Z%d#� Z&d$� Z'd%� Z(y&)'�
TestTranformsc
�2 � t t j |� � }|D �ci c] }|j |�� }}|D ]� }d|j vr�||j
}|j dv rD| j
|j � d|j � d|j � d|j � �� |j dv s��|j dk( s��| j
|j � d|j � d|j � d|j � �� �� y c c}w )N�JUMP_)�
JUMP_BACKWARD�JUMP_FORWARDz at z
jumps to �RETURN_VALUE)�listr r �offsetr �argval�fail)�self�code�instructionsr �targets�tgts r �check_jump_targetsz TestTranforms.check_jump_targets( s � ��C�0�0��6�7��4@�A�L�5�5�<�<��&�L��A�!�E��e�l�l�*���%�,�,�'�C��z�z�>�>�� � �U�\�\�N�$�u�|�|�n� =&�&)�j�j�\��c�j�j�\�C� D� ��� A�A��
�
�n�,�� � �U�\�\�N�$�u�|�|�n� =&�&)�j�j�\��c�j�j�\�C� D� "�� Bs �Dc � � t j |� }t t j |� � }t d� |D � � }t d� |D � � }| j
|d� | j |t |j � � y)z0Check that the lnotab byte offsets are sensible.c 3 �&