
    J/Ph:                        d Z ddlZddlZddlZddlmZmZmZ ddl	m
Z
 ddlmZ ddlmZmZmZmZ ddlmZ ddlmZmZmZ dd	lmZmZmZmZ dd
lmZ ddlm Z! ddl"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z( ddl)Z) G d de)j(                  Z* G d de)j(                  Z+ G d de)j(                  Z, G d de)j(                  Z- G d de%e)j(                  Z. G d de%e(          Z/e0dk    r e)j1                     dS dS )z"
Unspecified error handling tests
    N)jitnjittypes)errors)	structref)overload	intrinsicoverload_methodoverload_attribute)CompilerBase)TranslateByteCode	FixupArgsIRProcessing)NopythonTypeInferenceDeadCodeEliminationNoPythonBackendNativeLowering)PassManager)_err_reasons)skip_parfors_unsupportedoverride_configSerialMixinskip_unless_cffiskip_unless_scipyTestCasec                       e Zd Zd ZdS )TestErrorHandlingBeforeLoweringc                    d }t           t          fD ]w}|                     t          j                  5 }  ||          d           d d d            n# 1 swxY w Y   d}|                     |t          |j                             xd S )Nc                     | dz   fd}|S )z return the closure    c                     | z   S N )xzs    ^/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numba/tests/test_errorhandling.pyinnerzmTestErrorHandlingBeforeLowering.test_unsupported_make_function_return_inner_func.<locals>.func.<locals>.inner#   s    1u    r#   )r$   r'   r%   s     @r&   funcz^TestErrorHandlingBeforeLowering.test_unsupported_make_function_return_inner_func.<locals>.func   s*    AA    Lr(   r    z%Cannot capture the non-constant value)r   r   assertRaisesr   TypingErrorassertInstr	exception)selfr)   pipelineraisesexpecteds        r&   0test_unsupported_make_function_return_inner_funczPTestErrorHandlingBeforeLowering.test_unsupported_make_function_return_inner_func   s    	 	 	 T	 	; 	;H""6#566 "&q!!!" " " " " " " " " " " " " " " ?HMM(C(8$9$9::::	; 	;s   AA	A	N)__name__
__module____qualname__r3   r#   r(   r&   r   r      s#        ; ; ; ; ;r(   r   c                       e Zd Zd ZdS )TestUnsupportedReportingc                     t           d             }|                     t          j                  5 } |             d d d            n# 1 swxY w Y   d}|                     |t          |j                             d S )Nc                  2    t          j        g d           d S )N)r          )np
asanyarrayr#   r(   r&   r)   zFTestUnsupportedReporting.test_unsupported_numpy_function.<locals>.func3   s    M'''"""""r(   z4Use of unsupported NumPy function 'numpy.asanyarray'r   r*   r   r+   r,   r-   r.   )r/   r)   r1   r2   s       r&   test_unsupported_numpy_functionz8TestUnsupportedReporting.test_unsupported_numpy_function1   s    		# 	# 
	# v122 	fDFFF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 JhF$4 5 566666   AAAN)r4   r5   r6   r@   r#   r(   r&   r8   r8   /   s#        
7 
7 
7 
7 
7r(   r8   c                   T    e Zd Zd Zd Zd Zd Zd Zd Ze	d             Z
d Zd	 Zd
S )TestMiscErrorHandlingc                 ~    t           d             }t          j        dgt          j                  } ||           d S )Nc                     d| z  S N
   r#   r$   s    r&   fnzHTestMiscErrorHandling.test_use_of_exception_for_flow_control.<locals>.fnE   s    q5Lr(   g      ?)dtype)r   r=   arrayfloat64)r/   rI   as      r&   &test_use_of_exception_for_flow_controlz<TestMiscErrorHandling.test_use_of_exception_for_flow_control@   sH    
 
	 	 
	 HcU,,,
1r(   c                     d }d }||fD ]f}|                      t                    5 } |             d d d            n# 1 swxY w Y   |                     dt          |j                             gd S )Nc                       t          d          )Ntest_string	Exceptionr#   r(   r&   foo_commentedz_TestMiscErrorHandling.test_commented_func_definition_is_not_a_definition.<locals>.foo_commentedR       M***r(   c                       t          d          )z> def docstring containing def might match function definition!rQ   rR   r#   r(   r&   foo_docstringz_TestMiscErrorHandling.test_commented_func_definition_is_not_a_definition.<locals>.foo_docstringV   rU   r(   rQ   )r*   rS   r,   r-   r.   )r/   rT   rW   r)   r1   s        r&   2test_commented_func_definition_is_not_a_definitionzHTestMiscErrorHandling.test_commented_func_definition_is_not_a_definitionL   s    	+ 	+ 	+	+ 	+ 	+ #M2 	@ 	@D""9--                MM-V-=)>)>????		@ 	@s   >A	A	c                 T    G d dt                     }t          |          d             }|                     t          j                  5 } |t          ddg                     d d d            n# 1 swxY w Y   d}|                     |t          |j                             d S )Nc                       e Zd Zd ZdS )FTestMiscErrorHandling.test_use_of_ir_unknown_loc.<locals>.TestPipelinec                    d}t          |          }|                    t          d           |                    t          d           |                    t          d           |                    t
          d           |                    t          d           |                    t          d           |                    t          d           |	                                 |gS )	Nbad_DCE_pipelinezanalyzing bytecodezfix up argszprocessing IRDCEznopython frontendznative loweringznopython mode backend)
r   add_passr   r   r   r   r   r   r   finalize)r/   namepms      r&   define_pipelineszWTestMiscErrorHandling.test_use_of_ir_unknown_loc.<locals>.TestPipeline.define_pipelinesc   s    ) &&-/CDDDI}555L/::: /77713FGGGN,=>>>O-DEEEtr(   N)r4   r5   r6   rc   r#   r(   r&   TestPipeliner[   b   s#            r(   rd   )pipeline_classc                     dS )Nr   r#   rM   s    r&   fz;TestMiscErrorHandling.test_use_of_ir_unknown_loc.<locals>.fs   s    1r(   r    r;   z File "unknown location", line 0:)	r   r   r*   r   r+   iterr,   r-   r.   )r/   rd   rh   r1   r2   s        r&   test_use_of_ir_unknown_locz0TestMiscErrorHandling.test_use_of_ir_unknown_loc`   s   	 	 	 	 	< 	 	 	" 
\	*	*	*	 	 
+	*	 v122 	fAdAa5kkNNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 6hF$4 5 566666s   A33A7:A7c                     |                      t          j                  5 } |             d d d            n# 1 swxY w Y   ddg}|D ]*}|                     |t	          |j                             +d S )NzThe use of az'in globals, is not supported as globals)r*   r   r+   r,   r-   r.   )r/   r)   r1   r2   exs        r&   check_write_to_globalsz,TestMiscErrorHandling.check_write_to_globals}   s    v122 	fDFFF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 #$MN 	5 	5BMM"c&"2334444	5 	5s   7;;c                 V    ddl m} |                     t          |                     d S )Nr   )global_reflected_write)"numba.tests.errorhandling_usecasesro   rm   r   )r/   ro   s     r&   *test_handling_of_write_to_reflected_globalz@TestMiscErrorHandling.test_handling_of_write_to_reflected_global   s7    MMMMMM##D)?$@$@AAAAAr(   c                 V    ddl m} |                     t          |                     d S )Nr   )global_dict_write)rp   rs   rm   r   )r/   rs   s     r&   +test_handling_of_write_to_typed_dict_globalzATestMiscErrorHandling.test_handling_of_write_to_typed_dict_global   s7    HHHHHH##D):$;$;<<<<<r(   c                    t          d          d             }|                     t          j                  5 } |             d d d            n# 1 swxY w Y   d}|                     |t          |j                             d S )NT)parallelc                  *    t          d          D ]} d S rF   )prange)is    r&   foozPTestMiscErrorHandling.test_handling_forgotten_numba_internal_import.<locals>.foo   s$    BZZ   r(   zC'prange' looks like a Numba internal function, has it been importedr?   )r/   rz   r1   r2   s       r&   -test_handling_forgotten_numba_internal_importzCTestMiscErrorHandling.test_handling_forgotten_numba_internal_import   s    	t				 	 
		 v122 	fCEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	+hF$4 5 566666   AAAc                 (   d }d}t          d          t          fD ]t}|                     t          j                  5 }  ||                       d d d            n# 1 swxY w Y   |                     |t          |j                             ud S )Nc                  8    d t          d          D              d S )Nc              3      K   | ]}|V  d S r"   r#   ).0r$   s     r&   	<genexpr>zdTestMiscErrorHandling.test_handling_unsupported_generator_expression.<locals>.foo.<locals>.<genexpr>   s"      ""1Q""""""r(   rG   )ranger#   r(   r&   rz   zQTestMiscErrorHandling.test_handling_unsupported_generator_expression.<locals>.foo   s"    ""b		""""""r(   z-The use of yield in a closure is unsupported.T)forceobj)r   r   r*   r   UnsupportedErrorr,   r-   r.   )r/   rz   r2   decr1   s        r&   .test_handling_unsupported_generator_expressionzDTestMiscErrorHandling.test_handling_unsupported_generator_expression   s    	# 	# 	# C%%%t+ 	; 	;C""6#:;; vC


              MM(C(8$9$9::::	; 	;s   AA"	%A"	c                     t           d             }d}|                     t          j                  5 } |             d d d            n# 1 swxY w Y   |                     |t          |j                             d S )Nc                      t           S r"   rg   r#   r(   r&   rz   zCTestMiscErrorHandling.test_handling_undefined_variable.<locals>.foo   s    Hr(   z"NameError: name 'a' is not definedr?   )r/   rz   r2   r1   s       r&    test_handling_undefined_variablez6TestMiscErrorHandling.test_handling_undefined_variable   s    		 	 
	 8v122 	fCEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	hF$4 5 566666s   A		AAN)r4   r5   r6   rN   rX   rj   rm   rq   rt   r   r{   r   r   r#   r(   r&   rC   rC   >   s        
 
 
@ @ @(7 7 7:5 5 5B B B= = = 7 7 7	; 	; 	;	7 	7 	7 	7 	7r(   rC   c                   |    e Zd Zd Zd Zed             Zd Zd Zd Z	d Z
d Zd	 Zd
 Zd Zed             Zd ZdS )TestErrorMessagesc                    dd t                    fd            }t          fd            }|                     t          j                  5 } |             d d d            n# 1 swxY w Y   t          |j                  }|                     t          d         	                                d         |           |                     |           d S )Nspecific_reasonc                      d S r"   r#   r#   r(   r&   rz   z2TestErrorMessages.test_specific_error.<locals>.foo       Dr(   c                  ,    t          j                   r"   )r   NumbaValueError)given_reasons   r&   ol_fooz5TestErrorMessages.test_specific_error.<locals>.ol_foo   s    (666r(   c                                     d S r"   r#   rz   s   r&   call_fooz7TestErrorMessages.test_specific_error.<locals>.call_foo       CEEEEEr(   specific_errorr   )
