Author: Philip Jenvey <pjen...@underboss.org>
Branch: stdlib-2.7.11
Changeset: r81418:935519a71e7c
Date: 2015-12-21 23:43 -0800
http://bitbucket.org/pypy/pypy/changeset/935519a71e7c/

Log:    merge vendor/stdlib (2.7.11)

diff too long, truncating to 2000 out of 24624 lines

diff --git a/lib-python/2.7/CGIHTTPServer.py b/lib-python/2.7/CGIHTTPServer.py
--- a/lib-python/2.7/CGIHTTPServer.py
+++ b/lib-python/2.7/CGIHTTPServer.py
@@ -84,7 +84,7 @@
         path begins with one of the strings in self.cgi_directories
         (and the next character is a '/' or the end of the string).
         """
-        collapsed_path = _url_collapse_path(urllib.unquote(self.path))
+        collapsed_path = _url_collapse_path(self.path)
         dir_sep = collapsed_path.find('/', 1)
         head, tail = collapsed_path[:dir_sep], collapsed_path[dir_sep+1:]
         if head in self.cgi_directories:
@@ -120,11 +120,7 @@
                 break
 
         # find an explicit query string, if present.
-        i = rest.rfind('?')
-        if i >= 0:
-            rest, query = rest[:i], rest[i+1:]
-        else:
-            query = ''
+        rest, _, query = rest.partition('?')
 
         # dissect the part after the directory name into a script name &
         # a possible additional path, to be stored in PATH_INFO.
@@ -308,13 +304,15 @@
     The utility of this function is limited to is_cgi method and helps
     preventing some security attacks.
 
-    Returns: A tuple of (head, tail) where tail is everything after the final /
-    and head is everything before it.  Head will always start with a '/' and,
-    if it contains anything else, never have a trailing '/'.
+    Returns: The reconstituted URL, which will always start with a '/'.
 
     Raises: IndexError if too many '..' occur within the path.
 
     """
+    # Query component should not be involved.
+    path, _, query = path.partition('?')
+    path = urllib.unquote(path)
+
     # Similar to os.path.split(os.path.normpath(path)) but specific to URL
     # path semantics rather than local operating system semantics.
     path_parts = path.split('/')
@@ -335,6 +333,9 @@
     else:
         tail_part = ''
 
+    if query:
+        tail_part = '?'.join((tail_part, query))
+
     splitpath = ('/' + '/'.join(head_parts), tail_part)
     collapsed_path = "/".join(splitpath)
 
diff --git a/lib-python/2.7/UserDict.py b/lib-python/2.7/UserDict.py
--- a/lib-python/2.7/UserDict.py
+++ b/lib-python/2.7/UserDict.py
@@ -1,7 +1,24 @@
 """A more or less complete user-defined wrapper around dictionary objects."""
 
 class UserDict:
-    def __init__(self, dict=None, **kwargs):
+    def __init__(*args, **kwargs):
+        if not args:
+            raise TypeError("descriptor '__init__' of 'UserDict' object "
+                            "needs an argument")
+        self = args[0]
+        args = args[1:]
+        if len(args) > 1:
+            raise TypeError('expected at most 1 arguments, got %d' % len(args))
+        if args:
+            dict = args[0]
+        elif 'dict' in kwargs:
+            dict = kwargs.pop('dict')
+            import warnings
+            warnings.warn("Passing 'dict' as keyword argument is "
+                          "deprecated", PendingDeprecationWarning,
+                          stacklevel=2)
+        else:
+            dict = None
         self.data = {}
         if dict is not None:
             self.update(dict)
@@ -43,7 +60,23 @@
     def itervalues(self): return self.data.itervalues()
     def values(self): return self.data.values()
     def has_key(self, key): return key in self.data
-    def update(self, dict=None, **kwargs):
+    def update(*args, **kwargs):
+        if not args:
+            raise TypeError("descriptor 'update' of 'UserDict' object "
+                            "needs an argument")
+        self = args[0]
+        args = args[1:]
+        if len(args) > 1:
+            raise TypeError('expected at most 1 arguments, got %d' % len(args))
+        if args:
+            dict = args[0]
+        elif 'dict' in kwargs:
+            dict = kwargs.pop('dict')
+            import warnings
+            warnings.warn("Passing 'dict' as keyword argument is deprecated",
+                          PendingDeprecationWarning, stacklevel=2)
+        else:
+            dict = None
         if dict is None:
             pass
         elif isinstance(dict, UserDict):
diff --git a/lib-python/2.7/_abcoll.py b/lib-python/2.7/_abcoll.py
--- a/lib-python/2.7/_abcoll.py
+++ b/lib-python/2.7/_abcoll.py
@@ -453,6 +453,7 @@
         for key in self._mapping:
             yield key
 
+KeysView.register(type({}.viewkeys()))
 
 class ItemsView(MappingView, Set):
 
@@ -473,6 +474,7 @@
         for key in self._mapping:
             yield (key, self._mapping[key])
 
+ItemsView.register(type({}.viewitems()))
 
 class ValuesView(MappingView):
 
@@ -486,6 +488,7 @@
         for key in self._mapping:
             yield self._mapping[key]
 
+ValuesView.register(type({}.viewvalues()))
 
 class MutableMapping(Mapping):
 
diff --git a/lib-python/2.7/_pyio.py b/lib-python/2.7/_pyio.py
--- a/lib-python/2.7/_pyio.py
+++ b/lib-python/2.7/_pyio.py
@@ -7,6 +7,7 @@
 import os
 import abc
 import codecs
+import sys
 import warnings
 import errno
 # Import thread instead of threading to reduce startup cost
@@ -1497,6 +1498,11 @@
         if not isinstance(encoding, basestring):
             raise ValueError("invalid encoding: %r" % encoding)
 
+        if sys.py3kwarning and not codecs.lookup(encoding)._is_text_encoding:
+            msg = ("%r is not a text encoding; "
+                   "use codecs.open() to handle arbitrary codecs")
+            warnings.warnpy3k(msg % encoding, stacklevel=2)
+
         if errors is None:
             errors = "strict"
         else:
diff --git a/lib-python/2.7/base64.py b/lib-python/2.7/base64.py
--- a/lib-python/2.7/base64.py
+++ b/lib-python/2.7/base64.py
@@ -7,6 +7,7 @@
 
 import re
 import struct
+import string
 import binascii
 
 
@@ -52,7 +53,7 @@
     # Strip off the trailing newline
     encoded = binascii.b2a_base64(s)[:-1]
     if altchars is not None:
-        return _translate(encoded, {'+': altchars[0], '/': altchars[1]})
+        return encoded.translate(string.maketrans(b'+/', altchars[:2]))
     return encoded
 
 
@@ -68,7 +69,7 @@
     string.
     """
     if altchars is not None:
-        s = _translate(s, {altchars[0]: '+', altchars[1]: '/'})
+        s = s.translate(string.maketrans(altchars[:2], '+/'))
     try:
         return binascii.a2b_base64(s)
     except binascii.Error, msg:
@@ -92,13 +93,16 @@
     """
     return b64decode(s)
 
+_urlsafe_encode_translation = string.maketrans(b'+/', b'-_')
+_urlsafe_decode_translation = string.maketrans(b'-_', b'+/')
+
 def urlsafe_b64encode(s):
     """Encode a string using a url-safe Base64 alphabet.
 
     s is the string to encode.  The encoded string is returned.  The alphabet
     uses '-' instead of '+' and '_' instead of '/'.
     """
-    return b64encode(s, '-_')
+    return b64encode(s).translate(_urlsafe_encode_translation)
 
 def urlsafe_b64decode(s):
     """Decode a string encoded with the standard Base64 alphabet.
@@ -109,7 +113,7 @@
 
     The alphabet uses '-' instead of '+' and '_' instead of '/'.
     """
-    return b64decode(s, '-_')
+    return b64decode(s.translate(_urlsafe_decode_translation))
 
 
 
@@ -200,7 +204,7 @@
     # False, or the character to map the digit 1 (one) to.  It should be
     # either L (el) or I (eye).
     if map01:
-        s = _translate(s, {'0': 'O', '1': map01})
+        s = s.translate(string.maketrans(b'01', b'O' + map01))
     if casefold:
         s = s.upper()
     # Strip off pad characters from the right.  We need to count the pad
diff --git a/lib-python/2.7/codecs.py b/lib-python/2.7/codecs.py
--- a/lib-python/2.7/codecs.py
+++ b/lib-python/2.7/codecs.py
@@ -79,9 +79,19 @@
 ### Codec base classes (defining the API)
 
 class CodecInfo(tuple):
+    """Codec details when looking up the codec registry"""
+
+    # Private API to allow Python to blacklist the known non-Unicode
+    # codecs in the standard library. A more general mechanism to
+    # reliably distinguish test encodings from other codecs will hopefully
+    # be defined for Python 3.5
+    #
+    # See http://bugs.python.org/issue19619
+    _is_text_encoding = True # Assume codecs are text encodings by default
 
     def __new__(cls, encode, decode, streamreader=None, streamwriter=None,
-        incrementalencoder=None, incrementaldecoder=None, name=None):
+        incrementalencoder=None, incrementaldecoder=None, name=None,
+        _is_text_encoding=None):
         self = tuple.__new__(cls, (encode, decode, streamreader, streamwriter))
         self.name = name
         self.encode = encode
@@ -90,6 +100,8 @@
         self.incrementaldecoder = incrementaldecoder
         self.streamwriter = streamwriter
         self.streamreader = streamreader
+        if _is_text_encoding is not None:
+            self._is_text_encoding = _is_text_encoding
         return self
 
     def __repr__(self):
@@ -126,8 +138,8 @@
             'strict' handling.
 
             The method may not store state in the Codec instance. Use
