summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-08-14 15:54:27 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2008-08-14 15:54:27 (GMT)
commit241b8345ea913125ee5aeb04e32bfca40d9ddbce (patch)
tree303813097d54d3bf30eae05c114a882b7c40f1fc /Objects
parent9f4e7fee6234c7aece800cb16584267f87cfabcc (diff)
downloadcpython-241b8345ea913125ee5aeb04e32bfca40d9ddbce.zip
cpython-241b8345ea913125ee5aeb04e32bfca40d9ddbce.tar.gz
cpython-241b8345ea913125ee5aeb04e32bfca40d9ddbce.tar.bz2
Make obj an owned reference in Py_buffer; this checkin
was missing from the patch for #3139.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 5fb89f3..aca60bd 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -683,6 +683,8 @@ PyBuffer_FillInfo(Py_buffer *view, PyObject *obj, void *buf, Py_ssize_t len,
}
view->obj = obj;
+ if (obj)
+ Py_INCREF(obj);
view->buf = buf;
view->len = len;
view->readonly = readonly;
@@ -710,7 +712,8 @@ PyBuffer_Release(Py_buffer *view)
/* Unmanaged buffer */
return;
Py_TYPE(obj)->tp_as_buffer->bf_releasebuffer(obj, view);
-
+ Py_DECREF(obj);
+ view->obj = NULL;
}
PyObject *