[Python-Dev] remaining issues from Klocwork static analysis
Georg Brandl
g.brandl at gmx.net
Wed Jul 26 09:16:25 CEST 2006
Neal Norwitz wrote:
> On 7/25/06, "Martin v. Löwis" <martin at v.loewis.de> wrote:
>> Neal Norwitz wrote:
>> > # 74 Object/funcobject.c:143 Suspicious deref of ptr before NULL check
>>
>> Not quite sure what it is complaining about, but
>>
>> else if (PyTuple_Check(closure)) {
>> Py_XINCREF(closure);
>> }
>>
>> looks indeed suspicious: Why do we check for NULL (XINCREF) when
>> we know closure can't be NULL (Tuple_Check). Drop the X, and see
>> if the warning goes away
>
> Yes, I definitely think dropping the X would make the warning go away.
> Do we want to check for a NULL pointer and raise an exception? The
> docs don't address the issue, so I think if we added a check, ie: if
> (closure && PyTuple_Check(closure)) and got rid of the X that would be
> fine as well.
You'll have to do something about the error message, then, since it
uses closure->ob_type.
Georg
More information about the Python-Dev
mailing list