[pypy-svn] r77029 - pypy/branch/fast-forward/pypy/module/posix
afa at codespeak.net
afa at codespeak.net
Sun Sep 12 22:11:52 CEST 2010
Author: afa
Date: Sun Sep 12 22:11:51 2010
New Revision: 77029
Modified:
pypy/branch/fast-forward/pypy/module/posix/app_posix.py
Log:
For the moment, on Windows we disable the validation of a file descriptor in os.fdopen().
This needs more thinking,
and "happy nonsensical" code like http://paste.pocoo.org/show/259546/
Modified: pypy/branch/fast-forward/pypy/module/posix/app_posix.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/posix/app_posix.py (original)
+++ pypy/branch/fast-forward/pypy/module/posix/app_posix.py Sun Sep 12 22:11:51 2010
@@ -64,6 +64,18 @@
if self.st_ctime is None:
self.__dict__['st_ctime'] = self[9]
+if osname == 'posix':
+ def _validate_fd(fd):
+ import fcntl
+ try:
+ fcntl.fcntl(fd, fcntl.F_GETFD)
+ except IOError, e:
+ raise OSError(e.errno, e.strerror, e.filename)
+else:
+ def _validate_fd(fd):
+ # XXX for the moment
+ return
+
# Capture file.fdopen at import time, as some code replaces
# __builtins__.file with a custom function.
_fdopen = file.fdopen
@@ -72,12 +84,7 @@
"""fdopen(fd [, mode='r' [, buffering]]) -> file_object
Return an open file object connected to a file descriptor."""
- # Validate fd
- import fcntl
- try:
- fcntl.fcntl(fd, fcntl.F_GETFD)
- except IOError, e:
- raise OSError(e.errno, e.strerror, e.filename)
+ _validate_fd(fd)
return _fdopen(fd, mode, buffering)
More information about the Pypy-commit
mailing list