Author: Brian Kearns <[email protected]>
Branch: stdlib-2.7.6
Changeset: r69785:7db678d05e15
Date: 2014-03-07 11:59 -0500
http://bitbucket.org/pypy/pypy/changeset/7db678d05e15/
Log: another approach
diff --git a/pypy/module/_file/interp_file.py b/pypy/module/_file/interp_file.py
--- a/pypy/module/_file/interp_file.py
+++ b/pypy/module/_file/interp_file.py
@@ -3,6 +3,7 @@
import stat
import errno
from rpython.rlib import streamio
+from rpython.rlib.objectmodel import specialize
from rpython.rlib.rarithmetic import r_longlong
from rpython.rlib.rstring import StringBuilder
from pypy.module._file.interp_stream import W_AbstractStream, StreamErrors
@@ -13,6 +14,7 @@
from pypy.interpreter.gateway import interp2app, unwrap_spec
from pypy.interpreter.streamutil import wrap_streamerror,
wrap_oserror_as_ioerror
+
class W_File(W_AbstractStream):
"""An interp-level file object. This implements the same interface than
the app-level files, with the following differences:
@@ -115,7 +117,7 @@
self.check_mode_ok(mode)
stream = dispatch_filename(streamio.open_file_as_stream)(
self.space, w_name, mode, buffering,
- space.getexecutioncontext().checksignals)
+ signal_checker(space))
fd = stream.try_to_find_file_descriptor()
self.check_not_dir(fd)
self.fdopenstream(stream, fd, mode)
@@ -577,6 +579,10 @@
def getopenstreams(space):
return space.fromcache(FileState).openstreams
[email protected]()
+def signal_checker(space):
+ return space.getexecutioncontext().checksignals
+
MAYBE_EAGAIN = getattr(errno, 'EAGAIN', None)
MAYBE_EWOULDBLOCK = getattr(errno, 'EWOULDBLOCK', None)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit