+
    ;iP+                     *   ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	t	^ RI
Ht ^ RIHt ^ RIHt ^ RIHtHt  ! R R]4      t ! R	 R
]4      t ! R R]4      t ! R R]4      tR tR tR tR t]R8X  d   ]P:                  ! 4        R# R# )    N)get_context)TypingError)TestCase)resolve_dispatcher_from_strdumpsloadsc                      a  ] tR t^t o R t]P                  R 4       tR tR t	R t
R tR tR tR	 tR
 tR tR tR tR tR tR tR tR tR tR tRtV tR# )TestDispatcherPicklingc                l    \        \        P                  ^,           4       F  pV! V.VO5/ VB  K  	  R# )   N)rangepickleHIGHEST_PROTOCOL)selfmethargskwargsprotos   &&*, X/var/www/html/photoedit/myenv/lib/python3.14/site-packages/numba/tests/test_serialize.pyrun_with_protocols)TestDispatcherPickling.run_with_protocols   s.    622Q67E((( 8    c              #     "   R p\        V4      pVP                  p\        VP                  4      ! V4      Vn         Rx  W2n        R#   Y2n        i ; i5i)cpuN)r   targetdescrtype)r   hwstrdispatcher_cls	old_descrs   &   r   simulate_fresh_target,TestDispatcherPickling.simulate_fresh_target   sM     4U;"..	%).*D*D%Ee%L"	3 *3&&s   :AA	 A	AAc                   a aa VVV 3R  lpV! V4       \         P                  ! W!4      pS P                  4       ;_uu_ 4        \         P                  ! V4      pV! V4       RRR4       R#   + '       g   i     R# ; i)c                    < \        S\        4      '       d.   \        S\        4      '       d   SP                  ! SV .SO5!   R # SP                  V ! S!  S4       R # )N)
isinstancer   
issubclass	ExceptionassertRaisesassertPreciseEqual)funcr   expected_resultr   s   &r   check_result7TestDispatcherPickling.check_call.<locals>.check_result&   sF    ?D11	::!!/4?$?''d_Er   N)r   r   r!   r	   )r   r   r*   r+   r   r,   picklednew_funcs   f&&ff   r   
check_call!TestDispatcherPickling.check_call%   sU    	F 	T,,t+''))||G,H" *)))s   A++A<	c                    ^RI Hp V P                  V P                  V^R4       V P                  V P                  V^R4       R# )r   )add_with_sigNr      )333333?g@)serialize_usecasesr3   r   r0   )r   r3   s   & r   test_call_with_sig)TestDispatcherPickling.test_call_with_sig4   s5    4q&Iq*Mr   c                    ^RI Hp V P                  V P                  V^R4       V P                  V P                  VRR4       V P                  V P                  VRR4       R# )r   )add_without_sig      @abcNr4   r6   g333333@)abc)r7   r;   r   r0   )r   r;   s   & r   test_call_without_sig,TestDispatcherPickling.test_call_without_sig:   sM    7!VL#zR%Ur   c                    ^RI Hp V P                  V P                  VRR4       V P                  V P                  V\        \        4       \        4       34       R# )r   )add_nopythonr<   Nr>   )r7   rD   r   r0   r   object)r   rD   s   & r   test_call_nopython)TestDispatcherPickling.test_call_nopythonA   s@    4sJO{VXW]W_L`ar   c                V    ^RI Hp V P                  V P                  V\        R4       R# )r   )add_nopython_failN)r      )r7   rI   r   r0   r   )r   rI   s   & r   test_call_nopython_fail.TestDispatcherPickling.test_call_nopython_failG   s    91BKQWXr   c                N    ^RI Hp V P                  V P                  VRR4       R# )r   )get_global_objmodeg      @N)g      @)r7   rN   r   r0   )r   rN   s   & r   test_call_objmode_with_global4TestDispatcherPickling.test_call_objmode_with_globalL   s    :1CS&Qr   c                ^    ^RI Hp V! ^4      pV P                  V P                  V^R4       R# )r   closureN)rJ      )r7   rS   r   r0   )r   rS   inners   &  r   test_call_closure(TestDispatcherPickling.test_call_closureP   s&    /
6Br   c                ^    ^RI Hp V! R/ VB pV P                  V P                  VRR4       R# )r   )closure_with_globalsg      @N)      @      @)r7   rY   r   r0   )r   jit_argsrY   rU   s   &,  r   check_call_closure_with_globals6TestDispatcherPickling.check_call_closure_with_globalsU   s*    <$5H5VDr   c                *    V P                  R R7       R# )T)nopythonNr^   r   s   &r   'test_call_closure_with_globals_nopython>TestDispatcherPickling.test_call_closure_with_globals_nopythonZ       ,,d,;r   c                *    V P                  R R7       R# )T)forceobjNrb   rc   s   &r   &test_call_closure_with_globals_objmode=TestDispatcherPickling.test_call_closure_with_globals_objmode]   rf   r   c                ^    ^RI Hp V! R4      pV P                  V P                  VRR4       R# )r   )closure_calling_other_functionrZ   g      &@N)r\   g      @)r7   rl   r   r0   )r   rl   rU   s   &  r   (test_call_closure_calling_other_function?TestDispatcherPickling.test_call_closure_calling_other_function`   s'    F.s3jIr   c                ^    ^RI Hp V! R4      pV P                  V P                  VRR4       R# )r   closure_calling_other_closurerZ   g       @Nr[   )r7   rq   r   r0   )r   rq   rU   s   &  r   'test_call_closure_calling_other_closure>TestDispatcherPickling.test_call_closure_calling_other_closuree   s'    E-c2VDr   c                N    ^RI Hp V P                  V P                  V^$R4       R# )r   )dyn_funcN   )r7   ru   r   r0   )r   ru   s   & r   test_call_dyn_func)TestDispatcherPickling.test_call_dyn_funcj   s    02tDr   c                N    ^RI Hp V P                  V P                  V^$R4       R# )r   )dyn_func_objmodeNrv   )r7   r{   r   r0   )r   r{   s   & r   test_call_dyn_func_objmode1TestDispatcherPickling.test_call_dyn_func_objmodeo   s    81A2tLr   c                ^    ^RI Hp V! R4      pV P                  V P                  VVR4       R# )r   )get_renamed_module        N)r   )r7   r   r   r0   )r   r   expecteds   &  r   test_renamed_module*TestDispatcherPickling.test_renamed_modulet   s-    : &c*1C (&	2r   c                    ^RI Hp V! R4      p\        P                  ! V4      pRP                  ! R/ \        4       B p\        P                  ! \        P                  RV.4       R# )ze
Check that reconstructing doesn't depend on resources already
instantiated in the original process.
rp   rZ   zif 1:
            import pickle

            data = {pickled!r}
            func = pickle.loads(data)
            res = func(4.0)
            assert res == 8.0, res
            -cN )
