[pypy-svn] r64230 - pypy/trunk/pypy/rlib

cfbolz at codespeak.net cfbolz at codespeak.net
Fri Apr 17 11:51:30 CEST 2009


Author: cfbolz
Date: Fri Apr 17 11:51:30 2009
New Revision: 64230

Modified:
   pypy/trunk/pypy/rlib/rcoroutine.py
Log:
(cfbolz, pedronis around): fix a bug in coroutines: when modules are torn down strange stuff is 
happening.


Modified: pypy/trunk/pypy/rlib/rcoroutine.py
==============================================================================
--- pypy/trunk/pypy/rlib/rcoroutine.py	(original)
+++ pypy/trunk/pypy/rlib/rcoroutine.py	Fri Apr 17 11:51:30 2009
@@ -288,7 +288,12 @@
         # Additionally note that in the context of __del__, we are
         # not in the position to issue a switch.
         # we defer it completely.
-        syncstate.postpone_deletion(self)
+        
+        # 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 syncstate is None:
+            syncstate.postpone_deletion(self)
 
     # coroutines need complete control over their __del__ behaviour. In
     # particular they need to care about calling space.userdel themselves



More information about the Pypy-commit mailing list