SF bug[ #423781:  pprint.isrecursive() broken.
diff --git a/Lib/pprint.py b/Lib/pprint.py
index 814ca48..48efb33 100644
--- a/Lib/pprint.py
+++ b/Lib/pprint.py
@@ -49,26 +49,21 @@
     printer = PrettyPrinter(stream=stream)
     printer.pprint(object)
 
-
 def pformat(object):
     """Format a Python object into a pretty-printed representation."""
     return PrettyPrinter().pformat(object)
 
-
-def isreadable(object):
-    """Determine if saferepr(object) is readable by eval()."""
-    return PrettyPrinter().isreadable(object)
-
-
-def isrecursive(object):
-    """Determine if object requires a recursive representation."""
-    return PrettyPrinter().isrecursive(object)
-
-
 def saferepr(object):
     """Version of repr() which can handle recursive data structures."""
     return _safe_repr(object, {})[0]
 
+def isreadable(object):
+    """Determine if saferepr(object) is readable by eval()."""
+    return _safe_repr(object, {})[1]
+
+def isrecursive(object):
+    """Determine if object requires a recursive representation."""
+    return _safe_repr(object, {})[2]
 
 class PrettyPrinter:
     def __init__(self, indent=1, width=80, depth=None, stream=None):
@@ -92,7 +87,7 @@
         indent = int(indent)
         width = int(width)
         assert indent >= 0
-        assert (not depth) or depth > 0, "depth may not be negative"
+        assert depth is None or depth > 0, "depth must be > 0"
         assert width
         self.__depth = depth
         self.__indent_per_level = indent
@@ -182,23 +177,28 @@
         del context[objid]
 
     def __repr(self, object, context, level):
-        repr, readable = _safe_repr(object, context, self.__depth, level)
+        repr, readable, recursive = _safe_repr(object, context,
+                                               self.__depth, level)
         if not readable:
             self.__readable = 0
+        if recursive:
+            self.__recursive = 1
         return repr
 
+# Return triple (repr_string, isreadable, isrecursive).
 
 def _safe_repr(object, context, maxlevels=None, level=0):
     level = level + 1
     typ = type(object)
     if not (typ in (DictType, ListType, TupleType) and object):
         rep = `object`
-        return rep, (rep and (rep[0] != '<'))
+        return rep, (rep and (rep[0] != '<')), 0
     if context.has_key(id(object)):
-        return `_Recursion(object)`, 0
+        return `_Recursion(object)`, 0, 1
     objid = id(object)
     context[objid] = 1
     readable = 1
+    recursive = 0
     if typ is DictType:
         if maxlevels and level >= maxlevels:
             s = "{...}"
@@ -206,14 +206,20 @@
         else:
             items = object.items()
             k, v = items[0]
-            krepr, kreadable = _safe_repr(k, context, maxlevels, level)
-            vrepr, vreadable = _safe_repr(v, context, maxlevels, level)
+            krepr, kreadable, krecur = _safe_repr(k, context, maxlevels,
+                                                  level)
+            vrepr, vreadable, vrecur = _safe_repr(v, context, maxlevels,
+                                                  level)
             readable = readable and kreadable and vreadable
+            recursive = recursive or krecur or vrecur
             s = "{%s: %s" % (krepr, vrepr)
             for k, v in items[1:]:
-                krepr, kreadable = _safe_repr(k, context, maxlevels, level)
-                vrepr, vreadable = _safe_repr(v, context, maxlevels, level)
+                krepr, kreadable, krecur = _safe_repr(k, context, maxlevels,
+                                                      level)
+                vrepr, vreadable, vrecur = _safe_repr(v, context, maxlevels,
+                                                      level)
                 readable = readable and kreadable and vreadable
+                recursive = recursive or krecur or vrecur
                 s = "%s, %s: %s" % (s, krepr, vrepr)
             s = s + "}"
     else:
@@ -222,22 +228,24 @@
             s = s + "..."
             readable = 0
         else:
-            subrepr, subreadable = _safe_repr(
+            subrepr, subreadable, subrecur = _safe_repr(
                 object[0], context, maxlevels, level)
             readable = readable and subreadable
+            recursive = recursive or subrecur
             s = s + subrepr
             tail = object[1:]
             if not tail:
                 if typ is TupleType:
                     s = s + ','
             for ent in tail:
-                subrepr, subreadable = _safe_repr(
+                subrepr, subreadable, subrecur = _safe_repr(
                     ent, context, maxlevels, level)
                 readable = readable and subreadable
+                recursive = recursive or subrecur
                 s = "%s, %s" % (s, subrepr)
         s = s + term
     del context[objid]
-    return s, readable
+    return s, readable and not recursive, recursive
 
 
 class _Recursion:
diff --git a/Lib/test/output/test_pprint b/Lib/test/output/test_pprint
new file mode 100644
index 0000000..6f04e91
--- /dev/null
+++ b/Lib/test/output/test_pprint
@@ -0,0 +1 @@
+test_pprint
diff --git a/Lib/test/test_pprint.py b/Lib/test/test_pprint.py
new file mode 100644
index 0000000..610e989
--- /dev/null
+++ b/Lib/test/test_pprint.py
@@ -0,0 +1,36 @@
+from test_support import verify
+import pprint
+
+# Verify that .isrecursive() and .isreadable() work.
+
+a = range(100)
+b = range(200)
+a[-12] = b
+
+for safe in 2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, u"yaddayadda", a, b:
+    verify(pprint.isrecursive(safe) == 0, "expected isrecursive == 0")
+    verify(pprint.isreadable(safe) == 1,  "expected isreadable == 1")
+
+# Tie a knot.
+b[67] = a
+# Messy dict.
+d = {}
+d[0] = d[1] = d[2] = d
+
+for icky in a, b, d, (d, d):
+    verify(pprint.isrecursive(icky) == 1, "expected isrecursive == 1")
+    verify(pprint.isreadable(icky) == 0,  "expected isreadable == 0")
+
+# Break the cycles.
+d.clear()
+del a[:]
+del b[:]
+
+for safe in a, b, d, (d, d):
+    verify(pprint.isrecursive(safe) == 0, "expected isrecursive == 0")
+    verify(pprint.isreadable(safe) == 1,  "expected isreadable == 1")
+
+# Not recursive but not readable anyway.
+for unreadable in type(3), pprint, pprint.isrecursive:
+    verify(pprint.isrecursive(unreadable) == 0, "expected isrecursive == 0")
+    verify(pprint.isreadable(unreadable) ==0,  "expected isreadable == 0")