+
    ei  c                   s   ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt	^ RI
Ht ^RIHt  ! R R]P                  4      t ! R R]4      t ! R R	]P                  4      t ! R
 R]P                  4      t ! R R]P                  4      t]P(                  P*                  ]P(                  P-                  ]P.                  ! 4       P1                  4       R8H  RRR7       ! R R]P                  4      4       4       tR# )    N)IS_PYPY)utilc                   s  a  ] tR t^t o ]P
                  ! RRRR4      .t]P                  P                  RRR.4      ]P                  P                  R 4       4       t]P                  P                  ]R	R
7      R 4       tR t]P                  P!                  ]P$                  R8H  RR
7      R 4       t]P                  P!                  ]P$                  R8H  RR
7      R 4       tR tR tRtV tR# )TestF77Callbacktestssrccallbackzfoo.fnamett2c                s(    V P                  V4       R # N)check_function)selfr      &&E/usr/lib64/python3.14/site-packages/numpy/f2py/tests/test_callback.pytest_allZTestF77Callback.test_all   s     	D!    z,PyPy cannot modify tp_doc after PyType_Ready)reasonc                s    \         P                  ! R 4      pV P                  P                  P                  V8X  g   Q hR# )a          a = t(fun,[fun_extra_args])

        Wrapper for ``t``.

        Parameters
        ----------
        fun : call-back function

        Other Parameters
        ----------------
        fun_extra_args : input tuple, optional
            Default: ()

        Returns
        -------
        a : int

        Notes
        -----
        Call-back functions::

            def fun(): return a
            Return objects:
                a : int
        N)textwrapZdedentmoduler   __doc__)r   Zexpected   & r   test_docstringZTestF77Callback.test_docstring   s5     ?? $ 4 {{}}$$000r   c                s   \        V P                  V4      pV! R  4      pV^8X  g   Q hV! R RR7      pV^8X  g   Q hV! R RR7      pV^8X  g   Q hV! R R	R7      pV^8X  g   Q hV! \        P                  \        P                  3R7      pV^8X  g   Q hV! \        P                  \        P                  3R7      pV^8X  g   Q hV! V P                  P
                  RR7      pV^8X  g   Q hV! V P                  P                  4      pV^8X  g   Q hV! V P                  P                  P                  4      pV^8X  g   Q h ! R R4      pV! 4       pV! V4      pV^8X  g   Q hV! VP                  4      pV^	8X  g   Q hR# )
c                  s    ^# )i    r   r   r   <lambda>0TestF77Callback.check_function.<locals>.<lambda>:   s    ar   c                 s    ^# i   r   a   &r   r   r   <       r   )Zfun_extra_argsc                 s    V # r
   r   r   r   r   r   r   >   r   r   c                 s    ^V ,           # r   r   r   r   r   r   r   @   s    Ar   c                   s,   a  ] tR t^Nt o R tR tRtV tR# ))TestF77Callback.check_function.<locals>.Ac                s    ^# i   r   r   r   r   __call__Z2TestF77Callback.check_function.<locals>.A.__call__O       r   c                s    ^	# )i	   r   r!   r   r   mthZ-TestF77Callback.check_function.<locals>.A.mthR   r#   r   r   N)__name__
