
     YHh                         d dl 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d dlZd dlZd dl	m
Z
 d dlZd dlZd dlmc mZ d dlmZ e j*                  j-                  e j*                  j/                  e            Ze j*                  j5                  ed      Ze j*                  j5                  ed      Z ee      5 Z eed      D  ci c]  \  } }|jA                         |  c}} Z!ddd       da"d Z# G d d	ejH                        Z% G d
 de%      Z& G d de&      Z'e(dk(  r ejR                          yyc c}} w # 1 sw Y   WxY w)    N)	ccompiler)Cygdbcodefilecfuncs.c   c            
      v   t         t         S da 	 t        j                  g dt        j                        } | j	                         \  }}d}t        j                  ||j                  dd            }|rt        t        t        |j                                     }|ddgk\  rd	a t        j                  d
      5 }|j                  d       |j!                          t        j                  ddd|j"                  gt        j                        } | j	                         \  }}	 t        t        t        |j                  dd      j%                                     }|ddgk  rda d d d        t         st)        j*                  d       t         S # t        $ r d }Y (w xY w# t&        $ r da Y Hw xY w# 1 sw Y   MxY w)NF)gdbz-nxz	--version)stdoutzGNU gdb [^\d]*(\d+)\.(\d+)asciiignore      Tzw+)modez8python import sys; print("%s %s" % sys.version_info[:2])r	   -batch-xz6Skipping gdb tests, need gdb >= 7.2 with Python >= 2.7)have_gdb
subprocessPopenPIPEcommunicaterematchdecodeOSErrorlistmapintgroupstempfileNamedTemporaryFilewriteflushnamesplit
ValueErrorwarningswarn)pr
   _regexgdb_versiongdb_version_numberpython_version_scriptinternal_python_versions           \/var/www/html/planif/env/lib/python3.12/site-packages/Cython/Debugger/Tests/TestLibCython.pytest_gdbr0      s   H	H8Q
 MMO	-hhufmmGX&FG!#c;+=+=+?"@A!Q'H,,$7 %;P%++NP%++-$$eXt=R=W=W%X,6OO=MMO	%.23sFMM'S[<\<b<b<d3e.f+.!Q7#(% NOO=  0 " %$H%% %s=   'F :A(F/#A FFFF,)F/+F,,F//F8c                       e Zd Zd Zd Zy)DebuggerTestCasec           	      >   t               syt        j                         | _        t        j
                  j                  | j                  d      | _        t        j
                  j                  | j                  dd      | _        t        j
                  j                  | j                  d      | _	        t	        j                         | _        	 t	        j                  | j                         t        j                  t        | j                         t        j                  t         | j                  dz          t        j                  t         j#                  dd      | j                  dz          t%        j&                         }|j)                  dgd	d
g       t+        | j                  d| j                        }t-        j.                         }t1        j2                  d| j                  dt1        j4                  t              d|}t7        t        j8                  d      }t:        j<                  }|t:        _        |j?                          	  |j@                  d| j                  ddd	| j                  dd| |jC                  |d   |d   |d   dddgi       |jE                          |t:        _        |jG                          y# |jE                          |t:        _        |jG                          w xY w#  t	        j                  | j                          xY w)z
        Run gdb and have cygdb import the debug information from the code
        defined in TestParseTreeTransforms's setUp method
        Nzcodefile.pyxcython_debugcython_debug_info_codefilecfuncsz.cz.hr   Tz-fPIC)debugextra_postargsr   )test_directorymodulemodule_pathF)workdircleanup_workdirtagsw)	gdb_debug
output_dir)	targetdirincdirannotateextra_compile_optionsr9   r:   extra_objectszcfuncs.o)r9   r:   r<   rC   extra_extension_args )$r0   r   mkdtemptempdirospathjoindestfile
debug_destcfuncs_destfilegetcwdcwdchdirshutilcopyr   cfuncs_filereplacer   new_compilercompiledict	build_extOptimizationruntestsCythonCompileTestCase
parse_tagsopendevnullsysstderrdisable_optimization
run_cythonrun_distutilsrestore_stateclose)selfcompileroptsoptimization_disablercython_compile_testcase
new_stderrrc   s          r/   setUpzDebuggerTestCase.setUpG   s   
 z'')T\\>B'',,t||&4&BD  "ww||DLL(C99;H	HHT\\"KK$--0KKT%9%9D%@AKK++D$7,,t35 !--/Hj\wiP#||! MMD %.$:$:$<!&.&D&D ' %((2	'
 '# bjj#.JZZF#CJ!668#2'22 	"ll"$(%)\\+		 	 (55#'(8#9> !12*9:,)G 6  &335#
  " &335#
  "	HHTXXs&   F K: AK
 +K: 
-K77K: :"Lc                     t               sy t        j                  | j                         t	        j
                  | j                         y N)r0   rK   rS   rR   rT   rmtreerJ   )ri   s    r/   tearDownzDebuggerTestCase.tearDown   s*    z
