File manager - Edit - /opt/imunify360/venv/lib/python3.11/site-packages/simplejson/tests/__pycache__/test_free_threading.cpython-311.pyc
Back
� ��]ja � �V � d Z ddlZddlZddlmZ ddlZddlmZ G d� de� � ZdS )a, Tests that exercise the C extension from multiple threads. These tests pass on any Python build but their real purpose is to catch data races on free-threaded builds (PEP 703) where the GIL is disabled. The test_free_threading CI job runs these with ``PYTHON_GIL=0`` on a free-threaded interpreter. � N)�TestCase)�skip_if_speedups_missingc �x � e Zd ZdZdZdZd� Zed� � � Zed� � � Z ed� � � Z ed� � � Zd S ) �TestFreeThreadingz>Exercise the C extension from multiple threads simultaneously.� i� c � ���� t j dk r| � d� � g ���fd���fd�t | j � � D � � }|D ]}|� � � �|D ]}|� � � ��r�d �d S )N� emscriptenz#threads not available on Emscriptenc �x �� �� � d S # t $ r } �� | � � Y d } ~ d S d } ~ ww xY w�N)� BaseException�append)�e�errors�workers ����/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib64/python3.11/site-packages/simplejson/tests/test_free_threading.py�wrappedz/TestFreeThreading._run_threads.<locals>.wrapped sZ �� � !��������� � !� !� !�� � �a� � � � � � � � � ����� !���s � � 9�4�9c �: �� g | ]}t j �� � � ��S ))�target)� threading�Thread)�.0�_r s �r � <listcomp>z2TestFreeThreading._run_threads.<locals>.<listcomp>! s7 �� � 3� 3� 3�� �#�7�3�3�3� 3� 3� 3� r )�sys�platform�skipTest�range� N_THREADS�start�join)�selfr �threads�tr r s ` @@r �_run_threadszTestFreeThreading._run_threads s� ���� ��<�<�'�'��M�M�?�@�@�@��� !� !� !� !� !� !�3� 3� 3� 3�!�$�.�1�1�3� 3� 3��� � �A� �G�G�I�I�I�I�� � �A� �F�F�H�H�H�H�� ���)�O� � r c � � ��� t t d� � � � dg d�d�dd��t j �d�� � ���� fd �}� � |� � d S ) N�@ �value)� g @NTF)�key�listu hello é world)�numbers�nested�stringT�� sort_keysc � �� t �j � � D ],} �� t j �d�� � �� � �-d S �NTr/ )r �N_ITER�assertEqual� simplejson�dumps)r �data�expectedr"