[Python-Dev] are NULL checks in Objects/abstract.c reallyneeded?

Jeremy Hylton jeremy@zope.com
13 Mar 2003 15:35:45 -0500


On Thu, 2003-03-13 at 15:16, Raymond Hettinger wrote:
> > > Can we get most of the same benefit by using 
> > > an assert() rather than NULL-->SystemError?
> > 
> > No.  assert() causes the program to fail.  SystemError() raises an
> > exception and lets the program keep going.  Those are vastly different
> > effects.
> 
> Of course.  My thought was that either one will come to the
> attention of the extension writer before the extension goes out.
> But then, if the code in question never got excercised, then it
> would crash in the hands of a user.

That's right.  We should expect that some number of bugs in extension
code are going to be found by end users.  An end user is better able to
cope with a SystemError than a core file.

Long running servers have a different reason to prefer SystemError.  A
Zope process allows untrusted code to call some extension module,
believing it is safe.  A bug is found in the extension.  If the bug
tickles an assert(), Zope crashes.  If the bug raises an exception, Zope
catches it and continues.

> Raymond Hettinger
> 
> #################################################################
> #################################################################
> #################################################################
> #####
> #####
> #####
> #################################################################
> #################################################################
> #################################################################

Your funky sig is back :-).

Jeremy