dll#    N)__name__
__module____qualname__ro   rs   rH   rt   r/   r2   r2   E   s    Xt$rt   r2   c                   (     e Zd Z fdZ fdZ xZS )GdbDebuggerTestCasec           	         t               sy t        | 	          t        j                  d      }t        j                  dt
        j                  d d d      }t        j                  | j                  |      | _
        t        | j                  d      5 }|j                  |       d d d        ddd| j                  d	d
t
        j                  ddg	}g }t        j                  j!                  d      }|r|j#                  |       |j#                  t        j$                  j'                  t        j$                  j'                  t        j$                  j)                  t*        j,                                           t/        t        j                  t        j0                  j3                  |            }t5        j6                  |t4        j8                  t4        j8                  |      | _        y # 1 sw Y   JxY w)Na              python

            import os
            import sys
            import traceback

            def excepthook(type, value, tb):
                traceback.print_exception(type, value, tb)
                sys.stderr.flush()
                sys.stdout.flush()
                os._exit(1)

            sys.excepthook = excepthook

            # Have tracebacks end up on sys.stderr (gdb replaces sys.stderr
            # with an object that calls gdb.write())
            sys.stderr = sys.__stderr__

            end
            z            python

            from Cython.Debugger.Tests import test_libcython_in_gdb
            test_libcython_in_gdb.main(version=r   z)

            end
            ar	   r   r   z-nz--argsz-czimport codefile
PYTHONPATH)r|   )r
   rc   env)r0   superro   textwrapdedentrb   version_infocygdbmake_command_filerJ   gdb_command_filer`   r!   
executablerK   environgetappendrL   dirnameabspathCython__file__rZ   pathseprM   r   r   r   r(   )	ri   prefix_codecodefargspathsrL   r}   	__class__s	           r/   ro   zGdbDebuggerTestCase.setUp   sr   zoo ' ,  ##BQ' * + !& 7 78C!E $''- 	GGDM	 xt'<'<dH&79 zz~~l+LLRWW__RWW__GGOOFOO,&. / 	02::"**//%*@A!!????		 	s   G//G9c                    t               sy 	 t        | 	          | j                  rb| j                  j                  j                          | j                  j                  j                          | j                  j                          t        j                  | j                         y #  Y bxY w#  Y ExY w# t        j                  | j                         w xY wrq   )r0   r~   rs   r(   r
   rh   rc   waitrK   remover   )ri   r   s    r/   rs   zGdbDebuggerTestCase.tearDown   s    z		-GvvVV]]((*VV]]((*IId++,  IId++,s4   B8 $B* $B1 0B8 *B.,B8 1B53B8 8!C)ru   rv   rw   ro   rs   __classcell__)r   s   @r/   ry   ry      s    :x- -rt   ry   c                       e Zd Zd Zy)TestAllc                    t               sy | j                  j                         \  }}|j                  d      }|j                  d      }| j                  j                  }|dk(  r?t
        j                  j                  |       t
        j                  j                  |       y |dk\  rFd}|d|}|d|}|d|}d|d||d||}t
        j                  j                  |       y y )	NzUTF-8r   r   z******************************z   v INSIDE GDB v   z   v STDERR v   z   ^ INSIDE GDB ^   
)r0   r(   r   r   
returncoderb   rc   r!   )	ri   outerrexit_statusborderstartrc   enderrmsgs	            r/   test_allzTestAll.test_all   s    z66%%'Sjj!jj!ff''!JJS!JJS!AF396BE/5v>F396BC+0#vsCHFJJV$ rt   N)ru   rv   rw   r   rH   rt   r/   r   r      s    %rt   r   __main__)*rK   r   rb   rT   r&   r   unittestr   r   	distutilsr   r]   Cython.Distutils.extensionr   Cython.Distutils.old_build_ext	Distutilsold_build_extr[   Cython.Debuggerr   r   rL   r   r   r   rootrM   r   rV   r`   r   	enumeratestripsource_to_linenor   r0   TestCaser2   ry   r   ru   main)ilines   00r/   <module>r      s"   	 	 
          ! 2 2 *	wwrwwx0177<<j)ggll4,	(^ Hq7@AGGAt

aGH &R`$x(( `$FK-* K-\%! %8 zHMMO u HH Hs   6D8D2D82D88E