mò %U²Ic@sÙdZdklZdddddgZhZdd„Zd„Zye Wne j onXd „Z ee e e ƒd „Z d d >Z d „Zd„Zd„ZhZhZhZd„Zd„Zd„ZdS(s¬Helper to provide extensibility for pickle/cPickle. This is only useful to add pickle support for extension types defined in C, not for instances of user-defined classes. (s ClassTypetpicklet constructort add_extensiontremove_extensiontclear_extension_cachecCsit|ƒtjotdƒ‚nt|ƒptdƒ‚n|t|<|dj ot |ƒndS(Ns-copy_reg is not intended for use with classess$reduction functions must be callable( ttypetob_typet _ClassTypet TypeErrortcallabletpickle_functiontdispatch_tabletconstructor_obtNoneR(RR R ((t%/data/zmath/lib/python2.4/copy_reg.pyRs   cCs!t|ƒptdƒ‚ndS(Nsconstructors must be callable(R tobjectR(R((RRs cCst|i|iffS(N(tcomplextctrealtimag(R((Rtpickle_complex'scCsF|tjoti|ƒ}n#|i||ƒ}|i||ƒ|S(N(tbaseRt__new__tclstobjtstatet__init__(RRRR((Rt_reconstructor.s  ii cCsL|djpt‚x>|iiD]*}t|dƒo|it@ oPq!q!Wt }|t jo d}n1||ijot d|i ‚n||ƒ}|i||f}y |i}Wn_tj oSt|ddƒot dƒ‚ny |i}Wq&tj o d}q&Xn X|ƒ}|ot||fSn t|fSdS(Nit __flags__scan't pickle %s objectst __slots__sNa class that defines __slots__ without defining __getstate__ cannot be pickled(tprototAssertionErrortselft __class__t__mro__RthasattrRt _HEAPTYPERR RRt__name__targst __getstate__tgetstatetAttributeErrortgetattrt__dict__tdictR(R RR&R(RRR,((Rt _reduce_ex:s2        cGs|i||ŒS(N(RRR&(RR&((Rt __newobj__[scCs|iidƒ}|dj o|Sng}t|dƒpnÄxÀ|iD]µ}d|ijoŸ|id}t |t ƒo |f}nxr|D]f}|djoq’q’|i dƒo/|i dƒ o|id|i|fƒq’|i|ƒq’WqKqKWy ||_WnnX|S( s›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.) t __slotnames__RR+t __weakref__t__s_%s%sN(s__dict__s __weakref__(RR+tgettnamesR R#R"Rtslotst isinstancet basestringtnamet startswithtendswithtappendR%R/(RRR7R3R4((Rt _slotnames^s2      ! cCsåt|ƒ}d|jo djnp td‚n||f}ti|ƒ|joti|ƒ|jodSn|tjotd|t|fƒ‚n|tjotd|t|fƒ‚n|t|<|t|t_extension_cache(R?R7R=R@((RR®s , cCstiƒdS(N(RCtclear(((RRºsN(t__doc__ttypest ClassTypeRt__all__R R RRRt NameErrorRRR$R-R.R;RARBRCRRR(RBRRHRARCRR.R$R-RRRRRR;RR ((Rt?s,      !  8