[pypy-commit] pypy inline-dict-ops: revert changes to debug, they break tons of tests. fijal: feel free to revert if you fix tests ; )

alex_gaynor noreply at buildbot.pypy.org
Fri Oct 21 01:32:27 CEST 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: inline-dict-ops
Changeset: r48288:99cce3fdfcfd
Date: 2011-10-20 19:32 -0400
http://bitbucket.org/pypy/pypy/changeset/99cce3fdfcfd/

Log:	revert changes to debug, they break tons of tests. fijal: feel free
	to revert if you fix tests ;)

diff --git a/pypy/rlib/debug.py b/pypy/rlib/debug.py
--- a/pypy/rlib/debug.py
+++ b/pypy/rlib/debug.py
@@ -1,26 +1,6 @@
-import sys, time, os
+import sys, time
 from pypy.rpython.extregistry import ExtRegistryEntry
 
-class DebugState(object):
-    def __init__(self):
-        self.prefixes = os.environ.get('PYPYDEFAULTLOG', 'all').split(',')
-        if self.prefixes == ['']:
-            self.prefixes = []
-        self.categories = []
-
-    def should_print(self, category=None):
-        if category is None:
-            category = self.categories[-1]
-        if self.prefixes != ['all']:
-            for prefix in self.prefixes:
-                if category.startswith(prefix):
-                    break
-            else:
-                return False
-        return True
-
-debug_state = DebugState() # a global state object
-
 def ll_assert(x, msg):
     """After translation to C, this becomes an RPyAssert."""
     assert x, msg
@@ -76,8 +56,6 @@
                   # or compatible
 
 def debug_print(*args):
-    if not debug_state.should_print():
-        return
     for arg in args:
         print >> sys.stderr, arg,
     print >> sys.stderr
@@ -108,25 +86,18 @@
     _stop_colors = ""
 
 def debug_start(category):
-    debug_state.categories.append(category)
-    if _log is not None:
-        _log.debug_start(category)
-    if not debug_state.should_print(category):
-        return
     c = int(time.clock() * 100)
     print >> sys.stderr, '%s[%x] {%s%s' % (_start_colors_1, c,
                                            category, _stop_colors)
-    
+    if _log is not None:
+        _log.debug_start(category)
+
 def debug_stop(category):
-    if _log is not None:
-        _log.debug_stop(category)
-    last = debug_state.categories.pop()
-    assert category == last
-    if not debug_state.should_print(category):
-        return
     c = int(time.clock() * 100)
     print >> sys.stderr, '%s[%x] %s}%s' % (_start_colors_2, c,
                                            category, _stop_colors)
+    if _log is not None:
+        _log.debug_stop(category)
 
 class Entry(ExtRegistryEntry):
     _about_ = debug_start, debug_stop


More information about the pypy-commit mailing list