diff options
author | Armin Rigo <arigo@tunes.org> | 2010-11-30 13:09:09 +0000 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2010-11-30 13:09:09 +0000 |
commit | 4ec89d72178fa2e74a70069dbbbdc1ae44751317 (patch) | |
tree | 5f83819f5e530d310a48393296cde76c053666e7 /lib_pypy/_marshal.py | |
parent | Add 'builtinify' as a decorator. (diff) | |
download | pypy-4ec89d72178fa2e74a70069dbbbdc1ae44751317.tar.gz pypy-4ec89d72178fa2e74a70069dbbbdc1ae44751317.tar.bz2 pypy-4ec89d72178fa2e74a70069dbbbdc1ae44751317.zip |
A first round of adding @__pypy__.builtinify a bit everywhere... :-(
Diffstat (limited to 'lib_pypy/_marshal.py')
-rw-r--r-- | lib_pypy/_marshal.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib_pypy/_marshal.py b/lib_pypy/_marshal.py index ce304e4c23..bfb5fb01bc 100644 --- a/lib_pypy/_marshal.py +++ b/lib_pypy/_marshal.py @@ -3,7 +3,7 @@ This module contains functions that can read and write Python values in a binary format. The format is specific to Python, but independent of machine architecture issues (e.g., you can write a Python value to a file on a PC, transport the file to a Sun, and read it back there). Details of the format may change between Python versions. """ -import types +import types, __pypy__ from _codecs import utf_8_decode, utf_8_encode TYPE_NULL = '0' @@ -645,15 +645,18 @@ _load_dispatch = _FastUnmarshaller.dispatch version = 1 +@__pypy__.builtinify def dump(x, f, version=version): # XXX 'version' is ignored, we always dump in a version-0-compatible format m = _Marshaller(f.write) m.dump(x) +@__pypy__.builtinify def load(f): um = _Unmarshaller(f.read) return um.load() +@__pypy__.builtinify def dumps(x, version=version): # XXX 'version' is ignored, we always dump in a version-0-compatible format buffer = [] @@ -661,6 +664,7 @@ def dumps(x, version=version): m.dump(x) return ''.join(buffer) +@__pypy__.builtinify def loads(s): um = _FastUnmarshaller(s) return um.load() |