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 cCs8x>|iiD]*}t|dƒo|it@ oPq q Wt}|tjo d}n1||ijot d|i ‚n||ƒ}|i||f}y |i }Wn_tj oSt|ddƒot dƒ‚ny |i}Wqtj o d}qXn X|ƒ}|ot||fSn t|fSdS(Nt __flags__scan't pickle %s objectst __slots__sNa class that defines __slots__ without defining __getstate__ cannot be pickled(tselft __class__t__mro__RthasattrRt _HEAPTYPERR RRt__name__targst __getstate__tgetstatetAttributeErrortgetattrt__dict__tdictR(RtprotoR$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.(RRR6R2R3((Rt _slotnames^s2      ! cCsåt|ƒ}d|jo djnp td‚n||f}ti|ƒ|joti|ƒ|jodSn|tjotd|t|fƒ‚n|tjotd|t|fƒ‚n|t|<|t|R6R<R?((RRœs   ,   cCs|||f}ti|ƒ|jpti|ƒ|jotd||fƒ‚nt|=t|=|tjo t|=ndS(s0Unregister an extension code. For testing only.s%key %s is not registered with code %sN( R>R6R?R@R1R<RAR=t_extension_cache(R>R6R<R?((RR®s , cCstiƒdS(N(RBtclear(((RRºsN(t__doc__ttypest ClassTypeRt__all__R R RRRt NameErrorRRR"R,R-R:R@RARBRRR(RARRGR@RBRR-R"R,RRRRRR:RR ((Rt?s,      !  8