[pypy-commit] pypy default: issue1453 in-progress: fix one particular bug I hit when debugging

arigo noreply at buildbot.pypy.org
Sat Apr 20 12:14:23 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r63519:40390dcf161a
Date: 2013-04-20 12:11 +0200
http://bitbucket.org/pypy/pypy/changeset/40390dcf161a/

Log:	issue1453 in-progress: fix one particular bug I hit when debugging
	it. As usual with threads, hard to test.

diff --git a/pypy/module/thread/threadlocals.py b/pypy/module/thread/threadlocals.py
--- a/pypy/module/thread/threadlocals.py
+++ b/pypy/module/thread/threadlocals.py
@@ -52,7 +52,7 @@
 
     def signals_enabled(self):
         ec = self.getvalue()
-        return ec._signals_enabled
+        return ec is not None and ec._signals_enabled
 
     def enable_signals(self, space):
         ec = self.getvalue()
@@ -72,10 +72,12 @@
     def leave_thread(self, space):
         "Notification that the current thread is about to stop."
         from pypy.module.thread.os_local import thread_is_stopping
-        try:
-            thread_is_stopping(self.getvalue())
-        finally:
-            self.setvalue(None)
+        ec = self.getvalue()
+        if ec is not None:
+            try:
+                thread_is_stopping(ec)
+            finally:
+                self.setvalue(None)
 
     def reinit_threads(self, space):
         "Called in the child process after a fork()"


More information about the pypy-commit mailing list