API question -- decref after adding to dictionary?
Rich Salz
salzr at certco.com
Tue Jul 27 16:37:36 EDT 1999
I'm converting my own associative array into a python dictionary so I can
callout to some python code. I think the snippet below should be clear
enough.
PyDictObject* newdict = PyDict_New();
for (CKeyValList::iterator i(kvl); i; ++i) {
PyString* v = Pystring_FromString(i.value());
PyDict__SetItemString(p, i.key(), v);
Py_DECREF(v);
}
Is the DECREF necessary? Reading the source of dictobject.c makes me think
it is, but the comments in object.h say otherwise.
Replies to me will be summarized to the list. Thanks.
/r$
More information about the Python-list
mailing list