r7   rq   r   r   formatlocals
subprocessr0   sys
executable)r   rq   r*   r.   codes   &    r   test_other_process)TestDispatcherPickling.test_other_process|   s_    
 	F,S1,,t$  #  # 	s~~tT:;r   c                   ^RI Hp V! ^4      p\        P                  ! V4      pV! ^4      p\        P                  ! V4      p\        P                  ! V4      p\        P                  ! V4      p\        P                  ! V4      pV P                  Wg4       V P                  V! ^^4      ^
4       VP                  4        V P                  V! ^^4      ^4       V P                  Wh4       V P                  V! ^^4      ^4       V! ^4      pV! ^*^+4       \        P                  ! V4      p?\        P                  ! 4        \        P                  ! V4      p\        P                  ! V4      pV P                  Wg4       V P                  V! ^^4      ^4       VP                  4        V P                  V! ^^4      ^4       R# )z
Check that deserializing the same function multiple times re-uses
the same dispatcher object.

Note that "same function" is intentionally under-specified.
rR   N)r7   rS   r   r   r	   assertIsassertEqualdisable_compileassertIsNotgccollect)	r   rS   r*   r.   func2pickled2fghs	   &        r   
test_reuse!TestDispatcherPickling.test_reuse   sU    	0qz,,t$
<<&LL!LL!LL"a1a"%	1a"%1a"% qzR,,t$


LL!LL!a1a"%	1a"%r   c                X    Rp\         P                  ! \        P                  RV.4       R# )z>
The imp module was deprecated in v3.4 in favour of importlib
a  if 1:
            import pickle
            import warnings
            with warnings.catch_warnings(record=True) as w:
                warnings.simplefilter('always', DeprecationWarning)
                from numba import njit
                @njit
                def foo(x):
                    return x + 1
                foo(1)
                serialized_foo = pickle.dumps(foo)
            for x in w:
                if 'serialize.py' in x.filename:
                    assert "the imp module is deprecated" not in x.msg
        r   N)r   r0   r   r   )r   r   s   & r   test_imp_deprecation+TestDispatcherPickling.test_imp_deprecation   s$     	s~~tT:;r   r   N)__name__
