Author: Philip Jenvey <pjen...@underboss.org> Branch: py3.5 Changeset: r89570:50b7ded1379c Date: 2017-01-14 22:26 -0800 http://bitbucket.org/pypy/pypy/changeset/50b7ded1379c/
Log: cpython issue23099: adapt new exported buf cpython impl details, tighten getbuffer diff --git a/lib-python/3/test/test_memoryio.py b/lib-python/3/test/test_memoryio.py --- a/lib-python/3/test/test_memoryio.py +++ b/lib-python/3/test/test_memoryio.py @@ -424,8 +424,8 @@ # of the underlying object. self.assertRaises(BufferError, memio.write, b'x' * 100) self.assertRaises(BufferError, memio.truncate) - self.assertRaises(BufferError, memio.close) - self.assertFalse(memio.closed) + self.assertRaises(BufferError, memio.close) + self.assertFalse(memio.closed) # Mutating the buffer updates the BytesIO buf[3:6] = b"abc" self.assertEqual(bytes(buf), b"123abc7890") diff --git a/pypy/module/_io/interp_bytesio.py b/pypy/module/_io/interp_bytesio.py --- a/pypy/module/_io/interp_bytesio.py +++ b/pypy/module/_io/interp_bytesio.py @@ -121,6 +121,7 @@ return space.wrap(size) def getbuffer_w(self, space): + self._check_closed(space) return space.wrap(W_MemoryView(BytesIOBuffer(self))) def getvalue_w(self, space): diff --git a/pypy/module/_io/test/test_bytesio.py b/pypy/module/_io/test/test_bytesio.py --- a/pypy/module/_io/test/test_bytesio.py +++ b/pypy/module/_io/test/test_bytesio.py @@ -140,6 +140,8 @@ # After the buffer gets released, we can resize the BytesIO again del buf memio.truncate() + memio.close() + raises(ValueError, memio.getbuffer) def test_readline(self): import _io _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit