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$
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$