
    >qj                        d Z ddlZddlZddlZddlZddlZddlZ ej                  d      d   d   d   Zej                  j                  Zej                  e_        ej                  ge_        d Zej"                  j%                  d	      j'                  d
      Zej"                  j+                  e      5 Z ej.                  ej1                               Zddd       d Zy# 1 sw Y   d ZyxY w)a  
Regression test for the cython_optimize binary interface.

The __pyx_capi__ dict of each module contains PyCapsule objects whose
*name* string encodes the C-level function signature that Cython checks
at import time when another module does ``cimport``.  Any change to
those strings is a binary incompatibility that breaks every downstream
package (e.g., scikit-learn, statsmodels) compiled against the previous release,
without any compile-time warning.

The expected signatures are stored in cython_abi_signatures.json.
The test fails if:
  * an existing name disappears, or
  * an existing name's signature string changes.
Adding new names is explicitly allowed (it is not a break).
    Ndicts)modezBuild Dependenciesblaszcython blas ilp64c                     i }| j                   j                         D ]'  \  }}t        |      }||j                  d      ||<   ) |S )z@Return {name: signature} for every entry in module.__pyx_capi__.zutf-8)__pyx_capi__items_get_capsule_namedecode)moduleresultnamecapsuleraws        c/opt/rentech/trading_bot/.venv/lib/python3.12/site-packages/scipy/optimize/tests/test_cython_abi.py_extract_capir   0   sQ    F,,224 /g(?::g.F4L/ M    zscipy.optimize.testszcython_abi_signatures.jsonc            
         t         d   } t        j                  d      }t        |      }g }| j	                         D ]H  \  }}||vr|j                  d|d|d       #||   |k7  s,|j                  d|d|d||          J |r6dj                  |      }t        j                  d	t        |       d
|        yy)z>No existing cython_optimize signature may change or disappear.z%scipy.optimize.cython_optimize._zerosz	REMOVED  z (was )z	CHANGED  z
  expected: z
  actual:   
z7scipy.optimize.cython_optimize._zeros.__pyx_capi__ has z ABI breakage(s):
N)
	_EXPECTED	importlibimport_moduler   r   appendjoinpytestfaillen)expectedmodactualerrorsr   expected_sigjoineds          r   "test_cython_optimize_abi_stabilityr$   A   s    @AH

!
!"I
JC3FF&nn. 
lvMMD86,)9; D\\)MMD8 $+. /%d|.0
 6"Ec&k] S!!'*	
 r   )__doc__ctypesr   importlib.resourcesjsonr   scipyshow_configCYTHON_BLAS_ILP64	pythonapiPyCapsule_GetNamer	   c_char_prestype	py_objectargtypesr   	resourcesfilesjoinpath	_sig_fileas_file_floads	read_textr   r$    r   r   <module>r;      s   "       E7#$89&ABUV  $$66 "OO  $../   %%&<=FF 	   + +r

2<<>*I+
	+
s   8!C%%C1