Files
cpython/Python
Amaury Forgeot d'Arc c572dc3752 Backport for issue1265 (pdb bug with "with" statement).
When an unfinished generator-iterator is garbage collected, PyEval_EvalFrameEx
is called with a GeneratorExit exception set.  This leads to funny results
if the sys.settrace function itself makes use of generators.
A visible effect is that the settrace function is reset to None.
Another is that the eventual "finally" block of the generator is not called.

It is necessary to save/restore the exception around the call to the trace
function.

This happens a lot with py3k: isinstance() of an ABCMeta instance runs
    def __instancecheck__(cls, instance):
        """Override for isinstance(instance, cls)."""
        return any(cls.__subclasscheck__(c)
                   for c in {instance.__class__, type(instance)})
which lets an opened generator expression each time it returns True.

And the problem can be reproduced in 2.5 with pure python code.
2007-11-13 22:43:05 +00:00
..
2006-04-13 13:08:58 +00:00
2007-10-05 03:45:42 +00:00
2002-06-11 06:22:31 +00:00
2002-01-23 15:51:12 +00:00
2002-08-15 14:59:02 +00:00
2007-08-23 18:08:33 +00:00
2002-12-30 22:08:05 +00:00
2006-07-11 16:44:25 +00:00
2007-10-12 03:59:09 +00:00
2002-06-11 06:22:31 +00:00
2005-07-09 15:26:33 +00:00