o
    Û¾iU  ã                   @   sX   d Z ddlmZmZmZ ddlmZ edd„ ƒZedd„ ƒZedd	„ ƒZ	ed
d„ ƒZ
dS )z 
Exception handling intrinsics.
é    )ÚtypesÚerrorsÚcgutils)Ú	intrinsicc                 C   ó   dd„ }t j}|ƒ |fS )z4An intrinsic to check if an exception is raised
    c                 S   s   | j }| |¡S ©N)ÚnrtÚeh_check©ÚcontextÚbuilderÚ	signatureÚargsr   © r   úH/home/ubuntu/.local/lib/python3.10/site-packages/numba/core/unsafe/eh.pyÚcodegen   s   
z exception_check.<locals>.codegen)r   Úboolean©Ú	typingctxr   Úrestyper   r   r   Úexception_check	   s   
r   c                 C   r   )z5An intrinsic to mark the start of a *try* block.
    c                 S   ó   | j }| |¡ |  ¡ S r   )r   Úeh_tryÚget_dummy_valuer
   r   r   r   r      ó   
zmark_try_block.<locals>.codegen©r   Únoner   r   r   r   Úmark_try_block   ó   
r   c                 C   r   )z3An intrinsic to mark the end of a *try* block.
    c                 S   r   r   )r   Ú
eh_end_tryr   r
   r   r   r   r   &   r   zend_try_block.<locals>.codegenr   r   r   r   r   Úend_try_block"   r   r    c                 C   s:   |j turd}t | t¡¡‚dd„ }tj}|||ƒ|fS )zwBasically do ``isinstance(exc_value, exc_class)`` for exception objects.
    Used in ``except Exception:`` syntax.
    z#Exception matching is limited to {}c                 S   s   t jS r   )r   Útrue_bit)r   r   r   r   r   r   r   r   9   s   z exception_match.<locals>.codegen)Ú	exc_classÚ	Exceptionr   ÚUnsupportedErrorÚformatr   r   )r   Ú	exc_valuer"   Úmsgr   r   r   r   r   Úexception_match/   s   
r(   N)Ú__doc__Ú
numba.corer   r   r   Únumba.core.extendingr   r   r   r    r(   r   r   r   r   Ú<module>   s    


