Merged revisions 59407-59422 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r59407 | armin.rigo | 2007-12-07 20:19:55 +0100 (Fri, 07 Dec 2007) | 2 lines

  This is probably what was meant here.
........
  r59410 | guido.van.rossum | 2007-12-08 05:38:23 +0100 (Sat, 08 Dec 2007) | 2 lines

  Be (just a bit :) more specific about release date.
........
  r59411 | alexandre.vassalotti | 2007-12-08 05:49:22 +0100 (Sat, 08 Dec 2007) | 3 lines

  Fix issue #1530.
  Return an error exit status if not all tests passes.
........
  r59413 | georg.brandl | 2007-12-08 11:56:39 +0100 (Sat, 08 Dec 2007) | 2 lines

  Fix tpyo.
........
  r59414 | georg.brandl | 2007-12-08 12:05:05 +0100 (Sat, 08 Dec 2007) | 2 lines

  Fix markup in whatsnew, use new directive in ACKS.
........
  r59415 | georg.brandl | 2007-12-08 12:05:36 +0100 (Sat, 08 Dec 2007) | 2 lines

  Fix Eren's name.
........
  r59416 | georg.brandl | 2007-12-08 12:23:13 +0100 (Sat, 08 Dec 2007) | 2 lines

  Add examples to the datetime documentation. Written for GHOP by "h4wk.cz".
........
  r59417 | skip.montanaro | 2007-12-08 15:37:43 +0100 (Sat, 08 Dec 2007) | 2 lines

  Note that open() is the preferred way to open files (issue 1510).
........
  r59418 | skip.montanaro | 2007-12-08 16:23:31 +0100 (Sat, 08 Dec 2007) | 1 line

  + "context manager"
........
  r59419 | skip.montanaro | 2007-12-08 16:26:16 +0100 (Sat, 08 Dec 2007) | 1 line

  correct email address
........
  r59420 | skip.montanaro | 2007-12-08 16:33:24 +0100 (Sat, 08 Dec 2007) | 3 lines

  When splitting, avoid making a copy of the string if the split doesn't find
  anything (issue 1538).
........
diff --git a/Lib/doctest.py b/Lib/doctest.py
index eb863cb..4a2da32 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -2651,12 +2651,15 @@
                 sys.path.insert(0, dirname)
                 m = __import__(filename[:-3])
                 del sys.path[0]
-                testmod(m)
+                failures, _ = testmod(m)
             else:
-                testfile(filename, module_relative=False)
+                failures, _ = testfile(filename, module_relative=False)
+            if failures:
+                return 1
     else:
         r = unittest.TextTestRunner()
         r.run(DocTestSuite())
+    return 0
 
 if __name__ == "__main__":
-    _test()
+    sys.exit(_test())