
    ܙd|;                     B   d Z ddlZddlZddlmZmZmZmZm	Z	 ddl
mZ ddlmc mc 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, ddl-Z-g dZ.ej/        0                    ee          Z1 G d de-j2                  Z3 G d de-j2                  Z4 G d de-j2                  Z5 G d de-j2                  Z6 G d de+e-j2                  Z7 G d de+e-j2                  Z8e9dk    r e-j:                     dS dS )z"
Unspecified error handling tests
    N)jitnjittypedint64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_scipy)            c                       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 r   c                     | z   S N )xzs    >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__r6   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   r   r   )np
asanyarrayr&   r+   r)   r,   zFTestUnsupportedReporting.test_unsupported_numpy_function.<locals>.func6   s    M'''"""""r+   z4Use of unsupported NumPy function 'numpy.asanyarray'r   r-   r   r.   r/   r0   r1   )r2   r,   r4   r5   s       r)   test_unsupported_numpy_functionz8TestUnsupportedReporting.test_unsupported_numpy_function4   s    		# 	# 
	# v122 	fDFFF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 JhF$4 5 566666   AAAN)r7   r8   r9   rA   r&   r+   r)   r;   r;   2   s#        
7 
7 
7 
7 
7r+   r;   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>.fnH   s    q5Lr+   g      ?)dtype)r   r>   arrayfloat64)r2   rJ   as      r)   &test_use_of_exception_for_flow_controlz<TestMiscErrorHandling.test_use_of_exception_for_flow_controlC   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_commentedU       M***r+   c                       t          d          )z> def docstring containing def might match function definition!rR   rS   r&   r+   r)   foo_docstringz_TestMiscErrorHandling.test_commented_func_definition_is_not_a_definition.<locals>.foo_docstringY   rV   r+   rR   )r-   rT   r/   r0   r1   )r2   rU   rX   r,   r4   s        r)   2test_commented_func_definition_is_not_a_definitionzHTestMiscErrorHandling.test_commented_func_definition_is_not_a_definitionO   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)r2   namepms      r)   define_pipelineszWTestMiscErrorHandling.test_use_of_ir_unknown_loc.<locals>.TestPipeline.define_pipelinesf   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)r7   r8   r9   rd   r&   r+   r)   TestPipeliner\   e   s#            r+   re   )pipeline_classc                     dS )Nr   r&   rN   s    r)   fz;TestMiscErrorHandling.test_use_of_ir_unknown_loc.<locals>.fv   s    1r+   r   r   z File "unknown location", line 0:)	r   r   r-   r   r.   iterr/   r0   r1   )r2   re   ri   r4   r5   s        r)   test_use_of_ir_unknown_locz0TestMiscErrorHandling.test_use_of_ir_unknown_locc   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/   r0   r1   )r2   r,   r4   r5   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                 P    t           d             }|                     |           d S )Nc                      dt           d<   d S NrH   r   )_global_listr&   r+   r)   foozMTestMiscErrorHandling.test_handling_of_write_to_reflected_global.<locals>.foo        LOOOr+   r   rn   r2   rs   s     r)   *test_handling_of_write_to_reflected_globalz@TestMiscErrorHandling.test_handling_of_write_to_reflected_global   7    		! 	! 
	! 	##C(((((r+   c                 P    t           d             }|                     |           d S )Nc                      dt           d<   d S rq   )_global_dictr&   r+   r)   rs   zNTestMiscErrorHandling.test_handling_of_write_to_typed_dict_global.<locals>.foo   rt   r+   ru   rv   s     r)   +test_handling_of_write_to_typed_dict_globalzATestMiscErrorHandling.test_handling_of_write_to_typed_dict_global   rx   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 rG   )prange)is    r)   rs   zPTestMiscErrorHandling.test_handling_forgotten_numba_internal_import.<locals>.foo   s$    BZZ   r+   zC'prange' looks like a Numba internal function, has it been importedr@   )r2   rs   r4   r5   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+   rH   )ranger&   r+   r)   rs   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/   r0   r1   )r2   rs   r5   decr4   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%   rh   r&   r+   r)   rs   zCTestMiscErrorHandling.test_handling_undefined_variable.<locals>.foo   s    Hr+   z"NameError: name 'a' is not definedr@   )r2   rs   r5   r4   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)r7   r8   r9   rO   rY   rk   rn   rw   r|   r   r   r   r   r&   r+   r)   rD   rD   A   s        
 
 
@ @ @(7 7 7:5 5 5) ) )) ) ) 7 7 7	; 	; 	;	7 	7 	7 	7 	7r+   rD   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j        ej        d          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)   rs   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&   rs   s   r)   call_fooz7TestErrorMessages.test_specific_error.<locals>.call_foo       CEEEEEr+   specific_errorr   )
r
   r   r-   r   r.   r0   r1   r/   error_reasons
splitlines)r2   r   r   r4   excstrrs   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)   rs   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.   r0   r1   r/   )r2   r   r   r4   r   rs   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)   rs   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.   r0   r1   r/   r   r   ospathjoinformat)r2   rs   r4   r   expected_filer5   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=====rB   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 )NrN   r   r&   r&   r+   r)   rs   z<TestErrorMessages.test_concrete_template_source.<locals>.foo   s    7Nr+   zOverload of function 'add'	No match.r   r-   r   r.   r0   r1   r/   r2   rs   r4   r   s       r)   test_concrete_template_sourcez/TestErrorMessages.test_concrete_template_source   s    		 	 
	 v122 	fCEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 V%&&2F;;; 	k6*****rB   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)   rs   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;;;;;rB   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)   rs   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	 	 	 	 	rB   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&   rI   s    r)   barzDTestErrorMessages.test_overloadfunction_template_source.<locals>.bar$  r   r+   c                     d S r%   r&   rI   s    r)   ol_barzGTestErrorMessages.test_overloadfunction_template_source.<locals>.ol_bar'      Dr+   c                        d          S r   r&   )r   s   r)   rs   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.   r0   r1   assertNotInr   r   r   r/   r   )r2   r   rs   r4   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>.codegenK      r+   )
isinstancer   IntegerLiteralr   RequireLiteralValuendimr   intp)	typingctxr'   arrsigr   given_reason1given_reason2s        r)   myintrinzBTestErrorMessages.test_intrinsic_template_source.<locals>.myintrinA  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_intrinO  s*    (6""CHQr+   r   r   zIntrinsic in function)
r   r   r-   r   r.   r0   r1   r/   r   r   )r2   r   r4   r   r   r   r   s       @@@r)   test_intrinsic_template_sourcez0TestErrorMessages.test_intrinsic_template_source<  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&   r2   s    r)   ol_unicode_isnonsensezTTestErrorMessages.test_overloadmethod_template_source.<locals>.ol_unicode_isnonsense`  r   r+   c                  .    d                                  d S Nabcr   r&   r+   r)   rs   zBTestErrorMessages.test_overloadmethod_template_source.<locals>.food  s    r+   ,Overload of function 'ol_unicode_isnonsense')
r   r   UnicodeTyper   r-   r   r.   r0   r1   r/   r2   r   rs   r4   r   s        r)   #test_overloadmethod_template_sourcez5TestErrorMessages.test_overloadmethod_template_source]  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_isnonsenseq  r   r+   c                      dj          d S r   r   r&   r+   r)   rs   zETestErrorMessages.test_overloadattribute_template_source.<locals>.foou  s    r+   r   )
r   r   r   r   r-   r   r.   r0   r1   r/   r   s        r)   &test_overloadattribute_template_sourcez8TestErrorMessages.test_overloadattribute_template_sourcen  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 NrN   r&   r   s   r)   rs   zMTestErrorMessages.test_external_function_pointer_template_source.<locals>.foo  s    E#JJJJJr+   .Type Restricted Function in function 'unknown')	numba.tests.ctypes_usecasesr   r   r-   r   r.   r0   r1   r/   )r2   rs   r4   r   r   s       @r)   .test_external_function_pointer_template_sourcez@TestErrorMessages.test_external_function_pointer_template_source  s    555555		 	 	 	 
	 v122 	fCEEE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 V%&&FOOOOOr   zCFFI not supportedc                 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)   rs   zITestErrorMessages.test_cffi_function_pointer_template_source.<locals>.foo  s    DIIIIIr+   r   )numba.testsr  initcffi_cosr   r-   r   r.   r0   r1   r/   )r2   modrs   r4   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)r7   r8   r9   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)r7   r8   r9   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.   r0   r1   r/   )r2   r  r  r4   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)r7   r8   r9   r   r   r   r   r   r   r   r   r   r   r   r  unittest
skipUnlesscffi_support	SUPPORTEDr
  r  r&   r+   r)   r   r      s       , , ,,* * *& > > >$+ + + 
< 
< 
<  + + +47 7 7BN N N"N N N"P P P X/1EFFP P GF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)maxrI   s    r)   rs   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   r0   r1   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)r7   r8   r9   r'  r&   r+   r)   r!  r!    s#        
? 
? 
? 
? 
?r+   r!  c                       e Zd ZdZd ZdS )TestCapturedErrorHandlingzjChecks that the way errors are captured changes depending on the env
    var "NUMBA_CAPTURED_ERRORS".
    c                    d t                    d             }dt          fdt          j        ffD ]\  }}t	          d|          5  |                     |          5 }t          d          fd            }d d d            n# 1 swxY w Y   d}|                     |t          |j	                             d d d            n# 1 swxY w Y   d S )	Nc                     d S r%   r&   rI   s    r)   r   z=TestCapturedErrorHandling.test_error_in_overload.<locals>.bar  r   r+   c                     | j          d }|S )Nc                     d S r%   r&   rI   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+   	new_style	old_styleCAPTURED_ERRORSzvoid(int64)c                      |            d S r%   r&   )r'   r   s    r)   rs   z=TestCapturedErrorHandling.test_error_in_overload.<locals>.foo  s    Ar+   z+object has no attribute 'some_invalid_attr')
r
   AttributeErrorr   r.   r   r-   r   r/   r0   r1   )r2   r   style	err_classr4   rs   r5   r   s          @r)   test_error_in_overloadz0TestCapturedErrorHandling.test_error_in_overload  s   	 	 	 
#	 	 
	 #.~!>"-v/A!B!D 	? 	?E9 !2E:: ? ?&&y11 V-((    )(               IhF,<(=(=>>>? ? ? ? ? ? ? ? ? ? ? ? ? ? ?	? 	?s6   	CB:CB

CB
-CC	C	N)r7   r8   r9   __doc__r7  r&   r+   r)   r)  r)    s-         ? ? ? ? ?r+   r)  __main__);r8  numpyr>   r   r   r   r   r   r   r   
numba.corer   numba.core.typing.cffi_utilscoretyping
cffi_utilsr  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  rr   Dictemptyr{   TestCaser!   r;   rD   r   r!  r)  r7   mainr&   r+   r)   <module>rL     sI        				 0 0 0 0 0 0 0 0 0 0 0 0 0 0       3 3 3 3 3 3 3 3 3 3 3 3 ( ( ( ( ( (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A A A A A A A A A A A A  ||zu--; ; ; ; ;h&7 ; ; ;&7 7 7 7 7x0 7 7 7w7 w7 w7 w7 w7H- w7 w7 w7trE rE rE rE rE) rE rE rEj? ? ? ? ?h6G ? ? ?? ? ? ? ?X-> ? ? ?: zHMOOOOO r+   