summaryrefslogtreecommitdiffstats
path: root/Lib/_pyio.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r--Lib/_pyio.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index 3614644..98b87f7 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -852,8 +852,14 @@ class BytesIO(BufferedIOBase):
def getbuffer(self):
"""Return a readable and writable view of the buffer.
"""
+ if self.closed:
+ raise ValueError("getbuffer on closed file")
return memoryview(self._buffer)
+ def close(self):
+ self._buffer.clear()
+ super().close()
+
def read(self, size=None):
if self.closed:
raise ValueError("read from closed file")