[Python-Dev] remaining issues from Klocwork static analysis (original) (raw)
Neal Norwitz nnorwitz at gmail.com
Wed Jul 26 07:12:42 CEST 2006
- Previous message: [Python-Dev] remaining issues from Klocwork static analysis
- Next message: [Python-Dev] remaining issues from Klocwork static analysis
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 7/25/06, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> > 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 && PyTupleCheck(closure)) and got rid of the X that would be > fine as well.
The docs do address the issue: \var{closure} must be \var{PyNone} or a tuple of cell objects. It doesn't allow for NULL, and None indicates that the closure should become NULL. The only caller of it in the core will never pass NULL. If you want to check that this is not NULL on the grounds that somebody may call it incorrectly, then you should also check that op is not NULL, because somebody may call it incorrectly.
We never really did address this issue did? A while back we talked about whether to assert vs check and do PyErr_BadInternalCall(). I don't remember a clear resolution (though my memory). I vaguely remember a preference towards asserting, but I don't know if that was in all cases or maybe it was just my preference. :-)
I'm happy to assert here too. But it's really a broader question. I guess I'm even happy to just remove the X. It would be nice to handle this consistently going forward.
n
- Previous message: [Python-Dev] remaining issues from Klocwork static analysis
- Next message: [Python-Dev] remaining issues from Klocwork static analysis
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]