From: Serhiy Storchaka Date: Tue, 3 Feb 2015 07:30:51 +0000 (+0200) Subject: Issue #23099: Closing io.BytesIO with exported buffer is rejected now to X-Git-Tag: v3.5.0a1~41 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=32ca3dcb97a75c05dc2b90c88bbf82a541c57c61;p=python Issue #23099: Closing io.BytesIO with exported buffer is rejected now to prevent corrupting exported buffer. --- 32ca3dcb97a75c05dc2b90c88bbf82a541c57c61 diff --cc Misc/NEWS index 62e5794871,6d58e8b865..7a3a5aea00 --- a/Misc/NEWS +++ 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. diff --cc Modules/_io/bytesio.c index 801ddcdc88,1537d979a3..7bbcb6eb2a --- a/Modules/_io/bytesio.c +++ b/Modules/_io/bytesio.c @@@ -779,7 -657,11 +779,8 @@@ PyDoc_STRVAR(close_doc static PyObject * bytesio_close(bytesio *self) { + CHECK_EXPORTS(self); - if (self->buf != NULL) { - PyMem_Free(self->buf); - self->buf = NULL; - } + reset(self); Py_RETURN_NONE; }