Rev 5433: (spiv) Suppress "maximum recursion depth exceeded in __subclasscheck__" in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Sep 20 02:55:30 BST 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5433 [merge]
revision-id: pqm at pqm.ubuntu.com-20100920015528-uq5ugmc4rdt5dsdp
parent: pqm at pqm.ubuntu.com-20100917142727-49blehg006i4nc9n
parent: andrew.bennetts at canonical.com-20100917043250-4f57ifkg0yu321t7
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2010-09-20 02:55:28 +0100
message:
  (spiv) Suppress "maximum recursion depth exceeded in __subclasscheck__"
   warnings during selftest. (Andrew Bennetts)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/test__bencode.py  test_bencode.py-20070806225234-s51cnnkh6raytxti-1
=== modified file 'NEWS'
--- a/NEWS	2010-09-17 06:59:59 +0000
+++ b/NEWS	2010-09-20 01:55:28 +0000
@@ -304,6 +304,10 @@
 * Rearrange thread leak detection code to eliminate global state and make it
   possible to extend the reporting. (Marting [gz], #633462)
 
+* Suppress the "maximum recursion depth exceeded in __subclasscheck__"
+  warning on stderr emitted during ``test_dict_deepnested`` in
+  ``bzrlib/tests/test__bencode.py``.  (Andrew Bennetts)
+
 * The test suite now simply holds log files in memory, rather than writing them
   out to disk and then reading them back in and deleting them.
   (Andrew Bennetts)

=== modified file 'bzrlib/tests/test__bencode.py'
--- a/bzrlib/tests/test__bencode.py	2010-02-17 17:11:16 +0000
+++ b/bzrlib/tests/test__bencode.py	2010-09-17 04:32:50 +0000
@@ -16,6 +16,8 @@
 
 """Tests for bencode structured encoding"""
 
+import sys
+
 from bzrlib import tests
 
 def load_tests(standard_tests, module, loader):
@@ -105,7 +107,14 @@
                             'd8:spam.mp3d6:author5:Alice6:lengthi100000eee')
 
     def test_dict_deepnested(self):
-        self._run_check_error(RuntimeError, ("d0:" * 10000) + 'i1e' + ("e" * 10000))
+        # The recursion here provokes CPython into emitting a warning on
+        # stderr, "maximum recursion depth exceeded in __subclasscheck__", due
+        # to running out of stack space while evaluating "except (...):" in
+        # _bencode_py.  This is harmless, so we temporarily override stderr to
+        # avoid distracting noise in the test output.
+        self.overrideAttr(sys, 'stderr', self._log_file)
+        self._run_check_error(
+            RuntimeError, ("d0:" * 10000) + 'i1e' + ("e" * 10000))
 
     def test_malformed_dict(self):
         self._run_check_error(ValueError, 'd')




More information about the bazaar-commits mailing list