]> granicus.if.org Git - python/commitdiff
Issue #23099: Closing io.BytesIO with exported buffer is rejected now to
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 3 Feb 2015 07:30:51 +0000 (09:30 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 3 Feb 2015 07:30:51 +0000 (09:30 +0200)
prevent corrupting exported buffer.

1  2 
Doc/library/io.rst
Lib/_pyio.py
Lib/test/test_memoryio.py
Misc/NEWS
Modules/_io/bytesio.c

Simple merge
diff --cc Lib/_pyio.py
Simple merge
Simple merge
diff --cc Misc/NEWS
index 62e5794871d47bac64ac5d689a6c86e87570fade,6d58e8b8658c30c6455b38dee3b60da8e16d5e5e..7a3a5aea00518985b6f2e6c298ebbf3860c980c8
+++ b/Misc/NEWS
@@@ -232,9 -56,9 +232,12 @@@ Core and Builtin
  Library
  -------
  
+ - Issue #23099: Closing io.BytesIO with exported buffer is rejected now to
+   prevent corrupting exported buffer.
 +- Issue #23326: Removed __ne__ implementations.  Since fixing default __ne__
 +  implementation in issue #21408 they are redundant.
 +
  - Issue #23363: Fix possible overflow in itertools.permutations.
  
  - Issue #23364: Fix possible overflow in itertools.product.
index 801ddcdc88cd7a0372eeea9595248b9c19600f13,1537d979a31daa62b0ad01bedd8fb6f55332b6ed..7bbcb6eb2ae0ed1f9b66cfc56b88d0c9d8c65eb9
@@@ -779,7 -657,11 +779,8 @@@ PyDoc_STRVAR(close_doc
  static PyObject *
  bytesio_close(bytesio *self)
  {
 -    if (self->buf != NULL) {
 -        PyMem_Free(self->buf);
 -        self->buf = NULL;
 -    }
+     CHECK_EXPORTS(self);
 +    reset(self);
      Py_RETURN_NONE;
  }