[pypy-svn] r66057 - pypy/branch/pyjitpl5/pypy/rlib
arigo at codespeak.net
arigo at codespeak.net
Tue Jun 30 16:38:29 CEST 2009
Author: arigo
Date: Tue Jun 30 16:38:28 2009
New Revision: 66057
Added:
pypy/branch/pyjitpl5/pypy/rlib/rcoroutine.py.merge.tmp
- copied, changed from r66039, pypy/branch/pyjitpl5/pypy/rlib/rcoroutine.py
Log:
merging of svn+ssh://codespeak.net/svn/pypy/trunk/pypy/rlib/rcoroutine.py
revisions 62865 to 66039:
------------------------------------------------------------------------
r64470 | cfbolz | 2009-04-20 18:44:37 +0200 (Mon, 20 Apr 2009) | 2 lines
nice comment that explains the strange code
------------------------------------------------------------------------
r64458 | iko | 2009-04-20 16:21:50 +0200 (Mon, 20 Apr 2009) | 3 lines
(iko, pedronis, arigo): Fix hanging stackless test
------------------------------------------------------------------------
r64375 | cfbolz | 2009-04-19 16:18:54 +0200 (Sun, 19 Apr 2009) | 2 lines
this is obviously nonsense
------------------------------------------------------------------------
r64230 | cfbolz | 2009-04-17 11:51:30 +0200 (Fri, 17 Apr 2009) | 3 lines
(cfbolz, pedronis around): fix a bug in coroutines: when modules are torn down strange stuff is
happening.
------------------------------------------------------------------------
r64205 | cfbolz | 2009-04-17 00:44:43 +0200 (Fri, 17 Apr 2009) | 4 lines
(cfbolz, pedronis): fix the problem in coroutine cleanup: you need to always
enqueue a coroutine for deletion, even if it does not have a frame because the
userdel needs to be called.
------------------------------------------------------------------------
r64171 | cfbolz | 2009-04-16 16:51:37 +0200 (Thu, 16 Apr 2009) | 3 lines
(pedronis, cfbolz, armin around): fix subclasses of coroutines that have a
__del__.
------------------------------------------------------------------------
r63373 | arigo | 2009-03-26 15:51:14 +0100 (Thu, 26 Mar 2009) | 2 lines
Import greenlets from the new place, /svn/greenlet/trunk.
------------------------------------------------------------------------
Copied: pypy/branch/pyjitpl5/pypy/rlib/rcoroutine.py.merge.tmp (from r66039, pypy/branch/pyjitpl5/pypy/rlib/rcoroutine.py)
==============================================================================
--- pypy/branch/pyjitpl5/pypy/rlib/rcoroutine.py (original)
+++ pypy/branch/pyjitpl5/pypy/rlib/rcoroutine.py.merge.tmp Tue Jun 30 16:38:28 2009
@@ -134,6 +134,10 @@
else:
self.things_to_do = False
+ def _freeze_(self):
+ self.reset()
+ return False
+
syncstate = SyncState()
@@ -281,17 +285,35 @@
pass # maybe print a warning?
self.kill()
+ __already_postponed = False
+
def __del__(self):
- # provide the necessary clean-up if this coro is left
- # with a frame.
+ # provide the necessary clean-up
# note that AppCoroutine has to take care about this
# as well, including a check for user-supplied __del__.
# Additionally note that in the context of __del__, we are
# not in the position to issue a switch.
# we defer it completely.
- if self.frame is not None and syncstate is not None:
+
+ # it is necessary to check whether syncstate is None because CPython
+ # sets it to None when it cleans up the modules, which will lead to
+ # very strange effects
+
+ if not we_are_translated():
+ # we need to make sure that we postpone each coroutine only once on
+ # top of CPython, because this resurrects the coroutine and CPython
+ # calls __del__ again, thus postponing and resurrecting the
+ # coroutine once more :-(
+ if self.__already_postponed:
+ return
+ self.__already_postponed = True
+ if syncstate is not None:
syncstate.postpone_deletion(self)
+ # coroutines need complete control over their __del__ behaviour. In
+ # particular they need to care about calling space.userdel themselves
+ handle_del_manually = True
+
def _userdel(self):
# override this for exposed coros
pass
More information about the Pypy-commit
mailing list