__module____qualname____firstlineno__r"   r$   __static_attributes____classdictcell__Z__classdict__   @r   Ar   N   s      r   r-   N)i   r    )	Zgetattrr   mathZdegreesZpiZfuncZfunc0Z	_cpointerr$   )r   r   r   rr-   r   s   &&    r   r   ZTestF77Callback.check_function8   sQ   DKK&iLAvvk%0Avvk%0Avvoe4BwwdllDGG;7CxxdllDGG;7Cxxdkku5Bwwdkk Bwwdkk))*Bww	 	 CaDAvvaeeHAvvr   Zwin32z)Fails with MinGW64 Gfortran (Issue #9673)c                sZ    R  pV P                   P                  pV! V4      pV^ 8X  g   Q hR# )c                 s    V R 8X  d   ^ # ^# )r/   r   )Zcoder   r   r   Z6TestF77Callback.test_string_callback.<locals>.callback^   s    s{r   N)r   Zstring_callback)r   r   fr/      &   r   test_string_callbackZ$TestF77Callback.test_string_callback[   s,    	 KK''hKAvvr   c                s   \         P                  ! RR4      p\         P                  ! RR4      p\         P                  ! R.R4      pR pV P                  P                  pWV3 F  pV! WFVP
                  4      pV^ 8X  d   K  Q h	  R# )   S8Zc c                 s    V P                   V38w  d   ^# V P                  R8w  d   ^# \        P                  ! V R8H  4      '       g   ^# ^ # )r3   r4   r   )ZshapedtypenpZall)cuZlencur   r   r   Z<TestF77Callback.test_string_callback_array.<locals>.callbackp   s;    xxE8#xx466")$$r   Nr3   )r3   i   )r7   Zzerosarrayr   Zstring_callback_arrayZsize)r   Zcu1Zcu2Zcu3r   r0   r8   ress   &       r   test_string_callback_arrayZ*TestF77Callback.test_string_callback_arrayh   su     hhud#hhvs#hhtT"	 KK--S/BH"''*C!8O8 "r   c           
     sZ  a aa . oV 3R  loVVV 3R lpR UUu. uF-  p\        ^4       F  p\        P                  ! W3R7      NK  	  K/  	  pppV F  pVP                  4        K  	  V F  pVP	                  4        K  	  RP	                  S4      oS'       d   \        S4      hR# u uppi )c                  s~   < \         P                  ! R 4       SP                  P                  R 4      p V ^{8X  g   Q h^*# )gMbP?c                  s    ^{# i{   r   r   r   r   r   Z?TestF77Callback.test_threadsafety.<locals>.cb.<locals>.<lambda>   s    cr   )timeZsleepr   r   )r/   r   s    r   cbZ-TestF77Callback.test_threadsafety.<locals>.cb   s3     JJt k*A8O8r   c                 s  <  \        ^24       F8  pSP                  P                  S4      pV^*8X  g   Q hSP                  V 4       K:  	  R#   \         d)    SP                  \        P                  ! 4       4        R# i ; i)i2   N)ranger   r   r   	ExceptionZappend	tracebackZ
format_exc)r   Zjr/   r?   errorsr   s   &  r   runnerZ1TestF77Callback.test_threadsafety.<locals>.runner   sg    6rAb)A7N7''- #  6i22456s   AA /A?>A?)ZtargetZargsz

