
    9[g                    :   d dl mZ d dlZd dlZd dlmZ d dlmZ d dlmZ d dlm	Z	 d dlm
Z
 d dlZd dlZe
rd dlmZ  G d	 d
      ZddZ ej"                  dd      dd       Z ej"                  dd      dd       Z ej"                  dd      dd       Zy)    )annotationsN)TracebackType)Any)Callable)	Generator)TYPE_CHECKING)Selfc                  @    e Zd ZdZddZddZd	dZ	 	 	 	 	 	 	 	 d
dZy)catch_unraisable_exceptiona  Context manager catching unraisable exception using sys.unraisablehook.

    Storing the exception value (cm.unraisable.exc_value) creates a reference
    cycle. The reference cycle is broken explicitly when the context manager
    exits.

    Storing the object (cm.unraisable.object) can resurrect it if it is set to
    an object which is being finalized. Exiting the context manager clears the
    stored object.

    Usage:
        with catch_unraisable_exception() as cm:
            # code creating an "unraisable exception"
            ...
            # check the unraisable exception: use cm.unraisable
            ...
        # cm.unraisable attribute no longer exists at this point
        # (to break a reference cycle)
    c                     d | _         d | _        y N)
unraisable	_old_hookselfs    V/var/www/html/bid-api/venv/lib/python3.12/site-packages/_pytest/unraisableexception.py__init__z#catch_unraisable_exception.__init__)   s    9=IM    c                    || _         y r   )r   )r   r   s     r   _hookz catch_unraisable_exception._hook-   s     %r   c                Z    t         j                  | _        | j                  t         _        | S r   )sysunraisablehookr   r   r   s    r   	__enter__z$catch_unraisable_exception.__enter__2   s     ++!ZZr   c                \    | j                   J | j                   t        _        d | _         | `y r   )r   r   r   r   )r   exc_typeexc_valexc_tbs       r   __exit__z#catch_unraisable_exception.__exit__7   s,     ~~)))!^^Or   N)returnNone)r   zsys.UnraisableHookArgsr    r!   )r    r	   )r   ztype[BaseException] | Noner   zBaseException | Noner   zTracebackType | Noner    r!   )__name__
__module____qualname____doc__r   r   r   r    r   r   r   r      sB    (N%

	,	 &	 %		
 
	r   r   c               #    K   t               5 } 	 d  | j                  r| j                  j                  | j                  j                  }nd}| d| j                  j                  d}|dj	                  t        j                  | j                  j                  | j                  j                  | j                  j                              z  }t        j                  t        j                  |             	 d d d        y # | j                  r| j                  j                  | j                  j                  }nd}| d| j                  j                  d}|dj	                  t        j                  | j                  j                  | j                  j                  | j                  j                              z  }t        j                  t        j                  |             w w xY w# 1 sw Y   y xY ww)NzException ignored inz: z

 )r   r   err_msgobjectjoin	tracebackformat_exceptionr   	exc_valueexc_tracebackwarningswarnpytest PytestUnraisableExceptionWarning)cmr)   msgs      r   !unraisable_exception_runtest_hookr6   C   s    	#	%	L}}==((4 mm33G4G 	BMM$8$8#;4@rww....//33  fEEcJK# 
&	% }}==((4 mm33G4G 	BMM$8$8#;4@rww....//33  fEEcJK 	 
&	%s4   G7G+DC%G+8	G7C'G((G++G40G7T)wrappertryfirstc               #  4   K   t               E d {    y 7 wr   r6   r&   r   r   pytest_runtest_setupr;   X        0222   c               #  4   K   t               E d {    y 7 wr   r:   r&   r   r   pytest_runtest_callr?   ]   r<   r=   c               #  4   K   t               E d {    y 7 wr   r:   r&   r   r   pytest_runtest_teardownrA   b   r<   r=   )r    zGenerator[None])
__future__r   r   r,   typesr   typingr   r   r   r   r0   r2   typing_extensionsr	   r   r6   hookimplr;   r?   rA   r&   r   r   <module>rG      s    " 
          &, ,^L* -3 .3 -3 .3 -3 .3r   