-            StreamCodec for codecs which have to keep state in order to
-            make encoding/decoding efficient.
+            StreamWriter for codecs which have to keep state in order to
+            make encoding efficient.
 
             The encoder must be able to handle zero length input and
             return an empty object of the output object type in this
@@ -149,8 +161,8 @@
             'strict' handling.
 
             The method may not store state in the Codec instance. Use
-            StreamCodec for codecs which have to keep state in order to
-            make encoding/decoding efficient.
+            StreamReader for codecs which have to keep state in order to
+            make decoding efficient.
 
             The decoder must be able to handle zero length input and
             return an empty object of the output object type in this
diff --git a/lib-python/2.7/cookielib.py b/lib-python/2.7/cookielib.py
--- a/lib-python/2.7/cookielib.py
+++ b/lib-python/2.7/cookielib.py
@@ -1434,7 +1434,7 @@
                         break
                     # convert RFC 2965 Max-Age to seconds since epoch
                     # XXX Strictly you're supposed to follow RFC 2616
-                    #   age-calculation rules.  Remember that zero Max-Age is a
+                    #   age-calculation rules.  Remember that zero Max-Age
                     #   is a request to discard (old and new) cookie, though.
                     k = "expires"
                     v = self._now + v
diff --git a/lib-python/2.7/ctypes/test/test_bitfields.py 
b/lib-python/2.7/ctypes/test/test_bitfields.py
--- a/lib-python/2.7/ctypes/test/test_bitfields.py
+++ b/lib-python/2.7/ctypes/test/test_bitfields.py
@@ -264,5 +264,33 @@
         x.a = 0xFEDCBA9876543211
         self.assertEqual(x.a, 0xFEDCBA9876543211)
 
+    @need_symbol('c_uint32')
+    def test_uint32_swap_little_endian(self):
+        # Issue #23319
+        class Little(LittleEndianStructure):
+            _fields_ = [("a", c_uint32, 24),
+                        ("b", c_uint32, 4),
+                        ("c", c_uint32, 4)]
+        b = bytearray(4)
+        x = Little.from_buffer(b)
+        x.a = 0xabcdef
+        x.b = 1
+        x.c = 2
+        self.assertEqual(b, b'\xef\xcd\xab\x21')
+
+    @need_symbol('c_uint32')
+    def test_uint32_swap_big_endian(self):
+        # Issue #23319
+        class Big(BigEndianStructure):
+            _fields_ = [("a", c_uint32, 24),
+                        ("b", c_uint32, 4),
+                        ("c", c_uint32, 4)]
+        b = bytearray(4)
+        x = Big.from_buffer(b)
+        x.a = 0xabcdef
+        x.b = 1
+        x.c = 2
+        self.assertEqual(b, b'\xab\xcd\xef\x12')
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/lib-python/2.7/ctypes/test/test_pointers.py 
b/lib-python/2.7/ctypes/test/test_pointers.py
--- a/lib-python/2.7/ctypes/test/test_pointers.py
+++ b/lib-python/2.7/ctypes/test/test_pointers.py
@@ -192,9 +192,19 @@
         LargeNamedType = type('T' * 2 ** 25, (Structure,), {})
         self.assertTrue(POINTER(LargeNamedType))
 
+        # to not leak references, we must clean _pointer_type_cache
+        from ctypes import _pointer_type_cache
+        del _pointer_type_cache[LargeNamedType]
+
     def test_pointer_type_str_name(self):
         large_string = 'T' * 2 ** 25
-        self.assertTrue(POINTER(large_string))
+        P = POINTER(large_string)
+        self.assertTrue(P)
+
+        # to not leak references, we must clean _pointer_type_cache
+        from ctypes import _pointer_type_cache
+        del _pointer_type_cache[id(P)]
+
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/lib-python/2.7/ctypes/test/test_random_things.py 
b/lib-python/2.7/ctypes/test/test_random_things.py
--- a/lib-python/2.7/ctypes/test/test_random_things.py
+++ b/lib-python/2.7/ctypes/test/test_random_things.py
@@ -30,7 +30,7 @@
     # value is printed correctly.
     #
     # Changed in 0.9.3: No longer is '(in callback)' prepended to the
-    # error message - instead a additional frame for the C code is
+    # error message - instead an additional frame for the C code is
     # created, then a full traceback printed.  When SystemExit is
     # raised in a callback function, the interpreter exits.
 
diff --git a/lib-python/2.7/ctypes/test/test_win32.py 
b/lib-python/2.7/ctypes/test/test_win32.py
--- a/lib-python/2.7/ctypes/test/test_win32.py
+++ b/lib-python/2.7/ctypes/test/test_win32.py
@@ -114,5 +114,9 @@
             self.assertEqual(ret.top, top.value)
             self.assertEqual(ret.bottom, bottom.value)
 
+        # to not leak references, we must clean _pointer_type_cache
+        from ctypes import _pointer_type_cache
+        del _pointer_type_cache[RECT]
+
 if __name__ == '__main__':
     unittest.main()
diff --git a/lib-python/2.7/distutils/__init__.py 
b/lib-python/2.7/distutils/__init__.py
--- a/lib-python/2.7/distutils/__init__.py
+++ b/lib-python/2.7/distutils/__init__.py
@@ -8,12 +8,6 @@
    setup (...)
 """
 
-__revision__ = "$Id$"
+import sys
 
-# Distutils version
-#
-# Updated automatically by the Python release process.
-#
-#--start constants--
-__version__ = "2.7.10"
-#--end constants--
+__version__ = sys.version[:sys.version.index(' ')]
diff --git a/lib-python/2.7/distutils/ccompiler.py 
b/lib-python/2.7/distutils/ccompiler.py
--- a/lib-python/2.7/distutils/ccompiler.py
+++ b/lib-python/2.7/distutils/ccompiler.py
@@ -718,7 +718,7 @@
         raise NotImplementedError
 
     def library_option(self, lib):
-        """Return the compiler option to add 'dir' to the list of libraries
+        """Return the compiler option to add 'lib' to the list of libraries
         linked into the shared library or executable.
         """
         raise NotImplementedError
diff --git a/lib-python/2.7/distutils/command/build_ext.py 
b/lib-python/2.7/distutils/command/build_ext.py
--- a/lib-python/2.7/distutils/command/build_ext.py
+++ b/lib-python/2.7/distutils/command/build_ext.py
@@ -209,10 +209,12 @@
                 else:
                     # win-amd64 or win-ia64
                     suffix = self.plat_name[4:]
