Closed as not planned
Description
One other issue is whether the output parameter should be touched if there is no meaningful value.
Take
PyDict_GetItemSuffixToBeDecided(PyDictObject *op, PyObject *key, PyObject **pvalue)
.
Should we touch*pvalue
if returning -1 or 0.
In other words, inPyObject *value; int err = PyDict_GetItemSuffixToBeDecided(op, key, &value);Should
value
be undefined iferr <= 0
, or should it be set toNULL
?It is more efficient to not touch it, since the return value specifies that it has no meaning.
But, do we trust all C extension authors not to read the value, which may point to a real object if they are unlucky? Setting*pvalue = NULL
is safer.
Originally posted by @markshannon in #1121 (comment)