r   r   r*   r   r+   r-   r.   r,   error_reasons
splitlines)r/   r   r   r1   excstrrz   r   s        @@r&   test_specific_errorz%TestErrorMessages.test_specific_error   s5   (	 	 	 
#	7 	7 	7 	7 
	7 
	 	 	 	 
	 v122 	fHJJJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 V%&&m$45@@BB1EvNNNlF+++++   A**A.1A.c                 8   d t                    d             }t          fd            }|                     t          j                  5 } |             d d d            n# 1 swxY w Y   t          |j                  }|                     d|           d S )Nc                      d S r"   r#   r#   r(   r&   rz   z2TestErrorMessages.test_no_match_error.<locals>.foo   r   r(   c                      d S r"   r#   r#   r(   r&   r   z5TestErrorMessages.test_no_match_error.<locals>.ol_foo   s    4r(   c                                     d S r"   r#   r   s   r&   r   z7TestErrorMessages.test_no_match_error.<locals>.call_foo   r   r(   zNo match)r   r   r*   r   r+   r-   r.   r,   )r/   r   r   r1   r   rz   s        @r&   test_no_match_errorz%TestErrorMessages.test_no_match_error   s    	 	 	 
#	 	 
	 
	 	 	 	 
	 v122 	fHJJJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 V%&&j&)))))   A%%A),A)c                    t           d             }|                     t          j                  5 } |             ddd           n# 1 swxY w Y   t	          |j                  }|                     t          d                                         d         |           t          j
                            ddd          }d| d	}|                     |                    |          |           dS )
