[Python-checkins] r65677 - python/trunk/Objects/abstract.c

martin.v.loewis python-checkins at python.org
Thu Aug 14 17:54:27 CEST 2008


Author: martin.v.loewis
Date: Thu Aug 14 17:54:27 2008
New Revision: 65677

Log:
Make obj an owned reference in Py_buffer; this checkin
was missing from the patch for #3139.


Modified:
   python/trunk/Objects/abstract.c

Modified: python/trunk/Objects/abstract.c
==============================================================================
--- python/trunk/Objects/abstract.c	(original)
+++ python/trunk/Objects/abstract.c	Thu Aug 14 17:54:27 2008
@@ -683,6 +683,8 @@
 	}
 
 	view->obj = obj;
+	if (obj)
+		Py_INCREF(obj);
 	view->buf = buf;
 	view->len = len;
 	view->readonly = readonly;
@@ -710,7 +712,8 @@
 		/* Unmanaged buffer */
 		return;
 	Py_TYPE(obj)->tp_as_buffer->bf_releasebuffer(obj, view);
-	
+	Py_DECREF(obj);
+	view->obj = NULL;
 }
 
 PyObject *


More information about the Python-checkins mailing list