[pypy-svn] r15166 - in pypy/dist/pypy: interpreter lib lib/test2 module/__builtin__ module/marshal tool
arigo at codespeak.net
arigo at codespeak.net
Wed Jul 27 11:50:10 CEST 2005
Author: arigo
Date: Wed Jul 27 11:50:00 2005
New Revision: 15166
Added:
pypy/dist/pypy/lib/marshal.py
- copied, changed from r15163, pypy/dist/pypy/module/marshal/app_marshal.py
pypy/dist/pypy/lib/osfilewrapper.py
- copied unchanged from r15163, pypy/dist/pypy/tool/osfilewrapper.py
pypy/dist/pypy/lib/test2/autopath.py
- copied unchanged from r15163, pypy/dist/pypy/tool/autopath.py
pypy/dist/pypy/lib/test2/test_marshal_extra.py
- copied, changed from r15163, pypy/dist/pypy/module/marshal/test/test_marshal_extra.py
Removed:
pypy/dist/pypy/module/marshal/
pypy/dist/pypy/tool/osfilewrapper.py
Modified:
pypy/dist/pypy/interpreter/baseobjspace.py
pypy/dist/pypy/module/__builtin__/importing.py
Log:
* moved marshal back into lib. It doesn't have to be a mixed module
to be geninterped, after all.
* moved osfilewrapper to lib as well, so that it can be imported at
app-level from marshal. (It is also imported at interp-level from
importing.py.)
Modified: pypy/dist/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/dist/pypy/interpreter/baseobjspace.py (original)
+++ pypy/dist/pypy/interpreter/baseobjspace.py Wed Jul 27 11:50:00 2005
@@ -145,7 +145,6 @@
builtinmodule_list.append(('unicodedata', None))
# Uncomment the following line to enable the builtin _codecs module
builtinmodule_list.append(('_codecs', None))
- builtinmodule_list.append(('marshal', None))
if self.options.useparsermodule == "recparser":
builtinmodule_list.append(('parser', 'recparser'))
elif self.options.useparsermodule == "parser":
Copied: pypy/dist/pypy/lib/marshal.py (from r15163, pypy/dist/pypy/module/marshal/app_marshal.py)
==============================================================================
--- pypy/dist/pypy/module/marshal/app_marshal.py (original)
+++ pypy/dist/pypy/lib/marshal.py Wed Jul 27 11:50:00 2005
@@ -1,10 +1,10 @@
-"""Marshal module written in Python.
+"""Internal Python object serialization
+
+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 os
-
-from pypy.tool.osfilewrapper import OsFileWrapper
+from osfilewrapper import OsFileWrapper
try:
import new
Copied: pypy/dist/pypy/lib/test2/test_marshal_extra.py (from r15163, pypy/dist/pypy/module/marshal/test/test_marshal_extra.py)
==============================================================================
--- pypy/dist/pypy/module/marshal/test/test_marshal_extra.py (original)
+++ pypy/dist/pypy/lib/test2/test_marshal_extra.py Wed Jul 27 11:50:00 2005
@@ -1,8 +1,8 @@
-import py
import autopath
+import py
import sys
import marshal as cpy_marshal
-from pypy.module.marshal import app_marshal as marshal
+from pypy.lib import marshal
from pypy.tool.udir import udir
Modified: pypy/dist/pypy/module/__builtin__/importing.py
==============================================================================
--- pypy/dist/pypy/module/__builtin__/importing.py (original)
+++ pypy/dist/pypy/module/__builtin__/importing.py Wed Jul 27 11:50:00 2005
@@ -7,7 +7,7 @@
from pypy.interpreter.module import Module
from pypy.interpreter.error import OperationError
from pypy.interpreter.baseobjspace import W_Root, ObjSpace
-from pypy.tool.osfilewrapper import OsFileWrapper
+from pypy.lib.osfilewrapper import OsFileWrapper
# XXX this uses the os.path module at interp-level, which means
# XXX that translate_pypy will produce a translated version of
Deleted: /pypy/dist/pypy/tool/osfilewrapper.py
==============================================================================
--- /pypy/dist/pypy/tool/osfilewrapper.py Wed Jul 27 11:50:00 2005
+++ (empty file)
@@ -1,34 +0,0 @@
-import os
-
-class OsFileWrapper(object):
- """ Very simple os file wrapper.
- Note user is responsible for closing.
- XXX Could add a simple buffer mechanism. """
-
- def __init__(self, fd):
- self.fd = fd
-
- def read(self, expected):
- readcount = 0
- bufs = []
- while readcount < expected:
- # os.read will raise an error itself
- buf = os.read(self.fd, expected)
- readcount += len(buf)
- bufs.append(buf)
- return "".join(bufs)
-
- def write(self, buf):
- writecount = 0
- towrite = len(buf)
- while writecount < towrite:
- # os.write will raise an error itself
- writecount += os.write(self.fd, buf[writecount:])
-
- def close(self):
- os.close(self.fd)
-
-
-def create_wrapper(filename, flag, mode=0777):
- fd = os.open(filename, flag, mode)
- return OsFileWrapper(fd)
More information about the Pypy-commit
mailing list