
    ?g                    :   S SK Jr  S SKrS SKrS SKJr  S SKJr  S SKJr  S SKJ	r	  S SKJ
r
  S SKrS SKr\
(       a  S SKJr   " S	 S
5      rSS jr\R"                  " SSS9SS j5       r\R"                  " SSS9SS j5       r\R"                  " SSS9SS j5       rg)    )annotationsN)TracebackType)Any)Callable)	Generator)TYPE_CHECKING)Selfc                  P    \ rS rSrSrS	S jrS
S jrSS jr        SS jrSr	g)catch_unraisable_exception   a  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                     S U l         S U l        g N)
unraisable	_old_hookselfs    =/usr/lib/python3/dist-packages/_pytest/unraisableexception.py__init__#catch_unraisable_exception.__init__)   s    9=IM    c                    Xl         g r   )r   )r   r   s     r   _hook catch_unraisable_exception._hook-   s	     %r   c                Z    [         R                  U l        U R                  [         l        U $ r   )sysunraisablehookr   r   r   s    r   	__enter__$catch_unraisable_exception.__enter__2   s     ++!ZZr   c                ^    U R                   c   eU R                   [        l        S U l         U ?g r   )r   r   r   r   )r   exc_typeexc_valexc_tbs       r   __exit__#catch_unraisable_exception.__exit__7   s,     ~~)))!^^Or   )r   r   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____firstlineno____doc__r   r   r   r#   __static_attributes__ r   r   r   r      sB    (N%

	,	 &	 %		
 
	r   r   c               #  "  #    [        5        n  S v   U R                  (       a  U R                  R                  b  U R                  R                  nOSnU SU R                  R                  < S3nUSR	                  [
        R                  " U R                  R                  U R                  R                  U R                  R                  5      5      -  n[        R                  " [        R                  " U5      5        S S S 5        g ! U R                  (       a  U R                  R                  b  U R                  R                  nOSnU SU R                  R                  < S3nUSR	                  [
        R                  " U R                  R                  U R                  R                  U R                  R                  5      5      -  n[        R                  " [        R                  " U5      5        f f = f! , (       d  f       g = f7f)NzException ignored inz: z

 )r   r   err_msgobjectjoin	tracebackformat_exceptionr    	exc_valueexc_tracebackwarningswarnpytest PytestUnraisableExceptionWarning)cmr0   msgs      r   !unraisable_exception_runtest_hookr=   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   HG>D
C.G>	H
C1G;;G>>
HHT)wrappertryfirstc               #  4   #    [        5        S h  vN   g  N7fr   r=   r-   r   r   pytest_runtest_setuprB   X        0222   c               #  4   #    [        5        S h  vN   g  N7fr   rA   r-   r   r   pytest_runtest_callrF   ]   rC   rD   c               #  4   #    [        5        S h  vN   g  N7fr   rA   r-   r   r   pytest_runtest_teardownrH   b   rC   rD   )r%   zGenerator[None])
__future__r   r   r3   typesr   typingr   r   r   r   r7   r9   typing_extensionsr	   r   r=   hookimplrB   rF   rH   r-   r   r   <module>rN      s    " 
          &, ,^L* -3 .3 -3 .3 -3 .3r   