z Checks that the reported source location for an overload is the
        overload implementation source, not the actual function source from the
        target library.c                  D    t           j                            d           d S )Nchars)r=   linalgsvdr#   r(   r&   rz   zDTestErrorMessages.test_error_function_source_is_correct.<locals>.foo   s    IMM'"""""r(   Nr   r   numbar=   z	linalg.pyz'Overload in function 'svd_impl': File: :)r   r*   r   r+   r-   r.   r,   r   r   ospathjoinformat)r/   rz   r1   r   expected_filer2   s         r&   %test_error_function_source_is_correctz7TestErrorMessages.test_error_function_source_is_correct   s    
	# 	# 
	# v122 	fCEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 V%&&m$45@@BB1EvNNNWdK@@M]MMMhoom44f=====rA   c                 (   t           d             }|                     t          j                  5 } |             d d d            n# 1 swxY w Y   t	          |j                  }|                     d|           |                     d|           d S )Nc                      ddz   S )NrM   r    r#   r#   r(   r&   rz   z<TestErrorMessages.test_concrete_template_source.<locals>.foo   s    7Nr(   zOverload of function 'add'	No match.r   r*   r   r+   r-   r.   r,   r/   rz   r1   r   s       r&   test_concrete_template_sourcez/TestErrorMessages.test_concrete_template_source   s    		 	 
	 v122 	fCEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 V%&&2F;;; 	k6*****rA   c                     t           d             }|                     t          j                  5 } |             d d d            n# 1 swxY w Y   t	          |j                  }|                     d|           d S )Nc                       t          d          S Nr    )lenr#   r(   r&   rz   z<TestErrorMessages.test_abstract_template_source.<locals>.foo  s    q66Mr(   zOverload of function 'len'r   r   s       r&   test_abstract_template_sourcez/TestErrorMessages.test_abstract_template_source   s    		 	 
	 v122 	fCEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 V%&&2F;;;;;rA   c                     t           d             }|                     t          j                  5 } |             d d d            n# 1 swxY w Y   t	          |j                  }|                     d|           d S )Nc                  *    t          j        d           S r"   )r=   angler#   r(   r&   rz   z<TestErrorMessages.test_callable_template_source.<locals>.foo  s    8D>>!r(   z6No implementation of function Function(<function angler   r   s       r&   test_callable_template_sourcez/TestErrorMessages.test_callable_template_source  s    		" 	" 
	" v122 	fCEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 V%&&N	 	 	 	 	rA   c                    d t                    d             }t          fd            }|                     t          j                  5 } |             d d d            n# 1 swxY w Y   t          |j                  }|                     d|           t          j	        
                    ddd          }d| d	}|                     |                    |          |           |                     d
|           d S )Nc                     d S r"   r#   rH   s    r&   barzDTestErrorMessages.test_overloadfunction_template_source.<locals>.bar  r   r(   c                     d S r"   r#   rH   s    r&   ol_barzGTestErrorMessages.test_overloadfunction_template_source.<locals>.ol_bar      Dr(   c                        d          S r   r#   )r   s   r&   rz   zDTestErrorMessages.test_overloadfunction_template_source.<locals>.foo"  s    3q66Mr(   z
<numerous>r   testsztest_errorhandling.pyz"Overload of function 'bar': File: r   r   )r   r   r*   r   r+   r-   r.   assertNotInr   r   r   r,   r   )r/   r   rz   r1   r   r   expected_olr   s          @r&   %test_overloadfunction_template_sourcez7TestErrorMessages.test_overloadfunction_template_source  s`   	 	 	 
#	 	 
	 
	 	 	 	 
	 v122 	fCEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 V%&& 	v...Wg%<> >K=KKKk((77@@@k6*****r   c                    ddt           fd            t          fd            }|                     t          j                  5 } |             d d d            n# 1 swxY w Y   t          |j                  }|                     t          d         	                                d         |           |                     |           |                     |           |                     d|           d S )Nzx must be literalzarray.ndim must be 1c                     t          |t          j                  st          j                  |j        dk    rt          j                  t          j        ||          }d }||fS )Nr    c                     d S r"   r#   )contextbuilder	signatureargss       r&   codegenzSTestErrorMessages.test_intrinsic_template_source.<locals>.myintrin.<locals>.codegenB      r(   )
isinstancer   IntegerLiteralr   RequireLiteralValuendimr   intp)	typingctxr$   arrsigr   given_reason1given_reason2s        r&   myintrinzBTestErrorMessages.test_intrinsic_template_source.<locals>.myintrin8  sp    a!566 @0???x1}},];;;*Q$$C  <r(   c                  H    t          j        d          }  d|            d S )N)r;   r;   r    )r=   zeros)r   r   s    r&   call_intrinzETestErrorMessages.test_intrinsic_template_source.<locals>.call_intrinF  s*    (6""CHQr(   r   r   zIntrinsic in function)
r	   r   r*   r   r+   r-   r.   r,   r   r   )r/   r   r1   r   r   r   r   s       @@@r&   test_intrinsic_template_sourcez0TestErrorMessages.test_intrinsic_template_source3  sR   +.		  	  	  	  	  
	  
	 	 	 	 
	 v122 	fKMMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 V%&&m$45@@BB1EvNNNmV,,,mV,,,-v66666s   A##A'*A'c                 B   t          t          j        d          d             }t          d             }|                     t
          j                  5 } |             d d d            n# 1 swxY w Y   t          |j                  }| 	                    d|           d S )N