-                new_lib = os.path.join(sys.exec_prefix, 'PCbuild')
-                if suffix:
-                    new_lib = os.path.join(new_lib, suffix)
-                self.library_dirs.append(new_lib)
+                # We could have been built in one of two places; add both
+                for d in ('PCbuild',), ('PC', 'VS9.0'):
+                    new_lib = os.path.join(sys.exec_prefix, *d)
+                    if suffix:
+                        new_lib = os.path.join(new_lib, suffix)
+                    self.library_dirs.append(new_lib)
 
             elif MSVC_VERSION == 8:
                 self.library_dirs.append(os.path.join(sys.exec_prefix,
diff --git a/lib-python/2.7/distutils/msvc9compiler.py 
b/lib-python/2.7/distutils/msvc9compiler.py
--- a/lib-python/2.7/distutils/msvc9compiler.py
+++ b/lib-python/2.7/distutils/msvc9compiler.py
@@ -426,7 +426,7 @@
         self.ldflags_shared = ['/DLL', '/nologo', '/INCREMENTAL:NO']
         if self.__version >= 7:
             self.ldflags_shared_debug = [
-                '/DLL', '/nologo', '/INCREMENTAL:no', '/DEBUG', '/pdb:None'
+                '/DLL', '/nologo', '/INCREMENTAL:no', '/DEBUG'
                 ]
         self.ldflags_static = [ '/nologo']
 
diff --git a/lib-python/2.7/distutils/tests/test_core.py 
b/lib-python/2.7/distutils/tests/test_core.py
--- a/lib-python/2.7/distutils/tests/test_core.py
+++ b/lib-python/2.7/distutils/tests/test_core.py
@@ -9,6 +9,7 @@
 from test.test_support import captured_stdout, run_unittest
 import unittest
 from distutils.tests import support
+from distutils import log
 
 # setup script that uses __file__
 setup_using___file__ = """\
@@ -36,6 +37,7 @@
         self.old_stdout = sys.stdout
         self.cleanup_testfn()
         self.old_argv = sys.argv, sys.argv[:]
+        self.addCleanup(log.set_threshold, log._global_log.threshold)
 
     def tearDown(self):
         sys.stdout = self.old_stdout
diff --git a/lib-python/2.7/distutils/tests/test_dist.py 
b/lib-python/2.7/distutils/tests/test_dist.py
--- a/lib-python/2.7/distutils/tests/test_dist.py
+++ b/lib-python/2.7/distutils/tests/test_dist.py
@@ -13,6 +13,7 @@
 import distutils.dist
 from test.test_support import TESTFN, captured_stdout, run_unittest, unlink
 from distutils.tests import support
+from distutils import log
 
 
 class test_dist(Command):
@@ -397,6 +398,7 @@
 
     def test_show_help(self):
         # smoke test, just makes sure some help is displayed
+        self.addCleanup(log.set_threshold, log._global_log.threshold)
         dist = Distribution()
         sys.argv = []
         dist.help = 1
diff --git a/lib-python/2.7/email/test/test_email.py 
b/lib-python/2.7/email/test/test_email.py
--- a/lib-python/2.7/email/test/test_email.py
+++ b/lib-python/2.7/email/test/test_email.py
@@ -12,6 +12,10 @@
 import textwrap
 from cStringIO import StringIO
 from random import choice
+try:
+    from threading import Thread
+except ImportError:
+    from dummy_threading import Thread
 
 import email
 
@@ -33,7 +37,7 @@
 from email import base64MIME
 from email import quopriMIME
 
-from test.test_support import findfile, run_unittest
+from test.test_support import findfile, run_unittest, start_threads
 from email.test import __file__ as landmark
 
 
@@ -2412,6 +2416,25 @@
         addrs = Utils.getaddresses(['User ((nested comment)) <f...@bar.com>'])
         eq(addrs[0][1], 'f...@bar.com')
 
+    def test_make_msgid_collisions(self):
+        # Test make_msgid uniqueness, even with multiple threads
+        class MsgidsThread(Thread):
+            def run(self):
+                # generate msgids for 3 seconds
+                self.msgids = []
+                append = self.msgids.append
+                make_msgid = Utils.make_msgid
+                clock = time.time
+                tfin = clock() + 3.0
+                while clock() < tfin:
+                    append(make_msgid())
+
+        threads = [MsgidsThread() for i in range(5)]
+        with start_threads(threads):
+            pass
+        all_ids = sum([t.msgids for t in threads], [])
+        self.assertEqual(len(set(all_ids)), len(all_ids))
+
     def test_utils_quote_unquote(self):
         eq = self.assertEqual
         msg = Message()
diff --git a/lib-python/2.7/email/utils.py b/lib-python/2.7/email/utils.py
--- a/lib-python/2.7/email/utils.py
+++ b/lib-python/2.7/email/utils.py
@@ -177,21 +177,20 @@
 def make_msgid(idstring=None):
     """Returns a string suitable for RFC 2822 compliant Message-ID, e.g:
 
-    <20020201195627.33539.96...@nightshade.la.mastaler.com>
+    <142480216486.20800.16526388040877946...@nightshade.la.mastaler.com>
 
     Optional idstring if given is a string used to strengthen the
     uniqueness of the message id.
     """
-    timeval = time.time()
-    utcdate = time.strftime('%Y%m%d%H%M%S', time.gmtime(timeval))
+    timeval = int(time.time()*100)
     pid = os.getpid()
-    randint = random.randrange(100000)
+    randint = random.getrandbits(64)
     if idstring is None:
         idstring = ''
     else:
         idstring = '.' + idstring
     idhost = socket.getfqdn()
-    msgid = '<%s.%s.%s%s@%s>' % (utcdate, pid, randint, idstring, idhost)
+    msgid = '<%d.%d.%d%s@%s>' % (timeval, pid, randint, idstring, idhost)
     return msgid
 
 
diff --git a/lib-python/2.7/encodings/base64_codec.py 
b/lib-python/2.7/encodings/base64_codec.py
--- a/lib-python/2.7/encodings/base64_codec.py
+++ b/lib-python/2.7/encodings/base64_codec.py
@@ -76,4 +76,5 @@
         incrementaldecoder=IncrementalDecoder,
         streamwriter=StreamWriter,
         streamreader=StreamReader,
+        _is_text_encoding=False,
     )
diff --git a/lib-python/2.7/encodings/bz2_codec.py 
b/lib-python/2.7/encodings/bz2_codec.py
--- a/lib-python/2.7/encodings/bz2_codec.py
+++ b/lib-python/2.7/encodings/bz2_codec.py
@@ -99,4 +99,5 @@
         incrementaldecoder=IncrementalDecoder,
         streamwriter=StreamWriter,
         streamreader=StreamReader,
+        _is_text_encoding=False,
     )
diff --git a/lib-python/2.7/encodings/hex_codec.py 
b/lib-python/2.7/encodings/hex_codec.py
--- a/lib-python/2.7/encodings/hex_codec.py
+++ b/lib-python/2.7/encodings/hex_codec.py
@@ -76,4 +76,5 @@
         incrementaldecoder=IncrementalDecoder,
         streamwriter=StreamWriter,
         streamreader=StreamReader,
+        _is_text_encoding=False,
     )
diff --git a/lib-python/2.7/encodings/quopri_codec.py 
b/lib-python/2.7/encodings/quopri_codec.py
--- a/lib-python/2.7/encodings/quopri_codec.py
+++ b/lib-python/2.7/encodings/quopri_codec.py
@@ -21,7 +21,7 @@
     # using str() because of cStringIO's Unicode undesired Unicode behavior.
     f = StringIO(str(input))
     g = StringIO()
-    quopri.encode(f, g, 1)
+    quopri.encode(f, g, quotetabs=True)
     output = g.getvalue()
     return (output, len(input))
 
@@ -72,4 +72,5 @@
         incrementaldecoder=IncrementalDecoder,
         streamwriter=StreamWriter,
         streamreader=StreamReader,
+        _is_text_encoding=False,
     )
diff --git a/lib-python/2.7/encodings/rot_13.py 
b/lib-python/2.7/encodings/rot_13.py
--- a/lib-python/2.7/encodings/rot_13.py
+++ b/lib-python/2.7/encodings/rot_13.py
@@ -44,6 +44,7 @@
         incrementaldecoder=IncrementalDecoder,
         streamwriter=StreamWriter,
         streamreader=StreamReader,
+        _is_text_encoding=False,
     )
 
 ### Decoding Map
diff --git a/lib-python/2.7/encodings/uu_codec.py 
b/lib-python/2.7/encodings/uu_codec.py
--- a/lib-python/2.7/encodings/uu_codec.py
+++ b/lib-python/2.7/encodings/uu_codec.py
@@ -126,4 +126,5 @@
         incrementaldecoder=IncrementalDecoder,
         streamreader=StreamReader,
         streamwriter=StreamWriter,
+        _is_text_encoding=False,
     )
diff --git a/lib-python/2.7/encodings/zlib_codec.py 
b/lib-python/2.7/encodings/zlib_codec.py
--- a/lib-python/2.7/encodings/zlib_codec.py
+++ b/lib-python/2.7/encodings/zlib_codec.py
@@ -99,4 +99,5 @@
         incrementaldecoder=IncrementalDecoder,
         streamreader=StreamReader,
         streamwriter=StreamWriter,
+        _is_text_encoding=False,
     )
diff --git a/lib-python/2.7/ensurepip/__init__.py 
b/lib-python/2.7/ensurepip/__init__.py
--- a/lib-python/2.7/ensurepip/__init__.py
+++ b/lib-python/2.7/ensurepip/__init__.py
@@ -12,9 +12,9 @@
 __all__ = ["version", "bootstrap"]
 
 
-_SETUPTOOLS_VERSION = "15.2"
+_SETUPTOOLS_VERSION = "18.2"
 
-_PIP_VERSION = "6.1.1"
+_PIP_VERSION = "7.1.2"
 
 # pip currently requires ssl support, so we try to provide a nicer
 # error message when that is missing (http://bugs.python.org/issue19744)
@@ -147,7 +147,7 @@
     _disable_pip_configuration_settings()
 
     # Construct the arguments to be passed to the pip command
-    args = ["uninstall", "-y"]
+    args = ["uninstall", "-y", "--disable-pip-version-check"]
     if verbosity:
         args += ["-" + "v" * verbosity]
 
diff --git a/lib-python/2.7/ensurepip/_bundled/pip-6.1.1-py2.py3-none-any.whl 
b/lib-python/2.7/ensurepip/_bundled/pip-6.1.1-py2.py3-none-any.whl
deleted file mode 100644
index 
e59694a019051d58b9a378a1adfc9461b8cec9c3..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch

[cut]

diff --git a/lib-python/2.7/ensurepip/_bundled/pip-7.1.2-py2.py3-none-any.whl 
b/lib-python/2.7/ensurepip/_bundled/pip-7.1.2-py2.py3-none-any.whl
new file mode 100644
index 
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..5e490155f0ca7f4ddb64c93c39fb2efb8795cd08
GIT binary patch

[cut]

diff --git 
a/lib-python/2.7/ensurepip/_bundled/setuptools-15.2-py2.py3-none-any.whl 
b/lib-python/2.7/ensurepip/_bundled/setuptools-15.2-py2.py3-none-any.whl
deleted file mode 100644
index 
f153ed376684275e08fcfebdb2de8352fb074171..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch

[cut]

diff --git 
a/lib-python/2.7/ensurepip/_bundled/setuptools-18.2-py2.py3-none-any.whl 
b/lib-python/2.7/ensurepip/_bundled/setuptools-18.2-py2.py3-none-any.whl
new file mode 100644
index 
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f4288d68e074466894d8a2342e113737df7b7649
GIT binary patch

[cut]

diff --git a/lib-python/2.7/httplib.py b/lib-python/2.7/httplib.py
--- a/lib-python/2.7/httplib.py
+++ b/lib-python/2.7/httplib.py
@@ -772,8 +772,7 @@
         if self.sock:
             raise RuntimeError("Can't setup tunnel for established 
connection.")
 
-        self._tunnel_host = host
-        self._tunnel_port = port
+        self._tunnel_host, self._tunnel_port = self._get_hostport(host, port)
         if headers:
             self._tunnel_headers = headers
         else:
@@ -802,8 +801,8 @@
         self.debuglevel = level
 
     def _tunnel(self):
-        (host, port) = self._get_hostport(self._tunnel_host, self._tunnel_port)
-        self.send("CONNECT %s:%d HTTP/1.0\r\n" % (host, port))
+        self.send("CONNECT %s:%d HTTP/1.0\r\n" % (self._tunnel_host,
+            self._tunnel_port))
         for header, value in self._tunnel_headers.iteritems():
             self.send("%s: %s\r\n" % (header, value))
         self.send("\r\n")
@@ -811,6 +810,11 @@
                                        method = self._method)
         (version, code, message) = response._read_status()
 
+        if version == "HTTP/0.9":
+            # HTTP/0.9 doesn't support the CONNECT verb, so if httplib has
+            # concluded HTTP/0.9 is being used something has gone wrong.
+            self.close()
+            raise socket.error("Invalid response from tunnel request")
         if code != 200:
             self.close()
             raise socket.error("Tunnel connection failed: %d %s" % (code,
@@ -1063,7 +1067,7 @@
         elif body is not None:
             try:
                 thelen = str(len(body))
-            except TypeError:
+            except (TypeError, AttributeError):
                 # If this is a file-like object, try to
                 # fstat its file descriptor
                 try:
diff --git a/lib-python/2.7/idlelib/AutoCompleteWindow.py 
b/lib-python/2.7/idlelib/AutoCompleteWindow.py
--- a/lib-python/2.7/idlelib/AutoCompleteWindow.py
+++ b/lib-python/2.7/idlelib/AutoCompleteWindow.py
@@ -192,6 +192,7 @@
         scrollbar.config(command=listbox.yview)
         scrollbar.pack(side=RIGHT, fill=Y)
         listbox.pack(side=LEFT, fill=BOTH, expand=True)
+        acw.lift()  # work around bug in Tk 8.5.18+ (issue #24570)
 
         # Initialize the listbox selection
         self.listbox.select_set(self._binary_search(self.start))
diff --git a/lib-python/2.7/idlelib/Bindings.py 
b/lib-python/2.7/idlelib/Bindings.py
--- a/lib-python/2.7/idlelib/Bindings.py
+++ b/lib-python/2.7/idlelib/Bindings.py
@@ -76,7 +76,6 @@
    ]),
  ('options', [
    ('Configure _IDLE', '<<open-config-dialog>>'),
-   ('Configure _Extensions', '<<open-config-extensions-dialog>>'),
    None,
    ]),
  ('help', [
diff --git a/lib-python/2.7/idlelib/CallTipWindow.py 
b/lib-python/2.7/idlelib/CallTipWindow.py
--- a/lib-python/2.7/idlelib/CallTipWindow.py
+++ b/lib-python/2.7/idlelib/CallTipWindow.py
@@ -72,6 +72,7 @@
                            background="#ffffe0", relief=SOLID, borderwidth=1,
                            font = self.widget['font'])
         self.label.pack()
+        tw.lift()  # work around bug in Tk 8.5.18+ (issue #24570)
 
         self.checkhideid = self.widget.bind(CHECKHIDE_VIRTUAL_EVENT_NAME,
                                             self.checkhide_event)
diff --git a/lib-python/2.7/idlelib/ClassBrowser.py 
b/lib-python/2.7/idlelib/ClassBrowser.py
--- a/lib-python/2.7/idlelib/ClassBrowser.py
+++ b/lib-python/2.7/idlelib/ClassBrowser.py
@@ -56,7 +56,7 @@
         self.settitle()
         top.focus_set()
         # create scrolled canvas
-        theme = idleConf.GetOption('main','Theme','name')
+        theme = idleConf.CurrentTheme()
         background = idleConf.GetHighlight(theme, 'normal')['background']
         sc = ScrolledCanvas(top, bg=background, highlightthickness=0, 
takefocus=1)
         sc.frame.pack(expand=1, fill="both")
diff --git a/lib-python/2.7/idlelib/ColorDelegator.py 
b/lib-python/2.7/idlelib/ColorDelegator.py
--- a/lib-python/2.7/idlelib/ColorDelegator.py
+++ b/lib-python/2.7/idlelib/ColorDelegator.py
@@ -62,7 +62,7 @@
         self.tag_raise('sel')
 
     def LoadTagDefs(self):
-        theme = idleConf.GetOption('main','Theme','name')
+        theme = idleConf.CurrentTheme()
         self.tagdefs = {
             "COMMENT": idleConf.GetHighlight(theme, "comment"),
             "KEYWORD": idleConf.GetHighlight(theme, "keyword"),
diff --git a/lib-python/2.7/idlelib/Debugger.py 
b/lib-python/2.7/idlelib/Debugger.py
--- a/lib-python/2.7/idlelib/Debugger.py
+++ b/lib-python/2.7/idlelib/Debugger.py
@@ -17,7 +17,10 @@
             self.set_step()
             return
         message = self.__frame2message(frame)
-        self.gui.interaction(message, frame)
+        try:
+            self.gui.interaction(message, frame)
+        except TclError:  # When closing debugger window with [x] in 3.x
+            pass
 
     def user_exception(self, frame, info):
         if self.in_rpc_code(frame):
@@ -59,8 +62,42 @@
         self.frame = None
         self.make_gui()
         self.interacting = 0
+        self.nesting_level = 0
 
     def run(self, *args):
+        # Deal with the scenario where we've already got a program running
+        # in the debugger and we want to start another. If that is the case,
+        # our second 'run' was invoked from an event dispatched not from
+        # the main event loop, but from the nested event loop in 'interaction'
+        # below. So our stack looks something like this:
+        #       outer main event loop
+        #         run()
+        #           <running program with traces>
+        #             callback to debugger's interaction()
+        #               nested event loop
+        #                 run() for second command
+        #
+        # This kind of nesting of event loops causes all kinds of problems
+        # (see e.g. issue #24455) especially when dealing with running as a
+        # subprocess, where there's all kinds of extra stuff happening in
+        # there - insert a traceback.print_stack() to check it out.
+        #
+        # By this point, we've already called restart_subprocess() in
+        # ScriptBinding. However, we also need to unwind the stack back to
+        # that outer event loop.  To accomplish this, we:
+        #   - return immediately from the nested run()
+        #   - abort_loop ensures the nested event loop will terminate
+        #   - the debugger's interaction routine completes normally
+        #   - the restart_subprocess() will have taken care of stopping
+        #     the running program, which will also let the outer run complete
+        #
+        # That leaves us back at the outer main event loop, at which point our
+        # after event can fire, and we'll come back to this routine with a
+        # clean stack.
+        if self.nesting_level > 0:
+            self.abort_loop()
+            self.root.after(100, lambda: self.run(*args))
+            return
         try:
             self.interacting = 1
             return self.idb.run(*args)
@@ -68,6 +105,10 @@
             self.interacting = 0
 
     def close(self, event=None):
+        try:
+            self.quit()
+        except Exception:
+            pass
         if self.interacting:
             self.top.bell()
             return
@@ -191,7 +232,12 @@
             b.configure(state="normal")
         #
         self.top.wakeup()
-        self.root.mainloop()
+        # Nested main loop: Tkinter's main loop is not reentrant, so use
+        # Tcl's vwait facility, which reenters the event loop until an
+        # event handler sets the variable we're waiting on
+        self.nesting_level += 1
+        self.root.tk.call('vwait', '::idledebugwait')
+        self.nesting_level -= 1
         #
         for b in self.buttons:
             b.configure(state="disabled")
@@ -215,23 +261,26 @@
 
     def cont(self):
         self.idb.set_continue()
-        self.root.quit()
+        self.abort_loop()
 
     def step(self):
         self.idb.set_step()
-        self.root.quit()
+        self.abort_loop()
 
     def next(self):
         self.idb.set_next(self.frame)
-        self.root.quit()
+        self.abort_loop()
 
     def ret(self):
         self.idb.set_return(self.frame)
-        self.root.quit()
+        self.abort_loop()
 
     def quit(self):
         self.idb.set_quit()
-        self.root.quit()
+        self.abort_loop()
+
+    def abort_loop(self):
+        self.root.tk.call('set', '::idledebugwait', '1')
 
     stackviewer = None
 
diff --git a/lib-python/2.7/idlelib/EditorWindow.py 
b/lib-python/2.7/idlelib/EditorWindow.py
--- a/lib-python/2.7/idlelib/EditorWindow.py
+++ b/lib-python/2.7/idlelib/EditorWindow.py
@@ -9,7 +9,6 @@
 import webbrowser
 
 from idlelib.MultiCall import MultiCallCreator
-from idlelib import idlever
 from idlelib import WindowList
 from idlelib import SearchDialog
 from idlelib import GrepDialog
@@ -18,6 +17,7 @@
 from idlelib.configHandler import idleConf
 from idlelib import aboutDialog, textView, configDialog
 from idlelib import macosxSupport
+from idlelib import help
 
 # The default tab setting for a Text widget, in average-width characters.
 TK_TABWIDTH_DEFAULT = 8
@@ -83,6 +83,11 @@
             near - a Toplevel widget (e.g. EditorWindow or PyShell)
                    to use as a reference for placing the help window
         """
+        import warnings as w
+        w.warn("EditorWindow.HelpDialog is no longer used by Idle.\n"
+               "It will be removed in 3.6 or later.\n"
+               "It has been replaced by private help.HelpWindow\n",
+               DeprecationWarning, stacklevel=2)
         if self.dlg is None:
             self.show_dialog(parent)
         if near:
@@ -109,9 +114,7 @@
         self.dlg = None
         self.parent = None
 
-helpDialog = HelpDialog()  # singleton instance
-def _help_dialog(parent):  # wrapper for htest
-    helpDialog.show_dialog(parent)
+helpDialog = HelpDialog()  # singleton instance, no longer used
 
 
 class EditorWindow(object):
@@ -154,7 +157,6 @@
                     EditorWindow.help_url = 'file://' + EditorWindow.help_url
             else:
                 EditorWindow.help_url = "https://docs.python.org/%d.%d/"; % 
sys.version_info[:2]
-        currentTheme=idleConf.CurrentTheme()
         self.flist = flist
         root = root or flist.root
         self.root = root
@@ -182,6 +184,7 @@
                 'name': 'text',
                 'padx': 5,
                 'wrap': 'none',
+                'highlightthickness': 0,
                 'width': self.width,
                 'height': idleConf.GetOption('main', 'EditorWindow', 'height', 
type='int')}
         if TkVersion >= 8.5:
@@ -200,13 +203,13 @@
         if macosxSupport.isAquaTk():
             # Command-W on editorwindows doesn't work without this.
             text.bind('<<close-window>>', self.close_event)
-            # Some OS X systems have only one mouse button,
-            # so use control-click for pulldown menus there.
-            #  (Note, AquaTk defines <2> as the right button if
-            #   present and the Tk Text widget already binds <2>.)
+            # Some OS X systems have only one mouse button, so use
+            # control-click for popup context menus there. For two
+            # buttons, AquaTk defines <2> as the right button, not <3>.
             text.bind("<Control-Button-1>",self.right_menu_event)
+            text.bind("<2>", self.right_menu_event)
         else:
-            # Elsewhere, use right-click for pulldown menus.
+            # Elsewhere, use right-click for popup menus.
             text.bind("<3>",self.right_menu_event)
         text.bind("<<cut>>", self.cut)
         text.bind("<<copy>>", self.copy)
@@ -216,8 +219,6 @@
         text.bind("<<python-docs>>", self.python_docs)
         text.bind("<<about-idle>>", self.about_dialog)
         text.bind("<<open-config-dialog>>", self.config_dialog)
-        text.bind("<<open-config-extensions-dialog>>",
-                  self.config_extensions_dialog)
         text.bind("<<open-module>>", self.open_module)
         text.bind("<<do-nothing>>", lambda event: "break")
         text.bind("<<select-all>>", self.select_all)
@@ -258,13 +259,7 @@
         vbar['command'] = text.yview
         vbar.pack(side=RIGHT, fill=Y)
         text['yscrollcommand'] = vbar.set
-        fontWeight = 'normal'
-        if idleConf.GetOption('main', 'EditorWindow', 'font-bold', 
type='bool'):
-            fontWeight='bold'
-        text.config(font=(idleConf.GetOption('main', 'EditorWindow', 'font'),
-                          idleConf.GetOption('main', 'EditorWindow',
-                                             'font-size', type='int'),
-                          fontWeight))
+        text['font'] = idleConf.GetFont(self.root, 'main', 'EditorWindow')
         text_frame.pack(side=LEFT, fill=BOTH, expand=1)
         text.pack(side=TOP, fill=BOTH, expand=1)
         text.focus_set()
@@ -318,7 +313,7 @@
         io.set_filename_change_hook(self.filename_change_hook)
 
         # Create the recent files submenu
-        self.recent_files_menu = Menu(self.menubar)
+        self.recent_files_menu = Menu(self.menubar, tearoff=0)
         self.menudict['file'].insert_cascade(3, label='Recent Files',
                                              underline=0,
                                              menu=self.recent_files_menu)
@@ -353,36 +348,6 @@
         self.askinteger = tkSimpleDialog.askinteger
         self.showerror = tkMessageBox.showerror
 
-        self._highlight_workaround()  # Fix selection tags on Windows
-
-    def _highlight_workaround(self):
-        # On Windows, Tk removes painting of the selection
-        # tags which is different behavior than on Linux and Mac.
-        # See issue14146 for more information.
-        if not sys.platform.startswith('win'):
-            return
-
-        text = self.text
-        text.event_add("<<Highlight-FocusOut>>", "<FocusOut>")
-        text.event_add("<<Highlight-FocusIn>>", "<FocusIn>")
-        def highlight_fix(focus):
-            sel_range = text.tag_ranges("sel")
-            if sel_range:
-                if focus == 'out':
-                    HILITE_CONFIG = idleConf.GetHighlight(
-                            idleConf.CurrentTheme(), 'hilite')
-                    text.tag_config("sel_fix", HILITE_CONFIG)
-                    text.tag_raise("sel_fix")
-                    text.tag_add("sel_fix", *sel_range)
-                elif focus == 'in':
-                    text.tag_remove("sel_fix", "1.0", "end")
-
-        text.bind("<<Highlight-FocusOut>>",
-                lambda ev: highlight_fix("out"))
-        text.bind("<<Highlight-FocusIn>>",
-                lambda ev: highlight_fix("in"))
-
-
     def _filename_to_unicode(self, filename):
         """convert filename to unicode in order to display it in Tk"""
         if isinstance(filename, unicode) or not filename:
@@ -446,6 +411,7 @@
 
     def set_status_bar(self):
         self.status_bar = self.MultiStatusBar(self.top)
+        sep = Frame(self.top, height=1, borderwidth=1, background='grey75')
         if sys.platform == "darwin":
             # Insert some padding to avoid obscuring some of the statusbar
             # by the resize widget.
@@ -453,6 +419,7 @@
         self.status_bar.set_label('column', 'Col: ?', side=RIGHT)
         self.status_bar.set_label('line', 'Ln: ?', side=RIGHT)
         self.status_bar.pack(side=BOTTOM, fill=X)
+        sep.pack(side=BOTTOM, fill=X)
         self.text.bind("<<set-line-and-column>>", self.set_line_and_column)
         self.text.event_add("<<set-line-and-column>>",
                             "<KeyRelease>", "<ButtonRelease>")
@@ -479,12 +446,13 @@
         self.menudict = menudict = {}
         for name, label in self.menu_specs:
             underline, label = prepstr(label)
-            menudict[name] = menu = Menu(mbar, name=name)
+            menudict[name] = menu = Menu(mbar, name=name, tearoff=0)
             mbar.add_cascade(label=label, menu=menu, underline=underline)
 
         if macosxSupport.isCarbonTk():
             # Insert the application menu
-            menudict['application'] = menu = Menu(mbar, name='apple')
+            menudict['application'] = menu = Menu(mbar, name='apple',
+                                                tearoff=0)
             mbar.add_cascade(label='IDLE', menu=menu)
 
         self.fill_menus()
@@ -565,19 +533,23 @@
             return 'normal'
 
     def about_dialog(self, event=None):
+        "Handle Help 'About IDLE' event."
+        # Synchronize with macosxSupport.overrideRootMenu.about_dialog.
         aboutDialog.AboutDialog(self.top,'About IDLE')
 
     def config_dialog(self, event=None):
+        "Handle Options 'Configure IDLE' event."
+        # Synchronize with macosxSupport.overrideRootMenu.config_dialog.
         configDialog.ConfigDialog(self.top,'Settings')
-    def config_extensions_dialog(self, event=None):
-        configDialog.ConfigExtensionsDialog(self.top)
 
     def help_dialog(self, event=None):
+        "Handle Help 'IDLE Help' event."
+        # Synchronize with macosxSupport.overrideRootMenu.help_dialog.
         if self.root:
             parent = self.root
         else:
             parent = self.top
-        helpDialog.display(parent, near=self.top)
+        help.show_idlehelp(parent)
 
     def python_docs(self, event=None):
         if sys.platform[:3] == 'win':
@@ -785,7 +757,7 @@
         # Called from self.filename_change_hook and from configDialog.py
         self._rmcolorizer()
         self._addcolorizer()
-        theme = idleConf.GetOption('main','Theme','name')
+        theme = idleConf.CurrentTheme()
         normal_colors = idleConf.GetHighlight(theme, 'normal')
         cursor_color = idleConf.GetHighlight(theme, 'cursor', fgBg='fg')
         select_colors = idleConf.GetHighlight(theme, 'hilite')
@@ -796,17 +768,15 @@
             selectforeground=select_colors['foreground'],
             selectbackground=select_colors['background'],
             )
+        if TkVersion >= 8.5:
+            self.text.config(
+                inactiveselectbackground=select_colors['background'])
 
     def ResetFont(self):
         "Update the text widgets' font if it is changed"
         # Called from configDialog.py
-        fontWeight='normal'
-        if idleConf.GetOption('main','EditorWindow','font-bold',type='bool'):
-            fontWeight='bold'
-        
self.text.config(font=(idleConf.GetOption('main','EditorWindow','font'),
-                idleConf.GetOption('main','EditorWindow','font-size',
-                                   type='int'),
-                fontWeight))
+
+        self.text['font'] = idleConf.GetFont(self.root, 'main','EditorWindow')
 
     def RemoveKeybindings(self):
         "Remove the keybindings before they are changed."
@@ -920,8 +890,10 @@
         except IOError as err:
             if not getattr(self.root, "recentfilelist_error_displayed", False):
                 self.root.recentfilelist_error_displayed = True
-                tkMessageBox.showerror(title='IDLE Error',
-                    message='Unable to update Recent Files list:\n%s'
+                tkMessageBox.showwarning(title='IDLE Warning',
+                    message="Cannot update File menu Recent Files list. "
+                            "Your operating system says:\n%s\n"
+                            "Select OK and IDLE will continue without 
updating."
                         % str(err),
                     parent=self.text)
         # for each edit window instance, construct the recent files menu
@@ -1729,4 +1701,4 @@
 
 if __name__ == '__main__':
     from idlelib.idle_test.htest import run
-    run(_help_dialog, _editor_window)
+    run(_editor_window)
diff --git a/lib-python/2.7/idlelib/GrepDialog.py 
b/lib-python/2.7/idlelib/GrepDialog.py
--- a/lib-python/2.7/idlelib/GrepDialog.py
+++ b/lib-python/2.7/idlelib/GrepDialog.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
 import os
 import fnmatch
 import re  # for htest
@@ -5,7 +6,6 @@
 from Tkinter import StringVar, BooleanVar, Checkbutton  # for GrepDialog
 from Tkinter import Tk, Text, Button, SEL, END  # for htest
 from idlelib import SearchEngine
-import itertools
 from idlelib.SearchDialogBase import SearchDialogBase
 # Importing OutputWindow fails due to import loop
 # EditorWindow -> GrepDialop -> OutputWindow -> EditorWindow
diff --git a/lib-python/2.7/idlelib/IOBinding.py 
b/lib-python/2.7/idlelib/IOBinding.py
--- a/lib-python/2.7/idlelib/IOBinding.py
+++ b/lib-python/2.7/idlelib/IOBinding.py
@@ -5,22 +5,18 @@
 #     end-of-line conventions, instead of relying on the standard library,
 #     which will only understand the local convention.
 
+import codecs
+from codecs import BOM_UTF8
 import os
-import types
 import pipes
+import re
 import sys
-import codecs
 import tempfile
+
 import tkFileDialog
 import tkMessageBox
-import re
-from Tkinter import *
 from SimpleDialog import SimpleDialog
 
-from idlelib.configHandler import idleConf
-
-from codecs import BOM_UTF8
-
 # Try setting the locale, so that we can find out
 # what encoding to use
 try:
@@ -251,7 +247,7 @@
             with open(filename, 'rb') as f:
                 chars = f.read()
         except IOError as msg:
-            tkMessageBox.showerror("I/O Error", str(msg), master=self.text)
+            tkMessageBox.showerror("I/O Error", str(msg), parent=self.text)
             return False
 
         chars = self.decode(chars)
@@ -298,7 +294,7 @@
                 title="Error loading the file",
                 message="The encoding '%s' is not known to this Python "\
                 "installation. The file may not display correctly" % name,
-                master = self.text)
+                parent = self.text)
             enc = None
         if enc:
             try:
