summaryrefslogtreecommitdiff
path: root/Modules/_io/bytesio.c
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2017-02-09 16:08:17 +0100
committerNick Coghlan <ncoghlan@gmail.com>2017-02-09 16:08:17 +0100
commitc6180bb73c8c7c7f9d8ea9816487b710597b6fc1 (patch)
treefb4a5c18886537b4b7df46ed3b2aa579747ff507 /Modules/_io/bytesio.c
parent5e0114a832a903518c4af6983161c0c2a8942a24 (diff)
parent819a21a3a4aac38f32e1ba4f68bcef45591fa3f0 (diff)
downloadcpython-c6180bb73c8c7c7f9d8ea9816487b710597b6fc1.tar.gz
Merge issue #26355 fix from Python 3.5
Diffstat (limited to 'Modules/_io/bytesio.c')
-rw-r--r--Modules/_io/bytesio.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c
index 9e5d78b166..a1ba121e26 100644
--- a/Modules/_io/bytesio.c
+++ b/Modules/_io/bytesio.c
@@ -87,7 +87,7 @@ scan_eol(bytesio *self, Py_ssize_t len)
static int
unshare_buffer(bytesio *self, size_t size)
{
- PyObject *new_buf, *old_buf;
+ PyObject *new_buf;
assert(SHARED_BUF(self));
assert(self->exports == 0);
assert(size >= (size_t)self->string_size);
@@ -96,9 +96,7 @@ unshare_buffer(bytesio *self, size_t size)
return -1;
memcpy(PyBytes_AS_STRING(new_buf), PyBytes_AS_STRING(self->buf),
self->string_size);
- old_buf = self->buf;
- self->buf = new_buf;
- Py_DECREF(old_buf);
+ Py_SETREF(self->buf, new_buf);
return 0;
}