Panda3D
Classes | Functions | Variables
direct.stdpy.pickle Namespace Reference

Classes

class  Pickler
 
class  Unpickler
 

Functions

def dump (obj, file, protocol=None)
 
def dumps (obj, protocol=None)
 
def load (file)
 
def loads (str)
 

Variables

 BasePickler = pickle._Pickler
 
 BaseUnpickler = pickle._Unpickler
 
 DEFAULT_PROTOCOL = pickle.DEFAULT_PROTOCOL
 
 HIGHEST_PROTOCOL = pickle.HIGHEST_PROTOCOL
 
 pickle = __import__('pickle')
 
 PickleError = pickle.PickleError
 
 PicklingError = pickle.PicklingError
 
 UnpicklingError = pickle.UnpicklingError
 

Detailed Description

 This module extends standard Python's pickle module so that it is
capable of writing more efficient pickle files that contain Panda
objects with shared pointers.  In particular, a single Python
structure that contains many NodePaths into the same scene graph will
write the NodePaths correctly when used with this pickle module, so
that when it is unpickled later, the NodePaths will still reference
into the same scene graph together.

If you use the standard pickle module instead, the NodePaths will each
duplicate its own copy of its scene graph.

This is necessary because the standard pickle module doesn't provide a
mechanism for sharing context between different objects written to the
same pickle stream, so each NodePath has to write itself without
knowing about the other NodePaths that will also be writing to the
same stream.  This replacement module solves this problem by defining
a ``__reduce_persist__()`` replacement method for ``__reduce__()``,
which accepts a pointer to the Pickler object itself, allowing for
shared context between all objects written by that Pickler.

Unfortunately, cPickle cannot be supported, because it does not
support extensions of this nature. 

Function Documentation

◆ dump()

def direct.stdpy.pickle.dump (   obj,
  file,
  protocol = None 
)

◆ dumps()

def direct.stdpy.pickle.dumps (   obj,
  protocol = None 
)

◆ load()

def direct.stdpy.pickle.load (   file)

◆ loads()

def direct.stdpy.pickle.loads (   str)

Variable Documentation

◆ BasePickler

BasePickler = pickle._Pickler

◆ BaseUnpickler

BaseUnpickler = pickle._Unpickler

◆ DEFAULT_PROTOCOL

DEFAULT_PROTOCOL = pickle.DEFAULT_PROTOCOL

◆ HIGHEST_PROTOCOL

HIGHEST_PROTOCOL = pickle.HIGHEST_PROTOCOL

◆ pickle

pickle = __import__('pickle')

◆ PickleError

PickleError = pickle.PickleError

◆ PicklingError

PicklingError = pickle.PicklingError

◆ UnpicklingError

UnpicklingError = pickle.UnpicklingError