[pypy-commit] pypy stdlib-2.7.8: Fixed a crash in BufferedRWPair

alex_gaynor noreply at buildbot.pypy.org
Sat Aug 23 07:47:36 CEST 2014


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: stdlib-2.7.8
Changeset: r72993:505a10d18c25
Date: 2014-08-22 22:47 -0700
http://bitbucket.org/pypy/pypy/changeset/505a10d18c25/

Log:	Fixed a crash in BufferedRWPair

diff --git a/pypy/module/_io/interp_bufferedio.py b/pypy/module/_io/interp_bufferedio.py
--- a/pypy/module/_io/interp_bufferedio.py
+++ b/pypy/module/_io/interp_bufferedio.py
@@ -919,9 +919,17 @@
     @func_renamer(method + '_w')
     def method_w(self, space, __args__):
         if writer:
+            if self.w_writer is None:
+                raise OperationError(
+                    space.w_ValueError, "I/O operation on uninitialized object"
+                )
             w_meth = space.getattr(self.w_writer, space.wrap(method))
             w_result = space.call_args(w_meth, __args__)
         if reader:
+            if self.w_reader is None:
+                raise OperationError(
+                    space.w_ValueError, "I/O operation on uninitialized object"
+                )
             w_meth = space.getattr(self.w_reader, space.wrap(method))
             w_result = space.call_args(w_meth, __args__)
         return w_result


More information about the pypy-commit mailing list