[Python-Dev] Null checking

Gustavo Niemeyer niemeyer@conectiva.com
Mon, 10 Jun 2002 11:53:34 -0300


Hello David!

> A couple of quick questions for the authors of the Python source: I notice
> that most, if not all, of the Python 'C' API includes null checks for the
> PyObject* arguments, meaning that you can't crash Python by passing the
> result of a previous operation, even if it returns an error.
> 
> First question: can that be counted on? Hmm, I guess I've answered my own
> question -- PyNumber_InPlaceAdd has no checks.

Something that should also be noticed is that even if Python doesn't
break, leaving errors around until a later point results in more trouble
debugging this code if something goes wrong, and maybe even wrong error
messages being sent to the user.

-- 
Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]