@@ -328,7 +324,7 @@
                   title="Save On Close",
                   message=message,
                   default=tkMessageBox.YES,
-                  master=self.text)
+                  parent=self.text)
         if confirm:
             reply = "yes"
             self.save(None)
@@ -387,11 +383,11 @@
             return True
         except IOError as msg:
             tkMessageBox.showerror("I/O Error", str(msg),
-                                   master=self.text)
+                                   parent=self.text)
             return False
 
     def encode(self, chars):
-        if isinstance(chars, types.StringType):
+        if isinstance(chars, str):
             # This is either plain ASCII, or Tk was returning mixed-encoding
             # text to us. Don't try to guess further.
             return chars
@@ -417,7 +413,7 @@
             tkMessageBox.showerror(
                 "I/O Error",
                 "%s. Saving as UTF-8" % failed,
-                master = self.text)
+                parent = self.text)
         # If there was a UTF-8 signature, use that. This should not fail
         if self.fileencoding == BOM_UTF8 or failed:
             return BOM_UTF8 + chars.encode("utf-8")
@@ -430,7 +426,7 @@
                     "I/O Error",
                     "Cannot save this as '%s' anymore. Saving as UTF-8" \
                     % self.fileencoding,
-                    master = self.text)
+                    parent = self.text)
                 return BOM_UTF8 + chars.encode("utf-8")
         # Nothing was declared, and we had not determined an encoding
         # on loading. Recommend an encoding line.
@@ -474,7 +470,7 @@
                   title="Print",
                   message="Print to Default Printer",
                   default=tkMessageBox.OK,
-                  master=self.text)
+                  parent=self.text)
         if not confirm:
             self.text.focus_set()
             return "break"
@@ -511,10 +507,10 @@
                          status + output
             if output:
                 output = "Printing command: %s\n" % repr(command) + output
-                tkMessageBox.showerror("Print status", output, 
master=self.text)
+                tkMessageBox.showerror("Print status", output, 
parent=self.text)
         else:  #no printing for this platform
             message = "Printing is not enabled for this platform: %s" % 
platform
-            tkMessageBox.showinfo("Print status", message, master=self.text)
+            tkMessageBox.showinfo("Print status", message, parent=self.text)
         if tempfilename:
             os.unlink(tempfilename)
         return "break"
@@ -533,7 +529,7 @@
     def askopenfile(self):
         dir, base = self.defaultfilename("open")
         if not self.opendialog:
-            self.opendialog = tkFileDialog.Open(master=self.text,
+            self.opendialog = tkFileDialog.Open(parent=self.text,
                                                 filetypes=self.filetypes)
         filename = self.opendialog.show(initialdir=dir, initialfile=base)
         if isinstance(filename, unicode):
@@ -556,7 +552,7 @@
         dir, base = self.defaultfilename("save")
         if not self.savedialog:
             self.savedialog = tkFileDialog.SaveAs(
-                    master=self.text,
+                    parent=self.text,
                     filetypes=self.filetypes,
                     defaultextension=self.defaultextension)
         filename = self.savedialog.show(initialdir=dir, initialfile=base)
@@ -568,8 +564,12 @@
         "Update recent file list on all editor windows"
         self.editwin.update_recent_files_list(filename)
 
-def _io_binding(parent):
-    root = Tk()
+
+def _io_binding(parent):  # htest #
+    from Tkinter import Toplevel, Text
+    from idlelib.configHandler import idleConf
+
+    root = Toplevel(parent)
     root.title("Test IOBinding")
     width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
     root.geometry("+%d+%d"%(x, y + 150))
@@ -586,12 +586,13 @@
             self.text.event_generate("<<open-window-from-file>>")
         def save(self, event):
             self.text.event_generate("<<save-window>>")
+        def update_recent_files_list(s, f): pass
 
     text = Text(root)
     text.pack()
     text.focus_set()
     editwin = MyEditWin(text)
-    io = IOBinding(editwin)
+    IOBinding(editwin)
 
 if __name__ == "__main__":
     from idlelib.idle_test.htest import run
diff --git a/lib-python/2.7/idlelib/MultiStatusBar.py 
b/lib-python/2.7/idlelib/MultiStatusBar.py
--- a/lib-python/2.7/idlelib/MultiStatusBar.py
+++ b/lib-python/2.7/idlelib/MultiStatusBar.py
@@ -8,13 +8,15 @@
         Frame.__init__(self, master, **kw)
         self.labels = {}
 
-    def set_label(self, name, text='', side=LEFT):
+    def set_label(self, name, text='', side=LEFT, width=0):
         if name not in self.labels:
-            label = Label(self, bd=1, relief=SUNKEN, anchor=W)
-            label.pack(side=side)
+            label = Label(self, borderwidth=0, anchor=W)
+            label.pack(side=side, pady=0, padx=4)
             self.labels[name] = label
         else:
             label = self.labels[name]
+        if width != 0:
+            label.config(width=width)
         label.config(text=text)
 
 def _multistatus_bar(parent):
diff --git a/lib-python/2.7/idlelib/NEWS.txt b/lib-python/2.7/idlelib/NEWS.txt
--- a/lib-python/2.7/idlelib/NEWS.txt
+++ b/lib-python/2.7/idlelib/NEWS.txt
@@ -1,7 +1,139 @@
+What's New in IDLE 2.7.11?
+==========================
+*Release date: 2015-12-06*
+
+- Issue 15348: Stop the debugger engine (normally in a user process)
+  before closing the debugger window (running in the IDLE process).
+  This prevents the RuntimeErrors that were being caught and ignored.
+
+- Issue #24455: Prevent IDLE from hanging when a) closing the shell while the
+  debugger is active (15347); b) closing the debugger with the [X] button
+  (15348); and c) activating the debugger when already active (24455).
+  The patch by Mark Roseman does this by making two changes.
+  1. Suspend and resume the gui.interaction method with the tcl vwait
+  mechanism intended for this purpose (instead of root.mainloop & .quit).
+  2. In gui.run, allow any existing interaction to terminate first.
+
+- Change 'The program' to 'Your program' in an IDLE 'kill program?' message
+  to make it clearer that the program referred to is the currently running
+  user program, not IDLE itself.
+
+- Issue #24750: Improve the appearance of the IDLE editor window status bar.
+  Patch by Mark Roseman.
+
+- Issue #25313: Change the handling of new built-in text color themes to better
+  address the compatibility problem introduced by the addition of IDLE Dark.
+  Consistently use the revised idleConf.CurrentTheme everywhere in idlelib.
+
+- Issue #24782: Extension configuration is now a tab in the IDLE Preferences
+  dialog rather than a separate dialog.   The former tabs are now a sorted
+  list.  Patch by Mark Roseman.
+
+- Issue #22726: Re-activate the config dialog help button with some content
+  about the other buttons and the new IDLE Dark theme.
+
+- Issue #24820: IDLE now has an 'IDLE Dark' built-in text color theme.
+  It is more or less IDLE Classic inverted, with a cobalt blue background.
+  Strings, comments, keywords, ... are still green, red, orange, ... .
+  To use it with IDLEs released before November 2015, hit the
+  'Save as New Custom Theme' button and enter a new name,
+  such as 'Custom Dark'.  The custom theme will work with any IDLE
+  release, and can be modified.
+
+- Issue #25224: README.txt is now an idlelib index for IDLE developers and
+  curious users.  The previous user content is now in the IDLE doc chapter.
+  'IDLE' now means 'Integrated Development and Learning Environment'.
+
+- Issue #24820: Users can now set breakpoint colors in
+  Settings -> Custom Highlighting.  Original patch by Mark Roseman.
+
+- Issue #24972: Inactive selection background now matches active selection
+  background, as configured by users, on all systems.  Found items are now
+  always highlighted on Windows.  Initial patch by Mark Roseman.
+
+- Issue #24570: Idle: make calltip and completion boxes appear on Macs
+  affected by a tk regression.  Initial patch by Mark Roseman.
+
+- Issue #24988: Idle ScrolledList context menus (used in debugger)
+  now work on Mac Aqua.  Patch by Mark Roseman.
+
+- Issue #24801: Make right-click for context menu work on Mac Aqua.
+  Patch by Mark Roseman.
+
+- Issue #25173: Associate tkinter messageboxes with a specific widget.
+  For Mac OSX, make them a 'sheet'.  Patch by Mark Roseman.
+
+- Issue #25198: Enhance the initial html viewer now used for Idle Help.
+  * Properly indent fixed-pitch text (patch by Mark Roseman).
+  * Give code snippet a very Sphinx-like light blueish-gray background.
+  * Re-use initial width and height set by users for shell and editor.
+  * When the Table of Contents (TOC) menu is used, put the section header
+  at the top of the screen.
+
+- Issue #25225: Condense and rewrite Idle doc section on text colors.
+
+- Issue #21995: Explain some differences between IDLE and console Python.
+
+- Issue #22820: Explain need for *print* when running file from Idle editor.
+
+- Issue #25224: Doc: augment Idle feature list and no-subprocess section.
+
+- Issue #25219: Update doc for Idle command line options.
+  Some were missing and notes were not correct.
+
+- Issue #24861: Most of idlelib is private and subject to change.
+  Use idleib.idle.* to start Idle. See idlelib.__init__.__doc__.
+
+- Issue #25199: Idle: add synchronization comments for future maintainers.
+
+- Issue #16893: Replace help.txt with help.html for Idle doc display.
+  The new idlelib/help.html is rstripped Doc/build/html/library/idle.html.
+  It looks better than help.txt and will better document Idle as released.
+  The tkinter html viewer that works for this file was written by Mark Roseman.
+  The now unused EditorWindow.HelpDialog class and helt.txt file are 
deprecated.
+
+- Issue #24199: Deprecate unused idlelib.idlever with possible removal in 3.6.
+
+- Issue #24790: Remove extraneous code (which also create 2 & 3 conflicts).
+
+- Issue #23672: Allow Idle to edit and run files with astral chars in name.
+  Patch by Mohd Sanad Zaki Rizvi.
+
+- Issue 24745: Idle editor default font. Switch from Courier to
+  platform-sensitive TkFixedFont.  This should not affect current customized
+  font selections.  If there is a problem, edit $HOME/.idlerc/config-main.cfg
+  and remove 'fontxxx' entries from [Editor Window].  Patch by Mark Roseman.
+
+- Issue #21192: Idle editor. When a file is run, put its name in the restart 
bar.
+  Do not print false prompts. Original patch by Adnan Umer.
+
+- Issue #13884: Idle menus. Remove tearoff lines. Patch by Roger Serwy.
+
+- Issue #15809: IDLE shell now uses locale encoding instead of Latin1 for
+  decoding unicode literals.
+
+
+What's New in IDLE 2.7.10?
+=========================
+*Release date: 2015-05-23*
+
+- Issue #23583: Fixed writing unicode to standard output stream in IDLE.
+
+- Issue #20577: Configuration of the max line length for the FormatParagraph
+  extension has been moved from the General tab of the Idle preferences dialog
+  to the FormatParagraph tab of the Config Extensions dialog.
+  Patch by Tal Einat.
+
+- Issue #16893: Update Idle doc chapter to match current Idle and add new
+  information.
+
+- Issue #23180: Rename IDLE "Windows" menu item to "Window".
+  Patch by Al Sweigart.
+
+
 What's New in IDLE 2.7.9?
 =========================
-
-*Release data: 2014-12-07* (projected)
+*Release date: 2014-12-10*
 
 - Issue #16893: Update Idle doc chapter to match current Idle and add new
   information.
@@ -35,7 +167,6 @@
 
 What's New in IDLE 2.7.8?
 =========================
-
 *Release date: 2014-06-29*
 
 - Issue #21940: Add unittest for WidgetRedirector. Initial patch by Saimadhav
@@ -63,7 +194,6 @@
 
 What's New in IDLE 2.7.7?
 =========================
-
 *Release date: 2014-05-31*
 
 - Issue #18104: Add idlelib/idle_test/htest.py with a few sample tests to begin
@@ -101,7 +231,6 @@
 
 What's New in IDLE 2.7.6?
 =========================
-
 *Release date: 2013-11-10*
 
 - Issue #19426: Fixed the opening of Python source file with specified 
encoding.
@@ -149,7 +278,6 @@
 
 What's New in IDLE 2.7.5?
 =========================
-
 *Release date: 2013-05-12*
 
 - Issue #17838: Allow sys.stdin to be reassigned.
@@ -184,7 +312,6 @@
 
 What's New in IDLE 2.7.4?
 =========================
-
 *Release date: 2013-04-06*
 
 - Issue #17625: In IDLE, close the replace dialog after it is used.
@@ -255,7 +382,6 @@
 
 What's New in IDLE 2.7.3?
 =========================
-
 *Release date: 2012-04-09*
 
 - Issue #964437 Make IDLE help window non-modal.
@@ -288,7 +414,6 @@
 
 What's New in IDLE 2.7.2?
 =========================
-
 *Release date: 2011-06-11*
 
 - Issue #11718: IDLE's open module dialog couldn't find the __init__.py
@@ -333,7 +458,6 @@
 
 What's New in Python 2.7.1?
 ===========================
-
 *Release date: 2010-11-27*
 
 - Issue #6378: idle.bat now runs with the appropriate Python version rather 
than
@@ -342,7 +466,6 @@
 
 What's New in IDLE 2.7?
 =======================
-
 *Release date: 2010-07-03*
 
 - Issue #5150: IDLE's format menu now has an option to strip trailing
@@ -374,7 +497,6 @@
 
 What's New in IDLE 2.6?
 =======================
-
 *Release date: 01-Oct-2008*
 
 - Issue #2665: On Windows, an IDLE installation upgraded from an old version
@@ -388,11 +510,6 @@
 - Autocompletion of filenames now support alternate separators, e.g. the
   '/' char on Windows.  Patch 2061 Tal Einat.
 
-What's New in IDLE 2.6a1?
-=========================
-
-*Release date: 29-Feb-2008*
-
 - Configured selection highlighting colors were ignored; updating highlighting
   in the config dialog would cause non-Python files to be colored as if they
   were Python source; improve use of ColorDelagator.  Patch 1334. Tal Einat.
@@ -464,15 +581,8 @@
 
 What's New in IDLE 1.2?
 =======================
-
 *Release date: 19-SEP-2006*
 
-
-What's New in IDLE 1.2c1?
-=========================
-
-*Release date: 17-AUG-2006*
-
 - File menu hotkeys: there were three 'p' assignments.  Reassign the
   'Save Copy As' and 'Print' hotkeys to 'y' and 't'.  Change the
   Shell hotkey from 's' to 'l'.
@@ -493,11 +603,6 @@
 - When used w/o subprocess, all exceptions were preceded by an error
   message claiming they were IDLE internal errors (since 1.2a1).
 
-What's New in IDLE 1.2b3?
-=========================
-
-*Release date: 03-AUG-2006*
-
 - Bug #1525817: Don't truncate short lines in IDLE's tool tips.
 
 - Bug #1517990: IDLE keybindings on MacOS X now work correctly
@@ -521,26 +626,6 @@
   'as' keyword in comment directly following import command. Closes 1325071.
   Patch 1479219 Tal Einat
 
-What's New in IDLE 1.2b2?
-=========================
-
-*Release date: 11-JUL-2006*
-
-What's New in IDLE 1.2b1?
-=========================
-
-*Release date: 20-JUN-2006*
-
-What's New in IDLE 1.2a2?
-=========================
-
-*Release date: 27-APR-2006*
-
-What's New in IDLE 1.2a1?
-=========================
-
-*Release date: 05-APR-2006*
-
 - Patch #1162825: Support non-ASCII characters in IDLE window titles.
 
 - Source file f.flush() after writing; trying to avoid lossage if user
@@ -620,19 +705,14 @@
 - The remote procedure call module rpc.py can now access data attributes of
   remote registered objects.  Changes to these attributes are local, however.
 
+
 What's New in IDLE 1.1?
 =======================
-
 *Release date: 30-NOV-2004*
 
 - On OpenBSD, terminating IDLE with ctrl-c from the command line caused a
   stuck subprocess MainThread because only the SocketThread was exiting.
 
-What's New in IDLE 1.1b3/rc1?
-=============================
-
-*Release date: 18-NOV-2004*
-
 - Saving a Keyset w/o making changes (by using the "Save as New Custom Key Set"
   button) caused IDLE to fail on restart (no new keyset was created in
   config-keys.cfg).  Also true for Theme/highlights.  Python Bug 1064535.
@@ -640,28 +720,12 @@
 - A change to the linecache.py API caused IDLE to exit when an exception was
   raised while running without the subprocess (-n switch).  Python Bug 1063840.
 
-What's New in IDLE 1.1b2?
-=========================
-
-*Release date: 03-NOV-2004*
-
 - When paragraph reformat width was made configurable, a bug was
   introduced that caused reformatting of comment blocks to ignore how
   far the block was indented, effectively adding the indentation width
   to the reformat width.  This has been repaired, and the reformat
   width is again a bound on the total width of reformatted lines.
 
-What's New in IDLE 1.1b1?
-=========================
-
-*Release date: 15-OCT-2004*
-
-
-What's New in IDLE 1.1a3?
-=========================
-
-*Release date: 02-SEP-2004*
-
 - Improve keyboard focus binding, especially in Windows menu.  Improve
   window raising, especially in the Windows menu and in the debugger.
   IDLEfork 763524.
@@ -669,24 +733,12 @@
 - If user passes a non-existent filename on the commandline, just
   open a new file, don't raise a dialog.  IDLEfork 854928.
 
-
-What's New in IDLE 1.1a2?
-=========================
-
-*Release date: 05-AUG-2004*
-
 - EditorWindow.py was not finding the .chm help file on Windows.  Typo
   at Rev 1.54.  Python Bug 990954
 
 - checking sys.platform for substring 'win' was breaking IDLE docs on Mac
   (darwin).  Also, Mac Safari browser requires full file:// URIs.  SF 900580.
 
-
-What's New in IDLE 1.1a1?
-=========================
-
-*Release date: 08-JUL-2004*
-
 - Redirect the warning stream to the shell during the ScriptBinding check of
   user code and format the warning similarly to an exception for both that
   check and for runtime warnings raised in the subprocess.
@@ -749,26 +801,10 @@
 
 What's New in IDLE 1.0?
 =======================
-
 *Release date: 29-Jul-2003*
 
-- Added a banner to the shell discussing warnings possibly raised by personal
-  firewall software.  Added same comment to README.txt.
-
-
-What's New in IDLE 1.0 release candidate 2?
-===========================================
-
-*Release date: 24-Jul-2003*
-
 - Calltip error when docstring was None  Python Bug 775541
 
-
-What's New in IDLE 1.0 release candidate 1?
-===========================================
-
-*Release date: 18-Jul-2003*
-
 - Updated extend.txt, help.txt, and config-extensions.def to correctly
   reflect the current status of the configuration system.  Python Bug 768469
 
@@ -784,12 +820,6 @@
   sys.std{in|out|err}.encoding, for both the local and the subprocess case.
   SF IDLEfork patch 682347.
 
-
-What's New in IDLE 1.0b2?
-=========================
-
-*Release date: 29-Jun-2003*
-
 - Extend AboutDialog.ViewFile() to support file encodings.  Make the CREDITS
   file Latin-1.
 
@@ -828,7 +858,6 @@
 
 What's New in IDLEfork 0.9b1?
 =============================
-
 *Release date: 02-Jun-2003*
 
 - The current working directory of the execution environment (and shell
@@ -930,10 +959,8 @@
   exception formatting to the subprocess.
 
 
-
 What's New in IDLEfork 0.9 Alpha 2?
 ===================================
-
 *Release date: 27-Jan-2003*
 
 - Updated INSTALL.txt to claify use of the python2 rpm.
@@ -1037,7 +1064,6 @@
 
 What's New in IDLEfork 0.9 Alpha 1?
 ===================================
-
 *Release date: 31-Dec-2002*
 
 - First release of major new functionality.  For further details refer to
diff --git a/lib-python/2.7/idlelib/OutputWindow.py 
b/lib-python/2.7/idlelib/OutputWindow.py
--- a/lib-python/2.7/idlelib/OutputWindow.py
+++ b/lib-python/2.7/idlelib/OutputWindow.py
@@ -96,7 +96,7 @@
                     "No special line",
                     "The line you point at doesn't look like "
                     "a valid file name followed by a line number.",
-                    master=self.text)
+                    parent=self.text)
                 return
         filename, lineno = result
         edit = self.flist.open(filename)
diff --git a/lib-python/2.7/idlelib/PathBrowser.py 
b/lib-python/2.7/idlelib/PathBrowser.py
--- a/lib-python/2.7/idlelib/PathBrowser.py
+++ b/lib-python/2.7/idlelib/PathBrowser.py
@@ -17,6 +17,7 @@
         self.init(flist)
 
     def settitle(self):
+        "Set window titles."
         self.top.wm_title("Path Browser")
         self.top.wm_iconname("Path Browser")
 
@@ -70,7 +71,7 @@
 
     def ispackagedir(self, file):
         if not os.path.isdir(file):
-            return 0
+            return False
         init = os.path.join(file, "__init__.py")
         return os.path.exists(init)
 
@@ -91,7 +92,7 @@
         sorted.sort()
         return sorted
 
-def _path_browser(parent):
+def _path_browser(parent):  # htest #
     flist = PyShellFileList(parent)
     PathBrowser(flist, _htest=True)
     parent.mainloop()
diff --git a/lib-python/2.7/idlelib/PyShell.py 
b/lib-python/2.7/idlelib/PyShell.py
--- a/lib-python/2.7/idlelib/PyShell.py
+++ b/lib-python/2.7/idlelib/PyShell.py
@@ -10,8 +10,6 @@
 import socket
 import time
 import threading
-import traceback
-import types
 import io
 
 import linecache
@@ -32,11 +30,11 @@
 from idlelib.UndoDelegator import UndoDelegator
 from idlelib.OutputWindow import OutputWindow
 from idlelib.configHandler import idleConf
-from idlelib import idlever
 from idlelib import rpc
 from idlelib import Debugger
 from idlelib import RemoteDebugger
 from idlelib import macosxSupport
+from idlelib import IOBinding
 
 IDENTCHARS = string.ascii_letters + string.digits + "_"
 HOST = '127.0.0.1' # python execution server on localhost loopback
@@ -160,7 +158,7 @@
             # possible due to update in restore_file_breaks
             return
         if color:
-            theme = idleConf.GetOption('main','Theme','name')
+            theme = idleConf.CurrentTheme()
             cfg = idleConf.GetHighlight(theme, "break")
         else:
             cfg = {'foreground': '', 'background': ''}
@@ -171,7 +169,7 @@
         filename = self.io.filename
         text.tag_add("BREAK", "%d.0" % lineno, "%d.0" % (lineno+1))
         try:
-            i = self.breakpoints.index(lineno)
+            self.breakpoints.index(lineno)
         except ValueError:  # only add if missing, i.e. do once
             self.breakpoints.append(lineno)
         try:    # update the subprocess debugger
@@ -345,7 +343,7 @@
 
     def LoadTagDefs(self):
         ColorDelegator.LoadTagDefs(self)
-        theme = idleConf.GetOption('main','Theme','name')
+        theme = idleConf.CurrentTheme()
         self.tagdefs.update({
             "stdin": {'background':None,'foreground':None},
             "stdout": idleConf.GetHighlight(theme, "stdout"),
@@ -439,7 +437,7 @@
             try:
                 self.rpcclt = MyRPCClient(addr)
                 break
-            except socket.error as err:
+            except socket.error:
                 pass
         else:
             self.display_port_binding_error()
@@ -460,7 +458,7 @@
         self.rpcclt.listening_sock.settimeout(10)
         try:
             self.rpcclt.accept()
-        except socket.timeout as err:
+        except socket.timeout:
             self.display_no_subprocess_error()
             return None
         self.rpcclt.register("console", self.tkconsole)
@@ -474,7 +472,7 @@
         self.poll_subprocess()
         return self.rpcclt
 
-    def restart_subprocess(self, with_cwd=False):
+    def restart_subprocess(self, with_cwd=False, filename=''):
         if self.restarting:
             return self.rpcclt
         self.restarting = True
@@ -495,25 +493,24 @@
         self.spawn_subprocess()
         try:
             self.rpcclt.accept()
-        except socket.timeout as err:
+        except socket.timeout:
             self.display_no_subprocess_error()
             return None
         self.transfer_path(with_cwd=with_cwd)
         console.stop_readline()
         # annotate restart in shell window and mark it
         console.text.delete("iomark", "end-1c")
-        if was_executing:
-            console.write('\n')
-            console.showprompt()
-        halfbar = ((int(console.width) - 16) // 2) * '='
-        console.write(halfbar + ' RESTART ' + halfbar)
+        tag = 'RESTART: ' + (filename if filename else 'Shell')
+        halfbar = ((int(console.width) -len(tag) - 4) // 2) * '='
+        console.write("\n{0} {1} {0}".format(halfbar, tag))
         console.text.mark_set("restart", "end-1c")
         console.text.mark_gravity("restart", "left")
-        console.showprompt()
+        if not filename:
+            console.showprompt()
         # restart subprocess debugger
         if debug:
             # Restarted debugger connects to current instance of debug GUI
-            gui = RemoteDebugger.restart_subprocess_debugger(self.rpcclt)
+            RemoteDebugger.restart_subprocess_debugger(self.rpcclt)
             # reload remote debugger breakpoints for all PyShellEditWindows
             debug.load_breakpoints()
         self.compile.compiler.flags = self.original_compiler_flags
@@ -634,7 +631,7 @@
         item = RemoteObjectBrowser.StubObjectTreeItem(self.rpcclt, oid)
         from idlelib.TreeWidget import ScrolledCanvas, TreeNode
         top = Toplevel(self.tkconsole.root)
-        theme = idleConf.GetOption('main','Theme','name')
+        theme = idleConf.CurrentTheme()
         background = idleConf.GetHighlight(theme, 'normal')['background']
         sc = ScrolledCanvas(top, bg=background, highlightthickness=0)
         sc.frame.pack(expand=1, fill="both")
@@ -654,7 +651,7 @@
         if source is None:
             source = open(filename, "r").read()
         try:
-            code = compile(source, filename, "exec")
+            code = compile(source, filename, "exec", dont_inherit=True)
         except (OverflowError, SyntaxError):
             self.tkconsole.resetoutput()
             print('*** Error in script or command!\n'
@@ -671,10 +668,11 @@
         self.more = 0
         self.save_warnings_filters = warnings.filters[:]
         warnings.filterwarnings(action="error", category=SyntaxWarning)
-        if isinstance(source, types.UnicodeType):
-            from idlelib import IOBinding
+        if isinstance(source, unicode) and IOBinding.encoding != 'utf-8':
             try:
-                source = source.encode(IOBinding.encoding)
+                source = '# -*- coding: %s -*-\n%s' % (
+                        IOBinding.encoding,
+                        source.encode(IOBinding.encoding))
             except UnicodeError:
                 self.tkconsole.resetoutput()
                 self.write("Unsupported characters in input\n")
@@ -801,7 +799,7 @@
                     "Exit?",
                     "Do you want to exit altogether?",
                     default="yes",
-                    master=self.tkconsole.text):
+                    parent=self.tkconsole.text):
                     raise
                 else:
                     self.showtraceback()
@@ -839,7 +837,7 @@
             "Run IDLE with the -n command line switch to start without a "
             "subprocess and refer to Help/IDLE Help 'Running without a "
             "subprocess' for further details.",
-            master=self.tkconsole.text)
+            parent=self.tkconsole.text)
 
     def display_no_subprocess_error(self):
         tkMessageBox.showerror(
@@ -847,14 +845,14 @@
             "IDLE's subprocess didn't make connection.  Either IDLE can't "
             "start a subprocess or personal firewall software is blocking "
             "the connection.",
-            master=self.tkconsole.text)
+            parent=self.tkconsole.text)
 
     def display_executing_dialog(self):
         tkMessageBox.showerror(
             "Already executing",
             "The Python Shell window is already executing a command; "
             "please wait until it is finished.",
-            master=self.tkconsole.text)
+            parent=self.tkconsole.text)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to