# HG changeset patch
# User Bob Ippolito <bob@redivi.com>
# Date 1363749440 25200
#      Tue Mar 19 20:17:20 2013 -0700
# Node ID b765a7a1d6b4898744ba889df581023f73d10576
# Parent  a5fedbf0efbde08316e94514e3aaa8c7f9fd6f37
fixes #65

diff --git a/CHANGES.txt b/CHANGES.txt
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -3,6 +3,7 @@
 * Updated documentation to reflect separators behavior when indent is
   not None
   https://github.com/simplejson/simplejson/issues/59
+* Test suite should be compatible with debug builds of Python 2.x and 3.x
 
 Version 3.1.1 released 2013-02-21
 
diff --git a/simplejson/tests/test_tool.py b/simplejson/tests/test_tool.py
--- a/simplejson/tests/test_tool.py
+++ b/simplejson/tests/test_tool.py
@@ -5,6 +5,21 @@
 import unittest
 import subprocess
 import tempfile
+try:
+    # Python 3.x
+    from test.support import strip_python_stderr
+except ImportError:
+    # Python 2.6+
+    try:
+        from test.test_support import strip_python_stderr
+    except ImportError:
+        # Python 2.5
+        import re
+        def strip_python_stderr(stderr):
+            return re.sub(
+                r"\[\d+ refs\]\r?\n?$".encode(),
+                "".encode(),
+                stderr).strip()
 
 class TestTool(unittest.TestCase):
     data = """
@@ -46,7 +61,7 @@
                                 stderr=subprocess.PIPE,
                                 stdout=subprocess.PIPE)
         out, err = proc.communicate(data)
-        self.assertEqual(err, ''.encode())
+        self.assertEqual(strip_python_stderr(err), ''.encode())
         self.assertEqual(proc.returncode, 0)
         return out