Author: Armin Rigo <[email protected]>
Branch: continulet-pickle
Changeset: r47274:ea97f442a1f2
Date: 2011-09-14 20:54 +0200
http://bitbucket.org/pypy/pypy/changeset/ea97f442a1f2/

Log:    Improve the DEBUG checks. Add a test that checks that we don't
        accidentally check-in DEBUG=True.

diff --git a/pypy/rlib/rstacklet.py b/pypy/rlib/rstacklet.py
--- a/pypy/rlib/rstacklet.py
+++ b/pypy/rlib/rstacklet.py
@@ -87,12 +87,20 @@
         return False
     def add(self, h):
         if not self.sthread.is_empty_handle(h):
+            if h == self.sthread.get_null_handle():
+                raise StackletDebugError("unexpected null handle")
             self.active.append(h)
     def remove(self, h):
         try:
             i = self.active.index(h)
         except ValueError:
-            raise StackletDebugError
+            if self.sthread.is_empty_handle(h):
+                msg = "empty stacklet handle"
+            elif h == self.sthread.get_null_handle():
+                msg = "unexpected null handle"
+            else:
+                msg = "double usage of handle %r" % (h,)
+            raise StackletDebugError(msg)
         del self.active[i]
 debug = Debug()
 
diff --git a/pypy/rlib/test/test_rstacklet.py b/pypy/rlib/test/test_rstacklet.py
--- a/pypy/rlib/test/test_rstacklet.py
+++ b/pypy/rlib/test/test_rstacklet.py
@@ -264,6 +264,10 @@
     gcrootfinder = 'shadowstack'
 
 
+def test_dont_keep_debug_to_true():
+    assert not rstacklet.DEBUG
+
+
 def target(*args):
     return entry_point, None
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to