[Python-checkins] python/dist/src/Include object.h,2.124,2.125
aleax at users.sourceforge.net
aleax at users.sourceforge.net
Sun Nov 9 11:38:42 EST 2003
Update of /cvsroot/python/python/dist/src/Include
In directory sc8-pr-cvs1:/tmp/cvs-serv11701
Modified Files:
object.h
Log Message:
fixed buggy comment as per SF bug #827856
(same as commit of Sun Nov 2 to the release23-maint branch)
Index: object.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/object.h,v
retrieving revision 2.124
retrieving revision 2.125
diff -C2 -d -r2.124 -r2.125
*** object.h 19 Oct 2003 22:58:11 -0000 2.124
--- object.h 9 Nov 2003 16:38:39 -0000 2.125
***************
*** 699,707 ****
Functions that create an object set the reference count to 1; such new
objects must be stored somewhere or destroyed again with Py_DECREF().
! Functions that 'store' objects such as PyTuple_SetItem() and
! PyDict_SetItemString()
don't increment the reference count of the object, since the most
frequent use is to store a fresh object. Functions that 'retrieve'
! objects such as PyTuple_GetItem() and PyDict_GetItemString() also
don't increment
the reference count, since most frequently the object is only looked at
--- 699,707 ----
Functions that create an object set the reference count to 1; such new
objects must be stored somewhere or destroyed again with Py_DECREF().
! Some functions that 'store' objects, such as PyTuple_SetItem() and
! PyList_SetItem(),
don't increment the reference count of the object, since the most
frequent use is to store a fresh object. Functions that 'retrieve'
! objects, such as PyTuple_GetItem() and PyDict_GetItemString(), also
don't increment
the reference count, since most frequently the object is only looked at
***************
*** 709,718 ****
must call Py_INCREF() explicitly.
! NOTE: functions that 'consume' a reference count like
! PyList_SetItemString() even consume the reference if the object wasn't
! stored, to simplify error handling.
It seems attractive to make other functions that take an object as
! argument consume a reference count; however this may quickly get
confusing (even the current practice is already confusing). Consider
it carefully, it may save lots of calls to Py_INCREF() and Py_DECREF() at
--- 709,718 ----
must call Py_INCREF() explicitly.
! NOTE: functions that 'consume' a reference count, like
! PyList_SetItem(), consume the reference even if the object wasn't
! successfully stored, to simplify error handling.
It seems attractive to make other functions that take an object as
! argument consume a reference count; however, this may quickly get
confusing (even the current practice is already confusing). Consider
it carefully, it may save lots of calls to Py_INCREF() and Py_DECREF() at
More information about the Python-checkins
mailing list