__module____qualname____firstlineno__r   
contextlibcontextmanagerr!   r0   r8   rA   rF   rK   rO   rV   r^   rd   ri   rm   rr   rx   r|   r   r   r   r   __static_attributes____classdictcell____classdict__s   @r   r   r      s     ) 3 3#NVbY
RC
E
<<J
E
E
M
2<$$&L< <r   r   c                   &   a  ] tR t^t o R tRtV tR# )TestSerializationMiscc                    ^ RI Hp \        4       p\        P                  ! V4      p\        V4      pV! \        V4      W44      pV P                  WR4       V! \        V4      W44      pV P                  WV4       R# )r   )_numba_unpickleN)	numba.core.serializer   rE   r   r   hashidr   r   )r   r   
random_objbytebufhashedgot1got2s   &      r   test_numba_unpickle)TestSerializationMisc.test_numba_unpickle   s^    8X
,,z*j!r*~w?*r*~w?d!r   r   N)r   r   r   r   r   r   r   r   s   @r   r   r      s     " "r   r   c                   r   a  ] tR t^t o RtRtR t]P                  ! ] R8H  R4      R 4       t	R t
R tR	tV tR
# )TestCloudPickleIssueszOThis test case includes issues specific to the cloudpickle implementation.
    Fc                   a a  ! R  R4      oV3R lpVV 3R lp\        S4      pV! 4        V! 4        \        V4       V! 4        \        V4       V! 4        R# )c                       ] tR t^tRtRtR# )ITestCloudPickleIssues.test_dynamic_class_reset_on_unpickle.<locals>.KlassNr   r   r   r   r   classvarr   r   r   r   Klassr          Hr   r   c                     < ^dS n         R# d   N)r   r   s   r   mutatorKTestCloudPickleIssues.test_dynamic_class_reset_on_unpickle.<locals>.mutator   s
     ENr   c                  @   < SP                  S P                  ^d4       R# r   )r   r   )r   r   s   r   checkITestCloudPickleIssues.test_dynamic_class_reset_on_unpickle.<locals>.check   s    U^^S1r   Nr   )r   r   r   savedr   s   f   @r   $test_dynamic_class_reset_on_unpickle:TestCloudPickleIssues.test_dynamic_class_reset_on_unpickle   sD    	 		!	2 e	eer   __main__z*Test cannot run as when module is __main__c                    \        R 4      pVP                  \        R7      pVP                  4        VP	                  ^<R7       V P                  VP                  ^ 4       R# )spawn)targettimeoutN)r   Process"check_main_class_reset_on_unpicklestartjoinr   exitcode)r   mpprocs   &  r   !test_main_class_reset_on_unpickle7TestCloudPickleIssues.test_main_class_reset_on_unpickle   sJ     !zz!CzD

		"	*r   c                     ! R  R4      p\        V4      p\        R4      pVP                  \        V3R7      pVP	                  4        VP                  ^<R7       V P                  VP                  ^ 4       R# )c                       ] tR t^tRtRtR# )RTestCloudPickleIssues.test_dynamic_class_reset_on_unpickle_new_proc.<locals>.KlassNr   r   r   r   r   r   r      r   r   r   r   )r   r   r   N)r   r   r   !check_unpickle_dyn_class_new_procr   r   r   r   )r   r   r   r   r   s   &    r   -test_dynamic_class_reset_on_unpickle_new_procCTestCloudPickleIssues.test_dynamic_class_reset_on_unpickle_new_proc   sc    	 	 e !zz!B%zR

		"	*r   c                h    \         P                  ! \        4      pV P                  V! 4       R4       R# )r   N)r   r   )numbanjit
issue_7356r   )r   cfuncs   & r   test_dynamic_class_issue_73563TestCloudPickleIssues.test_dynamic_class_issue_7356  s"    

:&*-r   r   N)r   r   r   r   __doc___numba_parallel_test_r   unittestskipIfr   r   r   r   r   r   s   @r   r   r      sM     !( __X+AC+C++. .r   r   c                       ] tR tRtRtRtR# )DynClassi  Nr   )r   r   r   r   r?   r   r   r   r   r   r     s    Ar   r   c                  R   \         P                  ! R R7      ;_uu_ 4        ^d\        n        \        P                  p RRR4       \         P                  ! R R7      ;_uu_ 4        \        P                  pRRR4       X V3#   + '       g   i     LL; i  + '       g   i     X X3# ; i)intp)beforeN)after)r   objmoder   r?   )r   r   s     r   r   r     sk    	f	%	%
 
& 
V	$	$

 
%5= 
&	% 
%	$5=s   B #B B	B&	c                      \         P                  ! R RR7      p V R,          pVP                  R8X  g   Q hVP                  ^d8w  g   Q h\	        V4      p^dVn        \        W4       R# )z"numba.tests.cloudpickle_main_classr   )run_namer   N)runpy
run_moduler   r   r   _check_dyn_class)glbsr   r   s      r   r   r     sa    ,D
 MEz)))>>S   %LEENU"r   c                 f    \        V 4      pVP                  ^d8w  g   Q h^dVn        \        W4       R# r   )r	   r   r   )r   r   s   & r   r   r   0  s,    %LE>>S   ENU"r   c                    a  V 3R  lpV! 4        \        V4      pVS Jd   \        R4      hV! 4        \        V4      pVS Jd   \        R4      hV! 4        R# )c                  @   < S P                   ^d8w  d   \        R4      hR# )r   zCheck failed. Klass reset.N)r   AssertionErrorr   s   r   r   _check_dyn_class.<locals>.check:  s     >>S  !=>> !r   zExpected reuseN)r	   r   )r   r   r   loadeds   f&  r   r   r   9  sS    ? 
G5\FU-..	G5\FU-..	Gr   r   )r   r   r   r   r   r   r   multiprocessingr   r   numba.core.errorsr   numba.tests.supportr   numba.core.target_extensionr   numba.cloudpickler   r	   r   r   r   rE   r   r   r   r   r   r   mainr   r   r   <module>r     s     	    
  '  ) ( C *v<X v<r"H ""3.H 3.lv 
#"#" zMMO r   