[pypy-svn] r78032 - in pypy/branch/fast-forward/pypy/module/_io: . test
afa at codespeak.net
afa at codespeak.net
Mon Oct 18 10:04:15 CEST 2010
Author: afa
Date: Mon Oct 18 10:04:13 2010
New Revision: 78032
Modified:
pypy/branch/fast-forward/pypy/module/_io/interp_fileio.py
pypy/branch/fast-forward/pypy/module/_io/test/test_io.py
Log:
add FileIO.fileno()
Modified: pypy/branch/fast-forward/pypy/module/_io/interp_fileio.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/_io/interp_fileio.py (original)
+++ pypy/branch/fast-forward/pypy/module/_io/interp_fileio.py Mon Oct 18 10:04:13 2010
@@ -162,6 +162,11 @@
self.seekable = 1
return space.newbool(self.seekable == 1)
+ @unwrap_spec('self', ObjSpace)
+ def fileno_w(self, space):
+ self._check_closed(space)
+ return space.wrap(self.fd)
+
W_FileIO.typedef = TypeDef(
'FileIO', W_RawIOBase.typedef,
__new__ = interp2app(W_FileIO.descr_new.im_func),
@@ -172,6 +177,7 @@
readable = interp2app(W_FileIO.readable_w),
writable = interp2app(W_FileIO.writable_w),
seekable = interp2app(W_FileIO.seekable_w),
+ fileno = interp2app(W_FileIO.fileno_w),
name = interp_attrproperty_w('w_name', cls=W_FileIO),
mode = GetSetProperty(W_FileIO.descr_get_mode),
)
Modified: pypy/branch/fast-forward/pypy/module/_io/test/test_io.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/_io/test/test_io.py (original)
+++ pypy/branch/fast-forward/pypy/module/_io/test/test_io.py Mon Oct 18 10:04:13 2010
@@ -65,4 +65,5 @@
os = self.posix
fd = os.open(self.tmpfile, os.O_RDONLY, 0666)
f = io.open(fd, "rb")
+ assert f.fileno() == fd
f.close()
More information about the Pypy-commit
mailing list