Author: Antonio Cuni <[email protected]>
Branch: py3k
Changeset: r52920:319e160de1b9
Date: 2012-02-27 11:30 +0100
http://bitbucket.org/pypy/pypy/changeset/319e160de1b9/
Log: start to kill the references to the module/_file, which will be
killed soon.
module/marshal used to special-case W_File for performances: now the
fast path is disabled, we should evenutally redo it for _io files.
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -13,14 +13,14 @@
and not p.basename.startswith('test')]
essential_modules = dict.fromkeys(
- ["exceptions", "_file", "sys", "builtins", "posix"]
+ ["exceptions", "_io", "sys", "builtins", "posix"]
)
default_modules = essential_modules.copy()
default_modules.update(dict.fromkeys(
["_codecs", "atexit", "gc", "_weakref", "marshal", "errno", "imp",
"math", "cmath", "_sre", "_pickle_support", "operator",
- "parser", "symbol", "token", "_ast", "_io", "_random", "__pypy__",
+ "parser", "symbol", "token", "_ast", "_random", "__pypy__",
"_string", "_testing"]))
diff --git a/pypy/module/array/interp_array.py
b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -4,7 +4,6 @@
from pypy.interpreter.error import OperationError
from pypy.interpreter.gateway import interp2app, unwrap_spec
from pypy.interpreter.typedef import GetSetProperty, make_weakref_descr
-from pypy.module._file.interp_file import W_File
from pypy.objspace.std.model import W_Object
from pypy.objspace.std.multimethod import FailedToImplement
from pypy.objspace.std.stdtypedef import SMM, StdTypeDef
diff --git a/pypy/module/marshal/interp_marshal.py
b/pypy/module/marshal/interp_marshal.py
--- a/pypy/module/marshal/interp_marshal.py
+++ b/pypy/module/marshal/interp_marshal.py
@@ -1,19 +1,16 @@
from pypy.interpreter.error import OperationError
from pypy.rlib.rarithmetic import intmask
from pypy.rlib import rstackovf
-from pypy.module._file.interp_file import W_File
Py_MARSHAL_VERSION = 2
def dump(space, w_data, w_f, w_version=Py_MARSHAL_VERSION):
"""Write the 'data' object into the open file 'f'."""
- # special case real files for performance
- file = space.interpclass_w(w_f)
- if isinstance(file, W_File):
- writer = DirectStreamWriter(space, file)
- else:
- writer = FileWriter(space, w_f)
+ # XXX: before py3k, we special-cased W_File to use a more performant
+ # FileWriter class. Should we do the same for py3k? Look also at
+ # DirectStreamWriter
+ writer = FileWriter(space, w_f)
try:
# note: bound methods are currently not supported,
# so we have to pass the instance in, instead.
@@ -32,12 +29,10 @@
def load(space, w_f):
"""Read one value from the file 'f' and return it."""
- # special case real files for performance
- file = space.interpclass_w(w_f)
- if isinstance(file, W_File):
- reader = DirectStreamReader(space, file)
- else:
- reader = FileReader(space, w_f)
+ # XXX: before py3k, we special-cased W_File to use a more performant
+ # FileWriter class. Should we do the same for py3k? Look also at
+ # DirectStreamReader
+ reader = FileReader(space, w_f)
try:
u = Unmarshaller(space, reader)
return u.load_w_obj()
@@ -120,10 +115,16 @@
self.file.unlock()
class DirectStreamWriter(StreamReaderWriter):
+ """
+ XXX: this class is unused right now. Look at the comment in dump()
+ """
def write(self, data):
self.file.do_direct_write(data)
class DirectStreamReader(StreamReaderWriter):
+ """
+ XXX: this class is unused right now. Look at the comment in dump()
+ """
def read(self, n):
data = self.file.direct_read(n)
if len(data) < n:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit