[Python-Dev] Need to hook Py_FatalError

2005-05-03 Thread m.u.k
Greetings,

Currently Py_FatalError only dumps the error to stderr and calls abort().
When doing quirky things with the interpreter, it's so annoying that process 
just terminates. Are there any reason why we still dont have a simple 
callback to hook Py_FatalError.

PS. If the answer is "because no one needs/implemented...", I can volunteer.


Best regards.


___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Need to hook Py_FatalError

2005-05-03 Thread m.u.k
Hi,

Guido van Rossum <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]: 
 
> Your efforts would be better directed towards fixing the causes of the
> fatal errors.
>
> I see no need to hook Py_FatalError, but since it's open source, you
> are of course free to patch your own copy if your urge is truly
> irresistible. Or I guess you could run Python under supervision of gdb
> and trap it that way.

Well, I admit it is a bit triva(as its implementation), at least nobody 
wanted it within Python's 10+ lifetime. Indeed Im using my own patched copy,
I just thought it'd be good some other naughty boy playing dangerous games 
with interpreter internals not spend hours in debugger trying to reproduce 
the crash.

> But tell me, what do you want the process to do instead of
> terminating? Py_FatalError is used in situations where raising an
> exception is impossible or would do more harm than good.

The need for this is only logging purposes. eg the process just terminates 
on client machine, you have no logs, no clues(except a coredump), nightmare!.
Some sort of log would be invaluable here.


Best regards.

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Need to hook Py_FatalError

2005-05-03 Thread m.u.k
Hi,

Josiah Carlson <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]: 

> In looking at the use of Py_FatalError in the Python Sources (it's a 10
> meg tarball that is well worth the download), it looks as though its use
> shows a Fatal error (hence the name).  Things like "Inconsistant
> interned string state" or "Immortal interned string died" or "Can't
> initialize type", etc.
> 
> Essentially, those errors generally signify "the internal state of
> python is messed up", whether that be by C extension, or even a bug in
> Python.  The crucial observation is that many of them have ambiguous
> possible recoveries.  How do you come back from "Can't initialize type",
> or even 'gc couldn't allocate "__del__"'?

The hook is not to come back just for logging, see my previous post please.

Best regards.




___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Need to hook Py_FatalError

2005-05-03 Thread m.u.k
Hi,

Josiah Carlson <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]: 

> Offering any hook for Py_FatalError may not even be enough, as some of
> those errors are caused by insufficient memory.  What if a hook were
> available, but it couldn't be called because there wasn't enough memory?
> 
> Of course there is the option of pre-allocating a few kilobytes, then
> just before one calls the hook, freeing that memory so that the hook can
> execute (assuming the hook is small enough).  I'm not sure if this is a
> desireable general mechanic, but it may be sufficient for you.  If you
> do figure out a logging mechanism that is almost guaranteed to execute
> on FatalError, post it to sourceforge.
 
IMHO this should be left to hooker(apparerently not right word, but you get 
the point :) ). If he allocates more mem. or does heavy stuff, that will just 
fail. Anyway abort() is a failure too. Either abort() will end the process or 
OS will on such a critical error.

Best regards.

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com