diff -Nru python3-stdlib-extensions-3.6.6/3.6/Lib/distutils/log.py python3-stdlib-extensions-3.6.7/3.6/Lib/distutils/log.py --- python3-stdlib-extensions-3.6.6/3.6/Lib/distutils/log.py 2018-06-26 23:39:50.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.6/Lib/distutils/log.py 2018-10-20 05:24:09.000000000 +0000 @@ -27,11 +27,13 @@ stream = sys.stderr else: stream = sys.stdout - if stream.errors == 'strict': + try: + stream.write('%s\n' % msg) + except UnicodeEncodeError: # emulate backslashreplace error handler encoding = stream.encoding msg = msg.encode(encoding, "backslashreplace").decode(encoding) - stream.write('%s\n' % msg) + stream.write('%s\n' % msg) stream.flush() def log(self, level, msg, *args): diff -Nru python3-stdlib-extensions-3.6.6/3.6/Lib/distutils/_msvccompiler.py python3-stdlib-extensions-3.6.7/3.6/Lib/distutils/_msvccompiler.py --- python3-stdlib-extensions-3.6.6/3.6/Lib/distutils/_msvccompiler.py 2018-06-26 23:39:50.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.6/Lib/distutils/_msvccompiler.py 2018-10-20 05:24:09.000000000 +0000 @@ -252,11 +252,11 @@ for dir in vc_env.get('include', '').split(os.pathsep): if dir: - self.add_include_dir(dir) + self.add_include_dir(dir.rstrip(os.sep)) for dir in vc_env.get('lib', '').split(os.pathsep): if dir: - self.add_library_dir(dir) + self.add_library_dir(dir.rstrip(os.sep)) self.preprocess_options = None # If vcruntime_redist is available, link against it dynamically. Otherwise, diff -Nru python3-stdlib-extensions-3.6.6/3.6/Lib/distutils/spawn.py python3-stdlib-extensions-3.6.7/3.6/Lib/distutils/spawn.py --- python3-stdlib-extensions-3.6.6/3.6/Lib/distutils/spawn.py 2018-06-26 23:39:50.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.6/Lib/distutils/spawn.py 2018-10-20 05:24:09.000000000 +0000 @@ -173,7 +173,7 @@ os.environ['PATH']. Returns the complete filename or None if not found. """ if path is None: - path = os.environ['PATH'] + path = os.environ.get('PATH', os.defpath) paths = path.split(os.pathsep) base, ext = os.path.splitext(executable) diff -Nru python3-stdlib-extensions-3.6.6/3.6/Lib/distutils/tests/test_bdist.py python3-stdlib-extensions-3.6.7/3.6/Lib/distutils/tests/test_bdist.py --- python3-stdlib-extensions-3.6.6/3.6/Lib/distutils/tests/test_bdist.py 2018-06-26 23:39:50.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.6/Lib/distutils/tests/test_bdist.py 2018-10-20 05:24:09.000000000 +0000 @@ -39,6 +39,9 @@ for name in names: subcmd = cmd.get_finalized_command(name) + if getattr(subcmd, '_unsupported', False): + # command is not supported on this build + continue self.assertTrue(subcmd.skip_build, '%s should take --skip-build from bdist' % name) diff -Nru python3-stdlib-extensions-3.6.6/3.6/Lib/distutils/tests/test_bdist_wininst.py python3-stdlib-extensions-3.6.7/3.6/Lib/distutils/tests/test_bdist_wininst.py --- python3-stdlib-extensions-3.6.6/3.6/Lib/distutils/tests/test_bdist_wininst.py 2018-06-26 23:39:50.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.6/Lib/distutils/tests/test_bdist_wininst.py 2018-10-20 05:24:09.000000000 +0000 @@ -5,6 +5,8 @@ from distutils.command.bdist_wininst import bdist_wininst from distutils.tests import support +@unittest.skipIf(getattr(bdist_wininst, '_unsupported', False), + 'bdist_wininst is not supported in this install') class BuildWinInstTestCase(support.TempdirManager, support.LoggingSilencer, unittest.TestCase): diff -Nru python3-stdlib-extensions-3.6.6/3.6/Lib/distutils/tests/test_log.py python3-stdlib-extensions-3.6.7/3.6/Lib/distutils/tests/test_log.py --- python3-stdlib-extensions-3.6.6/3.6/Lib/distutils/tests/test_log.py 2018-06-26 23:39:50.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.6/Lib/distutils/tests/test_log.py 2018-10-20 05:24:09.000000000 +0000 @@ -1,35 +1,43 @@ """Tests for distutils.log""" +import io import sys import unittest -from tempfile import NamedTemporaryFile -from test.support import run_unittest +from test.support import swap_attr, run_unittest from distutils import log class TestLog(unittest.TestCase): def test_non_ascii(self): - # Issue #8663: test that non-ASCII text is escaped with - # backslashreplace error handler (stream use ASCII encoding and strict - # error handler) - old_stdout = sys.stdout - old_stderr = sys.stderr - old_threshold = log.set_threshold(log.DEBUG) - try: - with NamedTemporaryFile(mode="w+", encoding='ascii') as stdout, \ - NamedTemporaryFile(mode="w+", encoding='ascii') as stderr: - sys.stdout = stdout - sys.stderr = stderr - log.debug("debug:\xe9") - log.fatal("fatal:\xe9") + # Issues #8663, #34421: test that non-encodable text is escaped with + # backslashreplace error handler and encodable non-ASCII text is + # output as is. + for errors in ('strict', 'backslashreplace', 'surrogateescape', + 'replace', 'ignore'): + with self.subTest(errors=errors): + stdout = io.TextIOWrapper(io.BytesIO(), + encoding='cp437', errors=errors) + stderr = io.TextIOWrapper(io.BytesIO(), + encoding='cp437', errors=errors) + old_threshold = log.set_threshold(log.DEBUG) + try: + with swap_attr(sys, 'stdout', stdout), \ + swap_attr(sys, 'stderr', stderr): + log.debug('Dεbug\tMėssãge') + log.fatal('Fαtal\tÈrrōr') + finally: + log.set_threshold(old_threshold) + stdout.seek(0) - self.assertEqual(stdout.read().rstrip(), "debug:\\xe9") + self.assertEqual(stdout.read().rstrip(), + 'Dεbug\tM?ss?ge' if errors == 'replace' else + 'Dεbug\tMssge' if errors == 'ignore' else + 'Dεbug\tM\\u0117ss\\xe3ge') stderr.seek(0) - self.assertEqual(stderr.read().rstrip(), "fatal:\\xe9") - finally: - log.set_threshold(old_threshold) - sys.stdout = old_stdout - sys.stderr = old_stderr + self.assertEqual(stderr.read().rstrip(), + 'Fαtal\t?rr?r' if errors == 'replace' else + 'Fαtal\trrr' if errors == 'ignore' else + 'Fαtal\t\\xc8rr\\u014dr') def test_suite(): return unittest.makeSuite(TestLog) diff -Nru python3-stdlib-extensions-3.6.6/3.6/Lib/distutils/tests/test_spawn.py python3-stdlib-extensions-3.6.7/3.6/Lib/distutils/tests/test_spawn.py --- python3-stdlib-extensions-3.6.6/3.6/Lib/distutils/tests/test_spawn.py 2018-06-26 23:39:50.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.6/Lib/distutils/tests/test_spawn.py 2018-10-20 05:24:09.000000000 +0000 @@ -1,9 +1,13 @@ """Tests for distutils.spawn.""" -import unittest -import sys import os +import stat +import sys +import unittest +from unittest import mock from test.support import run_unittest, unix_shell +from test import support as test_support +from distutils.spawn import find_executable from distutils.spawn import _nt_quote_args from distutils.spawn import spawn from distutils.errors import DistutilsExecError @@ -51,6 +55,47 @@ os.chmod(exe, 0o777) spawn([exe]) # should work without any error + def test_find_executable(self): + with test_support.temp_dir() as tmp_dir: + # use TESTFN to get a pseudo-unique filename + program_noeext = test_support.TESTFN + # Give the temporary program an ".exe" suffix for all. + # It's needed on Windows and not harmful on other platforms. + program = program_noeext + ".exe" + + filename = os.path.join(tmp_dir, program) + with open(filename, "wb"): + pass + os.chmod(filename, stat.S_IXUSR) + + # test path parameter + rv = find_executable(program, path=tmp_dir) + self.assertEqual(rv, filename) + + if sys.platform == 'win32': + # test without ".exe" extension + rv = find_executable(program_noeext, path=tmp_dir) + self.assertEqual(rv, filename) + + # test find in the current directory + with test_support.change_cwd(tmp_dir): + rv = find_executable(program) + self.assertEqual(rv, program) + + # test non-existent program + dont_exist_program = "dontexist_" + program + rv = find_executable(dont_exist_program , path=tmp_dir) + self.assertIsNone(rv) + + # test os.defpath: missing PATH environment variable + with test_support.EnvironmentVarGuard() as env: + with mock.patch('distutils.spawn.os.defpath', tmp_dir): + env.pop('PATH') + + rv = find_executable(program) + self.assertEqual(rv, filename) + + def test_suite(): return unittest.makeSuite(SpawnTestCase) diff -Nru python3-stdlib-extensions-3.6.6/3.6/Lib/tkinter/__init__.py python3-stdlib-extensions-3.6.7/3.6/Lib/tkinter/__init__.py --- python3-stdlib-extensions-3.6.6/3.6/Lib/tkinter/__init__.py 2018-06-26 23:39:50.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.6/Lib/tkinter/__init__.py 2018-10-20 05:24:09.000000000 +0000 @@ -61,7 +61,7 @@ if isinstance(value, (list, tuple)): if len(value) == 1: value = _stringify(value[0]) - if value[0] == '{': + if _magic_re.search(value): value = '{%s}' % value else: value = '{%s}' % _join(value) @@ -72,7 +72,10 @@ elif _magic_re.search(value): # add '\' before special characters and spaces value = _magic_re.sub(r'\\\1', value) + value = value.replace('\n', r'\n') value = _space_re.sub(r'\\\1', value) + if value[0] == '"': + value = '\\' + value elif value[0] == '"' or _space_re.search(value): value = '{%s}' % value return value diff -Nru python3-stdlib-extensions-3.6.6/3.6/Lib/tkinter/test/support.py python3-stdlib-extensions-3.6.7/3.6/Lib/tkinter/test/support.py --- python3-stdlib-extensions-3.6.6/3.6/Lib/tkinter/test/support.py 2018-06-26 23:39:50.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.6/Lib/tkinter/test/support.py 2018-10-20 05:24:09.000000000 +0000 @@ -1,3 +1,4 @@ +import functools import re import tkinter import unittest @@ -54,9 +55,20 @@ tcl_version = tuple(map(int, _tkinter.TCL_VERSION.split('.'))) def requires_tcl(*version): - return unittest.skipUnless(tcl_version >= version, + if len(version) <= 2: + return unittest.skipUnless(tcl_version >= version, 'requires Tcl version >= ' + '.'.join(map(str, version))) + def deco(test): + @functools.wraps(test) + def newtest(self): + if get_tk_patchlevel() < (8, 6, 5): + self.skipTest('requires Tcl version >= ' + + '.'.join(map(str, get_tk_patchlevel()))) + test(self) + return newtest + return deco + _tk_patchlevel = None def get_tk_patchlevel(): global _tk_patchlevel diff -Nru python3-stdlib-extensions-3.6.6/3.6/Lib/tkinter/test/test_tkinter/test_widgets.py python3-stdlib-extensions-3.6.7/3.6/Lib/tkinter/test/test_tkinter/test_widgets.py --- python3-stdlib-extensions-3.6.6/3.6/Lib/tkinter/test/test_tkinter/test_widgets.py 2018-06-26 23:39:50.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.6/Lib/tkinter/test/test_tkinter/test_widgets.py 2018-10-20 05:24:09.000000000 +0000 @@ -703,7 +703,7 @@ 'disabledforeground', 'exportselection', 'font', 'foreground', 'height', 'highlightbackground', 'highlightcolor', 'highlightthickness', - 'listvariable', 'relief', + 'justify', 'listvariable', 'relief', 'selectbackground', 'selectborderwidth', 'selectforeground', 'selectmode', 'setgrid', 'state', 'takefocus', 'width', 'xscrollcommand', 'yscrollcommand', @@ -717,6 +717,8 @@ self.checkEnumParam(widget, 'activestyle', 'dotbox', 'none', 'underline') + test_justify = requires_tcl(8, 6, 5)(StandardOptionsTests.test_justify) + def test_listvariable(self): widget = self.create() var = tkinter.DoubleVar(self.root) @@ -951,7 +953,9 @@ OPTIONS = ( 'background', 'borderwidth', 'cursor', 'handlepad', 'handlesize', 'height', - 'opaqueresize', 'orient', 'relief', + 'opaqueresize', 'orient', + 'proxybackground', 'proxyborderwidth', 'proxyrelief', + 'relief', 'sashcursor', 'sashpad', 'sashrelief', 'sashwidth', 'showhandle', 'width', ) @@ -978,6 +982,23 @@ widget = self.create() self.checkBooleanParam(widget, 'opaqueresize') + @requires_tcl(8, 6, 5) + def test_proxybackground(self): + widget = self.create() + self.checkColorParam(widget, 'proxybackground') + + @requires_tcl(8, 6, 5) + def test_proxyborderwidth(self): + widget = self.create() + self.checkPixelsParam(widget, 'proxyborderwidth', + 0, 1.3, 2.9, 6, -2, '10p', + conv=noconv) + + @requires_tcl(8, 6, 5) + def test_proxyrelief(self): + widget = self.create() + self.checkReliefParam(widget, 'proxyrelief') + def test_sashcursor(self): widget = self.create() self.checkCursorParam(widget, 'sashcursor') diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/distutils/log.py python3-stdlib-extensions-3.6.7/3.7/Lib/distutils/log.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/distutils/log.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/distutils/log.py 2018-10-20 06:04:19.000000000 +0000 @@ -27,11 +27,13 @@ stream = sys.stderr else: stream = sys.stdout - if stream.errors == 'strict': + try: + stream.write('%s\n' % msg) + except UnicodeEncodeError: # emulate backslashreplace error handler encoding = stream.encoding msg = msg.encode(encoding, "backslashreplace").decode(encoding) - stream.write('%s\n' % msg) + stream.write('%s\n' % msg) stream.flush() def log(self, level, msg, *args): diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/distutils/_msvccompiler.py python3-stdlib-extensions-3.6.7/3.7/Lib/distutils/_msvccompiler.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/distutils/_msvccompiler.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/distutils/_msvccompiler.py 2018-10-20 06:04:19.000000000 +0000 @@ -252,11 +252,11 @@ for dir in vc_env.get('include', '').split(os.pathsep): if dir: - self.add_include_dir(dir) + self.add_include_dir(dir.rstrip(os.sep)) for dir in vc_env.get('lib', '').split(os.pathsep): if dir: - self.add_library_dir(dir) + self.add_library_dir(dir.rstrip(os.sep)) self.preprocess_options = None # If vcruntime_redist is available, link against it dynamically. Otherwise, diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/distutils/spawn.py python3-stdlib-extensions-3.6.7/3.7/Lib/distutils/spawn.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/distutils/spawn.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/distutils/spawn.py 2018-10-20 06:04:19.000000000 +0000 @@ -173,7 +173,7 @@ os.environ['PATH']. Returns the complete filename or None if not found. """ if path is None: - path = os.environ['PATH'] + path = os.environ.get('PATH', os.defpath) paths = path.split(os.pathsep) base, ext = os.path.splitext(executable) diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/distutils/tests/test_bdist.py python3-stdlib-extensions-3.6.7/3.7/Lib/distutils/tests/test_bdist.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/distutils/tests/test_bdist.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/distutils/tests/test_bdist.py 2018-10-20 06:04:19.000000000 +0000 @@ -39,6 +39,9 @@ for name in names: subcmd = cmd.get_finalized_command(name) + if getattr(subcmd, '_unsupported', False): + # command is not supported on this build + continue self.assertTrue(subcmd.skip_build, '%s should take --skip-build from bdist' % name) diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/distutils/tests/test_bdist_wininst.py python3-stdlib-extensions-3.6.7/3.7/Lib/distutils/tests/test_bdist_wininst.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/distutils/tests/test_bdist_wininst.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/distutils/tests/test_bdist_wininst.py 2018-10-20 06:04:19.000000000 +0000 @@ -5,6 +5,8 @@ from distutils.command.bdist_wininst import bdist_wininst from distutils.tests import support +@unittest.skipIf(getattr(bdist_wininst, '_unsupported', False), + 'bdist_wininst is not supported in this install') class BuildWinInstTestCase(support.TempdirManager, support.LoggingSilencer, unittest.TestCase): diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/distutils/tests/test_log.py python3-stdlib-extensions-3.6.7/3.7/Lib/distutils/tests/test_log.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/distutils/tests/test_log.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/distutils/tests/test_log.py 2018-10-20 06:04:19.000000000 +0000 @@ -1,35 +1,43 @@ """Tests for distutils.log""" +import io import sys import unittest -from tempfile import NamedTemporaryFile -from test.support import run_unittest +from test.support import swap_attr, run_unittest from distutils import log class TestLog(unittest.TestCase): def test_non_ascii(self): - # Issue #8663: test that non-ASCII text is escaped with - # backslashreplace error handler (stream use ASCII encoding and strict - # error handler) - old_stdout = sys.stdout - old_stderr = sys.stderr - old_threshold = log.set_threshold(log.DEBUG) - try: - with NamedTemporaryFile(mode="w+", encoding='ascii') as stdout, \ - NamedTemporaryFile(mode="w+", encoding='ascii') as stderr: - sys.stdout = stdout - sys.stderr = stderr - log.debug("debug:\xe9") - log.fatal("fatal:\xe9") + # Issues #8663, #34421: test that non-encodable text is escaped with + # backslashreplace error handler and encodable non-ASCII text is + # output as is. + for errors in ('strict', 'backslashreplace', 'surrogateescape', + 'replace', 'ignore'): + with self.subTest(errors=errors): + stdout = io.TextIOWrapper(io.BytesIO(), + encoding='cp437', errors=errors) + stderr = io.TextIOWrapper(io.BytesIO(), + encoding='cp437', errors=errors) + old_threshold = log.set_threshold(log.DEBUG) + try: + with swap_attr(sys, 'stdout', stdout), \ + swap_attr(sys, 'stderr', stderr): + log.debug('Dεbug\tMėssãge') + log.fatal('Fαtal\tÈrrōr') + finally: + log.set_threshold(old_threshold) + stdout.seek(0) - self.assertEqual(stdout.read().rstrip(), "debug:\\xe9") + self.assertEqual(stdout.read().rstrip(), + 'Dεbug\tM?ss?ge' if errors == 'replace' else + 'Dεbug\tMssge' if errors == 'ignore' else + 'Dεbug\tM\\u0117ss\\xe3ge') stderr.seek(0) - self.assertEqual(stderr.read().rstrip(), "fatal:\\xe9") - finally: - log.set_threshold(old_threshold) - sys.stdout = old_stdout - sys.stderr = old_stderr + self.assertEqual(stderr.read().rstrip(), + 'Fαtal\t?rr?r' if errors == 'replace' else + 'Fαtal\trrr' if errors == 'ignore' else + 'Fαtal\t\\xc8rr\\u014dr') def test_suite(): return unittest.makeSuite(TestLog) diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/distutils/tests/test_spawn.py python3-stdlib-extensions-3.6.7/3.7/Lib/distutils/tests/test_spawn.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/distutils/tests/test_spawn.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/distutils/tests/test_spawn.py 2018-10-20 06:04:19.000000000 +0000 @@ -1,9 +1,13 @@ """Tests for distutils.spawn.""" -import unittest -import sys import os +import stat +import sys +import unittest +from unittest import mock from test.support import run_unittest, unix_shell +from test import support as test_support +from distutils.spawn import find_executable from distutils.spawn import _nt_quote_args from distutils.spawn import spawn from distutils.errors import DistutilsExecError @@ -51,6 +55,47 @@ os.chmod(exe, 0o777) spawn([exe]) # should work without any error + def test_find_executable(self): + with test_support.temp_dir() as tmp_dir: + # use TESTFN to get a pseudo-unique filename + program_noeext = test_support.TESTFN + # Give the temporary program an ".exe" suffix for all. + # It's needed on Windows and not harmful on other platforms. + program = program_noeext + ".exe" + + filename = os.path.join(tmp_dir, program) + with open(filename, "wb"): + pass + os.chmod(filename, stat.S_IXUSR) + + # test path parameter + rv = find_executable(program, path=tmp_dir) + self.assertEqual(rv, filename) + + if sys.platform == 'win32': + # test without ".exe" extension + rv = find_executable(program_noeext, path=tmp_dir) + self.assertEqual(rv, filename) + + # test find in the current directory + with test_support.change_cwd(tmp_dir): + rv = find_executable(program) + self.assertEqual(rv, program) + + # test non-existent program + dont_exist_program = "dontexist_" + program + rv = find_executable(dont_exist_program , path=tmp_dir) + self.assertIsNone(rv) + + # test os.defpath: missing PATH environment variable + with test_support.EnvironmentVarGuard() as env: + with mock.patch('distutils.spawn.os.defpath', tmp_dir): + env.pop('PATH') + + rv = find_executable(program) + self.assertEqual(rv, filename) + + def test_suite(): return unittest.makeSuite(SpawnTestCase) diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/fixer_util.py python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/fixer_util.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/fixer_util.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/fixer_util.py 2018-10-20 06:04:19.000000000 +0000 @@ -101,8 +101,8 @@ test.prefix = " " if_leaf = Leaf(token.NAME, "if") if_leaf.prefix = " " - inner_args.append(Node(syms.old_comp_if, [if_leaf, test])) - inner = Node(syms.listmaker, [xp, Node(syms.old_comp_for, inner_args)]) + inner_args.append(Node(syms.comp_if, [if_leaf, test])) + inner = Node(syms.listmaker, [xp, Node(syms.comp_for, inner_args)]) return Node(syms.atom, [Leaf(token.LBRACE, "["), inner, @@ -208,7 +208,7 @@ next = getattr(next, attr) p0 = """for_stmt< 'for' any 'in' node=any ':' any* > - | old_comp_for< 'for' any 'in' node=any any* > + | comp_for< 'for' any 'in' node=any any* > """ p1 = """ power< diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/fixes/fix_dict.py python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/fixes/fix_dict.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/fixes/fix_dict.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/fixes/fix_dict.py 2018-10-20 06:04:19.000000000 +0000 @@ -83,7 +83,7 @@ p1 = patcomp.compile_pattern(P1) P2 = """for_stmt< 'for' any 'in' node=any ':' any* > - | old_comp_for< 'for' any 'in' node=any any* > + | comp_for< 'for' any 'in' node=any any* > """ p2 = patcomp.compile_pattern(P2) diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/fixes/fix_paren.py python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/fixes/fix_paren.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/fixes/fix_paren.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/fixes/fix_paren.py 2018-10-20 06:04:19.000000000 +0000 @@ -15,7 +15,7 @@ PATTERN = """ atom< ('[' | '(') (listmaker< any - old_comp_for< + comp_for< 'for' NAME 'in' target=testlist_safe< any (',' any)+ [','] > @@ -24,7 +24,7 @@ > | testlist_gexp< any - old_comp_for< + comp_for< 'for' NAME 'in' target=testlist_safe< any (',' any)+ [','] > diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/fixes/fix_reload.py python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/fixes/fix_reload.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/fixes/fix_reload.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/fixes/fix_reload.py 2018-10-20 06:04:19.000000000 +0000 @@ -1,6 +1,6 @@ """Fixer for reload(). -reload(s) -> imp.reload(s)""" +reload(s) -> importlib.reload(s)""" # Local imports from .. import fixer_base @@ -32,7 +32,7 @@ if (obj.type == self.syms.argument and obj.children[0].value == '**'): return # Make no change. - names = ('imp', 'reload') + names = ('importlib', 'reload') new = ImportAndCall(node, results, names) - touch_import(None, 'imp', node) + touch_import(None, 'importlib', node) return new diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/fixes/fix_xrange.py python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/fixes/fix_xrange.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/fixes/fix_xrange.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/fixes/fix_xrange.py 2018-10-20 06:04:19.000000000 +0000 @@ -55,7 +55,7 @@ p1 = patcomp.compile_pattern(P1) P2 = """for_stmt< 'for' any 'in' node=any ':' any* > - | old_comp_for< 'for' any 'in' node=any any* > + | comp_for< 'for' any 'in' node=any any* > | comparison< any 'in' node=any any*> """ p2 = patcomp.compile_pattern(P2) diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/Grammar.txt python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/Grammar.txt --- python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/Grammar.txt 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/Grammar.txt 2018-10-20 06:04:19.000000000 +0000 @@ -111,8 +111,8 @@ '{' [dictsetmaker] '}' | '`' testlist1 '`' | NAME | NUMBER | STRING+ | '.' '.' '.') -listmaker: (test|star_expr) ( old_comp_for | (',' (test|star_expr))* [','] ) -testlist_gexp: (test|star_expr) ( old_comp_for | (',' (test|star_expr))* [','] ) +listmaker: (test|star_expr) ( comp_for | (',' (test|star_expr))* [','] ) +testlist_gexp: (test|star_expr) ( comp_for | (',' (test|star_expr))* [','] ) lambdef: 'lambda' [varargslist] ':' test trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME subscriptlist: subscript (',' subscript)* [','] @@ -142,28 +142,9 @@ star_expr ) comp_iter: comp_for | comp_if -comp_for: [ASYNC] 'for' exprlist 'in' or_test [comp_iter] +comp_for: [ASYNC] 'for' exprlist 'in' testlist_safe [comp_iter] comp_if: 'if' old_test [comp_iter] -# As noted above, testlist_safe extends the syntax allowed in list -# comprehensions and generators. We can't use it indiscriminately in all -# derivations using a comp_for-like pattern because the testlist_safe derivation -# contains comma which clashes with trailing comma in arglist. -# -# This was an issue because the parser would not follow the correct derivation -# when parsing syntactically valid Python code. Since testlist_safe was created -# specifically to handle list comprehensions and generator expressions enclosed -# with parentheses, it's safe to only use it in those. That avoids the issue; we -# can parse code like set(x for x in [],). -# -# The syntax supported by this set of rules is not a valid Python 3 syntax, -# hence the prefix "old". -# -# See https://bugs.python.org/issue27494 -old_comp_iter: old_comp_for | old_comp_if -old_comp_for: [ASYNC] 'for' exprlist 'in' testlist_safe [old_comp_iter] -old_comp_if: 'if' old_test [old_comp_iter] - testlist1: test (',' test)* # not used in grammar, but may appear in "node" passed from Parser to Compiler diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/pgen2/tokenize.py python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/pgen2/tokenize.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/pgen2/tokenize.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/pgen2/tokenize.py 2018-10-20 06:04:19.000000000 +0000 @@ -56,7 +56,7 @@ Whitespace = r'[ \f\t]*' Comment = r'#[^\r\n]*' Ignore = Whitespace + any(r'\\\r?\n' + Whitespace) + maybe(Comment) -Name = r'[a-zA-Z_]\w*' +Name = r'\w+' Binnumber = r'0[bB]_?[01]+(?:_[01]+)*' Hexnumber = r'0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?' @@ -107,8 +107,8 @@ PseudoExtras = group(r'\\\r?\n', Comment, Triple) PseudoToken = Whitespace + group(PseudoExtras, Number, Funny, ContStr, Name) -tokenprog, pseudoprog, single3prog, double3prog = list(map( - re.compile, (Token, PseudoToken, Single3, Double3))) +tokenprog, pseudoprog, single3prog, double3prog = map( + re.compile, (Token, PseudoToken, Single3, Double3)) _strprefixes = ( _combinations('r', 'R', 'f', 'F') | @@ -349,7 +349,6 @@ logical line; continuation lines are included. """ lnum = parenlev = continued = 0 - namechars, numchars = string.ascii_letters + '_', '0123456789' contstr, needcont = '', 0 contline = None indents = [0] @@ -451,7 +450,7 @@ spos, epos, pos = (lnum, start), (lnum, end), end token, initial = line[start:end], line[start] - if initial in numchars or \ + if initial in string.digits or \ (initial == '.' and token != '.'): # ordinary number yield (NUMBER, token, spos, epos, line) elif initial in '\r\n': @@ -501,7 +500,7 @@ yield stashed stashed = None yield (STRING, token, spos, epos, line) - elif initial in namechars: # ordinary name + elif initial.isidentifier(): # ordinary name if token in ('async', 'await'): if async_def: yield (ASYNC if token == 'async' else AWAIT, diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/refactor.py python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/refactor.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/refactor.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/refactor.py 2018-10-20 06:04:19.000000000 +0000 @@ -514,7 +514,7 @@ set. """ try: - fp = io.open(filename, "w", encoding=encoding) + fp = io.open(filename, "w", encoding=encoding, newline='') except OSError as err: self.log_error("Can't create %s: %s", filename, err) return diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/tests/test_fixers.py python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/tests/test_fixers.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/tests/test_fixers.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/tests/test_fixers.py 2018-10-20 06:04:19.000000000 +0000 @@ -290,30 +290,30 @@ def test(self): b = """reload(a)""" - a = """import imp\nimp.reload(a)""" + a = """import importlib\nimportlib.reload(a)""" self.check(b, a) def test_comment(self): b = """reload( a ) # comment""" - a = """import imp\nimp.reload( a ) # comment""" + a = """import importlib\nimportlib.reload( a ) # comment""" self.check(b, a) # PEP 8 comments b = """reload( a ) # comment""" - a = """import imp\nimp.reload( a ) # comment""" + a = """import importlib\nimportlib.reload( a ) # comment""" self.check(b, a) def test_space(self): b = """reload( a )""" - a = """import imp\nimp.reload( a )""" + a = """import importlib\nimportlib.reload( a )""" self.check(b, a) b = """reload( a)""" - a = """import imp\nimp.reload( a)""" + a = """import importlib\nimportlib.reload( a)""" self.check(b, a) b = """reload(a )""" - a = """import imp\nimp.reload(a )""" + a = """import importlib\nimportlib.reload(a )""" self.check(b, a) def test_unchanged(self): diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/tests/test_parser.py python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/tests/test_parser.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/tests/test_parser.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/tests/test_parser.py 2018-10-20 06:04:19.000000000 +0000 @@ -529,6 +529,16 @@ self.validate("""x = {2, 3, 4,}""") +# Adapted from Python 3's Lib/test/test_unicode_identifiers.py and +# Lib/test/test_tokenize.py:TokenizeTest.test_non_ascii_identifiers +class TestIdentfier(GrammarTest): + def test_non_ascii_identifiers(self): + self.validate("Örter = 'places'\ngrün = 'green'") + self.validate("蟒 = a蟒 = 锦蛇 = 1") + self.validate("µ = aµ = µµ = 1") + self.validate("𝔘𝔫𝔦𝔠𝔬𝔡𝔢 = a_𝔘𝔫𝔦𝔠𝔬𝔡𝔢 = 1") + + class TestNumericLiterals(GrammarTest): def test_new_octal_notation(self): self.validate("""0o7777777777777""") @@ -612,13 +622,6 @@ self.validate(s) -class TestGeneratorExpressions(GrammarTest): - - def test_trailing_comma_after_generator_expression_argument_works(self): - # BPO issue 27494 - self.validate("set(x for x in [],)") - - def diff_texts(a, b, filename): a = a.splitlines() b = b.splitlines() diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/tests/test_refactor.py python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/tests/test_refactor.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/lib2to3/tests/test_refactor.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/lib2to3/tests/test_refactor.py 2018-10-20 06:04:19.000000000 +0000 @@ -300,6 +300,7 @@ old, new = self.refactor_file(fn) self.assertIn(b"\r\n", old) self.assertIn(b"\r\n", new) + self.assertNotIn(b"\r\r\n", new) def test_refactor_docstring(self): rt = self.rt() diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/tkinter/__init__.py python3-stdlib-extensions-3.6.7/3.7/Lib/tkinter/__init__.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/tkinter/__init__.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/tkinter/__init__.py 2018-10-20 06:04:19.000000000 +0000 @@ -61,7 +61,7 @@ if isinstance(value, (list, tuple)): if len(value) == 1: value = _stringify(value[0]) - if value[0] == '{': + if _magic_re.search(value): value = '{%s}' % value else: value = '{%s}' % _join(value) @@ -72,7 +72,10 @@ elif _magic_re.search(value): # add '\' before special characters and spaces value = _magic_re.sub(r'\\\1', value) + value = value.replace('\n', r'\n') value = _space_re.sub(r'\\\1', value) + if value[0] == '"': + value = '\\' + value elif value[0] == '"' or _space_re.search(value): value = '{%s}' % value return value diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/tkinter/test/support.py python3-stdlib-extensions-3.6.7/3.7/Lib/tkinter/test/support.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/tkinter/test/support.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/tkinter/test/support.py 2018-10-20 06:04:19.000000000 +0000 @@ -1,3 +1,4 @@ +import functools import re import tkinter import unittest @@ -54,9 +55,20 @@ tcl_version = tuple(map(int, _tkinter.TCL_VERSION.split('.'))) def requires_tcl(*version): - return unittest.skipUnless(tcl_version >= version, + if len(version) <= 2: + return unittest.skipUnless(tcl_version >= version, 'requires Tcl version >= ' + '.'.join(map(str, version))) + def deco(test): + @functools.wraps(test) + def newtest(self): + if get_tk_patchlevel() < (8, 6, 5): + self.skipTest('requires Tcl version >= ' + + '.'.join(map(str, get_tk_patchlevel()))) + test(self) + return newtest + return deco + _tk_patchlevel = None def get_tk_patchlevel(): global _tk_patchlevel diff -Nru python3-stdlib-extensions-3.6.6/3.7/Lib/tkinter/test/test_tkinter/test_widgets.py python3-stdlib-extensions-3.6.7/3.7/Lib/tkinter/test/test_tkinter/test_widgets.py --- python3-stdlib-extensions-3.6.6/3.7/Lib/tkinter/test/test_tkinter/test_widgets.py 2018-06-27 03:07:35.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/3.7/Lib/tkinter/test/test_tkinter/test_widgets.py 2018-10-20 06:04:19.000000000 +0000 @@ -703,7 +703,7 @@ 'disabledforeground', 'exportselection', 'font', 'foreground', 'height', 'highlightbackground', 'highlightcolor', 'highlightthickness', - 'listvariable', 'relief', + 'justify', 'listvariable', 'relief', 'selectbackground', 'selectborderwidth', 'selectforeground', 'selectmode', 'setgrid', 'state', 'takefocus', 'width', 'xscrollcommand', 'yscrollcommand', @@ -717,6 +717,8 @@ self.checkEnumParam(widget, 'activestyle', 'dotbox', 'none', 'underline') + test_justify = requires_tcl(8, 6, 5)(StandardOptionsTests.test_justify) + def test_listvariable(self): widget = self.create() var = tkinter.DoubleVar(self.root) @@ -951,7 +953,9 @@ OPTIONS = ( 'background', 'borderwidth', 'cursor', 'handlepad', 'handlesize', 'height', - 'opaqueresize', 'orient', 'relief', + 'opaqueresize', 'orient', + 'proxybackground', 'proxyborderwidth', 'proxyrelief', + 'relief', 'sashcursor', 'sashpad', 'sashrelief', 'sashwidth', 'showhandle', 'width', ) @@ -978,6 +982,23 @@ widget = self.create() self.checkBooleanParam(widget, 'opaqueresize') + @requires_tcl(8, 6, 5) + def test_proxybackground(self): + widget = self.create() + self.checkColorParam(widget, 'proxybackground') + + @requires_tcl(8, 6, 5) + def test_proxyborderwidth(self): + widget = self.create() + self.checkPixelsParam(widget, 'proxyborderwidth', + 0, 1.3, 2.9, 6, -2, '10p', + conv=noconv) + + @requires_tcl(8, 6, 5) + def test_proxyrelief(self): + widget = self.create() + self.checkReliefParam(widget, 'proxyrelief') + def test_sashcursor(self): widget = self.create() self.checkCursorParam(widget, 'sashcursor') diff -Nru python3-stdlib-extensions-3.6.6/debian/changelog python3-stdlib-extensions-3.6.7/debian/changelog --- python3-stdlib-extensions-3.6.6/debian/changelog 2018-06-27 15:01:32.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/debian/changelog 2018-10-22 11:15:03.000000000 +0000 @@ -1,3 +1,11 @@ +python3-stdlib-extensions (3.6.7-1~18.10) cosmic-proposed; urgency=medium + + * SRU: LP: #1799202. + * Update 3.6 extensions and modules to 3.6.7. + * Update 3.7 extensions and modules to 3.7.1. + + -- Matthias Klose Mon, 22 Oct 2018 13:15:03 +0200 + python3-stdlib-extensions (3.6.6-1) unstable; urgency=medium * Update 3.6 extensions and modules to 3.6.6. diff -Nru python3-stdlib-extensions-3.6.6/debian/control python3-stdlib-extensions-3.6.7/debian/control --- python3-stdlib-extensions-3.6.6/debian/control 2018-06-06 18:06:09.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/debian/control 2018-10-21 09:30:59.000000000 +0000 @@ -9,7 +9,7 @@ python3.6-dbg:any, python3.7-dbg:any, tk-dev, blt-dev (>= 2.4z-9), libgdbm-dev Build-Conflicts: tcl8.4-dev, tk8.4-dev, tcl8.5-dev, tk8.5-dev -Standards-Version: 4.1.4 +Standards-Version: 4.2.1 Vcs-Git: https://salsa.debian.org/cpython-team/python3-stdlib.git Vcs-Browser: https://salsa.debian.org/cpython-team/python3-stdlib diff -Nru python3-stdlib-extensions-3.6.6/debian/rules python3-stdlib-extensions-3.6.7/debian/rules --- python3-stdlib-extensions-3.6.6/debian/rules 2018-06-15 10:20:28.000000000 +0000 +++ python3-stdlib-extensions-3.6.7/debian/rules 2018-10-22 11:15:03.000000000 +0000 @@ -16,7 +16,7 @@ PYVERS = $(shell py3versions -vs) PYVERS = 3.6 3.7 -MIN_VER = 3.6.4-1~ +MIN_VER = 3.6.6-1~ include /usr/share/dpkg/architecture.mk