[pypy-commit] pypy stdlib-3.2.5: CPython 3.2.5 seems to be more careful when unwrapping file descriptors.

amauryfa noreply at buildbot.pypy.org
Wed Apr 2 22:24:41 CEST 2014


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: stdlib-3.2.5
Changeset: r70407:c3d1b11d8ccd
Date: 2014-04-02 22:20 +0200
http://bitbucket.org/pypy/pypy/changeset/c3d1b11d8ccd/

Log:	CPython 3.2.5 seems to be more careful when unwrapping file
	descriptors. Do the same in pypy, and don't turn OverflowErrors into
	ValueErrors.

	This will fix a failure in test_fcntl, but will probably break other
	tests. Need to watch buildbot.

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1606,13 +1606,7 @@
                 raise OperationError(self.w_TypeError,
                     self.wrap("fileno() returned a non-integer")
                 )
-        try:
-            fd = self.c_int_w(w_fd)
-        except OperationError, e:
-            if e.match(self, self.w_OverflowError):
-                fd = -1
-            else:
-                raise
+        fd = self.c_int_w(w_fd)  # Can raise w_OverflowError
         if fd < 0:
             raise oefmt(self.w_ValueError,
                 "file descriptor cannot be a negative integer (%d)", fd)


More information about the pypy-commit mailing list