[pypy-commit] pypy py3.5: cpython issue23099: adapt new exported buf cpython impl details, tighten getbuffer
pjenvey
pypy.commits at gmail.com
Sun Jan 15 01:32:43 EST 2017
Author: Philip Jenvey <pjenvey at 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
More information about the pypy-commit
mailing list