Merged revisions 75149,75260-75263,75265-75267,75292,75300,75376,75405,75429-75433,75437,75445,75501,75551,75572,75589-75591,75657,75742,75868,75952-75957,76057,76105,76139,76143,76162,76223 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75149 | gregory.p.smith | 2009-09-29 16:56:31 -0500 (Tue, 29 Sep 2009) | 3 lines

  Mention issue6972 in extractall docs about overwriting things outside of
  the supplied path.
........
  r75260 | andrew.kuchling | 2009-10-05 16:24:20 -0500 (Mon, 05 Oct 2009) | 1 line

  Wording fix
........
  r75261 | andrew.kuchling | 2009-10-05 16:24:35 -0500 (Mon, 05 Oct 2009) | 1 line

  Fix narkup
........
  r75262 | andrew.kuchling | 2009-10-05 16:25:03 -0500 (Mon, 05 Oct 2009) | 1 line

  Document 'skip' parameter to constructor
........
  r75263 | andrew.kuchling | 2009-10-05 16:25:35 -0500 (Mon, 05 Oct 2009) | 1 line

  Note side benefit of socket.create_connection()
........
  r75265 | andrew.kuchling | 2009-10-05 17:31:11 -0500 (Mon, 05 Oct 2009) | 1 line

  Reword sentence
........
  r75266 | andrew.kuchling | 2009-10-05 17:32:48 -0500 (Mon, 05 Oct 2009) | 1 line

  Use standard comma punctuation; reword some sentences in the docs
........
  r75267 | andrew.kuchling | 2009-10-05 17:42:56 -0500 (Mon, 05 Oct 2009) | 1 line

  Backport r73983: Document the thousands separator.
........
  r75292 | benjamin.peterson | 2009-10-08 22:11:36 -0500 (Thu, 08 Oct 2009) | 1 line

  death to old CVS keyword
........
  r75300 | benjamin.peterson | 2009-10-09 16:48:14 -0500 (Fri, 09 Oct 2009) | 1 line

  fix some coding style
........
  r75376 | benjamin.peterson | 2009-10-11 20:26:07 -0500 (Sun, 11 Oct 2009) | 1 line

  platform we don't care about
........
  r75405 | neil.schemenauer | 2009-10-14 12:17:14 -0500 (Wed, 14 Oct 2009) | 4 lines

  Issue #1754094: Improve the stack depth calculation in the compiler.
  There should be no other effect than a small decrease in memory use.
  Patch by Christopher Tur Lesniewski-Laas.
........
  r75429 | benjamin.peterson | 2009-10-14 20:47:28 -0500 (Wed, 14 Oct 2009) | 1 line

  pep8ify if blocks
........
  r75430 | benjamin.peterson | 2009-10-14 20:49:37 -0500 (Wed, 14 Oct 2009) | 1 line

  use floor division and add a test that exercises the tabsize codepath
........
  r75431 | benjamin.peterson | 2009-10-14 20:56:25 -0500 (Wed, 14 Oct 2009) | 1 line

  change test to what I intended
........
  r75432 | benjamin.peterson | 2009-10-14 22:05:39 -0500 (Wed, 14 Oct 2009) | 1 line

  some cleanups
........
  r75433 | benjamin.peterson | 2009-10-14 22:06:55 -0500 (Wed, 14 Oct 2009) | 1 line

  make inspect.isabstract() always return a boolean; add a test for it, too #7069
........
  r75437 | benjamin.peterson | 2009-10-15 10:44:46 -0500 (Thu, 15 Oct 2009) | 1 line

  only clear a module's __dict__ if the module is the only one with a reference to it #7140
........
  r75445 | vinay.sajip | 2009-10-16 09:06:44 -0500 (Fri, 16 Oct 2009) | 1 line

  Issue #7120: logging: Removed import of multiprocessing which is causing crash in GAE.
........
  r75501 | antoine.pitrou | 2009-10-18 13:37:11 -0500 (Sun, 18 Oct 2009) | 3 lines

  Add a comment about unreachable code, and fix a typo
........
  r75551 | benjamin.peterson | 2009-10-19 22:14:10 -0500 (Mon, 19 Oct 2009) | 1 line

  use property api
........
  r75572 | benjamin.peterson | 2009-10-20 16:55:17 -0500 (Tue, 20 Oct 2009) | 1 line

  clarify buffer arg #7178
........
  r75589 | benjamin.peterson | 2009-10-21 21:26:47 -0500 (Wed, 21 Oct 2009) | 1 line

  whitespace
........
  r75590 | benjamin.peterson | 2009-10-21 21:36:47 -0500 (Wed, 21 Oct 2009) | 1 line

  rewrite to be nice to other implementations
........
  r75591 | benjamin.peterson | 2009-10-21 21:50:38 -0500 (Wed, 21 Oct 2009) | 4 lines

  rewrite for style, clarify, and comments

  Also, use the hasattr() like scheme of allowing BaseException exceptions through.
........
  r75657 | antoine.pitrou | 2009-10-24 07:41:27 -0500 (Sat, 24 Oct 2009) | 3 lines

  Fix compilation error in debug mode.
........
  r75742 | benjamin.peterson | 2009-10-26 17:51:16 -0500 (Mon, 26 Oct 2009) | 1 line

  use 'is' instead of id()
........
  r75868 | benjamin.peterson | 2009-10-27 15:59:18 -0500 (Tue, 27 Oct 2009) | 1 line

  test expect base classes
........
  r75952 | georg.brandl | 2009-10-29 15:38:32 -0500 (Thu, 29 Oct 2009) | 1 line

  Use the correct function name in docstring.
........
  r75953 | georg.brandl | 2009-10-29 15:39:50 -0500 (Thu, 29 Oct 2009) | 1 line

  Remove mention of the old -X command line switch.
........
  r75954 | georg.brandl | 2009-10-29 15:53:00 -0500 (Thu, 29 Oct 2009) | 1 line

  Use constants instead of magic integers for test result.  Do not re-run with --verbose3 for environment changing tests.
........
  r75955 | georg.brandl | 2009-10-29 15:54:03 -0500 (Thu, 29 Oct 2009) | 1 line

  Use a single style for all the docstrings in the math module.
........
  r75956 | georg.brandl | 2009-10-29 16:16:34 -0500 (Thu, 29 Oct 2009) | 1 line

  I do not think the "railroad" program mentioned is still available.
........
  r75957 | georg.brandl | 2009-10-29 16:44:56 -0500 (Thu, 29 Oct 2009) | 1 line

  Fix constant name.
........
  r76057 | benjamin.peterson | 2009-11-02 09:06:45 -0600 (Mon, 02 Nov 2009) | 1 line

  prevent a rather unlikely segfault
........
  r76105 | georg.brandl | 2009-11-04 01:38:12 -0600 (Wed, 04 Nov 2009) | 1 line

  #7259: show correct equivalent for operator.i* operations in docstring; fix minor issues in operator docs.
........
  r76139 | benjamin.peterson | 2009-11-06 19:04:38 -0600 (Fri, 06 Nov 2009) | 1 line

  spelling
........
  r76143 | georg.brandl | 2009-11-07 02:26:07 -0600 (Sat, 07 Nov 2009) | 1 line

  #7271: fix typo.
........
  r76162 | benjamin.peterson | 2009-11-08 22:10:53 -0600 (Sun, 08 Nov 2009) | 1 line

  discuss how to use -p
........
  r76223 | georg.brandl | 2009-11-12 02:29:46 -0600 (Thu, 12 Nov 2009) | 1 line

  Give the profile module a module directive.
........
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 75a74fa..9fb0692 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -193,6 +193,14 @@
         newsoft = min(hard, max(soft, 1024*2048))
         resource.setrlimit(resource.RLIMIT_STACK, (newsoft, hard))
 
+# Test result constants.
+PASSED = 1
+FAILED = 0
+ENV_CHANGED = -1
+SKIPPED = -2
+RESOURCE_DENIED = -3
+INTERRUPTED = -4
+
 from test import support
 
 RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network',
@@ -352,7 +360,7 @@
             try:
                 result = runtest(*args, **kwargs)
             except BaseException as e:
-                result = -4, e.__class__.__name__
+                result = INTERRUPTED, e.__class__.__name__
             sys.stdout.flush()
             print()   # Force a newline (just in case)
             print(json.dumps(result))
@@ -443,19 +451,18 @@
     def accumulate_result(test, result):
         ok, test_time = result
         test_times.append((test_time, test))
-        if ok > 0:
+        if ok == PASSED:
             good.append(test)
-            return 'good'
-        elif -2 < ok <= 0:
+        elif ok == FAILED:
             bad.append(test)
-            if ok == -1:
-                environment_changed.append(test)
-            return 'bad'
-        else:
+        elif ok == ENV_CHANGED:
+            bad.append(test)
+            environment_changed.append(test)
+        elif ok == SKIPPED:
             skipped.append(test)
-            if ok == -3:
-                resource_denieds.append(test)
-            return 'skipped'
+        elif ok == RESOURCE_DENIED:
+            skipped.append(test)
+            resource_denieds.append(test)
 
     if use_mp:
         from threading import Thread
@@ -511,7 +518,7 @@
                 print(stdout)
             if stderr:
                 print(stderr, file=sys.stderr)
-            if result[0] == -4:
+            if result[0] == INTERRUPTED:
                 assert result[1] == 'KeyboardInterrupt'
                 pending.clear()
                 raise KeyboardInterrupt   # What else?
@@ -532,8 +539,8 @@
                 try:
                     result = runtest(test, verbose, quiet,
                                      testdir, huntrleaks, debug)
-                    which = accumulate_result(test, result)
-                    if verbose3 and which == 'bad':
+                    accumulate_result(test, result)
+                    if verbose3 and result[0] == FAILED:
                         print("Re-running test {} in verbose mode".format(test))
                         runtest(test, True, quiet, testdir, huntrleaks, debug)
                 except KeyboardInterrupt:
@@ -679,15 +686,14 @@
     testdir -- test directory
     huntrleaks -- run multiple times to test for leaks; requires a debug
                   build; a triple corresponding to -R's three arguments
-    debug -- if true, print tracebacks for failed tests regardless of
-             verbose setting
-    Return:
-        -4  KeyboardInterrupt when run under -j
-        -3  test skipped because resource denied
-        -2  test skipped for some other reason
-        -1  test failed because it changed the execution environment
-         0  test failed
-         1  test passed
+
+    Returns one of the test result constants:
+        INTERRUPTED      KeyboardInterrupt when run under -j
+        RESOURCE_DENIED  test skipped because resource denied
+        SKIPPED          test skipped for some other reason
+        ENV_CHANGED      test failed because it changed the execution environment
+        FAILED           test failed
+        PASSED           test passed
     """
 
     support.verbose = verbose  # Tell tests to be moderately quiet
@@ -843,18 +849,18 @@
         if not quiet:
             print(test, "skipped --", msg)
             sys.stdout.flush()
-        return -3, test_time
+        return RESOURCE_DENIED, test_time
     except unittest.SkipTest as msg:
         if not quiet:
             print(test, "skipped --", msg)
             sys.stdout.flush()
-        return -2, test_time
+        return SKIPPED, test_time
     except KeyboardInterrupt:
         raise
     except support.TestFailed as msg:
         print("test", test, "failed --", msg)
         sys.stdout.flush()
-        return 0, test_time
+        return FAILED, test_time
     except:
         type, value = sys.exc_info()[:2]
         print("test", test, "crashed --", str(type) + ":", value)
@@ -862,13 +868,13 @@
         if verbose or debug:
             traceback.print_exc(file=sys.stdout)
             sys.stdout.flush()
-        return 0, test_time
+        return FAILED, test_time
     else:
         if refleak:
-            return 0, test_time
+            return FAILED, test_time
         if environment.changed:
-            return -1, test_time
-        return 1, test_time
+            return ENV_CHANGED, test_time
+        return PASSED, test_time
 
 def cleanup_test_droppings(testname, verbose):
     import shutil
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index 0a832c4..07697ac 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -154,6 +154,14 @@
         im = ast.parse("from . import y").body[0]
         self.assertIsNone(im.module)
 
+    def test_base_classes(self):
+        self.assertTrue(issubclass(ast.For, ast.stmt))
+        self.assertTrue(issubclass(ast.Name, ast.expr))
+        self.assertTrue(issubclass(ast.stmt, ast.AST))
+        self.assertTrue(issubclass(ast.expr, ast.AST))
+        self.assertTrue(issubclass(ast.comprehension, ast.AST))
+        self.assertTrue(issubclass(ast.Gt, ast.AST))
+
     def test_nodeclasses(self):
         x = ast.BinOp(1, 2, 3, lineno=0)
         self.assertEquals(x.left, 1)
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index c1df23e..9dba30d 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -120,6 +120,28 @@
         self.assertTrue('a' in members)
         self.assertTrue('b' not in members)
 
+    def test_isabstract(self):
+        from abc import ABCMeta, abstractmethod
+
+        class AbstractClassExample(metaclass=ABCMeta):
+
+            @abstractmethod
+            def foo(self):
+                pass
+
+        class ClassExample(AbstractClassExample):
+            def foo(self):
+                pass
+
+        a = ClassExample()
+
+        # Test general behaviour.
+        self.assertTrue(inspect.isabstract(AbstractClassExample))
+        self.assertFalse(inspect.isabstract(ClassExample))
+        self.assertFalse(inspect.isabstract(a))
+        self.assertFalse(inspect.isabstract(int))
+        self.assertFalse(inspect.isabstract(5))
+
 
 class TestInterpreterStack(IsTestBase):
     def __init__(self, *args, **kwargs):
diff --git a/Lib/test/test_module.py b/Lib/test/test_module.py
index 0e56290..21ddc9a 100644
--- a/Lib/test/test_module.py
+++ b/Lib/test/test_module.py
@@ -55,6 +55,14 @@
               {"__name__": "foo", "__doc__": "foodoc", "bar": 42})
         self.assertTrue(foo.__dict__ is d)
 
+    def test_dont_clear_dict(self):
+        # See issue 7140.
+        def f():
+            foo = ModuleType("foo")
+            foo.bar = 4
+            return foo
+        self.assertEqual(f().__dict__["bar"], 4)
+
 def test_main():
     run_unittest(ModuleTests)
 
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py
index fb60ee4..9008717 100644
--- a/Lib/test/test_strptime.py
+++ b/Lib/test/test_strptime.py
@@ -493,9 +493,9 @@
         _strptime._strptime_time("10", "%d")
         _strptime._strptime_time("2005", "%Y")
         _strptime._TimeRE_cache.locale_time.lang = "Ni"
-        original_time_re = id(_strptime._TimeRE_cache)
+        original_time_re = _strptime._TimeRE_cache
         _strptime._strptime_time("10", "%d")
-        self.assertNotEqual(original_time_re, id(_strptime._TimeRE_cache))
+        self.assertIsNot(original_time_re, _strptime._TimeRE_cache)
         self.assertEqual(len(_strptime._regex_cache), 1)
 
     def test_regex_cleanup(self):
@@ -514,11 +514,10 @@
     def test_new_localetime(self):
         # A new LocaleTime instance should be created when a new TimeRE object
         # is created.
-        locale_time_id = id(_strptime._TimeRE_cache.locale_time)
+        locale_time_id = _strptime._TimeRE_cache.locale_time
         _strptime._TimeRE_cache.locale_time.lang = "Ni"
         _strptime._strptime_time("10", "%d")
-        self.assertNotEqual(locale_time_id,
-                         id(_strptime._TimeRE_cache.locale_time))
+        self.assertIsNot(locale_time_id, _strptime._TimeRE_cache.locale_time)
 
     def test_TimeRE_recreation(self):
         # The TimeRE instance should be recreated upon changing the locale.
@@ -530,15 +529,15 @@
         try:
             _strptime._strptime_time('10', '%d')
             # Get id of current cache object.
-            first_time_re_id = id(_strptime._TimeRE_cache)
+            first_time_re = _strptime._TimeRE_cache
             try:
                 # Change the locale and force a recreation of the cache.
                 locale.setlocale(locale.LC_TIME, ('de_DE', 'UTF8'))
                 _strptime._strptime_time('10', '%d')
                 # Get the new cache object's id.
-                second_time_re_id = id(_strptime._TimeRE_cache)
+                second_time_re = _strptime._TimeRE_cache
                 # They should not be equal.
-                self.assertNotEqual(first_time_re_id, second_time_re_id)
+                self.assertIsNot(first_time_re, second_time_re)
             # Possible test locale is not supported while initial locale is.
             # If this is the case just suppress the exception and fall-through
             # to the reseting to the original locale.
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 330a2c5..c5d8d79 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -185,11 +185,13 @@
         except AsyncExc:
             pass
         else:
+            # This code is unreachable but it reflects the intent. If we wanted
+            # to be smarter the above loop wouldn't be infinite.
             self.fail("AsyncExc not raised")
         try:
             self.assertEqual(result, 1) # one thread state modified
         except UnboundLocalError:
-            # The exception was raised to quickly for us to get the result.
+            # The exception was raised too quickly for us to get the result.
             pass
 
         # `worker_started` is set by the thread when it's inside a try/except
diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py
index ba705ba..7b91ab2 100644
--- a/Lib/test/test_tokenize.py
+++ b/Lib/test/test_tokenize.py
@@ -531,6 +531,24 @@
     ...         break
     ... else: True
     True
+
+Evil tabs
+    >>> dump_tokens("def f():\\n\\tif x\\n        \\tpass")
+    ENCODING   'utf-8'       (0, 0) (0, 0)
+    NAME       'def'         (1, 0) (1, 3)
+    NAME       'f'           (1, 4) (1, 5)
+    OP         '('           (1, 5) (1, 6)
+    OP         ')'           (1, 6) (1, 7)
+    OP         ':'           (1, 7) (1, 8)
+    NEWLINE    '\\n'          (1, 8) (1, 9)
+    INDENT     '\\t'          (2, 0) (2, 1)
+    NAME       'if'          (2, 1) (2, 3)
+    NAME       'x'           (2, 4) (2, 5)
+    NEWLINE    '\\n'          (2, 5) (2, 6)
+    INDENT     '        \\t'  (3, 0) (3, 9)
+    NAME       'pass'        (3, 9) (3, 13)
+    DEDENT     ''            (4, 0) (4, 0)
+    DEDENT     ''            (4, 0) (4, 0)
 """
 
 from test import support