
    d                         d Z g dZi ZddZd Z	 e d Z eeee           n# e$ r Y nw xY wd Z e e	e
ez            e           d ZdZ e	e
j                  Zd	 Zd
 Zd Zd Zi Zi Zi Zd Zd Zd ZdS )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                 |    t          |          st          d          |t          | <   |t          |           d S d S )Nz$reduction functions must be callable)callable	TypeErrordispatch_tabler   )ob_typepickle_functionconstructor_obs        /croot/python-split_1694437901252/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/lib/python3.11/copyreg.pyr   r      sP    O$$ @>???-N7 !N##### "!    c                 B    t          |           st          d          d S )Nzconstructors must be callable)r   r	   )objects    r   r   r      s+    F 978889 9r   c                 ,    t           | j        | j        ffS N)complexrealimag)cs    r   pickle_complexr   "   s    (((r   c                 <    dd l }dd l}|j        |j        | j        ffS )N    )	functoolsoperatorreduceor___args__)objr   r   s      r   pickle_unionr!   '   s1    hlCL999r   c                     |t           u rt                               |           }nA|                    | |          }|j        t           j        k    r|                    ||           |S r   )r   __new____init__)clsbasestater    s       r   _reconstructorr(   /   sY    v~~nnS!!ll3&&=FO++MM#u%%%Jr   i   c                    |dk     sJ | j         }|j        D ]J}t          |d          r|j        t          z  s n/|j        }t          |t                    r|j        |u r nKt          }|t          u rd }n'||u rt          d|j        d           ||           }|||f}	 | j        }t          |           j        t          j        u r t          | dd           rt          d           |            }nW# t          $ rJ t          | dd           rt          d|j        d|           d 	 | j        }n# t          $ r d }Y nw xY wY nw xY w|r
t"          ||fS t"          |fS )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@   =   s   19999
.C  4%% 	dny.H 	Elc9%% 	#,$*>*>Ev~~3;;DS\DDDEEET

uD$ JJ#v':::D+t,, ; F G G Gxzz  	 	 	4d++ 	@ 5S\ 5 5 .35 5 6 6 <@@	=DD 	 	 	DDD		   $tT))t##s6   "C4 46E+D32E3E?EEEEc                      | j         | g|R  S r   r#   )r%   r=   s     r   
__newobj__rC   h   s    3;s"T""""r   c                 $     | j         | g|R i |S )zUsed 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   k   s&     3;s,T,,,V,,,r   c                 $   | j                             d          }||S g }t          | d          sn| j        D ]}d|j         v r|j         d         }t	          |t
                    r|f}|D ]}|dv r|                    d          rb|                    d          sM|j        	                    d          }|r|
                    d||           h|
                    |           ~|
                    |           	 || _        n#  Y nxY w|S )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__Nr,   )r9   __weakref_____)r9   getr/   r.   r1   str
startswithendswithr4   lstripappendrH   )r%   namesr   slotsnamestrippeds         r   
_slotnamesrV   q   sU    L_--E E3$$ +  	+ 	+Aaj((
;/eS)) %"HE! + +D::: .. +t}}T7J7J +#$:#4#4S#9#9# /!LLLHHdd)CDDDD!LL....T****!Ls   D	 	Dc                    t          |          }d|cxk    rdk    sn t          d          | |f}t                              |          |k    r t                              |          |k    rdS |t          v r t          d|dt          |                   |t          v r t          d|dt          |                   |t          |<   |t          |<   dS )	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   t99D""""
"""",---4.C$$,,t$$++
!!!j##23779 : : 	:!!!j$$ 24 8 8: ; ; 	;#"tr   c                     | |f}t                               |          |k    st                              |          |k    rt          d|d|          t           |= t          |= |t          v r
t          |= dS dS )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      s    4.C$$,,t$$++j##tt% & & 	&C 4 T"""  r   c                  8    t                                            d S r   )rc   clear r   r   r   r      s    r   r   )__doc____all__r
   r   r   r   r   	NameErrorr!   r6   rZ   rM   r(   r0   r#   r2   r@   rC   rF   rV   r\   r]   rc   r   r   r   rf   r   r   <module>rj      s   I I I $ $ $ $9 9 9	-G
) ) ) F7NG,,,,  	 	 	D	: : : ttC#I % % %   	D	'$ '$ '$V# # #- - -1 1 1x    # # #$
# 
# 
#    s   $ ,,