[Patches] getpath patch (repost)

M.-A. Lemburg mal@lemburg.com
Wed, 24 May 2000 00:11:24 +0200


Greg Stein wrote:
> 
> On Tue, 23 May 2000, Skip Montanaro wrote:
> > >>>>> "M-A" == M -A Lemburg <mal@lemburg.com> writes:
> >
> >     M-A> "Fred L. Drake" wrote:
> >     >>
> >     >> On Tue, 23 May 2000, M.-A. Lemburg wrote:
> >     >> > The fatal error produces the core dump... so its not all that bad
> >     >> > ;-)
> >     >>
> >     >> Sigh.  Perhaps we need a non-coring Py_FatalErrorXXX()?
> >
> >     M-A> Hmm, the core dump is caused by abort() -- I don't think we can
> >     M-A> change that behaviour since it is defined by the C lib and using
> >     M-A> exit() is not an option since that would cause atexit() hooks to be
> >     M-A> called.
> >
> > Can't you use the _exit() system call or is that a Unix-only thing?
> > According to my Linux man page _exit is part of the defined APIs for SVr4,
> > SVID, POSIX, X/OPEN and BSD 4.3.  It also states:
> >
> >     _exit does not call any functions registered with the ANSI C atexit
> >     function and does not flush standard I/O buffers. To do these things,
> >     use exit(3).
> >
> > so you might have to flush all open stdio buffers manually.
> >
> > Maybe call _exit()+stdio flushes where _exit() is available and abort()
> > otherwise...
> 
> Um... how about a reset here: WHY do you want to avoid the atexit()
> functions?

Hmm, I guess you're right: Py_FatalError() is really meant as
tool to debugging code in critical situations (that's why
it contains hooks for the Windows debugger and calls abort()
to produce core files).

Yet, the situation we have here is different: the error
is not in the code but in the Python installation setup,
so a Py_TerminateError() which calls exit(42) (*) instead of
abort() would look more reasonable.

(*) Is there some sort of standard on exit codes in POSIX ?
Python uses 2 for some less troublesome cases in Modules/main.c...

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/