isnonsensec                     d S r"   r#   r/   s    r&   ol_unicode_isnonsensezTTestErrorMessages.test_overloadmethod_template_source.<locals>.ol_unicode_isnonsenseW  r   r(   c                  .    d                                  d S Nabcr   r#   r(   r&   rz   zBTestErrorMessages.test_overloadmethod_template_source.<locals>.foo[  s    r(   ,Overload of function 'ol_unicode_isnonsense')
r
   r   UnicodeTyper   r*   r   r+   r-   r.   r,   r/   r   rz   r1   r   s        r&   #test_overloadmethod_template_sourcez5TestErrorMessages.test_overloadmethod_template_sourceT  s     
*L	9	9	 	 
:	9	 
	 	 
	 v122 	fCEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 V%&&DfMMMMMr   c                 B   t          t          j        d          d             }t          d             }|                     t
          j                  5 } |             d d d            n# 1 swxY w Y   t          |j                  }| 	                    d|           d S )Nr   c                     d S r"   r#   r   s    r&   r   zWTestErrorMessages.test_overloadattribute_template_source.<locals>.ol_unicode_isnonsenseh  r   r(   c                      dj          d S r   r   r#   r(   r&   rz   zETestErrorMessages.test_overloadattribute_template_source.<locals>.fool  s    r(   r   )
r   r   r   r   r*   r   r+   r-   r.   r,   r   s        r&   &test_overloadattribute_template_sourcez8TestErrorMessages.test_overloadattribute_template_sourcee  s     
E-|	<	<	 	 
=	<	 
	 	 
	 v122 	fCEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 V%&&DfMMMMMr   c                    ddl m t          fd            }|                     t          j                  5 } |             d d d            n# 1 swxY w Y   t          |j                  }|                     d|           d S )Nr   c_cosc                        d           d S NrM   r#   r   s   r&   rz   zMTestErrorMessages.test_external_function_pointer_template_source.<locals>.fooy  s    E#JJJJJr(   .Type Restricted Function in function 'unknown')	numba.tests.ctypes_usecasesr   r   r*   r   r+   r-   r.   r,   )r/   rz   r1   r   r   s       @r&   .test_external_function_pointer_template_sourcez@TestErrorMessages.test_external_function_pointer_template_sourcev  s    555555		 	 	 	 
	 v122 	fCEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 V%&&FOOOOOr|   c                 D   ddl m} |                                 |j        t          fd            }|                     t          j                  5 } |             d d d            n# 1 swxY w Y   t          |j	                  }| 
                    d|           d S )Nr   )cffi_usecasesc                        d           d S r   r#   )r)   s   r&   rz   zITestErrorMessages.test_cffi_function_pointer_template_source.<locals>.foo  s    DIIIIIr(   r   )numba.testsr   initcffi_cosr   r*   r   r+   r-   r.   r,   )r/   modrz   r1   r   r)   s        @r&   *test_cffi_function_pointer_template_sourcez<TestErrorMessages.test_cffi_function_pointer_template_source  s    444444


|		 	 	 	 
	 v122 	fCEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 V%&&FOOOOOs   A++A/2A/c                    t           j         G d dt          j                              } G d dt           j                  }t          j        ||ddg           |                     t          j                  5 } |dd	           d d d            n# 1 swxY w Y   t          |j
                  }|                     d
|           d S )Nc                       e Zd ZdS );TestErrorMessages.test_missing_source.<locals>.ParticleTypeN)r4   r5   r6   r#   r(   r&   ParticleTyper    s        Dr(   r  c                       e Zd Zd ZdS )7TestErrorMessages.test_missing_source.<locals>.Particlec                 B    t           j                            | |          S r"   )r   StructRefProxy__new__)clsposmasss      r&   r  z?TestErrorMessages.test_missing_source.<locals>.Particle.__new__  s     /77SAAAr(   N)r4   r5   r6   r  r#   r(   r&   Particler	    s(        B B B B Br(   r  r  r  r    r;   )r  r  z#missing a required argument: 'mass')r   registerr   	StructRefr  define_proxyr*   r   r+   r-   r.   r,   )r/   r  r  r1   r   s        r&   test_missing_sourcez%TestErrorMessages.test_missing_source  s7   			 	 	 	 	5? 	 	 
			B 	B 	B 	B 	By/ 	B 	B 	B
 	xvGGGv122 	$fH####	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ V%&&;VDDDDDs   :BBBN)r4   r5   r6   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r#   r(   r&   r   r      s       , , ,,* * *& > > >$+ + + 
