[Patches] [Patch #101346] fetch/restore exceptions around GC collections

noreply@sourceforge.net noreply@sourceforge.net
Wed, 30 Aug 2000 06:40:59 -0700


Patch #101346 has been updated. 

Project: 
Category: core (C code)
Status: Open
Summary: fetch/restore exceptions around GC collections

Follow-Ups:

Date: 2000-Aug-29 12:29
By: jhylton

Comment:
This appears to fix #110915 on Linux.  It's not entirely clear that I've but the fetch/restore in the right place, but I think that all collections begin with collect_generations.

-------------------------------------------------------

Date: 2000-Aug-29 13:34
By: jhylton

Comment:
Get rid of the PyErr_Clear that was causing problems and make sure we always restore the exception state before leaving collect_generations.

Further, copy code from __del__ to print a message on stderr if the garbage collector did raise an exception.  It seems dangerous to ignore one completely, but it's not clear how to recover.

If the latter change makes any sense, we'll need to extract the two copies of the code (from classobject.c and gcmodule.c) and put a helper function in errors.c

-------------------------------------------------------

Date: 2000-Aug-30 06:40
By: marangoz

Comment:
Hm. The offending PyErr_Clear should definitely be removed.
Not sure that surrounding the collection process with err fetch/restore
is a good idea though. The collector could trigger __del__ methods
which in turn could set exceptions. The GC code itself should be
absolutely transparent w.r.t. exceptions and should propagate them
if they're raised elsewhere.

So, what needs to be done here is:
- remove PyErrClear
- use PySys_WriteStderr for debugging. The whole "output" stuff in
   gcmodule.c should be zapped, because it's a suboptimal and incomplete
   PySys_WriteStderr. The latter takes care to fetch/restore exceptions
   when printing the output.

PS: now that this is assigned to me, can I upload another patch over this
one for review?
-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=101346&group_id=5470