[issue14934] generator objects can clear their weakrefs before being resurrected

2019-03-30 Thread Nick Coghlan
Nick Coghlan added the comment: If I recall correctly, it's the generator destructor that handles throwing in ``GeneratorExit`` to get the generator to terminate. So this code can resurrect a generator as it's being collected by the GC: def resurrecting(resurrected): self =

[issue14934] generator objects can clear their weakrefs before being resurrected

2019-03-20 Thread Windson Yang
Windson Yang added the comment: The fixed looks easy, we call `PyObject_CallFinalizerFromDealloc` before PyObject_ClearWeakRefs. But I can't come up with the use case for testing when generator resurrects from `PyObject_CallFinalizer`. Any ideas? --

[issue14934] generator objects can clear their weakrefs before being resurrected

2019-03-16 Thread SilentGhost
Change by SilentGhost : -- versions: +Python 3.8 -Python 3.4, Python 3.5, Python 3.6 ___ Python tracker ___ ___ Python-bugs-list

[issue14934] generator objects can clear their weakrefs before being resurrected

2019-03-16 Thread Windson Yang
Windson Yang added the comment: In the docs https://docs.python.org/3/extending/newtypes.html#weak-reference-support points out: > /* Clear weakrefs first before calling any destructors */ So maybe we should also update the docs after fix this bug. Anyway, I will try to understand/fix

[issue14934] generator objects can clear their weakrefs before being resurrected

2019-03-15 Thread Mark Lawrence
Change by Mark Lawrence : -- nosy: -BreamoreBoy ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue14934] generator objects can clear their weakrefs before being resurrected

2014-07-04 Thread Mark Lawrence
Mark Lawrence added the comment: I'm still not brave enough to take on C code, but could this be handled by someone from the core-mentorship list? -- nosy: +BreamoreBoy versions: +Python 3.4, Python 3.5 -Python 3.2, Python 3.3 ___ Python tracker

[issue14934] generator objects can clear their weakrefs before being resurrected

2012-05-28 Thread Antoine Pitrou
New submission from Antoine Pitrou pit...@free.fr: In Objects/genobject.c, gen_dealloc() calls PyObject_ClearWeakRefs() before trying to finalize the generator, during which the generator object can be resurrected. This is probably a bug, since weakrefs are supposed to be cleared (and their