< 
< 
<  + + +47 7 7BN N N"N N N"P P P P P PE E E E Er(   r   c                       e Zd Zd ZdS )"TestDeveloperSpecificErrorMessagesc                 N   d }t          dd          5  |                     t          j                  5 } t	          d          |           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   t          |j                  }|                     d|           d S )Nc                 0    |                      d           d S )N)maxrH   s    r&   rz   zPTestDeveloperSpecificErrorMessages.test_bound_function_error_string.<locals>.foo  s    EE"IIIIIr(   DEVELOPER_MODEr    zvoid(int64[:,:])ztoo many positional arguments)r   r*   r   r+   r   r-   r.   r,   r   s       r&    test_bound_function_error_stringzCTestDeveloperSpecificErrorMessages.test_bound_function_error_string  s(   	 	 	 -q11 	. 	.""6#566 .&('((---. . . . . . . . . . . . . . .	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. V%&&5v>>>>>s4    A0AA0A	A0 A	!A00A47A4N)r4   r5   r6   r  r#   r(   r&   r  r    s#        
? 
? 
? 
? 
?r(   r  c                       e Zd ZdZd ZdS )TestCapturedErrorHandlingz-Checks that the way errors are captured.
    c                    d t                    d             }t          j                    5  t          j        dt          j                   |                     t                    5 }t          d          fd            }d d d            n# 1 swxY w Y   d}| 	                    |t          |j                             d d d            d S # 1 swxY w Y   d S )Nc                     d S r"   r#   rH   s    r&   r   z=TestCapturedErrorHandling.test_error_in_overload.<locals>.bar  r   r(   c                     | j          d }|S )Nc                     d S r"   r#   rH   s    r&   implzNTestCapturedErrorHandling.test_error_in_overload.<locals>.ol_bar.<locals>.impl  r   r(   )some_invalid_attr)r$   r#  s     r&   r   z@TestCapturedErrorHandling.test_error_in_overload.<locals>.ol_bar  s      Kr(   ignorezvoid(int64)c                      |            d S r"   r#   )r$   r   s    r&   rz   z=TestCapturedErrorHandling.test_error_in_overload.<locals>.foo  s    CFFFFFr(   z+object has no attribute 'some_invalid_attr')r   warningscatch_warningssimplefilterr   NumbaPendingDeprecationWarningr*   AttributeErrorr   r,   r-   r.   )r/   r   r1   rz   r2   r   s        @r&   test_error_in_overloadz0TestCapturedErrorHandling.test_error_in_overload  s   	 	 	 
#	 	 
	 $&& 
	; 
	;!("("GI I I "">22 fm$$    %$               EHMM(C(8$9$9:::
	; 
	; 
	; 
	; 
	; 
	; 
	; 
	; 
	; 
	; 
	; 
	; 
	; 
	; 
	; 
	; 
	; 
	;s5   :C*BCB	CB	-CCCN)r4   r5   r6   __doc__r,  r#   r(   r&   r  r    s-         ; ; ; ; ;r(   r  __main__)2r-  numpyr=   r   r'  r   r   r   r   
numba.corer   numba.experimentalr   numba.extendingr   r	   r
   r   numba.core.compilerr   numba.core.untyped_passesr   r   r   numba.core.typed_passesr   r   r   r   numba.core.compiler_machineryr   numba.core.types.functionsr   r   numba.tests.supportr   r   r   r   r   r   unittestr   r8   rC   r   r  r  r4   mainr#   r(   r&   <module>r;     s        				  " " " " " " " " " "       ( ( ( ( ( (1 1 1 1 1 1 1 1 1 1 1 1 , , , , , ,6 6 6 6 6 6 6 6 6 6F F F F F F F F F F F F 5 5 5 5 5 5 D D D D D D> > > > > > > > > > > > > > > > ; ; ; ; ;h&7 ; ; ;&7 7 7 7 7x0 7 7 7q7 q7 q7 q7 q7H- q7 q7 q7hrE rE rE rE rE) rE rE rEj? ? ? ? ?h6G ? ? ?; ; ; ; ;X ; ; ;< zHMOOOOO r(   