[pypy-svn] r61160 - pypy/trunk/pypy/interpreter
antocuni at codespeak.net
antocuni at codespeak.net
Tue Jan 20 15:35:55 CET 2009
Author: antocuni
Date: Tue Jan 20 15:35:52 2009
New Revision: 61160
Modified:
pypy/trunk/pypy/interpreter/generator.py
pypy/trunk/pypy/interpreter/typedef.py
Log:
implement __del__ for generator objects, but comment out it as it triggers a
bug in the hybrid gc
Modified: pypy/trunk/pypy/interpreter/generator.py
==============================================================================
--- pypy/trunk/pypy/interpreter/generator.py (original)
+++ pypy/trunk/pypy/interpreter/generator.py Tue Jan 20 15:35:52 2009
@@ -111,5 +111,15 @@
msg = "generator ignored GeneratorExit"
raise OperationError(space.w_RuntimeError, space.wrap(msg))
+ def descr__del__(self):
+ """
+ applevel __del__, which is called at a safe point after the
+ interp-level __del__ enqueued the object for destruction
+ """
+ self.descr_close()
+
+## # it seems there is a bug in the hybrid gc, if we add a __del__ it
+## # segfaults. With mark&sweep it works correctly
## def __del__(self):
-## self.descr_close()
+## if not self.frame.frame_finished_execution:
+## self._enqueue_for_destruction(self.space)
Modified: pypy/trunk/pypy/interpreter/typedef.py
==============================================================================
--- pypy/trunk/pypy/interpreter/typedef.py (original)
+++ pypy/trunk/pypy/interpreter/typedef.py Tue Jan 20 15:35:52 2009
@@ -863,6 +863,8 @@
descrmismatch='close'),
__iter__ = interp2app(GeneratorIterator.descr__iter__,
descrmismatch='__iter__'),
+ __del__ = interp2app(GeneratorIterator.descr__del__,
+ descrmismatch='__del__'),
gi_running = interp_attrproperty('running', cls=GeneratorIterator),
gi_frame = interp_attrproperty('frame', cls=GeneratorIterator),
__weakref__ = make_weakref_descr(GeneratorIterator),
More information about the Pypy-commit
mailing list