RandomSec/lib/jython-2.5.1/marshal.py
Vishal Talwar d0df704d8a added python code part of jython distribution in lib/jython-2.5.1
added python.path vm arg to startup script
fixed infinite loop in unwrap() when displaying sequences of sequences



git-svn-id: http://google-refine.googlecode.com/svn/trunk@509 7d457c2a-affb-35e4-300a-418c747d4874
2010-04-20 18:50:24 +00:00

29 lines
603 B
Python

"""Marshal module written in Python.
This doesn't marshal code objects, but supports everything else.
Performance or careful error checking is not an issue.
"""
import cStringIO
from _marshal import Marshaller, Unmarshaller
def dump(x, f, version=2):
Marshaller(f, version).dump(x)
# XXX - added just for debugging. remove!
def load(f, debug=False):
u = Unmarshaller(f)
if debug:
u._debug()
return u.load()
def dumps(x, version=2):
f = cStringIO.StringIO()
dump(x, f, version)
return f.getvalue()
def loads(s):
f = cStringIO.StringIO(s)
return load(f)