
    F\h                         S r / SQr0 rSS jrS rS r\" \\\5        S r\" \" \	\
-  5      \5        S rSr\" \	R                  5      rS	 rS
 rS rS r0 r0 r0 rS rS rS rg)zHelper to provide extensibility for pickle.

This is only useful to add pickle support for extension types defined in
C, not for instances of user-defined classes.
)pickleconstructoradd_extensionremove_extensionclear_extension_cacheNc                 j    [        U5      (       d  [        S5      eU[        U '   Ub  [        U5        g g )Nz$reduction functions must be callable)callable	TypeErrordispatch_tabler   )ob_typepickle_functionconstructor_obs      /usr/lib/python3.13/copyreg.pyr   r      s8    O$$>??-N7 !N# "    c                 :    [        U 5      (       d  [        S5      eg )Nzconstructors must be callable)r   r	   )objects    r   r   r      s    F788 r   c                 >    [         U R                  U R                  44$ N)complexrealimag)cs    r   pickle_complexr      s    QVVQVV$$$r   c                 Z    SS K nSS KnUR                  UR                  U R                  44$ )N    )	functoolsoperatorreduceor___args__)objr   r   s      r   pickle_unionr!   !   s#    hllCLL999r   c                     U[         L a  [         R                  U 5      nU$ UR                  X5      nUR                  [         R                  :w  a  UR                  X25        U$ r   )r   __new____init__)clsbasestater    s       r   _reconstructorr(   )   sO    v~nnS!
 J ll3&==FOO+MM#%Jr   i   c                     US:  d   eU R                   nUR                   Hb  n[        US5      (       a  UR                  [        -  (       d    O>UR
                  n[        U[        5      (       d  MQ  UR                  UL d  Mb    O   [        nU[        L a  S nO&X2L a  [        SUR                  < S35      eU" U 5      nX#U4n U R                  n[        U 5      R                  [        R                  L a  [        U SS 5      (       a  [        S5      eU" 5       nU(       a  ["        Xh4$ ["        U4$ ! [         aR    [        U SS 5      (       a  [        SUR                  < SU 35      S e U R                   n N_! [         a    S n  Nnf = ff = f)N   	__flags__zcannot pickle z object	__slots__zNa class that defines __slots__ without defining __getstate__ cannot be pickledzf object: a class that defines __slots__ without defining __getstate__ cannot be pickled with protocol )	__class____mro__hasattrr+   	_HEAPTYPEr#   
isinstance	_new_type__self__r   r	   __name____getstate__typegetattrAttributeError__dict__r(   )	selfprotor%   r&   newr'   argsgetstatedicts	            r   
_reduce_exr@   7   s   199
..C4%%dnny.Hllc9%%#,,$*>  v~;nS\\,<GDEET
uD$$ J##v':'::D+t,, F G Gzt))t##'  	4d++nS\\,< =- .3G5 6 <@@	==D 	D		s*   D1 19F+E99F	FF		Fc                 (    U R                   " U /UQ76 $ r   r#   )r%   r=   s     r   
__newobj__rC   b   s    ;;s"T""r   c                 .    U R                   " U /UQ70 UD6$ )zwUsed by pickle protocol 4, instead of __newobj__ to allow classes with
keyword-only arguments to be pickled correctly.
rB   )r%   r=   kwargss      r   __newobj_ex__rF   e   s     ;;s,T,V,,r   c                 ^   U R                   R                  S5      nUb  U$ / n[        U S5      (       d  OU R                   H  nSUR                   ;   d  M  UR                   S   n[	        U[
        5      (       a  U4nU H  nUS;   a  M  UR                  S5      (       ae  UR                  S5      (       dO  UR                  R                  S5      nU(       a  UR                  SU< U< 35        Ms  UR                  U5        M  UR                  U5        M     M      Xl        U$ !    U$ = f)a  Return a list of slot names for a given class.

This needs to find slots defined by the class and its bases, so we
can't simply return the __slots__ attribute.  We must walk down
the Method Resolution Order and concatenate the __slots__ of each
class found there.  (This assumes classes don't modify their
__slots__ attribute to misrepresent their slots after the class is
defined.)
__slotnames__r,   )r9   __weakref_____)r9   getr/   r.   r1   str
startswithendswithr4   lstripappendrH   )r%   namesr   slotsnamestrippeds         r   
_slotnamesrV   k   s    LL_-E E3$$ Aajj(

;/eS))"HE!D:: ..t}}T7J7J#$::#4#4S#9#!LLHd)CD!LL.T* " *! LLs   D' 'D,c                 n   [        U5      nSUs=::  a  S::  d  O  [        S5      eX4n[        R                  U5      U:X  a  [        R                  U5      U:X  a  gU[        ;   a  [        SU< S[        U   < 35      eU[        ;   a  [        SU< S[        U   < 35      eU[        U'   U[        U'   g)	zRegister an extension code.   izcode out of rangeNkey z! is already registered with code zcode z is already in use for key )int
ValueError_extension_registryrL   _inverted_registrymodulerT   codekeys       r   r   r      s    t9D"
",--.C$,t$+
!!2379 : 	:!! 24 8: ; 	;#"tr   c                     X4n[         R                  U5      U:w  d  [        R                  U5      U:w  a  [        SU< SU< 35      e[         U	 [        U	 U[        ;   a  [        U	 gg)z0Unregister an extension code.  For testing only.rY   z is not registered with code N)r\   rL   r]   r[   _extension_cacher^   s       r   r   r      sl    .C$,t$+t% & 	&C 4 T"  r   c                  ,    [         R                  5         g r   )rc   clear r   r   r   r      s    r   r   )__doc____all__r
   r   r   r   r   r!   r6   rZ   rM   r(   r0   r#   r2   r@   rC   rF   rV   r\   r]   rc   r   r   r   rf   r   r   <module>ri      s   I $9% w (: tC#I % 		'$V#-1x    #$
#r   