N)r   r	   )r@   	threadingZThreadZstartZjoinZAssertionError)r   rD   ZargZnZthreadsr   r?   rC   s   f     @@r   test_threadsafetyZ!TestF77Callback.test_threadsafety~   s     			6 #
"E"Iq F9,5 :" 	 

 AGGI  AFFH  V$ (( 
s   3B'c                s    V P                   P                  ^4        V P                   P                  ^4       R V P                   n        V P                   P                  ^4      pV^8X  g   Q hR V P                   n        V P                   P                  ^4      pV^8X  g   Q hV P                   = V P                   P                  ^4       RR lV P                   n        V P                   P                  ^4      pV^8X  g   Q hV P                   P                  ^4      pV^8X  g   Q hR#   \         d.   p\        T4      P	                  R4      '       g   Q h Rp?ELARp?ii ; i  \         d.   p\        T4      P	                  R4      '       g   Q h Rp?EL`Rp?ii ; i  \         d.   p\        T4      P	                  R4      '       g   Q h Rp?ELRp?ii ; i)   zCallback global_f not definedNz!cb: Callback global_f not definedc                 s    V ^,           # r9   r   Zxr   r   r   6TestF77Callback.test_hidden_callback.<locals>.<lambda>       Qr   c                 s    V ^,           # )rG   r   rH   r   r   r   rI      rJ   r   c                 s    V ^,           # )   r   rH   r   r   r   rI      s    1q5r   )r    )r   Zhidden_callbackrA   ZstrZ
startswithZhidden_callback2Zglobal_f)r   Zmsgr/      &  r   test_hidden_callbackZ$TestF77Callback.test_hidden_callback   s   	HKK''*	LKK((+  /KK''*Avv.KK''*AvvKK 	HKK''*  1KK''*Avv KK((+Avv9  	Hs8&&'FGGGG	H
  	Ls8&&'JKKKK	L  	Hs8&&'FGGGG	HsF   D+ E& 2F! +E#6"EE#&F1"FF!G,"GGr   N)r%   r&   r'   r(   r   getpathsourcespytestmarkZparametrizeslowr   xfailr   r   r   Zskipifsysplatformr2   r<   rF   rM   r)   r*   r+   r,   r   r   r      s
    ||GUJ@AG[[Vc4[1[["  2" [[wL  N1N1:!F [[/J  L	L	 [[/J  LL(&)P r   r   c                   s     ] tR t^tRtR.tRtR# )TestF77CallbackPythonTLSzO
Callback tests using Python thread-local storage instead of
compiler-provided
z-DF2PY_USE_PYTHON_TLSr   N)r%   r&   r'   r(   r   optionsr)   r   r   r   rV   rV      s    
 ''Gr   rV   c                   s   a  ] tR t^t o ]P
                  ! RRRR4      .t]P                  P                  R 4       t
RtV tR# )TestF90Callbackr   r   r   zgh17797.f90c                s    R  p\         P                  ! . RO\         P                  R7      pV P                  P	                  W4      pV^8X  g   Q hR# )c                 s    V ^{,           # r=   r   rH   r   r   incrZ*TestF90Callback.test_gh17797.<locals>.incr   s    s7Nr   )r6   N)r3   rG   rK   )r7   r:   Zint64r   Zgh17797)r   rY   Zyr/   r1   r   test_gh17797ZTestF90Callback.test_gh17797   s?    	 HHYbhh/KK(O###r   r   N)r%   r&   r'   r(   r   rN   rO   rP   rQ   rR   rZ   r)   r*   r+   r,   r   rX   rX      s8     ||GUJFGG[[$ $r   rX   c                   s   a  ] tR t^t o Rt]P                  ! RRRR4      .t]P                  P                  R 4       tRtV tR# )	TestGH18335zThe reproduction of the reported issue requires specific input that
extensions may break the issue conditions, so the reproducer is
implemented as a separate test class. Do not extend this test with
other tests!
r   r   r   zgh18335.f90c                sT    R  pV P                   P                  V4      pV^|8X  g   Q hR# )c                 s0    V ^ ;;,          ^,          uu&   R# )r    Nr   rH   r   r   fooZ%TestGH18335.test_gh18335.<locals>.foo   s    aDAIDr   N)r   Zgh18335)r   r\   r/   rL   r   test_gh18335ZTestGH18335.test_gh18335   s)    	 KK$G||r   r   N)r%   r&   r'   r(   r   r   rN   rO   rP   rQ   rR   r]   r)   r*   r+   r,   r   r[   r[      s?     
 ||GUJFGG[[ r   r[   c                   s~   a  ] tR t^t o ]P
                  ! RRRR4      ]P
                  ! RRRR4      .tRtR tRt	V t
R	# )
TestGH25211r   r   r   z	gh25211.fzgh25211.pyfZ	callback2c                sT    R  pV P                   P                  V4      pV^n8X  g   Q hR# )c                 s    W ,          # r
   r   rH   r   r   barZ%TestGH25211.test_gh25211.<locals>.bar   s	    5Lr   N)r   r\   )r   r_   r;   rL   r   test_gh25211ZTestGH25211.test_gh25211   s'    	 kkooc"czzr   r   N)r%   r&   r'   r(   r   rN   rO   Zmodule_namer`   r)   r*   r+   r,   r   r^   r^      s@     ||GUJD||GUJFHGK r   r^   ZdarwinFz*Callback aborts cause CI failures on macOS)Z	conditionZrunr   c                   sX   a  ] tR t^t o ]P
                  ! RRRR4      .tR.tR tRt	V t
R# )	TestCBFortranCallstatementr   r   r   zgh26681.f90z--lowerc                s0   \         P                  ! \        R R7      ;_uu_ 4       pV P                  P                  P
                  V P                  n        V P                  P                  P                  R 4       RRR4       R#   + '       g   i     R# ; i)Zhelpme)ZmatchN)rP   ZraisesZ
ValueErrorr   ZutilsZmy_abortZ
mypy_abortZdo_something)r   Zexcr   r   test_callstatement_fortranZ5TestCBFortranCallstatement.test_callstatement_fortran  sX    ]]:X66#%)[[%6%6%?%?DKK"KK**84 7666s   ABB	r   N)r%   r&   r'   r(   r   rN   rO   rW   rb   r)   r*   r+   r,   r   ra   ra      s/     
 ||GUJFGGkG5 5r   ra   )r.   rU   rT   r   rE   r>   rB   rP   Znumpyr7   Znumpy.testingr   r5   r   ZF2PyTestr   rV   rX   r[   r^   rQ   rR   rS   ZsystemZlowerra   r   r   r   <module>rc      s      
       ! tdmm tn( (
$dmm 
$$-- "
$-- 
 hoo/5578CF  H5 5H 5r   