Module copy_reg
[hide private]
[frames] | no frames]

Module copy_reg

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.

Functions [hide private]
 
pickle(ob_type, pickle_function, constructor_ob=None)
 
constructor(object)
 
pickle_complex(c)
 
_reconstructor(cls, base, state)
 
_reduce_ex(self, proto)
 
__newobj__(cls, *args)
 
_slotnames(cls)
Return a list of slot names for a given class.
 
add_extension(module, name, code)
Register an extension code.
 
remove_extension(module, name, code)
Unregister an extension code.
 
clear_extension_cache()
Variables [hide private]
  dispatch_table = {}
  _HEAPTYPE = 512
  _extension_registry = {}
  _inverted_registry = {}
  _extension_cache = {}

Imports: _ClassType


Function Details [hide private]

_slotnames(cls)

 

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.)

remove_extension(module, name, code)

 

Unregister an extension code. For testing only.