From webhook-mailer at python.org Sun Dec 1 00:44:30 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 01 Dec 2019 05:44:30 -0000 Subject: [Python-checkins] Fix typos (GH-17423) Message-ID: https://github.com/python/cpython/commit/575d0b46d122292ca6e0576a91265d7abf7cbc3d commit: 575d0b46d122292ca6e0576a91265d7abf7cbc3d branch: master author: Ofek Lev committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-11-30T21:44:21-08:00 summary: Fix typos (GH-17423) files: M Doc/library/datetime.rst diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index f9a114eeb0a75..2bd25cc4362b2 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -881,7 +881,7 @@ Other constructors, all class methods: Because naive ``datetime`` objects are treated by many ``datetime`` methods as local times, it is preferred to use aware datetimes to represent times in UTC. As such, the recommended way to create an object representing the - current time in UTC by calling ``datetime.now(timezone.utc)``. + current time in UTC is by calling ``datetime.now(timezone.utc)``. .. classmethod:: datetime.fromtimestamp(timestamp, tz=None) @@ -942,7 +942,7 @@ Other constructors, all class methods: Because naive ``datetime`` objects are treated by many ``datetime`` methods as local times, it is preferred to use aware datetimes to represent times in UTC. As such, the recommended way to create an object representing a - specific timestamp in UTC by calling + specific timestamp in UTC is by calling ``datetime.fromtimestamp(timestamp, tz=timezone.utc)``. .. versionchanged:: 3.3 From webhook-mailer at python.org Sun Dec 1 00:52:43 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 01 Dec 2019 05:52:43 -0000 Subject: [Python-checkins] Fix typos (GH-17423) Message-ID: https://github.com/python/cpython/commit/5f234538ab5625a81476981ab8772b46b67bf66e commit: 5f234538ab5625a81476981ab8772b46b67bf66e branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-11-30T21:52:39-08:00 summary: Fix typos (GH-17423) (cherry picked from commit 575d0b46d122292ca6e0576a91265d7abf7cbc3d) Co-authored-by: Ofek Lev files: M Doc/library/datetime.rst diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index b1e1b25691d8f..b49eab44aef9e 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -881,7 +881,7 @@ Other constructors, all class methods: Because naive ``datetime`` objects are treated by many ``datetime`` methods as local times, it is preferred to use aware datetimes to represent times in UTC. As such, the recommended way to create an object representing the - current time in UTC by calling ``datetime.now(timezone.utc)``. + current time in UTC is by calling ``datetime.now(timezone.utc)``. .. classmethod:: datetime.fromtimestamp(timestamp, tz=None) @@ -942,7 +942,7 @@ Other constructors, all class methods: Because naive ``datetime`` objects are treated by many ``datetime`` methods as local times, it is preferred to use aware datetimes to represent times in UTC. As such, the recommended way to create an object representing a - specific timestamp in UTC by calling + specific timestamp in UTC is by calling ``datetime.fromtimestamp(timestamp, tz=timezone.utc)``. .. versionchanged:: 3.3 From webhook-mailer at python.org Sun Dec 1 15:07:43 2019 From: webhook-mailer at python.org (Tal Einat) Date: Sun, 01 Dec 2019 20:07:43 -0000 Subject: [Python-checkins] document threading.Lock.locked() (GH-17427) Message-ID: https://github.com/python/cpython/commit/fdafa1d0ed0a8930b52ee81e57c931cc4d5c2388 commit: fdafa1d0ed0a8930b52ee81e57c931cc4d5c2388 branch: master author: idomic committer: Tal Einat date: 2019-12-01T22:07:39+02:00 summary: document threading.Lock.locked() (GH-17427) files: M Doc/library/threading.rst diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index 9a68491fbd53f..96989bdd525e0 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -496,6 +496,10 @@ All methods are executed atomically. There is no return value. + .. method:: locked() + Return true if the lock is acquired. + + .. _rlock-objects: From webhook-mailer at python.org Sun Dec 1 15:12:14 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 01 Dec 2019 20:12:14 -0000 Subject: [Python-checkins] document threading.Lock.locked() (GH-17427) Message-ID: https://github.com/python/cpython/commit/864207181d74800cf3f4e6c45b637854c65aa415 commit: 864207181d74800cf3f4e6c45b637854c65aa415 branch: 2.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-01T12:12:09-08:00 summary: document threading.Lock.locked() (GH-17427) (cherry picked from commit fdafa1d0ed0a8930b52ee81e57c931cc4d5c2388) Co-authored-by: idomic files: M Doc/library/threading.rst diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index e16f78c204771..9228e11442374 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -448,6 +448,10 @@ All methods are executed atomically. There is no return value. + .. method:: locked() + Return true if the lock is acquired. + + .. _rlock-objects: From webhook-mailer at python.org Sun Dec 1 15:13:22 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 01 Dec 2019 20:13:22 -0000 Subject: [Python-checkins] document threading.Lock.locked() (GH-17427) Message-ID: https://github.com/python/cpython/commit/cbac6ee3f6aaced5b4f8126199eef89c64ef99fc commit: cbac6ee3f6aaced5b4f8126199eef89c64ef99fc branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-01T12:13:18-08:00 summary: document threading.Lock.locked() (GH-17427) (cherry picked from commit fdafa1d0ed0a8930b52ee81e57c931cc4d5c2388) Co-authored-by: idomic files: M Doc/library/threading.rst diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index 6fcdd42d6080d..02af94eda6cc9 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -418,6 +418,10 @@ All methods are executed atomically. There is no return value. + .. method:: locked() + Return true if the lock is acquired. + + .. _rlock-objects: From webhook-mailer at python.org Sun Dec 1 15:14:30 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 01 Dec 2019 20:14:30 -0000 Subject: [Python-checkins] document threading.Lock.locked() (GH-17427) Message-ID: https://github.com/python/cpython/commit/d300c0e845cdb898b0950642ed75dd0ae883ad12 commit: d300c0e845cdb898b0950642ed75dd0ae883ad12 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-01T12:14:26-08:00 summary: document threading.Lock.locked() (GH-17427) (cherry picked from commit fdafa1d0ed0a8930b52ee81e57c931cc4d5c2388) Co-authored-by: idomic files: M Doc/library/threading.rst diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index fd815ef01716d..93ea4bda7cd7a 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -488,6 +488,10 @@ All methods are executed atomically. There is no return value. + .. method:: locked() + Return true if the lock is acquired. + + .. _rlock-objects: From webhook-mailer at python.org Sun Dec 1 18:06:40 2019 From: webhook-mailer at python.org (Abhilash Raj) Date: Sun, 01 Dec 2019 23:06:40 -0000 Subject: [Python-checkins] bpo-38449: Add URL delimiters test cases (#16729) Message-ID: https://github.com/python/cpython/commit/2fe4c48917c2d1b40cf063c6ed22ae2e71f4cb62 commit: 2fe4c48917c2d1b40cf063c6ed22ae2e71f4cb62 branch: master author: Dong-hee Na committer: Abhilash Raj date: 2019-12-01T15:06:28-08:00 summary: bpo-38449: Add URL delimiters test cases (#16729) * bpo-38449: Add tricky test cases * bpo-38449: Reflect codereview files: M Lib/test/test_mimetypes.py diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py index bfd5eeedaa77b..a5a06b189dec4 100644 --- a/Lib/test/test_mimetypes.py +++ b/Lib/test/test_mimetypes.py @@ -51,6 +51,21 @@ def test_non_standard_types(self): eq(self.db.guess_type('foo.xul', strict=False), ('text/xul', None)) eq(self.db.guess_extension('image/jpg', strict=False), '.jpg') + def test_filename_with_url_delimiters(self): + # bpo-38449: URL delimiters cases should be handled also. + # They would have different mime types if interpreted as URL as + # compared to when interpreted as filename because of the semicolon. + eq = self.assertEqual + gzip_expected = ('application/x-tar', 'gzip') + eq(self.db.guess_type(";1.tar.gz"), gzip_expected) + eq(self.db.guess_type("?1.tar.gz"), gzip_expected) + eq(self.db.guess_type("#1.tar.gz"), gzip_expected) + eq(self.db.guess_type("#1#.tar.gz"), gzip_expected) + eq(self.db.guess_type(";1#.tar.gz"), gzip_expected) + eq(self.db.guess_type(";&1=123;?.tar.gz"), gzip_expected) + eq(self.db.guess_type("?k1=v1&k2=v2.tar.gz"), gzip_expected) + eq(self.db.guess_type(r" \"\`;b&b&c |.tar.gz"), gzip_expected) + def test_guess_all_types(self): eq = self.assertEqual unless = self.assertTrue From webhook-mailer at python.org Sun Dec 1 18:23:37 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 01 Dec 2019 23:23:37 -0000 Subject: [Python-checkins] bpo-38449: Add URL delimiters test cases (GH-16729) Message-ID: https://github.com/python/cpython/commit/926eabb6b46106e677d5e1ea25b7bab918da4110 commit: 926eabb6b46106e677d5e1ea25b7bab918da4110 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-01T15:23:32-08:00 summary: bpo-38449: Add URL delimiters test cases (GH-16729) * bpo-38449: Add tricky test cases * bpo-38449: Reflect codereview (cherry picked from commit 2fe4c48917c2d1b40cf063c6ed22ae2e71f4cb62) Co-authored-by: Dong-hee Na files: M Lib/test/test_mimetypes.py diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py index adbec8dab4266..f29de8c3a1a28 100644 --- a/Lib/test/test_mimetypes.py +++ b/Lib/test/test_mimetypes.py @@ -50,6 +50,21 @@ def test_non_standard_types(self): eq(self.db.guess_type('foo.xul', strict=False), ('text/xul', None)) eq(self.db.guess_extension('image/jpg', strict=False), '.jpg') + def test_filename_with_url_delimiters(self): + # bpo-38449: URL delimiters cases should be handled also. + # They would have different mime types if interpreted as URL as + # compared to when interpreted as filename because of the semicolon. + eq = self.assertEqual + gzip_expected = ('application/x-tar', 'gzip') + eq(self.db.guess_type(";1.tar.gz"), gzip_expected) + eq(self.db.guess_type("?1.tar.gz"), gzip_expected) + eq(self.db.guess_type("#1.tar.gz"), gzip_expected) + eq(self.db.guess_type("#1#.tar.gz"), gzip_expected) + eq(self.db.guess_type(";1#.tar.gz"), gzip_expected) + eq(self.db.guess_type(";&1=123;?.tar.gz"), gzip_expected) + eq(self.db.guess_type("?k1=v1&k2=v2.tar.gz"), gzip_expected) + eq(self.db.guess_type(r" \"\`;b&b&c |.tar.gz"), gzip_expected) + def test_guess_all_types(self): eq = self.assertEqual unless = self.assertTrue From webhook-mailer at python.org Sun Dec 1 18:24:21 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 01 Dec 2019 23:24:21 -0000 Subject: [Python-checkins] bpo-38449: Add URL delimiters test cases (GH-16729) Message-ID: https://github.com/python/cpython/commit/4f1eaf028058cc357030dfaa5e611c90662539f0 commit: 4f1eaf028058cc357030dfaa5e611c90662539f0 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-01T15:24:17-08:00 summary: bpo-38449: Add URL delimiters test cases (GH-16729) * bpo-38449: Add tricky test cases * bpo-38449: Reflect codereview (cherry picked from commit 2fe4c48917c2d1b40cf063c6ed22ae2e71f4cb62) Co-authored-by: Dong-hee Na files: M Lib/test/test_mimetypes.py diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py index bfd5eeedaa77b..a5a06b189dec4 100644 --- a/Lib/test/test_mimetypes.py +++ b/Lib/test/test_mimetypes.py @@ -51,6 +51,21 @@ def test_non_standard_types(self): eq(self.db.guess_type('foo.xul', strict=False), ('text/xul', None)) eq(self.db.guess_extension('image/jpg', strict=False), '.jpg') + def test_filename_with_url_delimiters(self): + # bpo-38449: URL delimiters cases should be handled also. + # They would have different mime types if interpreted as URL as + # compared to when interpreted as filename because of the semicolon. + eq = self.assertEqual + gzip_expected = ('application/x-tar', 'gzip') + eq(self.db.guess_type(";1.tar.gz"), gzip_expected) + eq(self.db.guess_type("?1.tar.gz"), gzip_expected) + eq(self.db.guess_type("#1.tar.gz"), gzip_expected) + eq(self.db.guess_type("#1#.tar.gz"), gzip_expected) + eq(self.db.guess_type(";1#.tar.gz"), gzip_expected) + eq(self.db.guess_type(";&1=123;?.tar.gz"), gzip_expected) + eq(self.db.guess_type("?k1=v1&k2=v2.tar.gz"), gzip_expected) + eq(self.db.guess_type(r" \"\`;b&b&c |.tar.gz"), gzip_expected) + def test_guess_all_types(self): eq = self.assertEqual unless = self.assertTrue From webhook-mailer at python.org Mon Dec 2 11:15:47 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 02 Dec 2019 16:15:47 -0000 Subject: [Python-checkins] bpo-38815: Accept TLSv3 default in min max test (GH-NNNN) (GH-17437) Message-ID: https://github.com/python/cpython/commit/34864d1cffdbfc620f8517dab9a68ae9a37b8c53 commit: 34864d1cffdbfc620f8517dab9a68ae9a37b8c53 branch: master author: torsava committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-02T08:15:42-08:00 summary: bpo-38815: Accept TLSv3 default in min max test (GH-NNNN) (GH-17437) Make ssl tests less strict and also accept TLSv3 as the default maximum version. This change unbreaks test_min_max_version on Fedora 32. https://bugs.python.org/issue38815 files: M Lib/test/test_ssl.py diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 3cd6e927a469e..258816d912b36 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1203,12 +1203,18 @@ def test_min_max_version(self): # RHEL 8 uses TLS 1.2 by default ssl.TLSVersion.TLSv1_2 } + maximum_range = { + # stock OpenSSL + ssl.TLSVersion.MAXIMUM_SUPPORTED, + # Fedora 32 uses TLS 1.3 by default + ssl.TLSVersion.TLSv1_3 + } self.assertIn( ctx.minimum_version, minimum_range ) - self.assertEqual( - ctx.maximum_version, ssl.TLSVersion.MAXIMUM_SUPPORTED + self.assertIn( + ctx.maximum_version, maximum_range ) ctx.minimum_version = ssl.TLSVersion.TLSv1_1 From webhook-mailer at python.org Mon Dec 2 11:34:49 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 02 Dec 2019 16:34:49 -0000 Subject: [Python-checkins] bpo-38815: Accept TLSv3 default in min max test (GH-NNNN) (GH-17437) Message-ID: https://github.com/python/cpython/commit/9e728806d03fff8fa9e75159e567b2b4e040971b commit: 9e728806d03fff8fa9e75159e567b2b4e040971b branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-02T08:34:44-08:00 summary: bpo-38815: Accept TLSv3 default in min max test (GH-NNNN) (GH-17437) Make ssl tests less strict and also accept TLSv3 as the default maximum version. This change unbreaks test_min_max_version on Fedora 32. https://bugs.python.org/issue38815 (cherry picked from commit 34864d1cffdbfc620f8517dab9a68ae9a37b8c53) Co-authored-by: torsava files: M Lib/test/test_ssl.py diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 419506f4d3c07..539cb7751db89 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1200,12 +1200,18 @@ def test_min_max_version(self): # RHEL 8 uses TLS 1.2 by default ssl.TLSVersion.TLSv1_2 } + maximum_range = { + # stock OpenSSL + ssl.TLSVersion.MAXIMUM_SUPPORTED, + # Fedora 32 uses TLS 1.3 by default + ssl.TLSVersion.TLSv1_3 + } self.assertIn( ctx.minimum_version, minimum_range ) - self.assertEqual( - ctx.maximum_version, ssl.TLSVersion.MAXIMUM_SUPPORTED + self.assertIn( + ctx.maximum_version, maximum_range ) ctx.minimum_version = ssl.TLSVersion.TLSv1_1 From webhook-mailer at python.org Mon Dec 2 11:35:55 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 02 Dec 2019 16:35:55 -0000 Subject: [Python-checkins] bpo-38815: Accept TLSv3 default in min max test (GH-NNNN) (GH-17437) Message-ID: https://github.com/python/cpython/commit/1f4f28cbf3ca4c7f85b41b1f7b9455a375415cc0 commit: 1f4f28cbf3ca4c7f85b41b1f7b9455a375415cc0 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-02T08:35:50-08:00 summary: bpo-38815: Accept TLSv3 default in min max test (GH-NNNN) (GH-17437) Make ssl tests less strict and also accept TLSv3 as the default maximum version. This change unbreaks test_min_max_version on Fedora 32. https://bugs.python.org/issue38815 (cherry picked from commit 34864d1cffdbfc620f8517dab9a68ae9a37b8c53) Co-authored-by: torsava files: M Lib/test/test_ssl.py diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index e21e7e07455cc..a01999f6aa3d8 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1220,12 +1220,18 @@ def test_min_max_version(self): # RHEL 8 uses TLS 1.2 by default ssl.TLSVersion.TLSv1_2 } + maximum_range = { + # stock OpenSSL + ssl.TLSVersion.MAXIMUM_SUPPORTED, + # Fedora 32 uses TLS 1.3 by default + ssl.TLSVersion.TLSv1_3 + } self.assertIn( ctx.minimum_version, minimum_range ) - self.assertEqual( - ctx.maximum_version, ssl.TLSVersion.MAXIMUM_SUPPORTED + self.assertIn( + ctx.maximum_version, maximum_range ) ctx.minimum_version = ssl.TLSVersion.TLSv1_1 From webhook-mailer at python.org Mon Dec 2 13:09:51 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Mon, 02 Dec 2019 18:09:51 -0000 Subject: [Python-checkins] Fix compiler warning in Objects/unicodeobject.c (GH-17440) Message-ID: https://github.com/python/cpython/commit/016b0280b8a97bc26e97c6a8dd5fb8fad5fe72e4 commit: 016b0280b8a97bc26e97c6a8dd5fb8fad5fe72e4 branch: master author: Pablo Galindo committer: GitHub date: 2019-12-02T18:09:43Z summary: Fix compiler warning in Objects/unicodeobject.c (GH-17440) files: M Objects/unicodeobject.c diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 77760195b32e7..1ec2accdb09f2 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -15950,7 +15950,7 @@ _PyUnicode_Fini(PyThreadState *tstate) interp->fs_codec.encoding = NULL; PyMem_RawFree(interp->fs_codec.errors); interp->fs_codec.errors = NULL; - interp->config.filesystem_errors = _Py_ERROR_UNKNOWN; + interp->config.filesystem_errors = (wchar_t *)_Py_ERROR_UNKNOWN; } From webhook-mailer at python.org Mon Dec 2 17:25:28 2019 From: webhook-mailer at python.org (Guido van Rossum) Date: Mon, 02 Dec 2019 22:25:28 -0000 Subject: [Python-checkins] bpo-38945: UU Encoding: Don't let newline in filename corrupt the output format (#17418) Message-ID: https://github.com/python/cpython/commit/a62ad4730c9b575f140f24074656c0257c86a09a commit: a62ad4730c9b575f140f24074656c0257c86a09a branch: master author: Matthew Rollings <1211162+stealthcopter at users.noreply.github.com> committer: Guido van Rossum date: 2019-12-02T14:25:21-08:00 summary: bpo-38945: UU Encoding: Don't let newline in filename corrupt the output format (#17418) files: A Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst M Lib/encodings/uu_codec.py M Lib/test/test_uu.py M Lib/uu.py diff --git a/Lib/encodings/uu_codec.py b/Lib/encodings/uu_codec.py index 2a5728fb5b74a..4e58c62fe9ef0 100644 --- a/Lib/encodings/uu_codec.py +++ b/Lib/encodings/uu_codec.py @@ -20,6 +20,10 @@ def uu_encode(input, errors='strict', filename='', mode=0o666): read = infile.read write = outfile.write + # Remove newline chars from filename + filename = filename.replace('\n','\\n') + filename = filename.replace('\r','\\r') + # Encode write(('begin %o %s\n' % (mode & 0o777, filename)).encode('ascii')) chunk = read(45) diff --git a/Lib/test/test_uu.py b/Lib/test/test_uu.py index c9f05e5b760d9..c8709f7a0d666 100644 --- a/Lib/test/test_uu.py +++ b/Lib/test/test_uu.py @@ -136,6 +136,15 @@ def test_garbage_padding(self): decoded = codecs.decode(encodedtext, "uu_codec") self.assertEqual(decoded, plaintext) + def test_newlines_escaped(self): + # Test newlines are escaped with uu.encode + inp = io.BytesIO(plaintext) + out = io.BytesIO() + filename = "test.txt\n\roverflow.txt" + safefilename = b"test.txt\\n\\roverflow.txt" + uu.encode(inp, out, filename) + self.assertIn(safefilename, out.getvalue()) + class UUStdIOTest(unittest.TestCase): def setUp(self): diff --git a/Lib/uu.py b/Lib/uu.py index 9b1e5e607207f..9f1f37f1a6410 100755 --- a/Lib/uu.py +++ b/Lib/uu.py @@ -73,6 +73,13 @@ def encode(in_file, out_file, name=None, mode=None, *, backtick=False): name = '-' if mode is None: mode = 0o666 + + # + # Remove newline chars from name + # + name = name.replace('\n','\\n') + name = name.replace('\r','\\r') + # # Write the data # diff --git a/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst b/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst new file mode 100644 index 0000000000000..1bf6ed567b241 --- /dev/null +++ b/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst @@ -0,0 +1 @@ +Newline characters have been escaped when performing uu encoding to prevent them from overflowing into to content section of the encoded file. This prevents malicious or accidental modification of data during the decoding process. \ No newline at end of file From webhook-mailer at python.org Mon Dec 2 17:43:19 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 02 Dec 2019 22:43:19 -0000 Subject: [Python-checkins] bpo-38945: UU Encoding: Don't let newline in filename corrupt the output format (GH-17418) Message-ID: https://github.com/python/cpython/commit/87f2d261ee1c63ed39517355833d087c5a78b4bf commit: 87f2d261ee1c63ed39517355833d087c5a78b4bf branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-02T14:43:15-08:00 summary: bpo-38945: UU Encoding: Don't let newline in filename corrupt the output format (GH-17418) (cherry picked from commit a62ad4730c9b575f140f24074656c0257c86a09a) Co-authored-by: Matthew Rollings <1211162+stealthcopter at users.noreply.github.com> files: A Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst M Lib/encodings/uu_codec.py M Lib/test/test_uu.py M Lib/uu.py diff --git a/Lib/encodings/uu_codec.py b/Lib/encodings/uu_codec.py index 2a5728fb5b74a..4e58c62fe9ef0 100644 --- a/Lib/encodings/uu_codec.py +++ b/Lib/encodings/uu_codec.py @@ -20,6 +20,10 @@ def uu_encode(input, errors='strict', filename='', mode=0o666): read = infile.read write = outfile.write + # Remove newline chars from filename + filename = filename.replace('\n','\\n') + filename = filename.replace('\r','\\r') + # Encode write(('begin %o %s\n' % (mode & 0o777, filename)).encode('ascii')) chunk = read(45) diff --git a/Lib/test/test_uu.py b/Lib/test/test_uu.py index c9f05e5b760d9..c8709f7a0d666 100644 --- a/Lib/test/test_uu.py +++ b/Lib/test/test_uu.py @@ -136,6 +136,15 @@ def test_garbage_padding(self): decoded = codecs.decode(encodedtext, "uu_codec") self.assertEqual(decoded, plaintext) + def test_newlines_escaped(self): + # Test newlines are escaped with uu.encode + inp = io.BytesIO(plaintext) + out = io.BytesIO() + filename = "test.txt\n\roverflow.txt" + safefilename = b"test.txt\\n\\roverflow.txt" + uu.encode(inp, out, filename) + self.assertIn(safefilename, out.getvalue()) + class UUStdIOTest(unittest.TestCase): def setUp(self): diff --git a/Lib/uu.py b/Lib/uu.py index 9b1e5e607207f..9f1f37f1a6410 100755 --- a/Lib/uu.py +++ b/Lib/uu.py @@ -73,6 +73,13 @@ def encode(in_file, out_file, name=None, mode=None, *, backtick=False): name = '-' if mode is None: mode = 0o666 + + # + # Remove newline chars from name + # + name = name.replace('\n','\\n') + name = name.replace('\r','\\r') + # # Write the data # diff --git a/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst b/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst new file mode 100644 index 0000000000000..1bf6ed567b241 --- /dev/null +++ b/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst @@ -0,0 +1 @@ +Newline characters have been escaped when performing uu encoding to prevent them from overflowing into to content section of the encoded file. This prevents malicious or accidental modification of data during the decoding process. \ No newline at end of file From webhook-mailer at python.org Mon Dec 2 17:44:48 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 02 Dec 2019 22:44:48 -0000 Subject: [Python-checkins] bpo-38945: UU Encoding: Don't let newline in filename corrupt the output format (GH-17418) Message-ID: https://github.com/python/cpython/commit/8859fc629474ab1ca7eb2e67aec538097c327e58 commit: 8859fc629474ab1ca7eb2e67aec538097c327e58 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-02T14:44:44-08:00 summary: bpo-38945: UU Encoding: Don't let newline in filename corrupt the output format (GH-17418) (cherry picked from commit a62ad4730c9b575f140f24074656c0257c86a09a) Co-authored-by: Matthew Rollings <1211162+stealthcopter at users.noreply.github.com> files: A Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst M Lib/encodings/uu_codec.py M Lib/test/test_uu.py M Lib/uu.py diff --git a/Lib/encodings/uu_codec.py b/Lib/encodings/uu_codec.py index 2a5728fb5b74a..4e58c62fe9ef0 100644 --- a/Lib/encodings/uu_codec.py +++ b/Lib/encodings/uu_codec.py @@ -20,6 +20,10 @@ def uu_encode(input, errors='strict', filename='', mode=0o666): read = infile.read write = outfile.write + # Remove newline chars from filename + filename = filename.replace('\n','\\n') + filename = filename.replace('\r','\\r') + # Encode write(('begin %o %s\n' % (mode & 0o777, filename)).encode('ascii')) chunk = read(45) diff --git a/Lib/test/test_uu.py b/Lib/test/test_uu.py index c9f05e5b760d9..c8709f7a0d666 100644 --- a/Lib/test/test_uu.py +++ b/Lib/test/test_uu.py @@ -136,6 +136,15 @@ def test_garbage_padding(self): decoded = codecs.decode(encodedtext, "uu_codec") self.assertEqual(decoded, plaintext) + def test_newlines_escaped(self): + # Test newlines are escaped with uu.encode + inp = io.BytesIO(plaintext) + out = io.BytesIO() + filename = "test.txt\n\roverflow.txt" + safefilename = b"test.txt\\n\\roverflow.txt" + uu.encode(inp, out, filename) + self.assertIn(safefilename, out.getvalue()) + class UUStdIOTest(unittest.TestCase): def setUp(self): diff --git a/Lib/uu.py b/Lib/uu.py index 9b1e5e607207f..9f1f37f1a6410 100755 --- a/Lib/uu.py +++ b/Lib/uu.py @@ -73,6 +73,13 @@ def encode(in_file, out_file, name=None, mode=None, *, backtick=False): name = '-' if mode is None: mode = 0o666 + + # + # Remove newline chars from name + # + name = name.replace('\n','\\n') + name = name.replace('\r','\\r') + # # Write the data # diff --git a/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst b/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst new file mode 100644 index 0000000000000..1bf6ed567b241 --- /dev/null +++ b/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst @@ -0,0 +1 @@ +Newline characters have been escaped when performing uu encoding to prevent them from overflowing into to content section of the encoded file. This prevents malicious or accidental modification of data during the decoding process. \ No newline at end of file From webhook-mailer at python.org Mon Dec 2 18:34:38 2019 From: webhook-mailer at python.org (Ned Deily) Date: Mon, 02 Dec 2019 23:34:38 -0000 Subject: [Python-checkins] bpo-38945: UU Encoding: Don't let newline in filename corrupt the output format (GH-17418) (GH-17444) Message-ID: https://github.com/python/cpython/commit/30afc91f5e70cf4748ffac77a419ba69ebca6f6a commit: 30afc91f5e70cf4748ffac77a419ba69ebca6f6a branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Ned Deily date: 2019-12-02T18:34:31-05:00 summary: bpo-38945: UU Encoding: Don't let newline in filename corrupt the output format (GH-17418) (GH-17444) (cherry picked from commit a62ad4730c9b575f140f24074656c0257c86a09a) Co-authored-by: Matthew Rollings <1211162+stealthcopter at users.noreply.github.com> files: A Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst M Lib/encodings/uu_codec.py M Lib/test/test_uu.py M Lib/uu.py diff --git a/Lib/encodings/uu_codec.py b/Lib/encodings/uu_codec.py index 2a5728fb5b74a..4e58c62fe9ef0 100644 --- a/Lib/encodings/uu_codec.py +++ b/Lib/encodings/uu_codec.py @@ -20,6 +20,10 @@ def uu_encode(input, errors='strict', filename='', mode=0o666): read = infile.read write = outfile.write + # Remove newline chars from filename + filename = filename.replace('\n','\\n') + filename = filename.replace('\r','\\r') + # Encode write(('begin %o %s\n' % (mode & 0o777, filename)).encode('ascii')) chunk = read(45) diff --git a/Lib/test/test_uu.py b/Lib/test/test_uu.py index 735647898137e..3503d76b8597f 100644 --- a/Lib/test/test_uu.py +++ b/Lib/test/test_uu.py @@ -114,6 +114,15 @@ def test_garbage_padding(self): decoded = codecs.decode(encodedtext, "uu_codec") self.assertEqual(decoded, plaintext) + def test_newlines_escaped(self): + # Test newlines are escaped with uu.encode + inp = io.BytesIO(plaintext) + out = io.BytesIO() + filename = "test.txt\n\roverflow.txt" + safefilename = b"test.txt\\n\\roverflow.txt" + uu.encode(inp, out, filename) + self.assertIn(safefilename, out.getvalue()) + class UUStdIOTest(unittest.TestCase): def setUp(self): diff --git a/Lib/uu.py b/Lib/uu.py index d68d29374a8bb..3a8c31cff06d8 100755 --- a/Lib/uu.py +++ b/Lib/uu.py @@ -73,6 +73,13 @@ def encode(in_file, out_file, name=None, mode=None): name = '-' if mode is None: mode = 0o666 + + # + # Remove newline chars from name + # + name = name.replace('\n','\\n') + name = name.replace('\r','\\r') + # # Write the data # diff --git a/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst b/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst new file mode 100644 index 0000000000000..1bf6ed567b241 --- /dev/null +++ b/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst @@ -0,0 +1 @@ +Newline characters have been escaped when performing uu encoding to prevent them from overflowing into to content section of the encoded file. This prevents malicious or accidental modification of data during the decoding process. \ No newline at end of file From webhook-mailer at python.org Tue Dec 3 10:36:03 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 03 Dec 2019 15:36:03 -0000 Subject: [Python-checkins] bpo-38270: Fix indentation of test_hmac assertions (GH-17446) Message-ID: https://github.com/python/cpython/commit/894331838b256412c95d54051ec46a1cb96f52e7 commit: 894331838b256412c95d54051ec46a1cb96f52e7 branch: master author: stratakis committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-03T07:35:54-08:00 summary: bpo-38270: Fix indentation of test_hmac assertions (GH-17446) Since https://github.com/python/cpython/commit/c64a1a61e6fc542cada40eb069a239317e1af36e two assertions were indented and thus ignored when running test_hmac. This PR fixes it. As the change is quite trivial I didn't add a NEWS entry. https://bugs.python.org/issue38270 files: M Lib/test/test_hmac.py diff --git a/Lib/test/test_hmac.py b/Lib/test/test_hmac.py index ea00367c8027a..23c108f6e3c27 100644 --- a/Lib/test/test_hmac.py +++ b/Lib/test/test_hmac.py @@ -367,7 +367,7 @@ def test_with_bytearray(self): digestmod="sha256") except Exception: self.fail("Constructor call with bytearray arguments raised exception.") - self.assertEqual(h.hexdigest(), self.expected) + self.assertEqual(h.hexdigest(), self.expected) @requires_hashdigest('sha256') def test_with_memoryview_msg(self): @@ -375,7 +375,7 @@ def test_with_memoryview_msg(self): h = hmac.HMAC(b"key", memoryview(b"hash this!"), digestmod="sha256") except Exception: self.fail("Constructor call with memoryview msg raised exception.") - self.assertEqual(h.hexdigest(), self.expected) + self.assertEqual(h.hexdigest(), self.expected) @requires_hashdigest('sha256') def test_withmodule(self): From webhook-mailer at python.org Tue Dec 3 13:19:01 2019 From: webhook-mailer at python.org (Guido van Rossum) Date: Tue, 03 Dec 2019 18:19:01 -0000 Subject: [Python-checkins] [2.7] bpo-38945: UU Encoding: Don't let newline in filename corrupt the output format (GH-17418). (#17452) Message-ID: https://github.com/python/cpython/commit/a016d4e32cc9faa48105d00db275439c3dc93559 commit: a016d4e32cc9faa48105d00db275439c3dc93559 branch: 2.7 author: Matthew Rollings <1211162+stealthcopter at users.noreply.github.com> committer: Guido van Rossum date: 2019-12-03T10:18:52-08:00 summary: [2.7] bpo-38945: UU Encoding: Don't let newline in filename corrupt the output format (GH-17418). (#17452) (cherry picked from commit a62ad4730c9b575f140f24074656c0257c86a09a) Co-authored-by: Matthew Rollings <1211162+stealthcopter at users.noreply.github.com> files: A Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst M Lib/encodings/uu_codec.py M Lib/test/test_uu.py M Lib/uu.py diff --git a/Lib/encodings/uu_codec.py b/Lib/encodings/uu_codec.py index 5cb0d2b13e071..fcd5aa45a9708 100644 --- a/Lib/encodings/uu_codec.py +++ b/Lib/encodings/uu_codec.py @@ -31,6 +31,10 @@ def uu_encode(input,errors='strict',filename='',mode=0666): read = infile.read write = outfile.write + # Remove newline chars from filename + filename = filename.replace('\n','\\n') + filename = filename.replace('\r','\\r') + # Encode write('begin %o %s\n' % (mode & 0777, filename)) chunk = read(45) diff --git a/Lib/test/test_uu.py b/Lib/test/test_uu.py index df41cbc12d40d..f016bb2c67ea2 100644 --- a/Lib/test/test_uu.py +++ b/Lib/test/test_uu.py @@ -9,6 +9,7 @@ import cStringIO import sys import uu +import io plaintext = "The smooth-scaled python crept over the sleeping dog\n" @@ -82,6 +83,15 @@ def test_garbage_padding(self): decoded = codecs.decode(encodedtext, "uu_codec") self.assertEqual(decoded, plaintext) + def test_newlines_escaped(self): + # Test newlines are escaped with uu.encode + inp = io.BytesIO(plaintext) + out = io.BytesIO() + filename = "test.txt\n\roverflow.txt" + safefilename = b"test.txt\\n\\roverflow.txt" + uu.encode(inp, out, filename) + self.assertIn(safefilename, out.getvalue()) + class UUStdIOTest(unittest.TestCase): def setUp(self): diff --git a/Lib/uu.py b/Lib/uu.py index f8fa4c4757661..8eaea5960dffe 100755 --- a/Lib/uu.py +++ b/Lib/uu.py @@ -73,6 +73,13 @@ def encode(in_file, out_file, name=None, mode=None): name = '-' if mode is None: mode = 0666 + + # + # Remove newline chars from name + # + name = name.replace('\n','\\n') + name = name.replace('\r','\\r') + # # Write the data # diff --git a/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst b/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst new file mode 100644 index 0000000000000..1bf6ed567b241 --- /dev/null +++ b/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst @@ -0,0 +1 @@ +Newline characters have been escaped when performing uu encoding to prevent them from overflowing into to content section of the encoded file. This prevents malicious or accidental modification of data during the decoding process. \ No newline at end of file From webhook-mailer at python.org Tue Dec 3 18:31:09 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 03 Dec 2019 23:31:09 -0000 Subject: [Python-checkins] bpo-27873: Update docstring for multiprocessing.Pool.map (GH-17436) Message-ID: https://github.com/python/cpython/commit/eb48a451e3844185b9a8751c9badffbddc89689d commit: eb48a451e3844185b9a8751c9badffbddc89689d branch: master author: An Long committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-03T15:30:53-08:00 summary: bpo-27873: Update docstring for multiprocessing.Pool.map (GH-17436) Update docstring for `multiprocessing.Pool.map` to mention `pool.starmap()`. Prev PR: https://github.com/python/cpython/pull/17367 @aeros https://bugs.python.org/issue27873 files: M Doc/library/multiprocessing.rst diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index d8182feab963a..3c7b5cc126209 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -2169,7 +2169,8 @@ with the :class:`Pool` class. .. method:: map(func, iterable[, chunksize]) A parallel equivalent of the :func:`map` built-in function (it supports only - one *iterable* argument though). It blocks until the result is ready. + one *iterable* argument though, for multiple iterables see :meth:`starmap`). + It blocks until the result is ready. This method chops the iterable into a number of chunks which it submits to the process pool as separate tasks. The (approximate) size of these From webhook-mailer at python.org Tue Dec 3 18:36:52 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 03 Dec 2019 23:36:52 -0000 Subject: [Python-checkins] bpo-27873: Update docstring for multiprocessing.Pool.map (GH-17436) Message-ID: https://github.com/python/cpython/commit/55a7046471e19843a68d4a1a15252fd197bb6913 commit: 55a7046471e19843a68d4a1a15252fd197bb6913 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-03T15:36:47-08:00 summary: bpo-27873: Update docstring for multiprocessing.Pool.map (GH-17436) Update docstring for `multiprocessing.Pool.map` to mention `pool.starmap()`. Prev PR: https://github.com/python/cpython/pull/17367 @aeros https://bugs.python.org/issue27873 (cherry picked from commit eb48a451e3844185b9a8751c9badffbddc89689d) Co-authored-by: An Long files: M Doc/library/multiprocessing.rst diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index 96e0dc831b795..9bed380117edd 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -2142,7 +2142,8 @@ with the :class:`Pool` class. .. method:: map(func, iterable[, chunksize]) A parallel equivalent of the :func:`map` built-in function (it supports only - one *iterable* argument though). It blocks until the result is ready. + one *iterable* argument though, for multiple iterables see :meth:`starmap`). + It blocks until the result is ready. This method chops the iterable into a number of chunks which it submits to the process pool as separate tasks. The (approximate) size of these From webhook-mailer at python.org Tue Dec 3 18:37:44 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 03 Dec 2019 23:37:44 -0000 Subject: [Python-checkins] bpo-27873: Update docstring for multiprocessing.Pool.map (GH-17436) Message-ID: https://github.com/python/cpython/commit/baf07395eaa77e515ddfa1d3f42785d50b4d2889 commit: baf07395eaa77e515ddfa1d3f42785d50b4d2889 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-03T15:37:40-08:00 summary: bpo-27873: Update docstring for multiprocessing.Pool.map (GH-17436) Update docstring for `multiprocessing.Pool.map` to mention `pool.starmap()`. Prev PR: https://github.com/python/cpython/pull/17367 @aeros https://bugs.python.org/issue27873 (cherry picked from commit eb48a451e3844185b9a8751c9badffbddc89689d) Co-authored-by: An Long files: M Doc/library/multiprocessing.rst diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index d8182feab963a..3c7b5cc126209 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -2169,7 +2169,8 @@ with the :class:`Pool` class. .. method:: map(func, iterable[, chunksize]) A parallel equivalent of the :func:`map` built-in function (it supports only - one *iterable* argument though). It blocks until the result is ready. + one *iterable* argument though, for multiple iterables see :meth:`starmap`). + It blocks until the result is ready. This method chops the iterable into a number of chunks which it submits to the process pool as separate tasks. The (approximate) size of these From webhook-mailer at python.org Wed Dec 4 01:15:27 2019 From: webhook-mailer at python.org (Inada Naoki) Date: Wed, 04 Dec 2019 06:15:27 -0000 Subject: [Python-checkins] bpo-29636: Add --(no-)indent arguments to json.tool (GH-345) Message-ID: https://github.com/python/cpython/commit/03257949bc02a4afdf2ea1eb07a73f8128129579 commit: 03257949bc02a4afdf2ea1eb07a73f8128129579 branch: master author: Daniel Himmelstein committer: Inada Naoki date: 2019-12-04T15:15:19+09:00 summary: bpo-29636: Add --(no-)indent arguments to json.tool (GH-345) files: A Misc/NEWS.d/next/Library/2018-02-22-11-24-33.bpo-29636.ogGRE2.rst M Lib/json/tool.py M Lib/test/test_json/test_tool.py diff --git a/Lib/json/tool.py b/Lib/json/tool.py index b3ef9923e3146..6c687d77c511c 100644 --- a/Lib/json/tool.py +++ b/Lib/json/tool.py @@ -30,20 +30,36 @@ def main(): help='sort the output of dictionaries alphabetically by key') parser.add_argument('--json-lines', action='store_true', default=False, help='parse input using the jsonlines format') + group = parser.add_mutually_exclusive_group() + group.add_argument('--indent', default=4, type=int, + help='separate items with newlines and use this number ' + 'of spaces for indentation') + group.add_argument('--tab', action='store_const', dest='indent', + const='\t', help='separate items with newlines and use ' + 'tabs for indentation') + group.add_argument('--no-indent', action='store_const', dest='indent', + const=None, + help='separate items with spaces rather than newlines') + group.add_argument('--compact', action='store_true', + help='suppress all whitespace separation (most compact)') options = parser.parse_args() - infile = options.infile - outfile = options.outfile - sort_keys = options.sort_keys - json_lines = options.json_lines - with infile, outfile: + dump_args = { + 'sort_keys': options.sort_keys, + 'indent': options.indent, + } + if options.compact: + dump_args['indent'] = None + dump_args['separators'] = ',', ':' + + with options.infile as infile, options.outfile as outfile: try: - if json_lines: + if options.json_lines: objs = (json.loads(line) for line in infile) else: objs = (json.load(infile), ) for obj in objs: - json.dump(obj, outfile, sort_keys=sort_keys, indent=4) + json.dump(obj, outfile, **dump_args) outfile.write('\n') except ValueError as e: raise SystemExit(e) diff --git a/Lib/test/test_json/test_tool.py b/Lib/test/test_json/test_tool.py index 1e95bc79e5d18..81d179c6d10b0 100644 --- a/Lib/test/test_json/test_tool.py +++ b/Lib/test/test_json/test_tool.py @@ -134,3 +134,44 @@ def test_sort_keys_flag(self): self.assertEqual(out.splitlines(), self.expect_without_sort_keys.encode().splitlines()) self.assertEqual(err, b'') + + def test_indent(self): + json_stdin = b'[1, 2]' + expect = textwrap.dedent('''\ + [ + 1, + 2 + ] + ''').encode() + args = sys.executable, '-m', 'json.tool', '--indent', '2' + with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) as proc: + json_stdout, err = proc.communicate(json_stdin) + self.assertEqual(expect.splitlines(), json_stdout.splitlines()) + self.assertEqual(err, b'') + + def test_no_indent(self): + json_stdin = b'[1,\n2]' + expect = b'[1, 2]' + args = sys.executable, '-m', 'json.tool', '--no-indent' + with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) as proc: + json_stdout, err = proc.communicate(json_stdin) + self.assertEqual(expect.splitlines(), json_stdout.splitlines()) + self.assertEqual(err, b'') + + def test_tab(self): + json_stdin = b'[1, 2]' + expect = b'[\n\t1,\n\t2\n]\n' + args = sys.executable, '-m', 'json.tool', '--tab' + with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) as proc: + json_stdout, err = proc.communicate(json_stdin) + self.assertEqual(expect.splitlines(), json_stdout.splitlines()) + self.assertEqual(err, b'') + + def test_compact(self): + json_stdin = b'[ 1 ,\n 2]' + expect = b'[1,2]' + args = sys.executable, '-m', 'json.tool', '--compact' + with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) as proc: + json_stdout, err = proc.communicate(json_stdin) + self.assertEqual(expect.splitlines(), json_stdout.splitlines()) + self.assertEqual(err, b'') diff --git a/Misc/NEWS.d/next/Library/2018-02-22-11-24-33.bpo-29636.ogGRE2.rst b/Misc/NEWS.d/next/Library/2018-02-22-11-24-33.bpo-29636.ogGRE2.rst new file mode 100644 index 0000000000000..9f96ed28f927f --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-02-22-11-24-33.bpo-29636.ogGRE2.rst @@ -0,0 +1,5 @@ +Add whitespace options for formatting JSON with the ``json.tool`` CLI. The +following mutually exclusive options are now supported: ``--indent`` for +setting the indent level in spaces; ``--tab`` for indenting with tabs; +``--no-indent`` for suppressing newlines; and ``--compact`` for suppressing +all whitespace. The default behavior remains the same as ``--indent=4``. From webhook-mailer at python.org Wed Dec 4 03:18:38 2019 From: webhook-mailer at python.org (Ethan Furman) Date: Wed, 04 Dec 2019 08:18:38 -0000 Subject: [Python-checkins] add @ethanfurman for tarfile (GH-17461) Message-ID: https://github.com/python/cpython/commit/83f144962fd3f6677e35e5a02b62ab909497c58b commit: 83f144962fd3f6677e35e5a02b62ab909497c58b branch: master author: Ethan Furman committer: GitHub date: 2019-12-04T00:18:31-08:00 summary: add @ethanfurman for tarfile (GH-17461) files: M .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 7b415ac5c2f52..40305d4607ad9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -116,6 +116,7 @@ Include/pytime.h @pganssle @abalkin **/*enum* @ethanfurman **/*cgi* @ethanfurman +**/*tarfile* @ethanfurman # macOS /Mac/ @python/macos-team From webhook-mailer at python.org Wed Dec 4 04:07:10 2019 From: webhook-mailer at python.org (Raymond Hettinger) Date: Wed, 04 Dec 2019 09:07:10 -0000 Subject: [Python-checkins] Add setobject.c (GH-17463) Message-ID: https://github.com/python/cpython/commit/edd5b38c137db82e2857242518fcc400e9b5a9c1 commit: edd5b38c137db82e2857242518fcc400e9b5a9c1 branch: master author: Raymond Hettinger committer: GitHub date: 2019-12-04T04:07:02-05:00 summary: Add setobject.c (GH-17463) files: M .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 40305d4607ad9..9354cc85d2883 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -11,6 +11,7 @@ **/*context* @1st1 **/*genobject* @1st1 **/*hamt* @1st1 +Objects/set* @rhettinger Objects/dict* @methane # Hashing From webhook-mailer at python.org Wed Dec 4 04:29:18 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 04 Dec 2019 09:29:18 -0000 Subject: [Python-checkins] bpo-38962: Fix reference leak in test_httpservers (GH-17454) Message-ID: https://github.com/python/cpython/commit/24f5cac7254177a4c9956d680c0a9b6dadd85c6f commit: 24f5cac7254177a4c9956d680c0a9b6dadd85c6f branch: master author: Pablo Galindo committer: Victor Stinner date: 2019-12-04T10:29:10+01:00 summary: bpo-38962: Fix reference leak in test_httpservers (GH-17454) files: M Lib/test/test_httpservers.py diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index 26da71e0b2701..c442f5571a868 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -807,11 +807,15 @@ def test_query_with_continuous_slashes(self): (res.read(), res.getheader('Content-type'), res.status)) def test_cgi_path_in_sub_directories(self): - CGIHTTPRequestHandler.cgi_directories.append('/sub/dir/cgi-bin') - res = self.request('/sub/dir/cgi-bin/file5.py') - self.assertEqual( - (b'Hello World' + self.linesep, 'text/html', HTTPStatus.OK), - (res.read(), res.getheader('Content-type'), res.status)) + try: + CGIHTTPRequestHandler.cgi_directories.append('/sub/dir/cgi-bin') + res = self.request('/sub/dir/cgi-bin/file5.py') + self.assertEqual( + (b'Hello World' + self.linesep, 'text/html', HTTPStatus.OK), + (res.read(), res.getheader('Content-type'), res.status)) + finally: + CGIHTTPRequestHandler.cgi_directories.remove('/sub/dir/cgi-bin') + class SocketlessRequestHandler(SimpleHTTPRequestHandler): From webhook-mailer at python.org Wed Dec 4 04:39:37 2019 From: webhook-mailer at python.org (Inada Naoki) Date: Wed, 04 Dec 2019 09:39:37 -0000 Subject: [Python-checkins] bpo-33684: json.tool: Use utf-8 for infile and outfile. (GH-17460) Message-ID: https://github.com/python/cpython/commit/808769f3a4cbdc47cf1a5708dd61b1787bb192d4 commit: 808769f3a4cbdc47cf1a5708dd61b1787bb192d4 branch: master author: Inada Naoki committer: GitHub date: 2019-12-04T18:39:31+09:00 summary: bpo-33684: json.tool: Use utf-8 for infile and outfile. (GH-17460) files: A Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst M Lib/json/tool.py M Lib/test/test_json/test_tool.py diff --git a/Lib/json/tool.py b/Lib/json/tool.py index 6c687d77c511c..2a404a4441796 100644 --- a/Lib/json/tool.py +++ b/Lib/json/tool.py @@ -20,10 +20,12 @@ def main(): description = ('A simple command line interface for json module ' 'to validate and pretty-print JSON objects.') parser = argparse.ArgumentParser(prog=prog, description=description) - parser.add_argument('infile', nargs='?', type=argparse.FileType(), + parser.add_argument('infile', nargs='?', + type=argparse.FileType(encoding="utf-8"), help='a JSON file to be validated or pretty-printed', default=sys.stdin) - parser.add_argument('outfile', nargs='?', type=argparse.FileType('w'), + parser.add_argument('outfile', nargs='?', + type=argparse.FileType('w', encoding="utf-8"), help='write the output of infile to outfile', default=sys.stdout) parser.add_argument('--sort-keys', action='store_true', default=False, diff --git a/Lib/test/test_json/test_tool.py b/Lib/test/test_json/test_tool.py index 81d179c6d10b0..953a5696e7c22 100644 --- a/Lib/test/test_json/test_tool.py +++ b/Lib/test/test_json/test_tool.py @@ -89,11 +89,11 @@ def test_stdin_stdout(self): self.assertEqual(out.splitlines(), self.expect.encode().splitlines()) self.assertEqual(err, b'') - def _create_infile(self): + def _create_infile(self, data=None): infile = support.TESTFN - with open(infile, "w") as fp: + with open(infile, "w", encoding="utf-8") as fp: self.addCleanup(os.remove, infile) - fp.write(self.data) + fp.write(data or self.data) return infile def test_infile_stdout(self): @@ -103,6 +103,21 @@ def test_infile_stdout(self): self.assertEqual(out.splitlines(), self.expect.encode().splitlines()) self.assertEqual(err, b'') + def test_non_ascii_infile(self): + data = '{"msg": "\u3053\u3093\u306b\u3061\u306f"}' + expect = textwrap.dedent('''\ + { + "msg": "\\u3053\\u3093\\u306b\\u3061\\u306f" + } + ''').encode() + + infile = self._create_infile(data) + rc, out, err = assert_python_ok('-m', 'json.tool', infile) + + self.assertEqual(rc, 0) + self.assertEqual(out.splitlines(), expect.splitlines()) + self.assertEqual(err, b'') + def test_infile_outfile(self): infile = self._create_infile() outfile = support.TESTFN + '.out' diff --git a/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst b/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst new file mode 100644 index 0000000000000..107f9bb008330 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst @@ -0,0 +1,2 @@ +Fix ``json.tool`` failed to read a JSON file with non-ASCII characters when +locale encoding is not UTF-8. From webhook-mailer at python.org Wed Dec 4 04:58:00 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Wed, 04 Dec 2019 09:58:00 -0000 Subject: [Python-checkins] bpo-33684: json.tool: Use utf-8 for infile and outfile. (GH-17460) Message-ID: https://github.com/python/cpython/commit/a75cad440ab50d823af5f06e51dfed3a319f1e8c commit: a75cad440ab50d823af5f06e51dfed3a319f1e8c branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-04T01:57:55-08:00 summary: bpo-33684: json.tool: Use utf-8 for infile and outfile. (GH-17460) (cherry picked from commit 808769f3a4cbdc47cf1a5708dd61b1787bb192d4) Co-authored-by: Inada Naoki files: A Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst M Lib/json/tool.py M Lib/test/test_json/test_tool.py diff --git a/Lib/json/tool.py b/Lib/json/tool.py index b3ef9923e3146..8db9ea40ad1b0 100644 --- a/Lib/json/tool.py +++ b/Lib/json/tool.py @@ -20,10 +20,12 @@ def main(): description = ('A simple command line interface for json module ' 'to validate and pretty-print JSON objects.') parser = argparse.ArgumentParser(prog=prog, description=description) - parser.add_argument('infile', nargs='?', type=argparse.FileType(), + parser.add_argument('infile', nargs='?', + type=argparse.FileType(encoding="utf-8"), help='a JSON file to be validated or pretty-printed', default=sys.stdin) - parser.add_argument('outfile', nargs='?', type=argparse.FileType('w'), + parser.add_argument('outfile', nargs='?', + type=argparse.FileType('w', encoding="utf-8"), help='write the output of infile to outfile', default=sys.stdout) parser.add_argument('--sort-keys', action='store_true', default=False, diff --git a/Lib/test/test_json/test_tool.py b/Lib/test/test_json/test_tool.py index 1e95bc79e5d18..f362f1b13a253 100644 --- a/Lib/test/test_json/test_tool.py +++ b/Lib/test/test_json/test_tool.py @@ -89,11 +89,11 @@ def test_stdin_stdout(self): self.assertEqual(out.splitlines(), self.expect.encode().splitlines()) self.assertEqual(err, b'') - def _create_infile(self): + def _create_infile(self, data=None): infile = support.TESTFN - with open(infile, "w") as fp: + with open(infile, "w", encoding="utf-8") as fp: self.addCleanup(os.remove, infile) - fp.write(self.data) + fp.write(data or self.data) return infile def test_infile_stdout(self): @@ -103,6 +103,21 @@ def test_infile_stdout(self): self.assertEqual(out.splitlines(), self.expect.encode().splitlines()) self.assertEqual(err, b'') + def test_non_ascii_infile(self): + data = '{"msg": "\u3053\u3093\u306b\u3061\u306f"}' + expect = textwrap.dedent('''\ + { + "msg": "\\u3053\\u3093\\u306b\\u3061\\u306f" + } + ''').encode() + + infile = self._create_infile(data) + rc, out, err = assert_python_ok('-m', 'json.tool', infile) + + self.assertEqual(rc, 0) + self.assertEqual(out.splitlines(), expect.splitlines()) + self.assertEqual(err, b'') + def test_infile_outfile(self): infile = self._create_infile() outfile = support.TESTFN + '.out' diff --git a/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst b/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst new file mode 100644 index 0000000000000..107f9bb008330 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst @@ -0,0 +1,2 @@ +Fix ``json.tool`` failed to read a JSON file with non-ASCII characters when +locale encoding is not UTF-8. From webhook-mailer at python.org Wed Dec 4 05:26:30 2019 From: webhook-mailer at python.org (Inada Naoki) Date: Wed, 04 Dec 2019 10:26:30 -0000 Subject: [Python-checkins] bpo-33684: json.tool: Use utf-8 for infile and outfile. (GH-17460) Message-ID: https://github.com/python/cpython/commit/e0f148e6635480521036415bd782c3424fe6c619 commit: e0f148e6635480521036415bd782c3424fe6c619 branch: 3.7 author: Inada Naoki committer: GitHub date: 2019-12-04T19:26:22+09:00 summary: bpo-33684: json.tool: Use utf-8 for infile and outfile. (GH-17460) (cherry picked from commit 808769f3a4cbdc47cf1a5708dd61b1787bb192d4) Co-authored-by: Inada Naoki files: A Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst M Lib/json/tool.py M Lib/test/test_json/test_tool.py diff --git a/Lib/json/tool.py b/Lib/json/tool.py index 5932f4ecded7e..8e63dbdd4e188 100644 --- a/Lib/json/tool.py +++ b/Lib/json/tool.py @@ -20,9 +20,9 @@ def main(): description = ('A simple command line interface for json module ' 'to validate and pretty-print JSON objects.') parser = argparse.ArgumentParser(prog=prog, description=description) - parser.add_argument('infile', nargs='?', type=argparse.FileType(), + parser.add_argument('infile', nargs='?', type=argparse.FileType(encoding="utf-8"), help='a JSON file to be validated or pretty-printed') - parser.add_argument('outfile', nargs='?', type=argparse.FileType('w'), + parser.add_argument('outfile', nargs='?', type=argparse.FileType('w', encoding="utf-8"), help='write the output of infile to outfile') parser.add_argument('--sort-keys', action='store_true', default=False, help='sort the output of dictionaries alphabetically by key') diff --git a/Lib/test/test_json/test_tool.py b/Lib/test/test_json/test_tool.py index 9d93f931ca395..2999dc1ef3718 100644 --- a/Lib/test/test_json/test_tool.py +++ b/Lib/test/test_json/test_tool.py @@ -67,11 +67,11 @@ def test_stdin_stdout(self): self.assertEqual(out.splitlines(), self.expect.encode().splitlines()) self.assertEqual(err, b'') - def _create_infile(self): + def _create_infile(self, data=None): infile = support.TESTFN - with open(infile, "w") as fp: + with open(infile, "w", encoding="utf-8") as fp: self.addCleanup(os.remove, infile) - fp.write(self.data) + fp.write(data or self.data) return infile def test_infile_stdout(self): @@ -81,6 +81,21 @@ def test_infile_stdout(self): self.assertEqual(out.splitlines(), self.expect.encode().splitlines()) self.assertEqual(err, b'') + def test_non_ascii_infile(self): + data = '{"msg": "\u3053\u3093\u306b\u3061\u306f"}' + expect = textwrap.dedent('''\ + { + "msg": "\\u3053\\u3093\\u306b\\u3061\\u306f" + } + ''').encode() + + infile = self._create_infile(data) + rc, out, err = assert_python_ok('-m', 'json.tool', infile) + + self.assertEqual(rc, 0) + self.assertEqual(out.splitlines(), expect.splitlines()) + self.assertEqual(err, b'') + def test_infile_outfile(self): infile = self._create_infile() outfile = support.TESTFN + '.out' diff --git a/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst b/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst new file mode 100644 index 0000000000000..107f9bb008330 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst @@ -0,0 +1,2 @@ +Fix ``json.tool`` failed to read a JSON file with non-ASCII characters when +locale encoding is not UTF-8. From webhook-mailer at python.org Wed Dec 4 06:20:08 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Wed, 04 Dec 2019 11:20:08 -0000 Subject: [Python-checkins] bpo-38962: Fix reference leak in new_interpreter() (GH-17453) Message-ID: https://github.com/python/cpython/commit/b96c6b0723b889d3a0c1740bce7f579f33d246f2 commit: b96c6b0723b889d3a0c1740bce7f579f33d246f2 branch: master author: Pablo Galindo committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-04T03:19:59-08:00 summary: bpo-38962: Fix reference leak in new_interpreter() (GH-17453) https://bugs.python.org/issue38962 Automerge-Triggered-By: @pablogsal files: M Python/pylifecycle.c diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index cce4783bc12c3..9218978cc6fa7 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -648,9 +648,11 @@ pycore_init_builtins(PyThreadState *tstate) if (interp->builtins_copy == NULL) { goto error; } + Py_DECREF(bimod); return _PyStatus_OK(); error: + Py_XDECREF(bimod); return _PyStatus_ERR("can't initialize builtins module"); } From webhook-mailer at python.org Wed Dec 4 06:51:09 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Wed, 04 Dec 2019 11:51:09 -0000 Subject: [Python-checkins] bpo-38962: Fix reference leak in the per-subinterpreter gc (GH-17457) Message-ID: https://github.com/python/cpython/commit/ac0e1c2694bc199dbd073312145e3c09bee52cc4 commit: ac0e1c2694bc199dbd073312145e3c09bee52cc4 branch: master author: Pablo Galindo committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-04T03:51:03-08:00 summary: bpo-38962: Fix reference leak in the per-subinterpreter gc (GH-17457) https://bugs.python.org/issue38962 Automerge-Triggered-By: @pablogsal files: M Python/pylifecycle.c diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 9218978cc6fa7..d6f65ec3caf66 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1253,17 +1253,16 @@ finalize_interp_clear(PyThreadState *tstate) { int is_main_interp = _Py_IsMainInterpreter(tstate); - /* bpo-36854: Explicitly clear the codec registry - and trigger a GC collection */ PyInterpreterState *interp = tstate->interp; - Py_CLEAR(interp->codec_search_path); - Py_CLEAR(interp->codec_search_cache); - Py_CLEAR(interp->codec_error_registry); - _PyGC_CollectNoFail(); /* Clear interpreter state and all thread states */ PyInterpreterState_Clear(tstate->interp); + /* Trigger a GC collection on subinterpreters*/ + if (!is_main_interp) { + _PyGC_CollectNoFail(); + } + finalize_interp_types(tstate, is_main_interp); if (is_main_interp) { From webhook-mailer at python.org Wed Dec 4 11:03:05 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 04 Dec 2019 16:03:05 -0000 Subject: [Python-checkins] bpo-38634: Allow non-apple build to cope with libedit (GH-16986) Message-ID: https://github.com/python/cpython/commit/7105319ada2e663659020cbe9fdf7ff38f421ab2 commit: 7105319ada2e663659020cbe9fdf7ff38f421ab2 branch: master author: serge-sans-paille committer: Victor Stinner date: 2019-12-04T17:02:57+01:00 summary: bpo-38634: Allow non-apple build to cope with libedit (GH-16986) The readline module now detects if Python is linked to libedit at runtime on all platforms. Previously, the check was only done on macOS. If Python is used as a library by a binary linking to libedit, the linker resolves the rl_initialize symbol required by the readline module against libedit instead of libreadline, which leads to a segfault. Take advantage of the existing supporting code to have readline module being compatible with both situations. files: A Misc/NEWS.d/next/Library/2019-12-04-15-56-28.bpo-38634.pq0ZWa.rst M Modules/readline.c diff --git a/Misc/NEWS.d/next/Library/2019-12-04-15-56-28.bpo-38634.pq0ZWa.rst b/Misc/NEWS.d/next/Library/2019-12-04-15-56-28.bpo-38634.pq0ZWa.rst new file mode 100644 index 0000000000000..d60c3172c2e51 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-04-15-56-28.bpo-38634.pq0ZWa.rst @@ -0,0 +1,2 @@ +The :mod:`readline` module now detects if Python is linked to libedit at runtime +on all platforms. Previously, the check was only done on macOS. diff --git a/Modules/readline.c b/Modules/readline.c index b76861f7b0407..27a993f449f33 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -45,14 +45,14 @@ extern char **completion_matches(char *, CPFunction *); #endif #endif -#ifdef __APPLE__ /* * It is possible to link the readline module to the readline * emulation library of editline/libedit. * - * On OSX this emulation library is not 100% API compatible - * with the "real" readline and cannot be detected at compile-time, - * hence we use a runtime check to detect if we're using libedit + * This emulation library is not 100% API compatible with the "real" readline + * and cannot be detected at compile-time, + * hence we use a runtime check to detect if the Python readlinke module is + * linked to libedit. * * Currently there is one known API incompatibility: * - 'get_history' has a 1-based index with GNU readline, and a 0-based @@ -64,7 +64,6 @@ static int using_libedit_emulation = 0; static const char libedit_version_tag[] = "EditLine wrapper"; static int libedit_history_start = 0; -#endif /* __APPLE__ */ #ifdef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK static void @@ -693,7 +692,6 @@ get_history_item(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "i:get_history_item", &idx)) return NULL; -#ifdef __APPLE__ if (using_libedit_emulation) { /* Older versions of libedit's readline emulation * use 0-based indexes, while readline and newer @@ -713,7 +711,6 @@ get_history_item(PyObject *self, PyObject *args) Py_RETURN_NONE; } } -#endif /* __APPLE__ */ if ((hist_ent = history_get(idx))) return decode(hist_ent->line); else { @@ -1081,7 +1078,6 @@ setup_readline(readlinestate *mod_state) /* The name must be defined before initialization */ rl_readline_name = "python"; -#ifdef __APPLE__ /* the libedit readline emulation resets key bindings etc * when calling rl_initialize. So call it upfront */ @@ -1098,7 +1094,6 @@ setup_readline(readlinestate *mod_state) libedit_history_start = 1; } clear_history(); -#endif /* __APPLE__ */ using_history(); @@ -1127,9 +1122,7 @@ setup_readline(readlinestate *mod_state) mod_state->begidx = PyLong_FromLong(0L); mod_state->endidx = PyLong_FromLong(0L); -#ifdef __APPLE__ if (!using_libedit_emulation) -#endif { if (!isatty(STDOUT_FILENO)) { /* Issue #19884: stdout is not a terminal. Disable meta modifier @@ -1149,11 +1142,9 @@ setup_readline(readlinestate *mod_state) * XXX: A bug in the readline-2.2 library causes a memory leak * inside this function. Nothing we can do about it. */ -#ifdef __APPLE__ if (using_libedit_emulation) rl_read_init_file(NULL); else -#endif /* __APPLE__ */ rl_initialize(); RESTORE_LOCALE(saved_locale) @@ -1283,12 +1274,10 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt) int length = _py_get_history_length(); if (length > 0) { HIST_ENTRY *hist_ent; -#ifdef __APPLE__ if (using_libedit_emulation) { /* handle older 0-based or newer 1-based indexing */ hist_ent = history_get(length + libedit_history_start - 1); } else -#endif /* __APPLE__ */ hist_ent = history_get(length); line = hist_ent ? hist_ent->line : ""; } else @@ -1316,10 +1305,8 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt) PyDoc_STRVAR(doc_module, "Importing this module enables command line editing using GNU readline."); -#ifdef __APPLE__ PyDoc_STRVAR(doc_module_le, "Importing this module enables command line editing using libedit readline."); -#endif /* __APPLE__ */ static struct PyModuleDef readlinemodule = { PyModuleDef_HEAD_INIT, @@ -1340,7 +1327,6 @@ PyInit_readline(void) PyObject *m; readlinestate *mod_state; -#ifdef __APPLE__ if (strncmp(rl_library_version, libedit_version_tag, strlen(libedit_version_tag)) == 0) { using_libedit_emulation = 1; } @@ -1348,7 +1334,6 @@ PyInit_readline(void) if (using_libedit_emulation) readlinemodule.m_doc = doc_module_le; -#endif /* __APPLE__ */ m = PyModule_Create(&readlinemodule); From webhook-mailer at python.org Wed Dec 4 11:21:21 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Wed, 04 Dec 2019 16:21:21 -0000 Subject: [Python-checkins] bpo-38634: Allow non-apple build to cope with libedit (GH-16986) Message-ID: https://github.com/python/cpython/commit/68669ef7883ea6338ca441e50f4f9d975f54d017 commit: 68669ef7883ea6338ca441e50f4f9d975f54d017 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-04T08:21:16-08:00 summary: bpo-38634: Allow non-apple build to cope with libedit (GH-16986) The readline module now detects if Python is linked to libedit at runtime on all platforms. Previously, the check was only done on macOS. If Python is used as a library by a binary linking to libedit, the linker resolves the rl_initialize symbol required by the readline module against libedit instead of libreadline, which leads to a segfault. Take advantage of the existing supporting code to have readline module being compatible with both situations. (cherry picked from commit 7105319ada2e663659020cbe9fdf7ff38f421ab2) Co-authored-by: serge-sans-paille files: A Misc/NEWS.d/next/Library/2019-12-04-15-56-28.bpo-38634.pq0ZWa.rst M Modules/readline.c diff --git a/Misc/NEWS.d/next/Library/2019-12-04-15-56-28.bpo-38634.pq0ZWa.rst b/Misc/NEWS.d/next/Library/2019-12-04-15-56-28.bpo-38634.pq0ZWa.rst new file mode 100644 index 0000000000000..d60c3172c2e51 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-04-15-56-28.bpo-38634.pq0ZWa.rst @@ -0,0 +1,2 @@ +The :mod:`readline` module now detects if Python is linked to libedit at runtime +on all platforms. Previously, the check was only done on macOS. diff --git a/Modules/readline.c b/Modules/readline.c index 57335fe911bff..081657fb23699 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -45,14 +45,14 @@ extern char **completion_matches(char *, CPFunction *); #endif #endif -#ifdef __APPLE__ /* * It is possible to link the readline module to the readline * emulation library of editline/libedit. * - * On OSX this emulation library is not 100% API compatible - * with the "real" readline and cannot be detected at compile-time, - * hence we use a runtime check to detect if we're using libedit + * This emulation library is not 100% API compatible with the "real" readline + * and cannot be detected at compile-time, + * hence we use a runtime check to detect if the Python readlinke module is + * linked to libedit. * * Currently there is one known API incompatibility: * - 'get_history' has a 1-based index with GNU readline, and a 0-based @@ -64,7 +64,6 @@ static int using_libedit_emulation = 0; static const char libedit_version_tag[] = "EditLine wrapper"; static int libedit_history_start = 0; -#endif /* __APPLE__ */ #ifdef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK static void @@ -693,7 +692,6 @@ get_history_item(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "i:get_history_item", &idx)) return NULL; -#ifdef __APPLE__ if (using_libedit_emulation) { /* Older versions of libedit's readline emulation * use 0-based indexes, while readline and newer @@ -713,7 +711,6 @@ get_history_item(PyObject *self, PyObject *args) Py_RETURN_NONE; } } -#endif /* __APPLE__ */ if ((hist_ent = history_get(idx))) return decode(hist_ent->line); else { @@ -1080,7 +1077,6 @@ setup_readline(readlinestate *mod_state) /* The name must be defined before initialization */ rl_readline_name = "python"; -#ifdef __APPLE__ /* the libedit readline emulation resets key bindings etc * when calling rl_initialize. So call it upfront */ @@ -1097,7 +1093,6 @@ setup_readline(readlinestate *mod_state) libedit_history_start = 1; } clear_history(); -#endif /* __APPLE__ */ using_history(); @@ -1126,9 +1121,7 @@ setup_readline(readlinestate *mod_state) mod_state->begidx = PyLong_FromLong(0L); mod_state->endidx = PyLong_FromLong(0L); -#ifdef __APPLE__ if (!using_libedit_emulation) -#endif { if (!isatty(STDOUT_FILENO)) { /* Issue #19884: stdout is not a terminal. Disable meta modifier @@ -1148,11 +1141,9 @@ setup_readline(readlinestate *mod_state) * XXX: A bug in the readline-2.2 library causes a memory leak * inside this function. Nothing we can do about it. */ -#ifdef __APPLE__ if (using_libedit_emulation) rl_read_init_file(NULL); else -#endif /* __APPLE__ */ rl_initialize(); RESTORE_LOCALE(saved_locale) @@ -1281,12 +1272,10 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt) int length = _py_get_history_length(); if (length > 0) { HIST_ENTRY *hist_ent; -#ifdef __APPLE__ if (using_libedit_emulation) { /* handle older 0-based or newer 1-based indexing */ hist_ent = history_get(length + libedit_history_start - 1); } else -#endif /* __APPLE__ */ hist_ent = history_get(length); line = hist_ent ? hist_ent->line : ""; } else @@ -1314,10 +1303,8 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt) PyDoc_STRVAR(doc_module, "Importing this module enables command line editing using GNU readline."); -#ifdef __APPLE__ PyDoc_STRVAR(doc_module_le, "Importing this module enables command line editing using libedit readline."); -#endif /* __APPLE__ */ static struct PyModuleDef readlinemodule = { PyModuleDef_HEAD_INIT, @@ -1338,7 +1325,6 @@ PyInit_readline(void) PyObject *m; readlinestate *mod_state; -#ifdef __APPLE__ if (strncmp(rl_library_version, libedit_version_tag, strlen(libedit_version_tag)) == 0) { using_libedit_emulation = 1; } @@ -1346,7 +1332,6 @@ PyInit_readline(void) if (using_libedit_emulation) readlinemodule.m_doc = doc_module_le; -#endif /* __APPLE__ */ m = PyModule_Create(&readlinemodule); From webhook-mailer at python.org Wed Dec 4 15:10:28 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 04 Dec 2019 20:10:28 -0000 Subject: [Python-checkins] bpo-38965: Fix faulthandler._stack_overflow() on GCC 10 (GH-17467) Message-ID: https://github.com/python/cpython/commit/8b787964e0a647caa0558b7c29ae501470d727d9 commit: 8b787964e0a647caa0558b7c29ae501470d727d9 branch: master author: Victor Stinner committer: GitHub date: 2019-12-04T21:10:06+01:00 summary: bpo-38965: Fix faulthandler._stack_overflow() on GCC 10 (GH-17467) Use the "volatile" keyword to prevent tail call optimization on any compiler, rather than relying on compiler specific pragma. files: A Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst M Modules/faulthandler.c diff --git a/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst b/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst new file mode 100644 index 0000000000000..517a1371eacd9 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst @@ -0,0 +1,3 @@ +Fix test_faulthandler on GCC 10. Use the "volatile" keyword in +``faulthandler._stack_overflow()`` to prevent tail call optimization on any +compiler, rather than relying on compiler specific pragma. diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c index d1280532ae2d4..b19401e94d85a 100644 --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -1161,18 +1161,14 @@ faulthandler_fatal_error_py(PyObject *self, PyObject *args) #if defined(FAULTHANDLER_USE_ALT_STACK) #define FAULTHANDLER_STACK_OVERFLOW -#ifdef __INTEL_COMPILER - /* Issue #23654: Turn off ICC's tail call optimization for the - * stack_overflow generator. ICC turns the recursive tail call into - * a loop. */ -# pragma intel optimization_level 0 -#endif -static -uintptr_t +static uintptr_t stack_overflow(uintptr_t min_sp, uintptr_t max_sp, size_t *depth) { - /* allocate 4096 bytes on the stack at each call */ - unsigned char buffer[4096]; + /* Allocate (at least) 4096 bytes on the stack at each call. + + bpo-23654, bpo-38965: use volatile keyword to prevent tail call + optimization. */ + volatile unsigned char buffer[4096]; uintptr_t sp = (uintptr_t)&buffer; *depth += 1; if (sp < min_sp || max_sp < sp) From webhook-mailer at python.org Wed Dec 4 15:29:31 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Wed, 04 Dec 2019 20:29:31 -0000 Subject: [Python-checkins] bpo-38965: Fix faulthandler._stack_overflow() on GCC 10 (GH-17467) Message-ID: https://github.com/python/cpython/commit/5044c889dfced2f43e2cccb673d889a4882f6b3b commit: 5044c889dfced2f43e2cccb673d889a4882f6b3b branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-04T12:29:22-08:00 summary: bpo-38965: Fix faulthandler._stack_overflow() on GCC 10 (GH-17467) Use the "volatile" keyword to prevent tail call optimization on any compiler, rather than relying on compiler specific pragma. (cherry picked from commit 8b787964e0a647caa0558b7c29ae501470d727d9) Co-authored-by: Victor Stinner files: A Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst M Modules/faulthandler.c diff --git a/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst b/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst new file mode 100644 index 0000000000000..517a1371eacd9 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst @@ -0,0 +1,3 @@ +Fix test_faulthandler on GCC 10. Use the "volatile" keyword in +``faulthandler._stack_overflow()`` to prevent tail call optimization on any +compiler, rather than relying on compiler specific pragma. diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c index e72faab32aa85..f3e3a29cf20b1 100644 --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -1094,18 +1094,14 @@ faulthandler_fatal_error_py(PyObject *self, PyObject *args) #if defined(HAVE_SIGALTSTACK) && defined(HAVE_SIGACTION) #define FAULTHANDLER_STACK_OVERFLOW -#ifdef __INTEL_COMPILER - /* Issue #23654: Turn off ICC's tail call optimization for the - * stack_overflow generator. ICC turns the recursive tail call into - * a loop. */ -# pragma intel optimization_level 0 -#endif -static -uintptr_t +static uintptr_t stack_overflow(uintptr_t min_sp, uintptr_t max_sp, size_t *depth) { - /* allocate 4096 bytes on the stack at each call */ - unsigned char buffer[4096]; + /* Allocate (at least) 4096 bytes on the stack at each call. + + bpo-23654, bpo-38965: use volatile keyword to prevent tail call + optimization. */ + volatile unsigned char buffer[4096]; uintptr_t sp = (uintptr_t)&buffer; *depth += 1; if (sp < min_sp || max_sp < sp) From webhook-mailer at python.org Wed Dec 4 15:30:36 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Wed, 04 Dec 2019 20:30:36 -0000 Subject: [Python-checkins] bpo-38965: Fix faulthandler._stack_overflow() on GCC 10 (GH-17467) Message-ID: https://github.com/python/cpython/commit/f4a21d3b239bf4f4e4e2a8a5936b9b040645b246 commit: f4a21d3b239bf4f4e4e2a8a5936b9b040645b246 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-04T12:30:31-08:00 summary: bpo-38965: Fix faulthandler._stack_overflow() on GCC 10 (GH-17467) Use the "volatile" keyword to prevent tail call optimization on any compiler, rather than relying on compiler specific pragma. (cherry picked from commit 8b787964e0a647caa0558b7c29ae501470d727d9) Co-authored-by: Victor Stinner files: A Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst M Modules/faulthandler.c diff --git a/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst b/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst new file mode 100644 index 0000000000000..517a1371eacd9 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst @@ -0,0 +1,3 @@ +Fix test_faulthandler on GCC 10. Use the "volatile" keyword in +``faulthandler._stack_overflow()`` to prevent tail call optimization on any +compiler, rather than relying on compiler specific pragma. diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c index 251d8e08a208e..230cde4934fd4 100644 --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -1097,18 +1097,14 @@ faulthandler_fatal_error_py(PyObject *self, PyObject *args) #if defined(HAVE_SIGALTSTACK) && defined(HAVE_SIGACTION) #define FAULTHANDLER_STACK_OVERFLOW -#ifdef __INTEL_COMPILER - /* Issue #23654: Turn off ICC's tail call optimization for the - * stack_overflow generator. ICC turns the recursive tail call into - * a loop. */ -# pragma intel optimization_level 0 -#endif -static -uintptr_t +static uintptr_t stack_overflow(uintptr_t min_sp, uintptr_t max_sp, size_t *depth) { - /* allocate 4096 bytes on the stack at each call */ - unsigned char buffer[4096]; + /* Allocate (at least) 4096 bytes on the stack at each call. + + bpo-23654, bpo-38965: use volatile keyword to prevent tail call + optimization. */ + volatile unsigned char buffer[4096]; uintptr_t sp = (uintptr_t)&buffer; *depth += 1; if (sp < min_sp || max_sp < sp) From webhook-mailer at python.org Wed Dec 4 22:14:33 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Thu, 05 Dec 2019 03:14:33 -0000 Subject: [Python-checkins] bpo-38698: Prevent UnboundLocalError to pop up in parse_message_id (GH-17277) Message-ID: https://github.com/python/cpython/commit/bb815499af855b1759c02535f8d7a9d0358e74e8 commit: bb815499af855b1759c02535f8d7a9d0358e74e8 branch: master author: Claudiu Popa committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-04T19:14:26-08:00 summary: bpo-38698: Prevent UnboundLocalError to pop up in parse_message_id (GH-17277) parse_message_id() was improperly using a token defined inside an exception handler, which was raising `UnboundLocalError` on parsing an invalid value. https://bugs.python.org/issue38698 files: A Misc/NEWS.d/next/Library/2019-12-02-10-35-19.bpo-38698.WZnAPQ.rst M Lib/email/_header_value_parser.py M Lib/test/test_email/test__header_value_parser.py diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py index 1668b4a14e9b9..abdef8189ca6f 100644 --- a/Lib/email/_header_value_parser.py +++ b/Lib/email/_header_value_parser.py @@ -2113,7 +2113,8 @@ def parse_message_id(value): except errors.HeaderParseError: message_id.defects.append(errors.InvalidHeaderDefect( "Expected msg-id but found {!r}".format(value))) - message_id.append(token) + else: + message_id.append(token) return message_id # diff --git a/Lib/test/test_email/test__header_value_parser.py b/Lib/test/test_email/test__header_value_parser.py index 46d90b38e91e1..71168f3183d23 100644 --- a/Lib/test/test_email/test__header_value_parser.py +++ b/Lib/test/test_email/test__header_value_parser.py @@ -2638,6 +2638,12 @@ def test_get_msg_id_no_id_right_part(self): ) self.assertEqual(msg_id.token_type, 'msg-id') + def test_get_msg_id_invalid_expected_msg_id_not_found(self): + text = "Message-Id: 935-XPB-567:0:86089:180874:0:45327:9:90305:17843586-40 at example.com" + msg_id = parser.parse_message_id(text) + self.assertDefectsEqual(msg_id.all_defects, + [errors.InvalidHeaderDefect]) + def test_get_msg_id_no_angle_start(self): with self.assertRaises(errors.HeaderParseError): parser.get_msg_id("msgwithnoankle") diff --git a/Misc/NEWS.d/next/Library/2019-12-02-10-35-19.bpo-38698.WZnAPQ.rst b/Misc/NEWS.d/next/Library/2019-12-02-10-35-19.bpo-38698.WZnAPQ.rst new file mode 100644 index 0000000000000..e606acb5dcf57 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-02-10-35-19.bpo-38698.WZnAPQ.rst @@ -0,0 +1,5 @@ +Prevent UnboundLocalError to pop up in parse_message_id + +parse_message_id() was improperly using a token defined inside an exception +handler, which was raising `UnboundLocalError` on parsing an invalid value. +Patch by Claudiu Popa. From webhook-mailer at python.org Thu Dec 5 07:40:40 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Thu, 05 Dec 2019 12:40:40 -0000 Subject: [Python-checkins] bpo-38951: Use threading.main_thread() check in asyncio (GH-17433) Message-ID: https://github.com/python/cpython/commit/99eb70a9eb9493602ff6ad8bb92df4318cf05a3e commit: 99eb70a9eb9493602ff6ad8bb92df4318cf05a3e branch: master author: Hill Ma committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-05T04:40:12-08:00 summary: bpo-38951: Use threading.main_thread() check in asyncio (GH-17433) https://bugs.python.org/issue38951 files: M Lib/asyncio/events.py M Lib/asyncio/unix_events.py diff --git a/Lib/asyncio/events.py b/Lib/asyncio/events.py index 36b7ea307e03b..c7343f515ca22 100644 --- a/Lib/asyncio/events.py +++ b/Lib/asyncio/events.py @@ -636,7 +636,7 @@ def get_event_loop(self): """ if (self._local._loop is None and not self._local._set_called and - isinstance(threading.current_thread(), threading._MainThread)): + threading.current_thread() is threading.main_thread()): self.set_event_loop(self.new_event_loop()) if self._local._loop is None: diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index 632546ad00817..97198ea2f4953 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -1406,8 +1406,7 @@ def _init_watcher(self): with events._lock: if self._watcher is None: # pragma: no branch self._watcher = ThreadedChildWatcher() - if isinstance(threading.current_thread(), - threading._MainThread): + if threading.current_thread() is threading.main_thread(): self._watcher.attach_loop(self._local._loop) def set_event_loop(self, loop): @@ -1421,7 +1420,7 @@ def set_event_loop(self, loop): super().set_event_loop(loop) if (self._watcher is not None and - isinstance(threading.current_thread(), threading._MainThread)): + threading.current_thread() is threading.main_thread()): self._watcher.attach_loop(loop) def get_child_watcher(self): From webhook-mailer at python.org Thu Dec 5 09:55:44 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Thu, 05 Dec 2019 14:55:44 -0000 Subject: [Python-checkins] bpo-27961: Replace PY_LLONG_MAX, PY_LLONG_MIN and PY_ULLONG_MAX with standard macros (GH-15385) Message-ID: https://github.com/python/cpython/commit/1f9f69dd4c5ee232c0b2f782933a89359932a67f commit: 1f9f69dd4c5ee232c0b2f782933a89359932a67f branch: master author: Sergey Fedoseev committer: Victor Stinner date: 2019-12-05T15:55:28+01:00 summary: bpo-27961: Replace PY_LLONG_MAX, PY_LLONG_MIN and PY_ULLONG_MAX with standard macros (GH-15385) Use standard constants LLONG_MIN, LLONG_MAX and ULLONG_MAX. files: M Doc/c-api/long.rst M Include/pythread.h M Modules/_testcapimodule.c M Objects/longobject.c diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index 83d59de6a0d58..5a6d09ad1bddd 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -195,8 +195,8 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate. :meth:`__int__` method (if present) to convert it to a :c:type:`PyLongObject`. - If the value of *obj* is greater than :const:`PY_LLONG_MAX` or less than - :const:`PY_LLONG_MIN`, set *\*overflow* to ``1`` or ``-1``, respectively, + If the value of *obj* is greater than :const:`LLONG_MAX` or less than + :const:`LLONG_MIN`, set *\*overflow* to ``1`` or ``-1``, respectively, and return ``-1``; otherwise, set *\*overflow* to ``0``. If any other exception occurs set *\*overflow* to ``0`` and return ``-1`` as usual. diff --git a/Include/pythread.h b/Include/pythread.h index f22e8c42c5027..569d69648994f 100644 --- a/Include/pythread.h +++ b/Include/pythread.h @@ -51,16 +51,16 @@ PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int); #if defined(_POSIX_THREADS) /* PyThread_acquire_lock_timed() uses _PyTime_FromNanoseconds(us * 1000), convert microseconds to nanoseconds. */ -# define PY_TIMEOUT_MAX (PY_LLONG_MAX / 1000) +# define PY_TIMEOUT_MAX (LLONG_MAX / 1000) #elif defined (NT_THREADS) /* In the NT API, the timeout is a DWORD and is expressed in milliseconds */ -# if 0xFFFFFFFFLL * 1000 < PY_LLONG_MAX +# if 0xFFFFFFFFLL * 1000 < LLONG_MAX # define PY_TIMEOUT_MAX (0xFFFFFFFFLL * 1000) # else -# define PY_TIMEOUT_MAX PY_LLONG_MAX +# define PY_TIMEOUT_MAX LLONG_MAX # endif #else -# define PY_TIMEOUT_MAX PY_LLONG_MAX +# define PY_TIMEOUT_MAX LLONG_MAX #endif diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 0908f3457f580..943bee6e21e19 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -639,7 +639,7 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) int overflow; /* Test that overflow is set properly for a large value. */ - /* num is a number larger than PY_LLONG_MAX on a typical machine. */ + /* num is a number larger than LLONG_MAX on a typical machine. */ num = PyLong_FromString("FFFFFFFFFFFFFFFFFFFFFFFF", NULL, 16); if (num == NULL) return NULL; @@ -655,8 +655,8 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) return raiseTestError("test_long_long_and_overflow", "overflow was not set to 1"); - /* Same again, with num = PY_LLONG_MAX + 1 */ - num = PyLong_FromLongLong(PY_LLONG_MAX); + /* Same again, with num = LLONG_MAX + 1 */ + num = PyLong_FromLongLong(LLONG_MAX); if (num == NULL) return NULL; one = PyLong_FromLong(1L); @@ -683,7 +683,7 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) "overflow was not set to 1"); /* Test that overflow is set properly for a large negative value. */ - /* num is a number smaller than PY_LLONG_MIN on a typical platform */ + /* num is a number smaller than LLONG_MIN on a typical platform */ num = PyLong_FromString("-FFFFFFFFFFFFFFFFFFFFFFFF", NULL, 16); if (num == NULL) return NULL; @@ -699,8 +699,8 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) return raiseTestError("test_long_long_and_overflow", "overflow was not set to -1"); - /* Same again, with num = PY_LLONG_MIN - 1 */ - num = PyLong_FromLongLong(PY_LLONG_MIN); + /* Same again, with num = LLONG_MIN - 1 */ + num = PyLong_FromLongLong(LLONG_MIN); if (num == NULL) return NULL; one = PyLong_FromLong(1L); @@ -757,7 +757,7 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) return raiseTestError("test_long_long_and_overflow", "overflow was set incorrectly"); - num = PyLong_FromLongLong(PY_LLONG_MAX); + num = PyLong_FromLongLong(LLONG_MAX); if (num == NULL) return NULL; overflow = 1234; @@ -765,14 +765,14 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) Py_DECREF(num); if (value == -1 && PyErr_Occurred()) return NULL; - if (value != PY_LLONG_MAX) + if (value != LLONG_MAX) return raiseTestError("test_long_long_and_overflow", - "expected return value PY_LLONG_MAX"); + "expected return value LLONG_MAX"); if (overflow != 0) return raiseTestError("test_long_long_and_overflow", "overflow was not cleared"); - num = PyLong_FromLongLong(PY_LLONG_MIN); + num = PyLong_FromLongLong(LLONG_MIN); if (num == NULL) return NULL; overflow = 0; @@ -780,9 +780,9 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) Py_DECREF(num); if (value == -1 && PyErr_Occurred()) return NULL; - if (value != PY_LLONG_MIN) + if (value != LLONG_MIN) return raiseTestError("test_long_long_and_overflow", - "expected return value PY_LLONG_MIN"); + "expected return value LLONG_MIN"); if (overflow != 0) return raiseTestError("test_long_long_and_overflow", "overflow was not cleared"); @@ -6710,9 +6710,9 @@ PyInit__testcapi(void) PyModule_AddObject(m, "FLT_MIN", PyFloat_FromDouble(FLT_MIN)); PyModule_AddObject(m, "DBL_MAX", PyFloat_FromDouble(DBL_MAX)); PyModule_AddObject(m, "DBL_MIN", PyFloat_FromDouble(DBL_MIN)); - PyModule_AddObject(m, "LLONG_MAX", PyLong_FromLongLong(PY_LLONG_MAX)); - PyModule_AddObject(m, "LLONG_MIN", PyLong_FromLongLong(PY_LLONG_MIN)); - PyModule_AddObject(m, "ULLONG_MAX", PyLong_FromUnsignedLongLong(PY_ULLONG_MAX)); + PyModule_AddObject(m, "LLONG_MAX", PyLong_FromLongLong(LLONG_MAX)); + PyModule_AddObject(m, "LLONG_MIN", PyLong_FromLongLong(LLONG_MIN)); + PyModule_AddObject(m, "ULLONG_MAX", PyLong_FromUnsignedLongLong(ULLONG_MAX)); PyModule_AddObject(m, "PY_SSIZE_T_MAX", PyLong_FromSsize_t(PY_SSIZE_T_MAX)); PyModule_AddObject(m, "PY_SSIZE_T_MIN", PyLong_FromSsize_t(PY_SSIZE_T_MIN)); PyModule_AddObject(m, "SIZEOF_PYGC_HEAD", PyLong_FromSsize_t(sizeof(PyGC_Head))); diff --git a/Objects/longobject.c b/Objects/longobject.c index f0567970468a8..bc87fb2bd65c3 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -1158,7 +1158,7 @@ PyLong_AsVoidPtr(PyObject *vv) * rewritten to use the newer PyLong_{As,From}ByteArray API. */ -#define PY_ABS_LLONG_MIN (0-(unsigned long long)PY_LLONG_MIN) +#define PY_ABS_LLONG_MIN (0-(unsigned long long)LLONG_MIN) /* Create a new int object from a C long long int. */ @@ -1462,11 +1462,11 @@ PyLong_AsLongLongAndOverflow(PyObject *vv, int *overflow) /* Haven't lost any bits, but casting to long requires extra * care (see comment above). */ - if (x <= (unsigned long long)PY_LLONG_MAX) { + if (x <= (unsigned long long)LLONG_MAX) { res = (long long)x * sign; } else if (sign < 0 && x == PY_ABS_LLONG_MIN) { - res = PY_LLONG_MIN; + res = LLONG_MIN; } else { *overflow = sign; @@ -5020,7 +5020,7 @@ _PyLong_GCD(PyObject *aarg, PyObject *barg) /* a fits into a long, so b must too */ x = PyLong_AsLong((PyObject *)a); y = PyLong_AsLong((PyObject *)b); -#elif PY_LLONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT +#elif LLONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT x = PyLong_AsLongLong((PyObject *)a); y = PyLong_AsLongLong((PyObject *)b); #else @@ -5039,7 +5039,7 @@ _PyLong_GCD(PyObject *aarg, PyObject *barg) } #if LONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT return PyLong_FromLong(x); -#elif PY_LLONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT +#elif LLONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT return PyLong_FromLongLong(x); #else # error "_PyLong_GCD" From webhook-mailer at python.org Thu Dec 5 11:18:34 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Thu, 05 Dec 2019 16:18:34 -0000 Subject: [Python-checkins] Remove unused variable in Python/pylifecycle.c (GH-17475) Message-ID: https://github.com/python/cpython/commit/4da44000843824d4231901c3cf28b604e79df456 commit: 4da44000843824d4231901c3cf28b604e79df456 branch: master author: Pablo Galindo committer: GitHub date: 2019-12-05T16:18:27Z summary: Remove unused variable in Python/pylifecycle.c (GH-17475) files: M Python/pylifecycle.c diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index d6f65ec3caf66..410156b80211e 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1253,8 +1253,6 @@ finalize_interp_clear(PyThreadState *tstate) { int is_main_interp = _Py_IsMainInterpreter(tstate); - PyInterpreterState *interp = tstate->interp; - /* Clear interpreter state and all thread states */ PyInterpreterState_Clear(tstate->interp); From webhook-mailer at python.org Thu Dec 5 11:51:38 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Thu, 05 Dec 2019 16:51:38 -0000 Subject: [Python-checkins] [3.8] bpo-38270: Fix indentation of test_hmac assertions (GH-17446) (GH-17450) Message-ID: https://github.com/python/cpython/commit/cfdaf92221da3c264d0da9c588994fefe4073196 commit: cfdaf92221da3c264d0da9c588994fefe4073196 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-05T08:51:30-08:00 summary: [3.8] bpo-38270: Fix indentation of test_hmac assertions (GH-17446) (GH-17450) Since https://github.com/python/cpython/commit/c64a1a61e6fc542cada40eb069a239317e1af36e two assertions were indented and thus ignored when running test_hmac. This PR fixes it. As the change is quite trivial I didn't add a NEWS entry. https://bugs.python.org/issue38270 (cherry picked from commit 894331838b256412c95d54051ec46a1cb96f52e7) Co-authored-by: stratakis https://bugs.python.org/issue38270 Automerge-Triggered-By: @tiran files: M Lib/test/test_hmac.py diff --git a/Lib/test/test_hmac.py b/Lib/test/test_hmac.py index ea00367c8027a..23c108f6e3c27 100644 --- a/Lib/test/test_hmac.py +++ b/Lib/test/test_hmac.py @@ -367,7 +367,7 @@ def test_with_bytearray(self): digestmod="sha256") except Exception: self.fail("Constructor call with bytearray arguments raised exception.") - self.assertEqual(h.hexdigest(), self.expected) + self.assertEqual(h.hexdigest(), self.expected) @requires_hashdigest('sha256') def test_with_memoryview_msg(self): @@ -375,7 +375,7 @@ def test_with_memoryview_msg(self): h = hmac.HMAC(b"key", memoryview(b"hash this!"), digestmod="sha256") except Exception: self.fail("Constructor call with memoryview msg raised exception.") - self.assertEqual(h.hexdigest(), self.expected) + self.assertEqual(h.hexdigest(), self.expected) @requires_hashdigest('sha256') def test_withmodule(self): From webhook-mailer at python.org Thu Dec 5 12:42:09 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Thu, 05 Dec 2019 17:42:09 -0000 Subject: [Python-checkins] bpo-38698: Prevent UnboundLocalError to pop up in parse_message_id (GH-17277) Message-ID: https://github.com/python/cpython/commit/e21aa61e96f8343200e765d119ebe778873a6bf1 commit: e21aa61e96f8343200e765d119ebe778873a6bf1 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-05T09:42:01-08:00 summary: bpo-38698: Prevent UnboundLocalError to pop up in parse_message_id (GH-17277) parse_message_id() was improperly using a token defined inside an exception handler, which was raising `UnboundLocalError` on parsing an invalid value. https://bugs.python.org/issue38698 (cherry picked from commit bb815499af855b1759c02535f8d7a9d0358e74e8) Co-authored-by: Claudiu Popa files: A Misc/NEWS.d/next/Library/2019-12-02-10-35-19.bpo-38698.WZnAPQ.rst M Lib/email/_header_value_parser.py M Lib/test/test_email/test__header_value_parser.py diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py index 1668b4a14e9b9..abdef8189ca6f 100644 --- a/Lib/email/_header_value_parser.py +++ b/Lib/email/_header_value_parser.py @@ -2113,7 +2113,8 @@ def parse_message_id(value): except errors.HeaderParseError: message_id.defects.append(errors.InvalidHeaderDefect( "Expected msg-id but found {!r}".format(value))) - message_id.append(token) + else: + message_id.append(token) return message_id # diff --git a/Lib/test/test_email/test__header_value_parser.py b/Lib/test/test_email/test__header_value_parser.py index e442c44a2a74d..2f63a3b3e0524 100644 --- a/Lib/test/test_email/test__header_value_parser.py +++ b/Lib/test/test_email/test__header_value_parser.py @@ -2638,6 +2638,12 @@ def test_get_msg_id_no_id_right_part(self): ) self.assertEqual(msg_id.token_type, 'msg-id') + def test_get_msg_id_invalid_expected_msg_id_not_found(self): + text = "Message-Id: 935-XPB-567:0:86089:180874:0:45327:9:90305:17843586-40 at example.com" + msg_id = parser.parse_message_id(text) + self.assertDefectsEqual(msg_id.all_defects, + [errors.InvalidHeaderDefect]) + def test_get_msg_id_no_angle_start(self): with self.assertRaises(errors.HeaderParseError): parser.get_msg_id("msgwithnoankle") diff --git a/Misc/NEWS.d/next/Library/2019-12-02-10-35-19.bpo-38698.WZnAPQ.rst b/Misc/NEWS.d/next/Library/2019-12-02-10-35-19.bpo-38698.WZnAPQ.rst new file mode 100644 index 0000000000000..e606acb5dcf57 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-02-10-35-19.bpo-38698.WZnAPQ.rst @@ -0,0 +1,5 @@ +Prevent UnboundLocalError to pop up in parse_message_id + +parse_message_id() was improperly using a token defined inside an exception +handler, which was raising `UnboundLocalError` on parsing an invalid value. +Patch by Claudiu Popa. From webhook-mailer at python.org Thu Dec 5 18:32:08 2019 From: webhook-mailer at python.org (Steve Dower) Date: Thu, 05 Dec 2019 23:32:08 -0000 Subject: [Python-checkins] Fix unquoted YAML in Windows release build (GH-17479) Message-ID: https://github.com/python/cpython/commit/44ea525ca56ad8ef783cbcd3a0636a425e5d801a commit: 44ea525ca56ad8ef783cbcd3a0636a425e5d801a branch: master author: Steve Dower committer: GitHub date: 2019-12-05T15:32:04-08:00 summary: Fix unquoted YAML in Windows release build (GH-17479) files: M .azure-pipelines/windows-release/stage-publish-nugetorg.yml M .azure-pipelines/windows-release/stage-publish-pythonorg.yml diff --git a/.azure-pipelines/windows-release/stage-publish-nugetorg.yml b/.azure-pipelines/windows-release/stage-publish-nugetorg.yml index 5aba048cd72a6..b78bd493a0fd1 100644 --- a/.azure-pipelines/windows-release/stage-publish-nugetorg.yml +++ b/.azure-pipelines/windows-release/stage-publish-nugetorg.yml @@ -31,7 +31,7 @@ jobs: buildVersionToDownload: specific buildId: $(BuildToPublish) - - powershell: gci pythonarm*.nupkg | %{ Write-Host "Not publishing: $($_.Name)"; gi $_ } | del + - powershell: 'gci pythonarm*.nupkg | %{ Write-Host "Not publishing: $($_.Name)"; gi $_ } | del' displayName: 'Prevent publishing ARM/ARM64 packages' workingDirectory: '$(Build.BinariesDirectory)\nuget' condition: and(succeeded(), not(variables['PublishArmPackages'])) diff --git a/.azure-pipelines/windows-release/stage-publish-pythonorg.yml b/.azure-pipelines/windows-release/stage-publish-pythonorg.yml index 6c61e9ac3bdbb..8c95f1b950cd7 100644 --- a/.azure-pipelines/windows-release/stage-publish-pythonorg.yml +++ b/.azure-pipelines/windows-release/stage-publish-pythonorg.yml @@ -39,7 +39,7 @@ jobs: artifactName: embed downloadPath: $(Build.BinariesDirectory) - - powershell: gci *embed-arm*.zip | %{ Write-Host "Not publishing: $($_.Name)"; gi $_ } | del + - powershell: 'gci *embed-arm*.zip | %{ Write-Host "Not publishing: $($_.Name)"; gi $_ } | del' displayName: 'Prevent publishing ARM/ARM64 packages' workingDirectory: '$(Build.BinariesDirectory)\embed' condition: and(succeeded(), not(variables['PublishArmPackages'])) From webhook-mailer at python.org Thu Dec 5 20:43:37 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 06 Dec 2019 01:43:37 -0000 Subject: [Python-checkins] bpo-38858: new_interpreter() reuses _PySys_Create() (GH-17481) Message-ID: https://github.com/python/cpython/commit/81fe5bd3d78f9bb955f8255404d99df27a31c36a commit: 81fe5bd3d78f9bb955f8255404d99df27a31c36a branch: master author: Victor Stinner committer: GitHub date: 2019-12-06T02:43:30+01:00 summary: bpo-38858: new_interpreter() reuses _PySys_Create() (GH-17481) new_interpreter() now calls _PySys_Create() to create a new sys module isolated from the main interpreter. It now calls _PySys_InitCore() and _PyImport_FixupBuiltin(). init_interp_main() now calls _PySys_InitMain(). files: M Include/internal/pycore_pylifecycle.h M Python/pylifecycle.c M Python/sysmodule.c diff --git a/Include/internal/pycore_pylifecycle.h b/Include/internal/pycore_pylifecycle.h index cd3be215ff112..4e4bbc2bed098 100644 --- a/Include/internal/pycore_pylifecycle.h +++ b/Include/internal/pycore_pylifecycle.h @@ -40,7 +40,6 @@ extern PyObject * _PyBuiltin_Init(PyThreadState *tstate); extern PyStatus _PySys_Create( PyThreadState *tstate, PyObject **sysmod_p); -extern PyStatus _PySys_SetPreliminaryStderr(PyObject *sysdict); extern PyStatus _PySys_ReadPreinitWarnOptions(PyWideStringList *options); extern PyStatus _PySys_ReadPreinitXOptions(PyConfig *config); extern int _PySys_InitMain(PyThreadState *tstate); diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 410156b80211e..9822cce4ae3b7 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -622,6 +622,8 @@ pycore_init_types(PyThreadState *tstate) static PyStatus pycore_init_builtins(PyThreadState *tstate) { + assert(!_PyErr_Occurred(tstate)); + PyObject *bimod = _PyBuiltin_Init(tstate); if (bimod == NULL) { goto error; @@ -649,6 +651,9 @@ pycore_init_builtins(PyThreadState *tstate) goto error; } Py_DECREF(bimod); + + assert(!_PyErr_Occurred(tstate)); + return _PyStatus_OK(); error: @@ -660,13 +665,14 @@ pycore_init_builtins(PyThreadState *tstate) static PyStatus pycore_init_import_warnings(PyThreadState *tstate, PyObject *sysmod) { - const PyConfig *config = &tstate->interp->config; + assert(!_PyErr_Occurred(tstate)); PyStatus status = _PyImportHooks_Init(tstate); if (_PyStatus_EXCEPTION(status)) { return status; } + const PyConfig *config = &tstate->interp->config; if (_Py_IsMainInterpreter(tstate)) { /* Initialize _warnings. */ if (_PyWarnings_Init() == NULL) { @@ -688,6 +694,9 @@ pycore_init_import_warnings(PyThreadState *tstate, PyObject *sysmod) return status; } } + + assert(!_PyErr_Occurred(tstate)); + return _PyStatus_OK(); } @@ -929,6 +938,8 @@ _Py_ReconfigureMainInterpreter(PyThreadState *tstate) static PyStatus init_interp_main(PyThreadState *tstate) { + assert(!_PyErr_Occurred(tstate)); + PyStatus status; int is_main_interp = _Py_IsMainInterpreter(tstate); PyInterpreterState *interp = tstate->interp; @@ -950,10 +961,10 @@ init_interp_main(PyThreadState *tstate) if (_PyTime_Init() < 0) { return _PyStatus_ERR("can't initialize time"); } + } - if (_PySys_InitMain(tstate) < 0) { - return _PyStatus_ERR("can't finish initializing sys"); - } + if (_PySys_InitMain(tstate) < 0) { + return _PyStatus_ERR("can't finish initializing sys"); } status = init_importlib_external(tstate); @@ -1031,6 +1042,8 @@ init_interp_main(PyThreadState *tstate) #endif } + assert(!_PyErr_Occurred(tstate)); + return _PyStatus_OK(); } @@ -1534,70 +1547,40 @@ new_interpreter(PyThreadState **tstate_p) status = _PyConfig_Copy(&interp->config, config); if (_PyStatus_EXCEPTION(status)) { - goto done; + goto error; } config = &interp->config; status = pycore_init_types(tstate); - - /* XXX The following is lax in error checking */ - PyObject *modules = PyDict_New(); - if (modules == NULL) { - status = _PyStatus_ERR("can't make modules dictionary"); - goto done; + if (_PyStatus_EXCEPTION(status)) { + goto error; } - interp->modules = modules; - PyObject *sysmod = _PyImport_FindBuiltin(tstate, "sys"); - if (sysmod != NULL) { - interp->sysdict = PyModule_GetDict(sysmod); - if (interp->sysdict == NULL) { - goto handle_exc; - } - Py_INCREF(interp->sysdict); - PyDict_SetItemString(interp->sysdict, "modules", modules); - if (_PySys_InitMain(tstate) < 0) { - status = _PyStatus_ERR("can't finish initializing sys"); - goto done; - } - } - else if (_PyErr_Occurred(tstate)) { - goto handle_exc; + PyObject *sysmod; + status = _PySys_Create(tstate, &sysmod); + if (_PyStatus_EXCEPTION(status)) { + return status; } status = pycore_init_builtins(tstate); if (_PyStatus_EXCEPTION(status)) { - goto done; + goto error; } - if (sysmod != NULL) { - status = _PySys_SetPreliminaryStderr(interp->sysdict); - if (_PyStatus_EXCEPTION(status)) { - goto done; - } - - status = pycore_init_import_warnings(tstate, sysmod); - if (_PyStatus_EXCEPTION(status)) { - goto done; - } - - status = init_interp_main(tstate); - if (_PyStatus_EXCEPTION(status)) { - goto done; - } + status = pycore_init_import_warnings(tstate, sysmod); + if (_PyStatus_EXCEPTION(status)) { + goto error; } - if (_PyErr_Occurred(tstate)) { - goto handle_exc; + status = init_interp_main(tstate); + if (_PyStatus_EXCEPTION(status)) { + goto error; } *tstate_p = tstate; return _PyStatus_OK(); -handle_exc: - status = _PyStatus_OK(); - -done: +error: *tstate_p = NULL; /* Oops, it didn't work. Undo it all. */ diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 78b9d22821fe3..b6bdf51bce333 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -2919,7 +2919,7 @@ _PySys_InitMain(PyThreadState *tstate) infrastructure for the io module in place. Use UTF-8/surrogateescape and ignore EAGAIN errors. */ -PyStatus +static PyStatus _PySys_SetPreliminaryStderr(PyObject *sysdict) { PyObject *pstderr = PyFile_NewStdPrinter(fileno(stderr)); @@ -2946,11 +2946,13 @@ _PySys_SetPreliminaryStderr(PyObject *sysdict) PyStatus _PySys_Create(PyThreadState *tstate, PyObject **sysmod_p) { + assert(!_PyErr_Occurred(tstate)); + PyInterpreterState *interp = tstate->interp; PyObject *modules = PyDict_New(); if (modules == NULL) { - return _PyStatus_ERR("can't make modules dictionary"); + goto error; } interp->modules = modules; @@ -2961,13 +2963,13 @@ _PySys_Create(PyThreadState *tstate, PyObject **sysmod_p) PyObject *sysdict = PyModule_GetDict(sysmod); if (sysdict == NULL) { - return _PyStatus_ERR("can't initialize sys dict"); + goto error; } Py_INCREF(sysdict); interp->sysdict = sysdict; if (PyDict_SetItemString(sysdict, "modules", interp->modules) < 0) { - return _PyStatus_ERR("can't initialize sys module"); + goto error; } PyStatus status = _PySys_SetPreliminaryStderr(sysdict); @@ -2980,10 +2982,17 @@ _PySys_Create(PyThreadState *tstate, PyObject **sysmod_p) return status; } - _PyImport_FixupBuiltin(sysmod, "sys", interp->modules); + if (_PyImport_FixupBuiltin(sysmod, "sys", interp->modules) < 0) { + goto error; + } + + assert(!_PyErr_Occurred(tstate)); *sysmod_p = sysmod; return _PyStatus_OK(); + +error: + return _PyStatus_ERR("can't initialize sys module"); } From webhook-mailer at python.org Thu Dec 5 21:37:13 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 06 Dec 2019 02:37:13 -0000 Subject: [Python-checkins] bpo-38858: Add pycore_interp_init() code to factorize code (GH-17483) Message-ID: https://github.com/python/cpython/commit/d863ade0c7fa4826e8b71aa467809c83a711f019 commit: d863ade0c7fa4826e8b71aa467809c83a711f019 branch: master author: Victor Stinner committer: GitHub date: 2019-12-06T03:37:07+01:00 summary: bpo-38858: Add pycore_interp_init() code to factorize code (GH-17483) Add a new pycore_interp_init() function called by new_interpreter() and pyinit_config(). files: M Python/pylifecycle.c diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 9822cce4ae3b7..8bd71a350de86 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -702,42 +702,51 @@ pycore_init_import_warnings(PyThreadState *tstate, PyObject *sysmod) static PyStatus -pyinit_config(_PyRuntimeState *runtime, - PyThreadState **tstate_p, - const PyConfig *config) +pycore_interp_init(PyThreadState *tstate) { - _PyConfig_Write(config, runtime); + PyStatus status; - PyStatus status = pycore_init_runtime(runtime, config); + status = pycore_init_types(tstate); if (_PyStatus_EXCEPTION(status)) { return status; } - PyThreadState *tstate; - status = pycore_create_interpreter(runtime, config, &tstate); + PyObject *sysmod; + status = _PySys_Create(tstate, &sysmod); if (_PyStatus_EXCEPTION(status)) { return status; } - config = &tstate->interp->config; - *tstate_p = tstate; - status = pycore_init_types(tstate); + status = pycore_init_builtins(tstate); if (_PyStatus_EXCEPTION(status)) { return status; } - PyObject *sysmod; - status = _PySys_Create(tstate, &sysmod); + return pycore_init_import_warnings(tstate, sysmod); +} + + +static PyStatus +pyinit_config(_PyRuntimeState *runtime, + PyThreadState **tstate_p, + const PyConfig *config) +{ + _PyConfig_Write(config, runtime); + + PyStatus status = pycore_init_runtime(runtime, config); if (_PyStatus_EXCEPTION(status)) { return status; } - status = pycore_init_builtins(tstate); + PyThreadState *tstate; + status = pycore_create_interpreter(runtime, config, &tstate); if (_PyStatus_EXCEPTION(status)) { return status; } + config = &tstate->interp->config; + *tstate_p = tstate; - status = pycore_init_import_warnings(tstate, sysmod); + status = pycore_interp_init(tstate); if (_PyStatus_EXCEPTION(status)) { return status; } @@ -1549,25 +1558,8 @@ new_interpreter(PyThreadState **tstate_p) if (_PyStatus_EXCEPTION(status)) { goto error; } - config = &interp->config; - - status = pycore_init_types(tstate); - if (_PyStatus_EXCEPTION(status)) { - goto error; - } - - PyObject *sysmod; - status = _PySys_Create(tstate, &sysmod); - if (_PyStatus_EXCEPTION(status)) { - return status; - } - - status = pycore_init_builtins(tstate); - if (_PyStatus_EXCEPTION(status)) { - goto error; - } - status = pycore_init_import_warnings(tstate, sysmod); + status = pycore_interp_init(tstate); if (_PyStatus_EXCEPTION(status)) { goto error; } From webhook-mailer at python.org Fri Dec 6 01:44:06 2019 From: webhook-mailer at python.org (Inada Naoki) Date: Fri, 06 Dec 2019 06:44:06 -0000 Subject: [Python-checkins] bpo-27413: json.tool: Add --no-ensure-ascii option. (GH-17472) Message-ID: https://github.com/python/cpython/commit/efefe25443c56988841ab96cdac01352123ba268 commit: efefe25443c56988841ab96cdac01352123ba268 branch: master author: wim glenn committer: Inada Naoki date: 2019-12-06T15:44:01+09:00 summary: bpo-27413: json.tool: Add --no-ensure-ascii option. (GH-17472) files: A Misc/NEWS.d/next/Library/2019-12-05-02-02-58.bpo-27413.212Th2.rst M Doc/library/json.rst M Lib/json/tool.py M Lib/test/test_json/test_tool.py diff --git a/Doc/library/json.rst b/Doc/library/json.rst index 23e39e95f783e..573ec1cb77dd6 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -732,6 +732,12 @@ Command line options .. versionadded:: 3.5 +.. cmdoption:: --no-ensure-ascii + + Disable escaping of non-ascii characters, see :func:`json.dumps` for more information. + + .. versionadded:: 3.9 + .. cmdoption:: --json-lines Parse every input line as separate JSON object. diff --git a/Lib/json/tool.py b/Lib/json/tool.py index 2a404a4441796..5542ce48c3802 100644 --- a/Lib/json/tool.py +++ b/Lib/json/tool.py @@ -30,6 +30,8 @@ def main(): default=sys.stdout) parser.add_argument('--sort-keys', action='store_true', default=False, help='sort the output of dictionaries alphabetically by key') + parser.add_argument('--no-ensure-ascii', dest='ensure_ascii', action='store_false', + help='disable escaping of non-ASCII characters') parser.add_argument('--json-lines', action='store_true', default=False, help='parse input using the jsonlines format') group = parser.add_mutually_exclusive_group() @@ -49,6 +51,7 @@ def main(): dump_args = { 'sort_keys': options.sort_keys, 'indent': options.indent, + 'ensure_ascii': options.ensure_ascii, } if options.compact: dump_args['indent'] = None diff --git a/Lib/test/test_json/test_tool.py b/Lib/test/test_json/test_tool.py index 953a5696e7c22..54800ae840c64 100644 --- a/Lib/test/test_json/test_tool.py +++ b/Lib/test/test_json/test_tool.py @@ -190,3 +190,25 @@ def test_compact(self): json_stdout, err = proc.communicate(json_stdin) self.assertEqual(expect.splitlines(), json_stdout.splitlines()) self.assertEqual(err, b'') + + def test_no_ensure_ascii_flag(self): + infile = self._create_infile('{"key":"?"}') + outfile = support.TESTFN + '.out' + self.addCleanup(os.remove, outfile) + assert_python_ok('-m', 'json.tool', '--no-ensure-ascii', infile, outfile) + with open(outfile, "rb") as f: + lines = f.read().splitlines() + # asserting utf-8 encoded output file + expected = [b'{', b' "key": "\xf0\x9f\x92\xa9"', b"}"] + self.assertEqual(lines, expected) + + def test_ensure_ascii_default(self): + infile = self._create_infile('{"key":"?"}') + outfile = support.TESTFN + '.out' + self.addCleanup(os.remove, outfile) + assert_python_ok('-m', 'json.tool', infile, outfile) + with open(outfile, "rb") as f: + lines = f.read().splitlines() + # asserting an ascii encoded output file + expected = [b'{', rb' "key": "\ud83d\udca9"', b"}"] + self.assertEqual(lines, expected) diff --git a/Misc/NEWS.d/next/Library/2019-12-05-02-02-58.bpo-27413.212Th2.rst b/Misc/NEWS.d/next/Library/2019-12-05-02-02-58.bpo-27413.212Th2.rst new file mode 100644 index 0000000000000..0116b8c2813f5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-05-02-02-58.bpo-27413.212Th2.rst @@ -0,0 +1,2 @@ +Added ability to pass through ``ensure_ascii`` options to json.dumps in the +``json.tool`` command-line interface. From webhook-mailer at python.org Fri Dec 6 09:27:49 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Fri, 06 Dec 2019 14:27:49 -0000 Subject: [Python-checkins] bpo-36820: Break unnecessary cycle in socket.py, codeop.py and dyld.py (GH-13135) Message-ID: https://github.com/python/cpython/commit/b64334cb93d0ddbb551c8cd712942bab2fc72772 commit: b64334cb93d0ddbb551c8cd712942bab2fc72772 branch: master author: Mario Corchero committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-06T06:27:38-08:00 summary: bpo-36820: Break unnecessary cycle in socket.py, codeop.py and dyld.py (GH-13135) Break cycle generated when saving an exception in socket.py, codeop.py and dyld.py as they keep alive not only the exception but user objects through the ``__traceback__`` attribute. https://bugs.python.org/issue36820 Automerge-Triggered-By: @pablogsal files: A Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst M Lib/codeop.py M Lib/ctypes/macholib/dyld.py M Lib/socket.py diff --git a/Lib/codeop.py b/Lib/codeop.py index fc7e1e70ceafe..082285f94fe84 100644 --- a/Lib/codeop.py +++ b/Lib/codeop.py @@ -93,10 +93,13 @@ def _maybe_compile(compiler, source, filename, symbol): except SyntaxError as e: err2 = e - if code: - return code - if not code1 and repr(err1) == repr(err2): - raise err1 + try: + if code: + return code + if not code1 and repr(err1) == repr(err2): + raise err1 + finally: + err1 = err2 = None def _compile(source, filename, symbol): return compile(source, filename, symbol, PyCF_DONT_IMPLY_DEDENT) diff --git a/Lib/ctypes/macholib/dyld.py b/Lib/ctypes/macholib/dyld.py index c158e672f0511..9d86b058765a3 100644 --- a/Lib/ctypes/macholib/dyld.py +++ b/Lib/ctypes/macholib/dyld.py @@ -149,6 +149,8 @@ def framework_find(fn, executable_path=None, env=None): return dyld_find(fn, executable_path=executable_path, env=env) except ValueError: raise error + finally: + error = None def test_dyld_find(): env = {} diff --git a/Lib/socket.py b/Lib/socket.py index 84a5dcb0daf29..374f1124bf7e8 100755 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -839,7 +839,11 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, sock.close() if err is not None: - raise err + try: + raise err + finally: + # Break explicitly a reference cycle + err = None else: raise error("getaddrinfo returns an empty list") diff --git a/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst b/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst new file mode 100644 index 0000000000000..82f6635c81582 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst @@ -0,0 +1,3 @@ +Break cycle generated when saving an exception in socket.py, codeop.py and +dyld.py as they keep alive not only the exception but user objects through +the ``__traceback__`` attribute. Patch by Mario Corchero. From webhook-mailer at python.org Fri Dec 6 09:59:56 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Fri, 06 Dec 2019 14:59:56 -0000 Subject: [Python-checkins] bpo-36820: Break unnecessary cycle in socket.py, codeop.py and dyld.py (GH-13135) Message-ID: https://github.com/python/cpython/commit/681285d052977e3a3a82ef665e788946fca1ac59 commit: 681285d052977e3a3a82ef665e788946fca1ac59 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-06T06:59:49-08:00 summary: bpo-36820: Break unnecessary cycle in socket.py, codeop.py and dyld.py (GH-13135) Break cycle generated when saving an exception in socket.py, codeop.py and dyld.py as they keep alive not only the exception but user objects through the ``__traceback__`` attribute. https://bugs.python.org/issue36820 Automerge-Triggered-By: @pablogsal (cherry picked from commit b64334cb93d0ddbb551c8cd712942bab2fc72772) Co-authored-by: Mario Corchero files: A Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst M Lib/codeop.py M Lib/ctypes/macholib/dyld.py M Lib/socket.py diff --git a/Lib/codeop.py b/Lib/codeop.py index fb759da42ad1a..0fa677f609b74 100644 --- a/Lib/codeop.py +++ b/Lib/codeop.py @@ -93,10 +93,13 @@ def _maybe_compile(compiler, source, filename, symbol): except SyntaxError as e: err2 = e - if code: - return code - if not code1 and repr(err1) == repr(err2): - raise err1 + try: + if code: + return code + if not code1 and repr(err1) == repr(err2): + raise err1 + finally: + err1 = err2 = None def _compile(source, filename, symbol): return compile(source, filename, symbol, PyCF_DONT_IMPLY_DEDENT) diff --git a/Lib/ctypes/macholib/dyld.py b/Lib/ctypes/macholib/dyld.py index c158e672f0511..9d86b058765a3 100644 --- a/Lib/ctypes/macholib/dyld.py +++ b/Lib/ctypes/macholib/dyld.py @@ -149,6 +149,8 @@ def framework_find(fn, executable_path=None, env=None): return dyld_find(fn, executable_path=executable_path, env=env) except ValueError: raise error + finally: + error = None def test_dyld_find(): env = {} diff --git a/Lib/socket.py b/Lib/socket.py index 813f4ef5c3e1f..5b17906ef479a 100644 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -804,7 +804,11 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, sock.close() if err is not None: - raise err + try: + raise err + finally: + # Break explicitly a reference cycle + err = None else: raise error("getaddrinfo returns an empty list") diff --git a/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst b/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst new file mode 100644 index 0000000000000..82f6635c81582 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst @@ -0,0 +1,3 @@ +Break cycle generated when saving an exception in socket.py, codeop.py and +dyld.py as they keep alive not only the exception but user objects through +the ``__traceback__`` attribute. Patch by Mario Corchero. From webhook-mailer at python.org Fri Dec 6 10:01:36 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Fri, 06 Dec 2019 15:01:36 -0000 Subject: [Python-checkins] bpo-36820: Break unnecessary cycle in socket.py, codeop.py and dyld.py (GH-13135) Message-ID: https://github.com/python/cpython/commit/5ba591fa2c1f74c4a84372fb4ffc0b16863f1ad7 commit: 5ba591fa2c1f74c4a84372fb4ffc0b16863f1ad7 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-06T07:01:31-08:00 summary: bpo-36820: Break unnecessary cycle in socket.py, codeop.py and dyld.py (GH-13135) Break cycle generated when saving an exception in socket.py, codeop.py and dyld.py as they keep alive not only the exception but user objects through the ``__traceback__`` attribute. https://bugs.python.org/issue36820 Automerge-Triggered-By: @pablogsal (cherry picked from commit b64334cb93d0ddbb551c8cd712942bab2fc72772) Co-authored-by: Mario Corchero files: A Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst M Lib/codeop.py M Lib/ctypes/macholib/dyld.py M Lib/socket.py diff --git a/Lib/codeop.py b/Lib/codeop.py index fb759da42ad1a..0fa677f609b74 100644 --- a/Lib/codeop.py +++ b/Lib/codeop.py @@ -93,10 +93,13 @@ def _maybe_compile(compiler, source, filename, symbol): except SyntaxError as e: err2 = e - if code: - return code - if not code1 and repr(err1) == repr(err2): - raise err1 + try: + if code: + return code + if not code1 and repr(err1) == repr(err2): + raise err1 + finally: + err1 = err2 = None def _compile(source, filename, symbol): return compile(source, filename, symbol, PyCF_DONT_IMPLY_DEDENT) diff --git a/Lib/ctypes/macholib/dyld.py b/Lib/ctypes/macholib/dyld.py index c158e672f0511..9d86b058765a3 100644 --- a/Lib/ctypes/macholib/dyld.py +++ b/Lib/ctypes/macholib/dyld.py @@ -149,6 +149,8 @@ def framework_find(fn, executable_path=None, env=None): return dyld_find(fn, executable_path=executable_path, env=env) except ValueError: raise error + finally: + error = None def test_dyld_find(): env = {} diff --git a/Lib/socket.py b/Lib/socket.py index cfa605a22ada9..40c7636cef006 100644 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -724,7 +724,11 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, sock.close() if err is not None: - raise err + try: + raise err + finally: + # Break explicitly a reference cycle + err = None else: raise error("getaddrinfo returns an empty list") diff --git a/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst b/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst new file mode 100644 index 0000000000000..82f6635c81582 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst @@ -0,0 +1,3 @@ +Break cycle generated when saving an exception in socket.py, codeop.py and +dyld.py as they keep alive not only the exception but user objects through +the ``__traceback__`` attribute. Patch by Mario Corchero. From webhook-mailer at python.org Fri Dec 6 10:32:47 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 06 Dec 2019 15:32:47 -0000 Subject: [Python-checkins] bpo-38982: Fix asyncio PidfdChildWatcher on waitpid() error (GH-17477) Message-ID: https://github.com/python/cpython/commit/e76ee1a72b9e3f5da287663ea3daec4bb3f67612 commit: e76ee1a72b9e3f5da287663ea3daec4bb3f67612 branch: master author: Victor Stinner committer: GitHub date: 2019-12-06T16:32:41+01:00 summary: bpo-38982: Fix asyncio PidfdChildWatcher on waitpid() error (GH-17477) If waitpid() is called elsewhere, waitpid() call fails with ChildProcessError: use return code 255 in this case, and log a warning. It ensure that the pidfd file descriptor is closed if this error occurs. files: A Misc/NEWS.d/next/Library/2019-12-05-18-21-26.bpo-38982.W3u-03.rst M Lib/asyncio/unix_events.py diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index 97198ea2f4953..28fb491864517 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -930,9 +930,20 @@ def add_child_handler(self, pid, callback, *args): def _do_wait(self, pid): pidfd, callback, args = self._callbacks.pop(pid) self._loop._remove_reader(pidfd) - _, status = os.waitpid(pid, 0) + try: + _, status = os.waitpid(pid, 0) + except ChildProcessError: + # The child process is already reaped + # (may happen if waitpid() is called elsewhere). + returncode = 255 + logger.warning( + "child process pid %d exit status already read: " + " will report returncode 255", + pid) + else: + returncode = _compute_returncode(status) + os.close(pidfd) - returncode = _compute_returncode(status) callback(pid, returncode, *args) def remove_child_handler(self, pid): diff --git a/Misc/NEWS.d/next/Library/2019-12-05-18-21-26.bpo-38982.W3u-03.rst b/Misc/NEWS.d/next/Library/2019-12-05-18-21-26.bpo-38982.W3u-03.rst new file mode 100644 index 0000000000000..b591209ea06ef --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-05-18-21-26.bpo-38982.W3u-03.rst @@ -0,0 +1,5 @@ +Fix asyncio ``PidfdChildWatcher``: handle ``waitpid()`` error. If +``waitpid()`` is called elsewhere, ``waitpid()`` call fails with +:exc:`ChildProcessError`: use return code 255 in this case, and log a +warning. It ensures that the pidfd file descriptor is closed if this error +occurs. From webhook-mailer at python.org Fri Dec 6 12:41:03 2019 From: webhook-mailer at python.org (Steve Dower) Date: Fri, 06 Dec 2019 17:41:03 -0000 Subject: [Python-checkins] bpo-33125: Add support for building and releasing Windows ARM64 packages (GH-17480) Message-ID: https://github.com/python/cpython/commit/c9f480d2ccda9de46584cabe086f0acfa45f2faf commit: c9f480d2ccda9de46584cabe086f0acfa45f2faf branch: 3.8 author: Steve Dower committer: GitHub date: 2019-12-06T09:40:39-08:00 summary: bpo-33125: Add support for building and releasing Windows ARM64 packages (GH-17480) Note that the support is not actually enabled yet, and so we won't be publishing these packages. However, for those who want to build it themselves (even by reusing the Azure Pipelines definition), it's now relatively easy to enable. files: A Misc/NEWS.d/next/Windows/2019-11-14-08-57-50.bpo-33125.EN5MWS.rst M .azure-pipelines/ci.yml M .azure-pipelines/pr.yml M .azure-pipelines/windows-release/build-steps.yml M .azure-pipelines/windows-release/layout-command.yml M .azure-pipelines/windows-release/msi-steps.yml M .azure-pipelines/windows-release/stage-build.yml M .azure-pipelines/windows-release/stage-layout-embed.yml M .azure-pipelines/windows-release/stage-layout-full.yml M .azure-pipelines/windows-release/stage-layout-msix.yml M .azure-pipelines/windows-release/stage-layout-nuget.yml M .azure-pipelines/windows-release/stage-pack-msix.yml M .azure-pipelines/windows-release/stage-pack-nuget.yml M .azure-pipelines/windows-release/stage-publish-nugetorg.yml M .azure-pipelines/windows-release/stage-publish-pythonorg.yml M .azure-pipelines/windows-release/stage-sign.yml M .azure-pipelines/windows-steps.yml M PC/layout/main.py M PC/layout/support/appxmanifest.py M PC/layout/support/constants.py M PC/layout/support/nuspec.py M PC/layout/support/props.py M PCbuild/build.bat M PCbuild/find_msbuild.bat M PCbuild/pcbuild.proj M PCbuild/prepare_libffi.bat M PCbuild/python_uwp.vcxproj M PCbuild/pythonw_uwp.vcxproj diff --git a/.azure-pipelines/ci.yml b/.azure-pipelines/ci.yml index fe10e45b67922..4c2f115cd9b60 100644 --- a/.azure-pipelines/ci.yml +++ b/.azure-pipelines/ci.yml @@ -145,7 +145,7 @@ jobs: buildOpt: '-p x64' testRunTitle: '$(Build.SourceBranchName)-win64' testRunPlatform: win64 - maxParallel: 2 + maxParallel: 4 steps: - template: ./windows-steps.yml diff --git a/.azure-pipelines/pr.yml b/.azure-pipelines/pr.yml index 09209fc0c954d..73d4f55b86450 100644 --- a/.azure-pipelines/pr.yml +++ b/.azure-pipelines/pr.yml @@ -145,7 +145,10 @@ jobs: buildOpt: '-p x64' testRunTitle: '$(System.PullRequest.TargetBranch)-win64' testRunPlatform: win64 - maxParallel: 2 + winarm64: + arch: arm64 + buildOpt: '-p arm64' + maxParallel: 4 steps: - template: ./windows-steps.yml diff --git a/.azure-pipelines/windows-release/build-steps.yml b/.azure-pipelines/windows-release/build-steps.yml index d4563cd0d722c..e2b6683f46e3c 100644 --- a/.azure-pipelines/windows-release/build-steps.yml +++ b/.azure-pipelines/windows-release/build-steps.yml @@ -43,7 +43,7 @@ steps: - powershell: | $env:SigningCertificate = $null - .\python.bat PC\layout -vv -t "$(Build.BinariesDirectory)\catalog" --catalog "${env:CAT}.cdf" --preset-default + python PC\layout -vv -b "$(Build.BinariesDirectory)\bin" -t "$(Build.BinariesDirectory)\catalog" --catalog "${env:CAT}.cdf" --preset-default --arch $(Arch) makecat "${env:CAT}.cdf" del "${env:CAT}.cdf" if (-not (Test-Path "${env:CAT}.cat")) { @@ -52,6 +52,7 @@ steps: displayName: 'Generate catalog' env: CAT: $(Build.BinariesDirectory)\bin\$(Arch)\python + PYTHON_HEXVERSION: $(VersionHex) - task: PublishPipelineArtifact at 0 displayName: 'Publish binaries' diff --git a/.azure-pipelines/windows-release/layout-command.yml b/.azure-pipelines/windows-release/layout-command.yml index 2dcd6ed26ca3a..406ccd859faa6 100644 --- a/.azure-pipelines/windows-release/layout-command.yml +++ b/.azure-pipelines/windows-release/layout-command.yml @@ -1,12 +1,20 @@ steps: +- task: DownloadPipelineArtifact at 1 + displayName: 'Download artifact: bin_$(HostArch)' + condition: and(succeeded(), variables['HostArch']) + inputs: + artifactName: bin_$(HostArch) + targetPath: $(Build.BinariesDirectory)\bin_$(HostArch) + - powershell: > Write-Host ( '##vso[task.setvariable variable=LayoutCmd]& - "{0}\bin\python.exe" + "$(Python)" "{1}\PC\layout" -vv --source "{1}" --build "{0}\bin" + --arch "$(Name)" --temp "{0}\layout-temp" --include-cat "{0}\bin\python.cat" --doc-build "{0}\doc"' diff --git a/.azure-pipelines/windows-release/msi-steps.yml b/.azure-pipelines/windows-release/msi-steps.yml index f7bff162f8e02..a460eb1bac8fe 100644 --- a/.azure-pipelines/windows-release/msi-steps.yml +++ b/.azure-pipelines/windows-release/msi-steps.yml @@ -54,6 +54,7 @@ steps: - powershell: | copy $(Build.BinariesDirectory)\amd64\Activate.ps1 Lib\venv\scripts\common\Activate.ps1 -Force displayName: 'Copy signed files into sources' + condition: and(succeeded(), variables['SigningCertificate']) - script: | call Tools\msi\get_externals.bat diff --git a/.azure-pipelines/windows-release/stage-build.yml b/.azure-pipelines/windows-release/stage-build.yml index c98576ef9705c..60d72b282d1e5 100644 --- a/.azure-pipelines/windows-release/stage-build.yml +++ b/.azure-pipelines/windows-release/stage-build.yml @@ -16,14 +16,16 @@ jobs: env: BUILDDIR: $(Build.BinariesDirectory)\Doc - #- powershell: iwr "https://www.python.org/ftp/python/3.7.3/python373.chm" -OutFile "$(Build.BinariesDirectory)\python390a0.chm" - # displayName: 'Cheat at building CHM docs' - - script: Doc\make.bat htmlhelp displayName: 'Build CHM docs' env: BUILDDIR: $(Build.BinariesDirectory)\Doc + #- powershell: | + # mkdir -Force "$(Build.BinariesDirectory)\Doc\htmlhelp" + # iwr "https://www.python.org/ftp/python/3.8.0/python380.chm" -OutFile "$(Build.BinariesDirectory)\Doc\htmlhelp\python390a0.chm" + # displayName: 'Cheat at building CHM docs' + - task: CopyFiles at 2 displayName: 'Assemble artifact: Doc' inputs: @@ -65,6 +67,16 @@ jobs: Arch: amd64 Platform: x64 Configuration: Debug + arm64: + Name: arm64 + Arch: arm64 + Platform: ARM64 + Configuration: Release + arm64_d: + Name: arm64_d + Arch: arm64 + Platform: ARM64 + Configuration: Debug steps: - template: ./build-steps.yml diff --git a/.azure-pipelines/windows-release/stage-layout-embed.yml b/.azure-pipelines/windows-release/stage-layout-embed.yml index 09857ff676b35..3306e1cbc49d9 100644 --- a/.azure-pipelines/windows-release/stage-layout-embed.yml +++ b/.azure-pipelines/windows-release/stage-layout-embed.yml @@ -19,6 +19,11 @@ jobs: Name: amd64 Python: $(Build.BinariesDirectory)\bin\python.exe PYTHONHOME: $(Build.SourcesDirectory) + arm64: + Name: arm64 + HostArch: amd64 + Python: $(Build.BinariesDirectory)\bin_amd64\python.exe + PYTHONHOME: $(Build.SourcesDirectory) steps: - template: ./checkout.yml diff --git a/.azure-pipelines/windows-release/stage-layout-full.yml b/.azure-pipelines/windows-release/stage-layout-full.yml index 12c347239013c..78bc1b3975e93 100644 --- a/.azure-pipelines/windows-release/stage-layout-full.yml +++ b/.azure-pipelines/windows-release/stage-layout-full.yml @@ -13,11 +13,18 @@ jobs: matrix: win32: Name: win32 - Python: $(Build.BinariesDirectory)\bin_$(Name)\python.exe + Python: $(Build.BinariesDirectory)\bin\python.exe PYTHONHOME: $(Build.SourcesDirectory) + TclLibrary: $(Build.BinariesDirectory)\tcltk_lib\tcl8 amd64: Name: amd64 - Python: $(Build.BinariesDirectory)\bin_$(Name)\python.exe + Python: $(Build.BinariesDirectory)\bin\python.exe + PYTHONHOME: $(Build.SourcesDirectory) + TclLibrary: $(Build.BinariesDirectory)\tcltk_lib\tcl8 + arm64: + Name: arm64 + HostArch: amd64 + Python: $(Build.BinariesDirectory)\bin_amd64\python.exe PYTHONHOME: $(Build.SourcesDirectory) steps: @@ -43,13 +50,15 @@ jobs: - task: DownloadPipelineArtifact at 1 displayName: 'Download artifact: tcltk_lib_$(Name)' + condition: and(succeeded(), variables['TclLibrary']) inputs: artifactName: tcltk_lib_$(Name) targetPath: $(Build.BinariesDirectory)\tcltk_lib - powershell: | - copy $(Build.BinariesDirectory)\bin\Activate.ps1 Lib\venv\scripts\common\Activate.ps1 -Force + copy "$(Build.BinariesDirectory)\bin\Activate.ps1" Lib\venv\scripts\common\Activate.ps1 -Force displayName: 'Copy signed files into sources' + condition: and(succeeded(), variables['SigningCertificate']) - template: ./layout-command.yml @@ -57,7 +66,7 @@ jobs: $(LayoutCmd) --copy "$(Build.ArtifactStagingDirectory)\layout" --preset-default displayName: 'Generate full layout' env: - TCL_LIBRARY: $(Build.BinariesDirectory)\tcltk_lib\tcl8 + TCL_LIBRARY: $(TclLibrary) - task: PublishPipelineArtifact at 0 displayName: 'Publish Artifact: layout_full_$(Name)' diff --git a/.azure-pipelines/windows-release/stage-layout-msix.yml b/.azure-pipelines/windows-release/stage-layout-msix.yml index ba86392f3ec69..60a5c9ea5435c 100644 --- a/.azure-pipelines/windows-release/stage-layout-msix.yml +++ b/.azure-pipelines/windows-release/stage-layout-msix.yml @@ -12,11 +12,18 @@ jobs: matrix: #win32: # Name: win32 - # Python: $(Build.BinariesDirectory)\bin_$(Name)\python.exe + # Python: $(Build.BinariesDirectory)\bin\python.exe # PYTHONHOME: $(Build.SourcesDirectory) + # TclLibrary: $(Build.BinariesDirectory)\tcltk_lib\tcl8 amd64: Name: amd64 - Python: $(Build.BinariesDirectory)\bin_$(Name)\python.exe + Python: $(Build.BinariesDirectory)\bin\python.exe + PYTHONHOME: $(Build.SourcesDirectory) + TclLibrary: $(Build.BinariesDirectory)\tcltk_lib\tcl8 + arm64: + Name: arm64 + HostArch: amd64 + Python: $(Build.BinariesDirectory)\bin_amd64\python.exe PYTHONHOME: $(Build.SourcesDirectory) steps: @@ -36,13 +43,15 @@ jobs: - task: DownloadPipelineArtifact at 1 displayName: 'Download artifact: tcltk_lib_$(Name)' + condition: and(succeeded(), variables['TclLibrary']) inputs: artifactName: tcltk_lib_$(Name) targetPath: $(Build.BinariesDirectory)\tcltk_lib - powershell: | - copy $(Build.BinariesDirectory)\bin\Activate.ps1 Lib\venv\scripts\common\Activate.ps1 -Force + copy "$(Build.BinariesDirectory)\bin\Activate.ps1" Lib\venv\scripts\common\Activate.ps1 -Force displayName: 'Copy signed files into sources' + condition: and(succeeded(), variables['SigningCertificate']) - template: ./layout-command.yml @@ -51,7 +60,7 @@ jobs: $(LayoutCmd) --copy "$(Build.ArtifactStagingDirectory)\appx-store" --preset-appx --precompile displayName: 'Generate store APPX layout' env: - TCL_LIBRARY: $(Build.BinariesDirectory)\tcltk_lib\tcl8 + TCL_LIBRARY: $(TclLibrary) - task: PublishPipelineArtifact at 0 displayName: 'Publish Artifact: layout_appxstore_$(Name)' @@ -79,7 +88,7 @@ jobs: $(LayoutCmd) --copy "$(Build.ArtifactStagingDirectory)\appx" --preset-appx --precompile --include-symbols --include-tests displayName: 'Generate sideloading APPX layout' env: - TCL_LIBRARY: $(Build.BinariesDirectory)\tcltk_lib\tcl8 + TCL_LIBRARY: $(TclLibrary) - task: PublishPipelineArtifact at 0 displayName: 'Publish Artifact: layout_appx_$(Name)' diff --git a/.azure-pipelines/windows-release/stage-layout-nuget.yml b/.azure-pipelines/windows-release/stage-layout-nuget.yml index 7954c4547f50a..7e20f89530349 100644 --- a/.azure-pipelines/windows-release/stage-layout-nuget.yml +++ b/.azure-pipelines/windows-release/stage-layout-nuget.yml @@ -13,11 +13,16 @@ jobs: matrix: win32: Name: win32 - Python: $(Build.BinariesDirectory)\bin_$(Name)\python.exe + Python: $(Build.BinariesDirectory)\bin\python.exe PYTHONHOME: $(Build.SourcesDirectory) amd64: Name: amd64 - Python: $(Build.BinariesDirectory)\bin_$(Name)\python.exe + Python: $(Build.BinariesDirectory)\bin\python.exe + PYTHONHOME: $(Build.SourcesDirectory) + arm64: + Name: arm64 + HostArch: amd64 + Python: $(Build.BinariesDirectory)\bin_amd64\python.exe PYTHONHOME: $(Build.SourcesDirectory) steps: @@ -32,14 +37,13 @@ jobs: - powershell: | copy $(Build.BinariesDirectory)\bin\Activate.ps1 Lib\venv\scripts\common\Activate.ps1 -Force displayName: 'Copy signed files into sources' + condition: and(succeeded(), variables['SigningCertificate']) - template: ./layout-command.yml - powershell: | $(LayoutCmd) --copy "$(Build.ArtifactStagingDirectory)\nuget" --preset-nuget displayName: 'Generate nuget layout' - env: - TCL_LIBRARY: $(Build.BinariesDirectory)\bin_$(Name)\tcl\tcl8 - task: PublishPipelineArtifact at 0 displayName: 'Publish Artifact: layout_nuget_$(Name)' diff --git a/.azure-pipelines/windows-release/stage-pack-msix.yml b/.azure-pipelines/windows-release/stage-pack-msix.yml index eebc63fb8809b..f17ba9628e21b 100644 --- a/.azure-pipelines/windows-release/stage-pack-msix.yml +++ b/.azure-pipelines/windows-release/stage-pack-msix.yml @@ -20,6 +20,16 @@ jobs: Artifact: appxstore Suffix: -store Upload: true + arm64: + Name: arm64 + Artifact: appx + Suffix: + ShouldSign: true + arm64_store: + Name: arm64 + Artifact: appxstore + Suffix: -store + Upload: true steps: - template: ./checkout.yml diff --git a/.azure-pipelines/windows-release/stage-pack-nuget.yml b/.azure-pipelines/windows-release/stage-pack-nuget.yml index f59bbe9b39a8d..34619fc5fdc31 100644 --- a/.azure-pipelines/windows-release/stage-pack-nuget.yml +++ b/.azure-pipelines/windows-release/stage-pack-nuget.yml @@ -15,6 +15,8 @@ jobs: Name: amd64 win32: Name: win32 + arm64: + Name: arm64 steps: - checkout: none diff --git a/.azure-pipelines/windows-release/stage-publish-nugetorg.yml b/.azure-pipelines/windows-release/stage-publish-nugetorg.yml index 570cdb3ec57f0..b78bd493a0fd1 100644 --- a/.azure-pipelines/windows-release/stage-publish-nugetorg.yml +++ b/.azure-pipelines/windows-release/stage-publish-nugetorg.yml @@ -31,6 +31,11 @@ jobs: buildVersionToDownload: specific buildId: $(BuildToPublish) + - powershell: 'gci pythonarm*.nupkg | %{ Write-Host "Not publishing: $($_.Name)"; gi $_ } | del' + displayName: 'Prevent publishing ARM/ARM64 packages' + workingDirectory: '$(Build.BinariesDirectory)\nuget' + condition: and(succeeded(), not(variables['PublishArmPackages'])) + - task: NuGetCommand at 2 displayName: Push packages condition: and(succeeded(), eq(variables['SigningCertificate'], variables['__RealSigningCertificate'])) diff --git a/.azure-pipelines/windows-release/stage-publish-pythonorg.yml b/.azure-pipelines/windows-release/stage-publish-pythonorg.yml index 2dd354a8c276f..8c95f1b950cd7 100644 --- a/.azure-pipelines/windows-release/stage-publish-pythonorg.yml +++ b/.azure-pipelines/windows-release/stage-publish-pythonorg.yml @@ -39,6 +39,10 @@ jobs: artifactName: embed downloadPath: $(Build.BinariesDirectory) + - powershell: 'gci *embed-arm*.zip | %{ Write-Host "Not publishing: $($_.Name)"; gi $_ } | del' + displayName: 'Prevent publishing ARM/ARM64 packages' + workingDirectory: '$(Build.BinariesDirectory)\embed' + condition: and(succeeded(), not(variables['PublishArmPackages'])) - task: DownloadPipelineArtifact at 1 displayName: 'Download artifact from $(BuildToPublish): Doc' diff --git a/.azure-pipelines/windows-release/stage-sign.yml b/.azure-pipelines/windows-release/stage-sign.yml index 2307c6c9c8f97..a0adc0581229d 100644 --- a/.azure-pipelines/windows-release/stage-sign.yml +++ b/.azure-pipelines/windows-release/stage-sign.yml @@ -19,6 +19,8 @@ jobs: Name: win32 amd64: Name: amd64 + arm64: + Name: arm64 steps: - template: ./checkout.yml diff --git a/.azure-pipelines/windows-steps.yml b/.azure-pipelines/windows-steps.yml index 794a23a5d77e8..f502c40637c31 100644 --- a/.azure-pipelines/windows-steps.yml +++ b/.azure-pipelines/windows-steps.yml @@ -19,9 +19,11 @@ steps: - script: python.bat -m test.pythoninfo displayName: 'Display build info' + condition: and(succeeded(), variables['testRunPlatform']) - script: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 --junit-xml="$(Build.BinariesDirectory)\test-results.xml" --tempdir="$(Build.BinariesDirectory)\test" displayName: 'Tests' + condition: and(succeeded(), variables['testRunPlatform']) env: PREFIX: $(Py_OutDir)\$(arch) @@ -32,4 +34,4 @@ steps: mergeTestResults: true testRunTitle: $(testRunTitle) platform: $(testRunPlatform) - condition: succeededOrFailed() + condition: and(succeededOrFailed(), variables['testRunPlatform']) diff --git a/Misc/NEWS.d/next/Windows/2019-11-14-08-57-50.bpo-33125.EN5MWS.rst b/Misc/NEWS.d/next/Windows/2019-11-14-08-57-50.bpo-33125.EN5MWS.rst new file mode 100644 index 0000000000000..0bc98c1a2fae7 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2019-11-14-08-57-50.bpo-33125.EN5MWS.rst @@ -0,0 +1 @@ +Add support for building and releasing Windows ARM64 packages. diff --git a/PC/layout/main.py b/PC/layout/main.py index 3ca49d08e8f98..305cb517d0f71 100644 --- a/PC/layout/main.py +++ b/PC/layout/main.py @@ -285,14 +285,13 @@ def _compile_one_py(src, dest, name, optimize, checked=True): log_warning("Failed to compile {}", src) return None + # name argument added to address bpo-37641 def _py_temp_compile(src, name, ns, dest_dir=None, checked=True): if not ns.precompile or src not in PY_FILES or src.parent in DATA_DIRS: return None dest = (dest_dir or ns.temp) / (src.stem + ".pyc") - return _compile_one_py( - src, dest, name, optimize=2, checked=checked - ) + return _compile_one_py(src, dest, name, optimize=2, checked=checked) def _write_to_zip(zf, dest, src, ns, checked=True): @@ -496,6 +495,13 @@ def main(): parser.add_argument( "-b", "--build", metavar="dir", help="Specify the build directory", type=Path ) + parser.add_argument( + "--arch", + metavar="architecture", + help="Specify the target architecture", + type=str, + default=None, + ) parser.add_argument( "--doc-build", metavar="dir", @@ -587,6 +593,8 @@ def main(): ns.doc_build = (Path.cwd() / ns.doc_build).resolve() if ns.include_cat and not ns.include_cat.is_absolute(): ns.include_cat = (Path.cwd() / ns.include_cat).resolve() + if not ns.arch: + ns.arch = "amd64" if sys.maxsize > 2 ** 32 else "win32" if ns.copy and not ns.copy.is_absolute(): ns.copy = (Path.cwd() / ns.copy).resolve() @@ -602,6 +610,7 @@ def main(): Source: {ns.source} Build: {ns.build} Temp: {ns.temp} +Arch: {ns.arch} Copy to: {ns.copy} Zip to: {ns.zip} @@ -609,6 +618,15 @@ def main(): ns=ns, ) + if ns.arch not in ("win32", "amd64", "arm32", "arm64"): + log_error("--arch is not a valid value (win32, amd64, arm32, arm64)") + return 4 + if ns.arch in ("arm32", "arm64"): + for n in ("include_idle", "include_tcltk"): + if getattr(ns, n): + log_warning(f"Disabling --{n.replace('_', '-')} on unsupported platform") + setattr(ns, n, False) + if ns.include_idle and not ns.include_tcltk: log_warning("Assuming --include-tcltk to support --include-idle") ns.include_tcltk = True diff --git a/PC/layout/support/appxmanifest.py b/PC/layout/support/appxmanifest.py index de5813a2536ae..9e008f793cf55 100644 --- a/PC/layout/support/appxmanifest.py +++ b/PC/layout/support/appxmanifest.py @@ -28,7 +28,14 @@ ), DisplayName="Python {}".format(VER_DOT), Description="The Python {} runtime and console.".format(VER_DOT), - ProcessorArchitecture="x64" if IS_X64 else "x86", +) + +APPX_PLATFORM_DATA = dict( + _keys=("ProcessorArchitecture",), + win32=("x86",), + amd64=("x64",), + arm32=("arm",), + arm64=("arm64",), ) PYTHON_VE_DATA = dict( @@ -65,7 +72,7 @@ BackgroundColor="transparent", ) -PY_PNG = '_resources/py.png' +PY_PNG = "_resources/py.png" APPXMANIFEST_NS = { "": "http://schemas.microsoft.com/appx/manifest/foundation/windows10", @@ -147,18 +154,22 @@ SCCD_FILENAME = "PC/classicAppCompat.sccd" +SPECIAL_LOOKUP = object() + REGISTRY = { "HKCU\\Software\\Python\\PythonCore": { VER_DOT: { "DisplayName": APPX_DATA["DisplayName"], "SupportUrl": "https://www.python.org/", - "SysArchitecture": "64bit" if IS_X64 else "32bit", + "SysArchitecture": SPECIAL_LOOKUP, "SysVersion": VER_DOT, "Version": "{}.{}.{}".format(VER_MAJOR, VER_MINOR, VER_MICRO), "InstallPath": { "": "[{AppVPackageRoot}]", "ExecutablePath": "[{{AppVPackageRoot}}]\\python{}.exe".format(VER_DOT), - "WindowedExecutablePath": "[{{AppVPackageRoot}}]\\pythonw{}.exe".format(VER_DOT), + "WindowedExecutablePath": "[{{AppVPackageRoot}}]\\pythonw{}.exe".format( + VER_DOT + ), }, "Help": { "Main Python Documentation": { @@ -338,6 +349,16 @@ def _get_registry_entries(ns, root="", d=None): if len(fullkey.parts) > 1: yield str(fullkey), None, None yield from _get_registry_entries(ns, fullkey, value) + elif value is SPECIAL_LOOKUP: + if key == "SysArchitecture": + return { + "win32": "32bit", + "amd64": "64bit", + "arm32": "32bit", + "arm64": "64bit", + }[ns.arch] + else: + raise ValueError(f"Key '{key}' unhandled for special lookup") elif len(r.parts) > 1: yield str(r), key, value @@ -376,14 +397,18 @@ def get_appxmanifest(ns): NS = APPXMANIFEST_NS QN = ET.QName + data = dict(APPX_DATA) + for k, v in zip(APPX_PLATFORM_DATA["_keys"], APPX_PLATFORM_DATA[ns.arch]): + data[k] = v + node = xml.find("m:Identity", NS) for k in node.keys(): - value = APPX_DATA.get(k) + value = data.get(k) if value: node.set(k, value) for node in xml.find("m:Properties", NS): - value = APPX_DATA.get(node.tag.rpartition("}")[2]) + value = data.get(node.tag.rpartition("}")[2]) if value: node.text = value @@ -405,7 +430,7 @@ def get_appxmanifest(ns): ["python", "python{}".format(VER_MAJOR), "python{}".format(VER_DOT)], PYTHON_VE_DATA, "console", - ("python.file", [".py"], '"%1"', 'Python File', PY_PNG), + ("python.file", [".py"], '"%1"', "Python File", PY_PNG), ) add_application( @@ -416,7 +441,7 @@ def get_appxmanifest(ns): ["pythonw", "pythonw{}".format(VER_MAJOR), "pythonw{}".format(VER_DOT)], PYTHONW_VE_DATA, "windows", - ("python.windowedfile", [".pyw"], '"%1"', 'Python File (no console)', PY_PNG), + ("python.windowedfile", [".pyw"], '"%1"', "Python File (no console)", PY_PNG), ) if ns.include_pip and ns.include_launchers: @@ -428,7 +453,7 @@ def get_appxmanifest(ns): ["pip", "pip{}".format(VER_MAJOR), "pip{}".format(VER_DOT)], PIP_VE_DATA, "console", - ("python.wheel", [".whl"], 'install "%1"', 'Python Wheel'), + ("python.wheel", [".whl"], 'install "%1"', "Python Wheel"), ) if ns.include_idle and ns.include_launchers: diff --git a/PC/layout/support/constants.py b/PC/layout/support/constants.py index d76fa3bbf3b47..a8647631e9b4c 100644 --- a/PC/layout/support/constants.py +++ b/PC/layout/support/constants.py @@ -5,15 +5,31 @@ __author__ = "Steve Dower " __version__ = "3.8" +import os +import re import struct import sys -VER_MAJOR, VER_MINOR, VER_MICRO, VER_FIELD4 = struct.pack(">i", sys.hexversion) + +def _unpack_hexversion(): + try: + hexversion = int(os.getenv("PYTHON_HEXVERSION"), 16) + except (TypeError, ValueError): + hexversion = sys.hexversion + return struct.pack(">i", sys.hexversion) + + +def _get_suffix(field4): + name = {0xA0: "a", 0xB0: "b", 0xC0: "c"}.get(field4 & 0xF0, "") + if name: + serial = field4 & 0x0F + return f"{name}{serial}" + return "" + + +VER_MAJOR, VER_MINOR, VER_MICRO, VER_FIELD4 = _unpack_hexversion() +VER_SUFFIX = _get_suffix(VER_FIELD4) VER_FIELD3 = VER_MICRO << 8 | VER_FIELD4 -VER_NAME = {"alpha": "a", "beta": "b", "candidate": "rc"}.get( - sys.version_info.releaselevel, "" -) -VER_SERIAL = sys.version_info.serial if VER_NAME else "" VER_DOT = "{}.{}".format(VER_MAJOR, VER_MINOR) PYTHON_DLL_NAME = "python{}{}.dll".format(VER_MAJOR, VER_MINOR) @@ -21,8 +37,6 @@ PYTHON_ZIP_NAME = "python{}{}.zip".format(VER_MAJOR, VER_MINOR) PYTHON_PTH_NAME = "python{}{}._pth".format(VER_MAJOR, VER_MINOR) -PYTHON_CHM_NAME = "python{}{}{}{}{}.chm".format( - VER_MAJOR, VER_MINOR, VER_MICRO, VER_NAME, VER_SERIAL +PYTHON_CHM_NAME = "python{}{}{}{}.chm".format( + VER_MAJOR, VER_MINOR, VER_MICRO, VER_SUFFIX ) - -IS_X64 = sys.maxsize > 2 ** 32 diff --git a/PC/layout/support/nuspec.py b/PC/layout/support/nuspec.py index ba26ff337e91e..b85095c555fe0 100644 --- a/PC/layout/support/nuspec.py +++ b/PC/layout/support/nuspec.py @@ -13,25 +13,21 @@ NUSPEC_DATA = { "PYTHON_TAG": VER_DOT, "PYTHON_VERSION": os.getenv("PYTHON_NUSPEC_VERSION"), - "PYTHON_BITNESS": "64-bit" if IS_X64 else "32-bit", - "PACKAGENAME": os.getenv("PYTHON_NUSPEC_PACKAGENAME"), - "PACKAGETITLE": os.getenv("PYTHON_NUSPEC_PACKAGETITLE"), "FILELIST": r' ', } -if not NUSPEC_DATA["PYTHON_VERSION"]: - if VER_NAME: - NUSPEC_DATA["PYTHON_VERSION"] = "{}.{}-{}{}".format( - VER_DOT, VER_MICRO, VER_NAME, VER_SERIAL - ) - else: - NUSPEC_DATA["PYTHON_VERSION"] = "{}.{}".format(VER_DOT, VER_MICRO) - -if not NUSPEC_DATA["PACKAGETITLE"]: - NUSPEC_DATA["PACKAGETITLE"] = "Python" if IS_X64 else "Python (32-bit)" +NUSPEC_PLATFORM_DATA = dict( + _keys=("PYTHON_BITNESS", "PACKAGENAME", "PACKAGETITLE"), + win32=("32-bit", "pythonx86", "Python (32-bit)"), + amd64=("64-bit", "python", "Python"), + arm32=("ARM", "pythonarm", "Python (ARM)"), + arm64=("ARM64", "pythonarm64", "Python (ARM64)"), +) -if not NUSPEC_DATA["PACKAGENAME"]: - NUSPEC_DATA["PACKAGENAME"] = "python" if IS_X64 else "pythonx86" +if not NUSPEC_DATA["PYTHON_VERSION"]: + NUSPEC_DATA["PYTHON_VERSION"] = "{}.{}{}{}".format( + VER_DOT, VER_MICRO, "-" if VER_SUFFIX else "", VER_SUFFIX + ) FILELIST_WITH_PROPS = r""" """ @@ -56,11 +52,21 @@ """ +def _get_nuspec_data_overrides(ns): + for k, v in zip(NUSPEC_PLATFORM_DATA["_keys"], NUSPEC_PLATFORM_DATA[ns.arch]): + ev = os.getenv("PYTHON_NUSPEC_" + k) + if ev: + yield k, ev + yield k, v + + def get_nuspec_layout(ns): if ns.include_all or ns.include_nuspec: - data = NUSPEC_DATA + data = dict(NUSPEC_DATA) + for k, v in _get_nuspec_data_overrides(ns): + if not data.get(k): + data[k] = v if ns.include_all or ns.include_props: - data = dict(data) data["FILELIST"] = FILELIST_WITH_PROPS nuspec = NUSPEC_TEMPLATE.format_map(data) yield "python.nuspec", ("python.nuspec", nuspec.encode("utf-8")) diff --git a/PC/layout/support/props.py b/PC/layout/support/props.py index 4d3b06195f6ed..b1560b5244762 100644 --- a/PC/layout/support/props.py +++ b/PC/layout/support/props.py @@ -18,15 +18,9 @@ } if not PROPS_DATA["PYTHON_VERSION"]: - if VER_NAME: - PROPS_DATA["PYTHON_VERSION"] = "{}.{}-{}{}".format( - VER_DOT, VER_MICRO, VER_NAME, VER_SERIAL - ) - else: - PROPS_DATA["PYTHON_VERSION"] = "{}.{}".format(VER_DOT, VER_MICRO) - -if not PROPS_DATA["PYTHON_PLATFORM"]: - PROPS_DATA["PYTHON_PLATFORM"] = "x64" if IS_X64 else "Win32" + PROPS_DATA["PYTHON_VERSION"] = "{}.{}{}{}".format( + VER_DOT, VER_MICRO, "-" if VER_SUFFIX else "", VER_SUFFIX + ) PROPS_DATA["PYTHON_TARGET"] = "_GetPythonRuntimeFilesDependsOn{}{}_{}".format( VER_MAJOR, VER_MINOR, PROPS_DATA["PYTHON_PLATFORM"] @@ -94,5 +88,13 @@ def get_props_layout(ns): if ns.include_all or ns.include_props: # TODO: Filter contents of props file according to included/excluded items - props = PROPS_TEMPLATE.format_map(PROPS_DATA) + d = dict(PROPS_DATA) + if not d.get("PYTHON_PLATFORM"): + d["PYTHON_PLATFORM"] = { + "win32": "Win32", + "amd64": "X64", + "arm32": "ARM", + "arm64": "ARM64", + }[ns.arch] + props = PROPS_TEMPLATE.format_map(d) yield "python.props", ("python.props", props.encode("utf-8")) diff --git a/PCbuild/build.bat b/PCbuild/build.bat index bce599329e73a..623409c24ec04 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -57,7 +57,7 @@ set conf=Release set target=Build set dir=%~dp0 set parallel=/m -set verbose=/nologo /v:m +set verbose=/nologo /v:m /clp:summary set kill= set do_pgo= set pgo_job=-m test --pgo diff --git a/PCbuild/find_msbuild.bat b/PCbuild/find_msbuild.bat index a2810f09c45e2..bc9d00c22c826 100644 --- a/PCbuild/find_msbuild.bat +++ b/PCbuild/find_msbuild.bat @@ -32,7 +32,7 @@ @rem VS 2017 and later provide vswhere.exe, which can be used @if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" goto :skip_vswhere @set _Py_MSBuild_Root= - at for /F "tokens=*" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationPath -latest') DO @(set _Py_MSBuild_Root=%%i\MSBuild) + at for /F "tokens=*" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationPath -latest -prerelease') DO @(set _Py_MSBuild_Root=%%i\MSBuild) @if not defined _Py_MSBuild_Root goto :skip_vswhere @for %%j in (Current 15.0) DO @if exist "%_Py_MSBuild_Root%\%%j\Bin\msbuild.exe" (set MSBUILD="%_Py_MSBuild_Root%\%%j\Bin\msbuild.exe") @set _Py_MSBuild_Root= diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj index 35f173ff864ea..22a9eed18d42b 100644 --- a/PCbuild/pcbuild.proj +++ b/PCbuild/pcbuild.proj @@ -60,7 +60,7 @@ - + diff --git a/PCbuild/prepare_libffi.bat b/PCbuild/prepare_libffi.bat index c65a5f7010bd0..f41ba83379af9 100644 --- a/PCbuild/prepare_libffi.bat +++ b/PCbuild/prepare_libffi.bat @@ -93,7 +93,10 @@ echo LIBFFI_SOURCE: %LIBFFI_SOURCE% echo MSVCC : %MSVCC% echo. -if not exist Makefile.in (%SH% -lc "(cd $LIBFFI_SOURCE; ./autogen.sh;)") +if not exist Makefile.in ( + %SH% -lc "(cd $LIBFFI_SOURCE; ./autogen.sh;)" + if errorlevel 1 exit /B 1 +) if "%BUILD_X64%"=="1" call :BuildOne x64 x86_64-w64-cygwin x86_64-w64-cygwin if "%BUILD_X86%"=="1" call :BuildOne x86 i686-pc-cygwin i686-pc-cygwin @@ -158,11 +161,13 @@ echo ================================================================ echo Configure the build to generate fficonfig.h and ffi.h echo ================================================================ %SH% -lc "(cd $OLDPWD; ./configure CC='%MSVCC% %ASSEMBLER% %BUILD_PDB%' CXX='%MSVCC% %ASSEMBLER% %BUILD_PDB%' LD='link' CPP='cl -nologo -EP' CXXCPP='cl -nologo -EP' CPPFLAGS='-DFFI_BUILDING_DLL' %BUILD_NOOPT% NM='dumpbin -symbols' STRIP=':' --build=$BUILD --host=$HOST;)" +if errorlevel 1 exit /B %ERRORLEVEL% echo ================================================================ echo Building libffi echo ================================================================ %SH% -lc "(cd $OLDPWD; export PATH=/usr/bin:$PATH; cp src/%SRC_ARCHITECTURE%/ffitarget.h include; make; find .;)" +if errorlevel 1 exit /B %ERRORLEVEL% REM Tests are not needed to produce artifacts if "%LIBFFI_TEST%" EQU "1" ( diff --git a/PCbuild/python_uwp.vcxproj b/PCbuild/python_uwp.vcxproj index 14e138cbed3e0..5ff120a0da331 100644 --- a/PCbuild/python_uwp.vcxproj +++ b/PCbuild/python_uwp.vcxproj @@ -1,6 +1,14 @@ ? + + Debug + ARM + + + Debug + ARM64 + Debug Win32 @@ -9,6 +17,14 @@ Debug x64 + + PGInstrument + ARM + + + PGInstrument + ARM64 + PGInstrument Win32 @@ -17,6 +33,14 @@ PGInstrument x64 + + PGUpdate + ARM + + + PGUpdate + ARM64 + PGUpdate Win32 @@ -25,6 +49,14 @@ PGUpdate x64 + + Release + ARM + + + Release + ARM64 + Release Win32 diff --git a/PCbuild/pythonw_uwp.vcxproj b/PCbuild/pythonw_uwp.vcxproj index e2c01710498ee..828d0d1ccac21 100644 --- a/PCbuild/pythonw_uwp.vcxproj +++ b/PCbuild/pythonw_uwp.vcxproj @@ -1,6 +1,14 @@ ? + + Debug + ARM + + + Debug + ARM64 + Debug Win32 @@ -9,6 +17,14 @@ Debug x64 + + PGInstrument + ARM + + + PGInstrument + ARM64 + PGInstrument Win32 @@ -17,6 +33,14 @@ PGInstrument x64 + + PGUpdate + ARM + + + PGUpdate + ARM64 + PGUpdate Win32 @@ -25,6 +49,14 @@ PGUpdate x64 + + Release + ARM + + + Release + ARM64 + Release Win32 From webhook-mailer at python.org Fri Dec 6 14:15:17 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 06 Dec 2019 19:15:17 -0000 Subject: [Python-checkins] bpo-37931: Fix crash on OSX re-initializing os.environ (GH-15428) Message-ID: https://github.com/python/cpython/commit/723f71abf7ab0a7be394f9f7b2daa9ecdf6fb1eb commit: 723f71abf7ab0a7be394f9f7b2daa9ecdf6fb1eb branch: master author: Benoit Hudson committer: Victor Stinner date: 2019-12-06T20:15:03+01:00 summary: bpo-37931: Fix crash on OSX re-initializing os.environ (GH-15428) On most platforms, the `environ` symbol is accessible everywhere. In a dylib on OSX, it's not easily accessible, you need to find it with _NSGetEnviron. The code was caching the *value* of environ. But a setenv() can change the value, leaving garbage at the old value. Fix: don't cache the value of environ, just read it every time. files: A Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst M Misc/ACKS M Modules/posixmodule.c diff --git a/Misc/ACKS b/Misc/ACKS index 357ce024e9e8c..239d06ffd0bf9 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -733,6 +733,7 @@ Miro Hron?ok Chiu-Hsiang Hsu Chih-Hao Huang Christian Hudon +Beno?t Hudson Lawrence Hudson Michael Hudson Jim Hugunin diff --git a/Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst b/Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst new file mode 100644 index 0000000000000..45b54e89cb89e --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst @@ -0,0 +1,3 @@ +Fixed a crash on OSX dynamic builds that occurred when re-initializing the +posix module after a Py_Finalize if the environment had changed since the +previous `import posix`. Patch by Beno?t Hudson. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 898547113732a..322c2159812cd 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -1402,7 +1402,6 @@ win32_get_reparse_tag(HANDLE reparse_point_handle, ULONG *reparse_tag) ** man environ(7). */ #include -static char **environ; #elif !defined(_MSC_VER) && (!defined(__WATCOMC__) || defined(__QNX__) || defined(__VXWORKS__)) extern char **environ; #endif /* !_MSC_VER */ @@ -1420,15 +1419,16 @@ convertenviron(void) d = PyDict_New(); if (d == NULL) return NULL; -#if defined(WITH_NEXT_FRAMEWORK) || (defined(__APPLE__) && defined(Py_ENABLE_SHARED)) - if (environ == NULL) - environ = *_NSGetEnviron(); -#endif #ifdef MS_WINDOWS /* _wenviron must be initialized in this way if the program is started through main() instead of wmain(). */ _wgetenv(L""); e = _wenviron; +#elif defined(WITH_NEXT_FRAMEWORK) || (defined(__APPLE__) && defined(Py_ENABLE_SHARED)) + /* environ is not accessible as an extern in a shared object on OSX; use + _NSGetEnviron to resolve it. The value changes if you add environment + variables between calls to Py_Initialize, so don't cache the value. */ + e = *_NSGetEnviron(); #else e = environ; #endif From webhook-mailer at python.org Fri Dec 6 14:32:40 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Fri, 06 Dec 2019 19:32:40 -0000 Subject: [Python-checkins] bpo-37931: Fix crash on OSX re-initializing os.environ (GH-15428) Message-ID: https://github.com/python/cpython/commit/836cf31a3cf468ed9598a220b8e194b366287bfe commit: 836cf31a3cf468ed9598a220b8e194b366287bfe branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-06T11:32:33-08:00 summary: bpo-37931: Fix crash on OSX re-initializing os.environ (GH-15428) On most platforms, the `environ` symbol is accessible everywhere. In a dylib on OSX, it's not easily accessible, you need to find it with _NSGetEnviron. The code was caching the *value* of environ. But a setenv() can change the value, leaving garbage at the old value. Fix: don't cache the value of environ, just read it every time. (cherry picked from commit 723f71abf7ab0a7be394f9f7b2daa9ecdf6fb1eb) Co-authored-by: Benoit Hudson files: A Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst M Misc/ACKS M Modules/posixmodule.c diff --git a/Misc/ACKS b/Misc/ACKS index e52ae984f1571..62c5928c508ff 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -725,6 +725,7 @@ Miro Hron?ok Chiu-Hsiang Hsu Chih-Hao Huang Christian Hudon +Beno?t Hudson Lawrence Hudson Michael Hudson Jim Hugunin diff --git a/Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst b/Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst new file mode 100644 index 0000000000000..45b54e89cb89e --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst @@ -0,0 +1,3 @@ +Fixed a crash on OSX dynamic builds that occurred when re-initializing the +posix module after a Py_Finalize if the environment had changed since the +previous `import posix`. Patch by Beno?t Hudson. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 7c823434e67fe..850769fd95eef 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -1372,7 +1372,6 @@ win32_get_reparse_tag(HANDLE reparse_point_handle, ULONG *reparse_tag) ** man environ(7). */ #include -static char **environ; #elif !defined(_MSC_VER) && (!defined(__WATCOMC__) || defined(__QNX__) || defined(__VXWORKS__)) extern char **environ; #endif /* !_MSC_VER */ @@ -1390,15 +1389,16 @@ convertenviron(void) d = PyDict_New(); if (d == NULL) return NULL; -#if defined(WITH_NEXT_FRAMEWORK) || (defined(__APPLE__) && defined(Py_ENABLE_SHARED)) - if (environ == NULL) - environ = *_NSGetEnviron(); -#endif #ifdef MS_WINDOWS /* _wenviron must be initialized in this way if the program is started through main() instead of wmain(). */ _wgetenv(L""); e = _wenviron; +#elif defined(WITH_NEXT_FRAMEWORK) || (defined(__APPLE__) && defined(Py_ENABLE_SHARED)) + /* environ is not accessible as an extern in a shared object on OSX; use + _NSGetEnviron to resolve it. The value changes if you add environment + variables between calls to Py_Initialize, so don't cache the value. */ + e = *_NSGetEnviron(); #else e = environ; #endif From webhook-mailer at python.org Sat Dec 7 06:05:13 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sat, 07 Dec 2019 11:05:13 -0000 Subject: [Python-checkins] bpo-38978: Implement __class_getitem__ for asyncio objects (GH-17491) Message-ID: https://github.com/python/cpython/commit/dec367261e7e2bb4dd42feeb58031abed2ade683 commit: dec367261e7e2bb4dd42feeb58031abed2ade683 branch: master author: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-07T03:05:07-08:00 summary: bpo-38978: Implement __class_getitem__ for asyncio objects (GH-17491) https://bugs.python.org/issue38978 files: A Misc/NEWS.d/next/Library/2019-12-07-13-40-52.bpo-38978.R3gHZI.rst M Lib/asyncio/futures.py M Lib/asyncio/queues.py M Lib/asyncio/tasks.py M Modules/_asynciomodule.c diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py index 9afda220bd78f..a3cf379ee8170 100644 --- a/Lib/asyncio/futures.py +++ b/Lib/asyncio/futures.py @@ -103,6 +103,9 @@ def __del__(self): context['source_traceback'] = self._source_traceback self._loop.call_exception_handler(context) + def __class_getitem__(cls, type): + return cls + @property def _log_traceback(self): return self.__log_traceback diff --git a/Lib/asyncio/queues.py b/Lib/asyncio/queues.py index 390ae9a6821c4..cd3f7c6a56789 100644 --- a/Lib/asyncio/queues.py +++ b/Lib/asyncio/queues.py @@ -76,6 +76,9 @@ def __repr__(self): def __str__(self): return f'<{type(self).__name__} {self._format()}>' + def __class_getitem__(cls, type): + return cls + def _format(self): result = f'maxsize={self._maxsize!r}' if getattr(self, '_queue', None): diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index 38d982716d46a..894d28eb107ac 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -175,6 +175,9 @@ def __del__(self): self._loop.call_exception_handler(context) super().__del__() + def __class_getitem__(cls, type): + return cls + def _repr_info(self): return base_tasks._task_repr_info(self) diff --git a/Misc/NEWS.d/next/Library/2019-12-07-13-40-52.bpo-38978.R3gHZI.rst b/Misc/NEWS.d/next/Library/2019-12-07-13-40-52.bpo-38978.R3gHZI.rst new file mode 100644 index 0000000000000..8b2eab0d52acf --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-07-13-40-52.bpo-38978.R3gHZI.rst @@ -0,0 +1,2 @@ +Implement ``__class_getitem__`` on asyncio objects (Future, Task, Queue). +Patch by Batuhan Taskaya. diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index aa46e3cf5640f..2d147447ab787 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -1381,6 +1381,12 @@ FutureObj_finalize(FutureObj *fut) PyErr_Restore(error_type, error_value, error_traceback); } +static PyObject * +future_cls_getitem(PyObject *cls, PyObject *type) +{ + Py_INCREF(cls); + return cls; +} static PyAsyncMethods FutureType_as_async = { (unaryfunc)future_new_iter, /* am_await */ @@ -1400,6 +1406,7 @@ static PyMethodDef FutureType_methods[] = { _ASYNCIO_FUTURE_DONE_METHODDEF _ASYNCIO_FUTURE_GET_LOOP_METHODDEF _ASYNCIO_FUTURE__REPR_INFO_METHODDEF + {"__class_getitem__", future_cls_getitem, METH_O|METH_CLASS, NULL}, {NULL, NULL} /* Sentinel */ }; @@ -2429,6 +2436,13 @@ TaskObj_finalize(TaskObj *task) FutureObj_finalize((FutureObj*)task); } +static PyObject * +task_cls_getitem(PyObject *cls, PyObject *type) +{ + Py_INCREF(cls); + return cls; +} + static void TaskObj_dealloc(PyObject *); /* Needs Task_CheckExact */ static PyMethodDef TaskType_methods[] = { @@ -2449,6 +2463,7 @@ static PyMethodDef TaskType_methods[] = { _ASYNCIO_TASK_GET_NAME_METHODDEF _ASYNCIO_TASK_SET_NAME_METHODDEF _ASYNCIO_TASK_GET_CORO_METHODDEF + {"__class_getitem__", task_cls_getitem, METH_O|METH_CLASS, NULL}, {NULL, NULL} /* Sentinel */ }; From webhook-mailer at python.org Sat Dec 7 06:22:05 2019 From: webhook-mailer at python.org (Andrew Svetlov) Date: Sat, 07 Dec 2019 11:22:05 -0000 Subject: [Python-checkins] bpo-38529: Fix asyncio stream warning (GH-17474) Message-ID: https://github.com/python/cpython/commit/7ddcd0caa4c2e6b43265df144f59c5aa508a94f2 commit: 7ddcd0caa4c2e6b43265df144f59c5aa508a94f2 branch: master author: Andrew Svetlov committer: GitHub date: 2019-12-07T13:22:00+02:00 summary: bpo-38529: Fix asyncio stream warning (GH-17474) files: A Misc/NEWS.d/next/Library/2019-12-05-16-13-25.bpo-38529.yvQgx3.rst M Lib/asyncio/streams.py M Lib/test/test_asyncio/test_streams.py diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py index 795530e6f69ef..3c80bb8892590 100644 --- a/Lib/asyncio/streams.py +++ b/Lib/asyncio/streams.py @@ -214,8 +214,7 @@ class StreamReaderProtocol(FlowControlMixin, protocols.Protocol): def __init__(self, stream_reader, client_connected_cb=None, loop=None): super().__init__(loop=loop) if stream_reader is not None: - self._stream_reader_wr = weakref.ref(stream_reader, - self._on_reader_gc) + self._stream_reader_wr = weakref.ref(stream_reader) self._source_traceback = stream_reader._source_traceback else: self._stream_reader_wr = None @@ -231,22 +230,6 @@ def __init__(self, stream_reader, client_connected_cb=None, loop=None): self._over_ssl = False self._closed = self._loop.create_future() - def _on_reader_gc(self, wr): - transport = self._transport - if transport is not None: - # connection_made was called - context = { - 'message': ('An open stream object is being garbage ' - 'collected; call "stream.close()" explicitly.') - } - if self._source_traceback: - context['source_traceback'] = self._source_traceback - self._loop.call_exception_handler(context) - transport.abort() - else: - self._reject_connection = True - self._stream_reader_wr = None - @property def _stream_reader(self): if self._stream_reader_wr is None: diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py index b9413ab35fc50..12bd536911dbb 100644 --- a/Lib/test/test_asyncio/test_streams.py +++ b/Lib/test/test_asyncio/test_streams.py @@ -924,59 +924,6 @@ def test_wait_closed_on_close_with_unread_data(self): wr.close() self.loop.run_until_complete(wr.wait_closed()) - def test_del_stream_before_sock_closing(self): - messages = [] - self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx)) - - with test_utils.run_test_server() as httpd: - with self.assertWarns(DeprecationWarning): - rd, wr = self.loop.run_until_complete( - asyncio.open_connection(*httpd.address, loop=self.loop)) - sock = wr.get_extra_info('socket') - self.assertNotEqual(sock.fileno(), -1) - - wr.write(b'GET / HTTP/1.0\r\n\r\n') - f = rd.readline() - data = self.loop.run_until_complete(f) - self.assertEqual(data, b'HTTP/1.0 200 OK\r\n') - - # drop refs to reader/writer - del rd - del wr - gc.collect() - # make a chance to close the socket - test_utils.run_briefly(self.loop) - - self.assertEqual(1, len(messages)) - self.assertEqual(sock.fileno(), -1) - - self.assertEqual(1, len(messages)) - self.assertEqual('An open stream object is being garbage ' - 'collected; call "stream.close()" explicitly.', - messages[0]['message']) - - def test_del_stream_before_connection_made(self): - messages = [] - self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx)) - - with test_utils.run_test_server() as httpd: - rd = asyncio.StreamReader(loop=self.loop) - pr = asyncio.StreamReaderProtocol(rd, loop=self.loop) - del rd - gc.collect() - tr, _ = self.loop.run_until_complete( - self.loop.create_connection( - lambda: pr, *httpd.address)) - - sock = tr.get_extra_info('socket') - self.assertEqual(sock.fileno(), -1) - - self.assertEqual(1, len(messages)) - self.assertEqual('An open stream was garbage collected prior to ' - 'establishing network connection; ' - 'call "stream.close()" explicitly.', - messages[0]['message']) - def test_async_writer_api(self): async def inner(httpd): rd, wr = await asyncio.open_connection(*httpd.address) diff --git a/Misc/NEWS.d/next/Library/2019-12-05-16-13-25.bpo-38529.yvQgx3.rst b/Misc/NEWS.d/next/Library/2019-12-05-16-13-25.bpo-38529.yvQgx3.rst new file mode 100644 index 0000000000000..c688926b4a49b --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-05-16-13-25.bpo-38529.yvQgx3.rst @@ -0,0 +1,2 @@ +Drop too noisy asyncio warning about deletion of a stream without explicit +``.close()`` call. From webhook-mailer at python.org Sat Dec 7 06:23:26 2019 From: webhook-mailer at python.org (Andrew Svetlov) Date: Sat, 07 Dec 2019 11:23:26 -0000 Subject: [Python-checkins] Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python version (GH-17484) Message-ID: https://github.com/python/cpython/commit/969ae7aca809a8dacafee04c261110eea0ac1945 commit: 969ae7aca809a8dacafee04c261110eea0ac1945 branch: master author: Andrew Svetlov committer: GitHub date: 2019-12-07T13:23:21+02:00 summary: Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python version (GH-17484) files: A Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst M Modules/_asynciomodule.c diff --git a/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst b/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst new file mode 100644 index 0000000000000..777535299be17 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst @@ -0,0 +1,2 @@ +Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python +version. diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 2d147447ab787..70da40a8a3b86 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -1815,6 +1815,21 @@ TaskWakeupMethWrapper_dealloc(TaskWakeupMethWrapper *o) Py_TYPE(o)->tp_free(o); } +static PyObject * +TaskWakeupMethWrapper_get___self__(TaskWakeupMethWrapper *o, void *Py_UNUSED(ignored)) +{ + if (o->ww_task) { + Py_INCREF(o->ww_task); + return (PyObject*)o->ww_task; + } + Py_RETURN_NONE; +} + +static PyGetSetDef TaskWakeupMethWrapper_getsetlist[] = { + {"__self__", (getter)TaskWakeupMethWrapper_get___self__, NULL, NULL}, + {NULL} /* Sentinel */ +}; + static PyTypeObject TaskWakeupMethWrapper_Type = { PyVarObject_HEAD_INIT(NULL, 0) "TaskWakeupMethWrapper", @@ -1826,6 +1841,7 @@ static PyTypeObject TaskWakeupMethWrapper_Type = { .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, .tp_traverse = (traverseproc)TaskWakeupMethWrapper_traverse, .tp_clear = (inquiry)TaskWakeupMethWrapper_clear, + .tp_getset = TaskWakeupMethWrapper_getsetlist, }; static PyObject * @@ -3266,7 +3282,7 @@ module_init(void) } if (module_initialized != 0) { return 0; - } + } else { module_initialized = 1; } From webhook-mailer at python.org Sat Dec 7 06:40:01 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sat, 07 Dec 2019 11:40:01 -0000 Subject: [Python-checkins] bpo-38529: Fix asyncio stream warning (GH-17474) Message-ID: https://github.com/python/cpython/commit/7fde4f446a3dcfed780a38fbfcd7c0b4d9d73b93 commit: 7fde4f446a3dcfed780a38fbfcd7c0b4d9d73b93 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-07T03:39:57-08:00 summary: bpo-38529: Fix asyncio stream warning (GH-17474) (cherry picked from commit 7ddcd0caa4c2e6b43265df144f59c5aa508a94f2) Co-authored-by: Andrew Svetlov files: A Misc/NEWS.d/next/Library/2019-12-05-16-13-25.bpo-38529.yvQgx3.rst M Lib/asyncio/streams.py M Lib/test/test_asyncio/test_streams.py diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py index 795530e6f69ef..3c80bb8892590 100644 --- a/Lib/asyncio/streams.py +++ b/Lib/asyncio/streams.py @@ -214,8 +214,7 @@ class StreamReaderProtocol(FlowControlMixin, protocols.Protocol): def __init__(self, stream_reader, client_connected_cb=None, loop=None): super().__init__(loop=loop) if stream_reader is not None: - self._stream_reader_wr = weakref.ref(stream_reader, - self._on_reader_gc) + self._stream_reader_wr = weakref.ref(stream_reader) self._source_traceback = stream_reader._source_traceback else: self._stream_reader_wr = None @@ -231,22 +230,6 @@ def __init__(self, stream_reader, client_connected_cb=None, loop=None): self._over_ssl = False self._closed = self._loop.create_future() - def _on_reader_gc(self, wr): - transport = self._transport - if transport is not None: - # connection_made was called - context = { - 'message': ('An open stream object is being garbage ' - 'collected; call "stream.close()" explicitly.') - } - if self._source_traceback: - context['source_traceback'] = self._source_traceback - self._loop.call_exception_handler(context) - transport.abort() - else: - self._reject_connection = True - self._stream_reader_wr = None - @property def _stream_reader(self): if self._stream_reader_wr is None: diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py index b9413ab35fc50..12bd536911dbb 100644 --- a/Lib/test/test_asyncio/test_streams.py +++ b/Lib/test/test_asyncio/test_streams.py @@ -924,59 +924,6 @@ def test_wait_closed_on_close_with_unread_data(self): wr.close() self.loop.run_until_complete(wr.wait_closed()) - def test_del_stream_before_sock_closing(self): - messages = [] - self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx)) - - with test_utils.run_test_server() as httpd: - with self.assertWarns(DeprecationWarning): - rd, wr = self.loop.run_until_complete( - asyncio.open_connection(*httpd.address, loop=self.loop)) - sock = wr.get_extra_info('socket') - self.assertNotEqual(sock.fileno(), -1) - - wr.write(b'GET / HTTP/1.0\r\n\r\n') - f = rd.readline() - data = self.loop.run_until_complete(f) - self.assertEqual(data, b'HTTP/1.0 200 OK\r\n') - - # drop refs to reader/writer - del rd - del wr - gc.collect() - # make a chance to close the socket - test_utils.run_briefly(self.loop) - - self.assertEqual(1, len(messages)) - self.assertEqual(sock.fileno(), -1) - - self.assertEqual(1, len(messages)) - self.assertEqual('An open stream object is being garbage ' - 'collected; call "stream.close()" explicitly.', - messages[0]['message']) - - def test_del_stream_before_connection_made(self): - messages = [] - self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx)) - - with test_utils.run_test_server() as httpd: - rd = asyncio.StreamReader(loop=self.loop) - pr = asyncio.StreamReaderProtocol(rd, loop=self.loop) - del rd - gc.collect() - tr, _ = self.loop.run_until_complete( - self.loop.create_connection( - lambda: pr, *httpd.address)) - - sock = tr.get_extra_info('socket') - self.assertEqual(sock.fileno(), -1) - - self.assertEqual(1, len(messages)) - self.assertEqual('An open stream was garbage collected prior to ' - 'establishing network connection; ' - 'call "stream.close()" explicitly.', - messages[0]['message']) - def test_async_writer_api(self): async def inner(httpd): rd, wr = await asyncio.open_connection(*httpd.address) diff --git a/Misc/NEWS.d/next/Library/2019-12-05-16-13-25.bpo-38529.yvQgx3.rst b/Misc/NEWS.d/next/Library/2019-12-05-16-13-25.bpo-38529.yvQgx3.rst new file mode 100644 index 0000000000000..c688926b4a49b --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-05-16-13-25.bpo-38529.yvQgx3.rst @@ -0,0 +1,2 @@ +Drop too noisy asyncio warning about deletion of a stream without explicit +``.close()`` call. From webhook-mailer at python.org Sat Dec 7 06:41:46 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sat, 07 Dec 2019 11:41:46 -0000 Subject: [Python-checkins] Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python version (GH-17484) Message-ID: https://github.com/python/cpython/commit/ce0a2a86207dacc1945c6d756527226d8feed0e0 commit: ce0a2a86207dacc1945c6d756527226d8feed0e0 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-07T03:41:41-08:00 summary: Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python version (GH-17484) (cherry picked from commit 969ae7aca809a8dacafee04c261110eea0ac1945) Co-authored-by: Andrew Svetlov files: A Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst M Modules/_asynciomodule.c diff --git a/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst b/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst new file mode 100644 index 0000000000000..777535299be17 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst @@ -0,0 +1,2 @@ +Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python +version. diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index d5f845ef0bed1..f4efa2120a9c8 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -1811,6 +1811,21 @@ TaskWakeupMethWrapper_dealloc(TaskWakeupMethWrapper *o) Py_TYPE(o)->tp_free(o); } +static PyObject * +TaskWakeupMethWrapper_get___self__(TaskWakeupMethWrapper *o, void *Py_UNUSED(ignored)) +{ + if (o->ww_task) { + Py_INCREF(o->ww_task); + return (PyObject*)o->ww_task; + } + Py_RETURN_NONE; +} + +static PyGetSetDef TaskWakeupMethWrapper_getsetlist[] = { + {"__self__", (getter)TaskWakeupMethWrapper_get___self__, NULL, NULL}, + {NULL} /* Sentinel */ +}; + static PyTypeObject TaskWakeupMethWrapper_Type = { PyVarObject_HEAD_INIT(NULL, 0) "TaskWakeupMethWrapper", @@ -1822,6 +1837,7 @@ static PyTypeObject TaskWakeupMethWrapper_Type = { .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, .tp_traverse = (traverseproc)TaskWakeupMethWrapper_traverse, .tp_clear = (inquiry)TaskWakeupMethWrapper_clear, + .tp_getset = TaskWakeupMethWrapper_getsetlist, }; static PyObject * @@ -3258,7 +3274,7 @@ module_init(void) } if (module_initialized != 0) { return 0; - } + } else { module_initialized = 1; } From webhook-mailer at python.org Sat Dec 7 06:46:23 2019 From: webhook-mailer at python.org (Andrew Svetlov) Date: Sat, 07 Dec 2019 11:46:23 -0000 Subject: [Python-checkins] [3.7] Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python version (GH-17484) (GH-17494) Message-ID: https://github.com/python/cpython/commit/8ce85a31e6987029832f4e33c4716eb513938c57 commit: 8ce85a31e6987029832f4e33c4716eb513938c57 branch: 3.7 author: Andrew Svetlov committer: GitHub date: 2019-12-07T13:46:18+02:00 summary: [3.7] Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python version (GH-17484) (GH-17494) (cherry picked from commit 969ae7aca809a8dacafee04c261110eea0ac1945) Co-authored-by: Andrew Svetlov files: A Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst M Modules/_asynciomodule.c diff --git a/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst b/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst new file mode 100644 index 0000000000000..777535299be17 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst @@ -0,0 +1,2 @@ +Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python +version. diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 99d5f1d8596ef..441506bc82a14 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -1821,6 +1821,21 @@ TaskWakeupMethWrapper_dealloc(TaskWakeupMethWrapper *o) Py_TYPE(o)->tp_free(o); } +static PyObject * +TaskWakeupMethWrapper_get___self__(TaskWakeupMethWrapper *o, void *Py_UNUSED(ignored)) +{ + if (o->ww_task) { + Py_INCREF(o->ww_task); + return (PyObject*)o->ww_task; + } + Py_RETURN_NONE; +} + +static PyGetSetDef TaskWakeupMethWrapper_getsetlist[] = { + {"__self__", (getter)TaskWakeupMethWrapper_get___self__, NULL, NULL}, + {NULL} /* Sentinel */ +}; + static PyTypeObject TaskWakeupMethWrapper_Type = { PyVarObject_HEAD_INIT(NULL, 0) "TaskWakeupMethWrapper", @@ -1832,6 +1847,7 @@ static PyTypeObject TaskWakeupMethWrapper_Type = { .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, .tp_traverse = (traverseproc)TaskWakeupMethWrapper_traverse, .tp_clear = (inquiry)TaskWakeupMethWrapper_clear, + .tp_getset = TaskWakeupMethWrapper_getsetlist, }; static PyObject * From webhook-mailer at python.org Sat Dec 7 06:52:40 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sat, 07 Dec 2019 11:52:40 -0000 Subject: [Python-checkins] bpo-37404: Raising value error if an SSLSocket is passed to asyncio functions (GH-16457) Message-ID: https://github.com/python/cpython/commit/892f9e0777f262d366d4747a54c33a1c15a49da6 commit: 892f9e0777f262d366d4747a54c33a1c15a49da6 branch: master author: idomic committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-07T03:52:35-08:00 summary: bpo-37404: Raising value error if an SSLSocket is passed to asyncio functions (GH-16457) https://bugs.python.org/issue37404 files: A Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst M Lib/asyncio/selector_events.py diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py index 00e3244bfb294..e1abf5118619c 100644 --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -348,6 +348,8 @@ def remove_writer(self, fd): The maximum amount of data to be received at once is specified by nbytes. """ + if isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: @@ -386,6 +388,8 @@ def _sock_recv(self, fut, sock, n): The received data is written into *buf* (a writable buffer). The return value is the number of bytes written. """ + if isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: @@ -425,6 +429,8 @@ def _sock_recv_into(self, fut, sock, buf): raised, and there is no way to determine how much data, if any, was successfully processed by the receiving end of the connection. """ + if isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: @@ -472,6 +478,8 @@ def _sock_sendall(self, fut, sock, view, pos): This method is a coroutine. """ + if isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") @@ -533,6 +541,8 @@ def _sock_connect_cb(self, fut, sock, address): object usable to send and receive data on the connection, and address is the address bound to the socket on the other end of the connection. """ + if isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() diff --git a/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst b/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst new file mode 100644 index 0000000000000..067fc9d3f189d --- /dev/null +++ b/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst @@ -0,0 +1,2 @@ +:mod:`asyncio` now raises :exc:`TyperError` when calling incompatible methods +with an :class:`ssl.SSLSocket` socket. Patch by Ido Michael. From webhook-mailer at python.org Sat Dec 7 07:44:25 2019 From: webhook-mailer at python.org (Andrew Svetlov) Date: Sat, 07 Dec 2019 12:44:25 -0000 Subject: [Python-checkins] [3.8] bpo-37404: Raising value error if an SSLSocket is passed to asyncio functions (GH-16457) (#17496) Message-ID: https://github.com/python/cpython/commit/930cef2770b641f49e69b67840daaa53b65cd0e0 commit: 930cef2770b641f49e69b67840daaa53b65cd0e0 branch: 3.8 author: Andrew Svetlov committer: GitHub date: 2019-12-07T14:44:20+02:00 summary: [3.8] bpo-37404: Raising value error if an SSLSocket is passed to asyncio functions (GH-16457) (#17496) https://bugs.python.org/issue37404 (cherry picked from commit 892f9e0777f262d366d4747a54c33a1c15a49da6) Co-authored-by: idomic files: A Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst M Lib/asyncio/selector_events.py diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py index 00e3244bfb294..e1abf5118619c 100644 --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -348,6 +348,8 @@ def remove_writer(self, fd): The maximum amount of data to be received at once is specified by nbytes. """ + if isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: @@ -386,6 +388,8 @@ def _sock_recv(self, fut, sock, n): The received data is written into *buf* (a writable buffer). The return value is the number of bytes written. """ + if isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: @@ -425,6 +429,8 @@ def _sock_recv_into(self, fut, sock, buf): raised, and there is no way to determine how much data, if any, was successfully processed by the receiving end of the connection. """ + if isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: @@ -472,6 +478,8 @@ def _sock_sendall(self, fut, sock, view, pos): This method is a coroutine. """ + if isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") @@ -533,6 +541,8 @@ def _sock_connect_cb(self, fut, sock, address): object usable to send and receive data on the connection, and address is the address bound to the socket on the other end of the connection. """ + if isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() diff --git a/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst b/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst new file mode 100644 index 0000000000000..067fc9d3f189d --- /dev/null +++ b/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst @@ -0,0 +1,2 @@ +:mod:`asyncio` now raises :exc:`TyperError` when calling incompatible methods +with an :class:`ssl.SSLSocket` socket. Patch by Ido Michael. From webhook-mailer at python.org Sat Dec 7 07:45:11 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sat, 07 Dec 2019 12:45:11 -0000 Subject: [Python-checkins] bpo-37404: Raising value error if an SSLSocket is passed to asyncio functions (GH-16457) Message-ID: https://github.com/python/cpython/commit/a85066df9423d381e6b233469b00db55563a9f80 commit: a85066df9423d381e6b233469b00db55563a9f80 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-07T04:45:07-08:00 summary: bpo-37404: Raising value error if an SSLSocket is passed to asyncio functions (GH-16457) https://bugs.python.org/issue37404 (cherry picked from commit 892f9e0777f262d366d4747a54c33a1c15a49da6) Co-authored-by: idomic files: A Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst M Lib/asyncio/selector_events.py diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py index 23bd8ad8492ff..c539b5d387196 100644 --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -345,6 +345,8 @@ def remove_writer(self, fd): The maximum amount of data to be received at once is specified by nbytes. """ + if isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() @@ -378,6 +380,8 @@ def _sock_recv(self, fut, registered_fd, sock, n): The received data is written into *buf* (a writable buffer). The return value is the number of bytes written. """ + if isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() @@ -415,6 +419,8 @@ def _sock_recv_into(self, fut, registered_fd, sock, buf): raised, and there is no way to determine how much data, if any, was successfully processed by the receiving end of the connection. """ + if isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() @@ -451,6 +457,8 @@ def _sock_sendall(self, fut, registered_fd, sock, data): This method is a coroutine. """ + if isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") @@ -508,6 +516,8 @@ def _sock_connect_cb(self, fut, sock, address): object usable to send and receive data on the connection, and address is the address bound to the socket on the other end of the connection. """ + if isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() diff --git a/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst b/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst new file mode 100644 index 0000000000000..067fc9d3f189d --- /dev/null +++ b/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst @@ -0,0 +1,2 @@ +:mod:`asyncio` now raises :exc:`TyperError` when calling incompatible methods +with an :class:`ssl.SSLSocket` socket. Patch by Ido Michael. From webhook-mailer at python.org Sat Dec 7 07:53:17 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sat, 07 Dec 2019 12:53:17 -0000 Subject: [Python-checkins] bpo-38652: Remove provisional note for asyncio.BufferedProtocol (GH-17047) Message-ID: https://github.com/python/cpython/commit/4443450fdaf248427cf4a00a6ee36229e6402ec6 commit: 4443450fdaf248427cf4a00a6ee36229e6402ec6 branch: master author: Anj-A <2017anj at gmail.com> committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-07T04:53:12-08:00 summary: bpo-38652: Remove provisional note for asyncio.BufferedProtocol (GH-17047) https://bugs.python.org/issue38652 files: M Doc/library/asyncio-protocol.rst M Misc/ACKS diff --git a/Doc/library/asyncio-protocol.rst b/Doc/library/asyncio-protocol.rst index ffac9018127c6..3079716f03ecc 100644 --- a/Doc/library/asyncio-protocol.rst +++ b/Doc/library/asyncio-protocol.rst @@ -588,9 +588,6 @@ Buffered Streaming Protocols ---------------------------- .. versionadded:: 3.7 - **Important:** this has been added to asyncio in Python 3.7 - *on a provisional basis*! This is as an experimental API that - might be changed or removed completely in Python 3.8. Buffered Protocols can be used with any event loop method that supports `Streaming Protocols`_. diff --git a/Misc/ACKS b/Misc/ACKS index 239d06ffd0bf9..2286f7b5017fa 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -22,6 +22,7 @@ Eitan Adler Anton Afanasyev Ali Afshar Nitika Agarwal +Anjani Agrawal Pablo S. Blum de Aguiar Jim Ahlstrom Farhan Ahmad From webhook-mailer at python.org Sat Dec 7 09:14:46 2019 From: webhook-mailer at python.org (Inada Naoki) Date: Sat, 07 Dec 2019 14:14:46 -0000 Subject: [Python-checkins] bpo-29636: json.tool: Add document for indentation options. (GH-17482) Message-ID: https://github.com/python/cpython/commit/15fb7fa88187f5841088721a43609bffe64a8dc7 commit: 15fb7fa88187f5841088721a43609bffe64a8dc7 branch: master author: Daniel Himmelstein committer: Inada Naoki date: 2019-12-07T23:14:40+09:00 summary: bpo-29636: json.tool: Add document for indentation options. (GH-17482) And updated test to use subprocess.run files: M Doc/library/json.rst M Lib/json/tool.py M Lib/test/test_json/test_tool.py diff --git a/Doc/library/json.rst b/Doc/library/json.rst index 573ec1cb77dd6..cfe68c9dd91d0 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -744,6 +744,12 @@ Command line options .. versionadded:: 3.8 +.. cmdoption:: --indent, --tab, --no-indent, --compact + + Mutually exclusive options for whitespace control + + .. versionadded:: 3.9 + .. cmdoption:: -h, --help Show the help message. diff --git a/Lib/json/tool.py b/Lib/json/tool.py index 5542ce48c3802..6d7d9a002e5c2 100644 --- a/Lib/json/tool.py +++ b/Lib/json/tool.py @@ -33,7 +33,8 @@ def main(): parser.add_argument('--no-ensure-ascii', dest='ensure_ascii', action='store_false', help='disable escaping of non-ASCII characters') parser.add_argument('--json-lines', action='store_true', default=False, - help='parse input using the jsonlines format') + help='parse input using the JSON Lines format. ' + 'Use with --no-indent or --compact to produce valid JSON Lines output.') group = parser.add_mutually_exclusive_group() group.add_argument('--indent', default=4, type=int, help='separate items with newlines and use this number ' diff --git a/Lib/test/test_json/test_tool.py b/Lib/test/test_json/test_tool.py index 54800ae840c64..c9a969b303398 100644 --- a/Lib/test/test_json/test_tool.py +++ b/Lib/test/test_json/test_tool.py @@ -2,7 +2,7 @@ import sys import textwrap import unittest -from subprocess import Popen, PIPE +import subprocess from test import support from test.support.script_helper import assert_python_ok @@ -84,10 +84,9 @@ class TestTool(unittest.TestCase): def test_stdin_stdout(self): args = sys.executable, '-m', 'json.tool' - with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) as proc: - out, err = proc.communicate(self.data.encode()) - self.assertEqual(out.splitlines(), self.expect.encode().splitlines()) - self.assertEqual(err, b'') + process = subprocess.run(args, input=self.data, capture_output=True, text=True, check=True) + self.assertEqual(process.stdout, self.expect) + self.assertEqual(process.stderr, '') def _create_infile(self, data=None): infile = support.TESTFN @@ -131,10 +130,9 @@ def test_infile_outfile(self): def test_jsonlines(self): args = sys.executable, '-m', 'json.tool', '--json-lines' - with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) as proc: - out, err = proc.communicate(self.jsonlines_raw.encode()) - self.assertEqual(out.splitlines(), self.jsonlines_expect.encode().splitlines()) - self.assertEqual(err, b'') + process = subprocess.run(args, input=self.jsonlines_raw, capture_output=True, text=True, check=True) + self.assertEqual(process.stdout, self.jsonlines_expect) + self.assertEqual(process.stderr, '') def test_help_flag(self): rc, out, err = assert_python_ok('-m', 'json.tool', '-h') @@ -151,45 +149,41 @@ def test_sort_keys_flag(self): self.assertEqual(err, b'') def test_indent(self): - json_stdin = b'[1, 2]' + input_ = '[1, 2]' expect = textwrap.dedent('''\ [ 1, 2 ] - ''').encode() + ''') args = sys.executable, '-m', 'json.tool', '--indent', '2' - with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) as proc: - json_stdout, err = proc.communicate(json_stdin) - self.assertEqual(expect.splitlines(), json_stdout.splitlines()) - self.assertEqual(err, b'') + process = subprocess.run(args, input=input_, capture_output=True, text=True, check=True) + self.assertEqual(process.stdout, expect) + self.assertEqual(process.stderr, '') def test_no_indent(self): - json_stdin = b'[1,\n2]' - expect = b'[1, 2]' + input_ = '[1,\n2]' + expect = '[1, 2]\n' args = sys.executable, '-m', 'json.tool', '--no-indent' - with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) as proc: - json_stdout, err = proc.communicate(json_stdin) - self.assertEqual(expect.splitlines(), json_stdout.splitlines()) - self.assertEqual(err, b'') + process = subprocess.run(args, input=input_, capture_output=True, text=True, check=True) + self.assertEqual(process.stdout, expect) + self.assertEqual(process.stderr, '') def test_tab(self): - json_stdin = b'[1, 2]' - expect = b'[\n\t1,\n\t2\n]\n' + input_ = '[1, 2]' + expect = '[\n\t1,\n\t2\n]\n' args = sys.executable, '-m', 'json.tool', '--tab' - with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) as proc: - json_stdout, err = proc.communicate(json_stdin) - self.assertEqual(expect.splitlines(), json_stdout.splitlines()) - self.assertEqual(err, b'') + process = subprocess.run(args, input=input_, capture_output=True, text=True, check=True) + self.assertEqual(process.stdout, expect) + self.assertEqual(process.stderr, '') def test_compact(self): - json_stdin = b'[ 1 ,\n 2]' - expect = b'[1,2]' + input_ = '[ 1 ,\n 2]' + expect = '[1,2]\n' args = sys.executable, '-m', 'json.tool', '--compact' - with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) as proc: - json_stdout, err = proc.communicate(json_stdin) - self.assertEqual(expect.splitlines(), json_stdout.splitlines()) - self.assertEqual(err, b'') + process = subprocess.run(args, input=input_, capture_output=True, text=True, check=True) + self.assertEqual(process.stdout, expect) + self.assertEqual(process.stderr, '') def test_no_ensure_ascii_flag(self): infile = self._create_infile('{"key":"?"}') From webhook-mailer at python.org Sat Dec 7 11:59:41 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sat, 07 Dec 2019 16:59:41 -0000 Subject: [Python-checkins] bpo-38820: OpenSSL 3.0.0 compatibility. (GH-17190) Message-ID: https://github.com/python/cpython/commit/2b7de6696bf2f924cd2cd9ff0a539c8aa37c6244 commit: 2b7de6696bf2f924cd2cd9ff0a539c8aa37c6244 branch: master author: Christian Heimes committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-07T08:59:36-08:00 summary: bpo-38820: OpenSSL 3.0.0 compatibility. (GH-17190) test_openssl_version now accepts version 3.0.0. getpeercert() no longer returns IPv6 addresses with a trailing new line. Signed-off-by: Christian Heimes https://bugs.python.org/issue38820 files: A Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst M Doc/library/ssl.rst M Lib/test/test_ssl.py M Modules/_ssl.c diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index e2c75bbd0a06c..3e5fcab22d028 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -1256,6 +1256,9 @@ SSL sockets also have the following additional methods and attributes: The returned dictionary includes additional X509v3 extension items such as ``crlDistributionPoints``, ``caIssuers`` and ``OCSP`` URIs. + .. versionchanged:: 3.9 + IPv6 address strings no longer have a trailing new line. + .. method:: SSLSocket.cipher() Returns a three-value tuple containing the name of the cipher being used, the diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 258816d912b36..4f70799465ced 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -488,7 +488,7 @@ def test_parse_cert_CVE_2013_4238(self): ('email', 'null at python.org\x00user at example.org'), ('URI', 'http://null.python.org\x00http://example.org'), ('IP Address', '192.0.2.1'), - ('IP Address', '2001:DB8:0:0:0:0:0:1\n')) + ('IP Address', '2001:DB8:0:0:0:0:0:1')) else: # OpenSSL 0.9.7 doesn't support IPv6 addresses in subjectAltName san = (('DNS', 'altnull.python.org\x00example.com'), @@ -515,7 +515,7 @@ def test_parse_all_sans(self): (('commonName', 'dirname example'),))), ('URI', 'https://www.python.org/'), ('IP Address', '127.0.0.1'), - ('IP Address', '0:0:0:0:0:0:0:1\n'), + ('IP Address', '0:0:0:0:0:0:0:1'), ('Registered ID', '1.2.3.4.5') ) ) @@ -542,11 +542,11 @@ def test_openssl_version(self): # Some sanity checks follow # >= 0.9 self.assertGreaterEqual(n, 0x900000) - # < 3.0 - self.assertLess(n, 0x30000000) + # < 4.0 + self.assertLess(n, 0x40000000) major, minor, fix, patch, status = t - self.assertGreaterEqual(major, 0) - self.assertLess(major, 3) + self.assertGreaterEqual(major, 1) + self.assertLess(major, 4) self.assertGreaterEqual(minor, 0) self.assertLess(minor, 256) self.assertGreaterEqual(fix, 0) diff --git a/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst b/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst new file mode 100644 index 0000000000000..2c6a6e853c25f --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst @@ -0,0 +1,2 @@ +Make Python compatible with OpenSSL 3.0.0. :func:`ssl.SSLSocket.getpeercert` +no longer returns IPv6 addresses with a trailing new line. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 6f1f9c881530f..43b236c212120 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -1410,6 +1410,54 @@ _get_peer_alt_names (X509 *certificate) { PyTuple_SET_ITEM(t, 1, v); break; + case GEN_IPADD: + /* OpenSSL < 3.0.0 adds a trailing \n to IPv6. 3.0.0 removed + * the trailing newline. Remove it in all versions + */ + t = PyTuple_New(2); + if (t == NULL) + goto fail; + + v = PyUnicode_FromString("IP Address"); + if (v == NULL) { + Py_DECREF(t); + goto fail; + } + PyTuple_SET_ITEM(t, 0, v); + + if (name->d.ip->length == 4) { + unsigned char *p = name->d.ip->data; + v = PyUnicode_FromFormat( + "%d.%d.%d.%d", + p[0], p[1], p[2], p[3] + ); + } else if (name->d.ip->length == 16) { + /* PyUnicode_FromFormat() does not support %X */ + unsigned char *p = name->d.ip->data; + len = sprintf( + buf, + "%X:%X:%X:%X:%X:%X:%X:%X", + p[0] << 8 | p[1], + p[2] << 8 | p[3], + p[4] << 8 | p[5], + p[6] << 8 | p[7], + p[8] << 8 | p[9], + p[10] << 8 | p[11], + p[12] << 8 | p[13], + p[14] << 8 | p[15] + ); + v = PyUnicode_FromStringAndSize(buf, len); + } else { + v = PyUnicode_FromString(""); + } + + if (v == NULL) { + Py_DECREF(t); + goto fail; + } + PyTuple_SET_ITEM(t, 1, v); + break; + default: /* for everything else, we use the OpenSSL print form */ switch (gntype) { @@ -1417,7 +1465,6 @@ _get_peer_alt_names (X509 *certificate) { case GEN_OTHERNAME: case GEN_X400: case GEN_EDIPARTY: - case GEN_IPADD: case GEN_RID: break; default: From webhook-mailer at python.org Sat Dec 7 12:20:32 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sat, 07 Dec 2019 17:20:32 -0000 Subject: [Python-checkins] [3.8] bpo-38820: OpenSSL 3.0.0 compatibility. (GH-17190) (GH-17499) Message-ID: https://github.com/python/cpython/commit/9d3cacd5901f8fbbc4f8b78fc35abad01a0e6546 commit: 9d3cacd5901f8fbbc4f8b78fc35abad01a0e6546 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-07T09:20:27-08:00 summary: [3.8] bpo-38820: OpenSSL 3.0.0 compatibility. (GH-17190) (GH-17499) test_openssl_version now accepts version 3.0.0. getpeercert() no longer returns IPv6 addresses with a trailing new line. Signed-off-by: Christian Heimes https://bugs.python.org/issue38820 (cherry picked from commit 2b7de6696bf2f924cd2cd9ff0a539c8aa37c6244) Co-authored-by: Christian Heimes https://bugs.python.org/issue38820 Automerge-Triggered-By: @tiran files: A Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst M Doc/library/ssl.rst M Lib/test/test_ssl.py M Modules/_ssl.c diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index f8fa25df6c241..bbb4c412d9303 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -1256,6 +1256,9 @@ SSL sockets also have the following additional methods and attributes: The returned dictionary includes additional X509v3 extension items such as ``crlDistributionPoints``, ``caIssuers`` and ``OCSP`` URIs. + .. versionchanged:: 3.8.1 + IPv6 address strings no longer have a trailing new line. + .. method:: SSLSocket.cipher() Returns a three-value tuple containing the name of the cipher being used, the diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 539cb7751db89..0bc0a8c4522d5 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -485,7 +485,7 @@ def test_parse_cert_CVE_2013_4238(self): ('email', 'null at python.org\x00user at example.org'), ('URI', 'http://null.python.org\x00http://example.org'), ('IP Address', '192.0.2.1'), - ('IP Address', '2001:DB8:0:0:0:0:0:1\n')) + ('IP Address', '2001:DB8:0:0:0:0:0:1')) else: # OpenSSL 0.9.7 doesn't support IPv6 addresses in subjectAltName san = (('DNS', 'altnull.python.org\x00example.com'), @@ -512,7 +512,7 @@ def test_parse_all_sans(self): (('commonName', 'dirname example'),))), ('URI', 'https://www.python.org/'), ('IP Address', '127.0.0.1'), - ('IP Address', '0:0:0:0:0:0:0:1\n'), + ('IP Address', '0:0:0:0:0:0:0:1'), ('Registered ID', '1.2.3.4.5') ) ) @@ -539,11 +539,11 @@ def test_openssl_version(self): # Some sanity checks follow # >= 0.9 self.assertGreaterEqual(n, 0x900000) - # < 3.0 - self.assertLess(n, 0x30000000) + # < 4.0 + self.assertLess(n, 0x40000000) major, minor, fix, patch, status = t - self.assertGreaterEqual(major, 0) - self.assertLess(major, 3) + self.assertGreaterEqual(major, 1) + self.assertLess(major, 4) self.assertGreaterEqual(minor, 0) self.assertLess(minor, 256) self.assertGreaterEqual(fix, 0) diff --git a/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst b/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst new file mode 100644 index 0000000000000..2c6a6e853c25f --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst @@ -0,0 +1,2 @@ +Make Python compatible with OpenSSL 3.0.0. :func:`ssl.SSLSocket.getpeercert` +no longer returns IPv6 addresses with a trailing new line. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 6f1f9c881530f..43b236c212120 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -1410,6 +1410,54 @@ _get_peer_alt_names (X509 *certificate) { PyTuple_SET_ITEM(t, 1, v); break; + case GEN_IPADD: + /* OpenSSL < 3.0.0 adds a trailing \n to IPv6. 3.0.0 removed + * the trailing newline. Remove it in all versions + */ + t = PyTuple_New(2); + if (t == NULL) + goto fail; + + v = PyUnicode_FromString("IP Address"); + if (v == NULL) { + Py_DECREF(t); + goto fail; + } + PyTuple_SET_ITEM(t, 0, v); + + if (name->d.ip->length == 4) { + unsigned char *p = name->d.ip->data; + v = PyUnicode_FromFormat( + "%d.%d.%d.%d", + p[0], p[1], p[2], p[3] + ); + } else if (name->d.ip->length == 16) { + /* PyUnicode_FromFormat() does not support %X */ + unsigned char *p = name->d.ip->data; + len = sprintf( + buf, + "%X:%X:%X:%X:%X:%X:%X:%X", + p[0] << 8 | p[1], + p[2] << 8 | p[3], + p[4] << 8 | p[5], + p[6] << 8 | p[7], + p[8] << 8 | p[9], + p[10] << 8 | p[11], + p[12] << 8 | p[13], + p[14] << 8 | p[15] + ); + v = PyUnicode_FromStringAndSize(buf, len); + } else { + v = PyUnicode_FromString(""); + } + + if (v == NULL) { + Py_DECREF(t); + goto fail; + } + PyTuple_SET_ITEM(t, 1, v); + break; + default: /* for everything else, we use the OpenSSL print form */ switch (gntype) { @@ -1417,7 +1465,6 @@ _get_peer_alt_names (X509 *certificate) { case GEN_OTHERNAME: case GEN_X400: case GEN_EDIPARTY: - case GEN_IPADD: case GEN_RID: break; default: From webhook-mailer at python.org Sat Dec 7 12:20:47 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sat, 07 Dec 2019 17:20:47 -0000 Subject: [Python-checkins] [3.7] bpo-38820: OpenSSL 3.0.0 compatibility. (GH-17190) (GH-17500) Message-ID: https://github.com/python/cpython/commit/a197f8aa7493e66bc54c3db8f796d00cef1c3042 commit: a197f8aa7493e66bc54c3db8f796d00cef1c3042 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-07T09:20:43-08:00 summary: [3.7] bpo-38820: OpenSSL 3.0.0 compatibility. (GH-17190) (GH-17500) test_openssl_version now accepts version 3.0.0. getpeercert() no longer returns IPv6 addresses with a trailing new line. Signed-off-by: Christian Heimes https://bugs.python.org/issue38820 (cherry picked from commit 2b7de6696bf2f924cd2cd9ff0a539c8aa37c6244) Co-authored-by: Christian Heimes https://bugs.python.org/issue38820 Automerge-Triggered-By: @tiran files: A Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst M Doc/library/ssl.rst M Lib/test/test_ssl.py M Modules/_ssl.c diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index 212d937b7ebb1..5aff697b8dfe2 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -1247,6 +1247,9 @@ SSL sockets also have the following additional methods and attributes: The returned dictionary includes additional X509v3 extension items such as ``crlDistributionPoints``, ``caIssuers`` and ``OCSP`` URIs. + .. versionchanged:: 3.7.6 + IPv6 address strings no longer have a trailing new line. + .. method:: SSLSocket.cipher() Returns a three-value tuple containing the name of the cipher being used, the diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index a01999f6aa3d8..1018259603f93 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -500,7 +500,7 @@ def test_parse_cert_CVE_2013_4238(self): ('email', 'null at python.org\x00user at example.org'), ('URI', 'http://null.python.org\x00http://example.org'), ('IP Address', '192.0.2.1'), - ('IP Address', '2001:DB8:0:0:0:0:0:1\n')) + ('IP Address', '2001:DB8:0:0:0:0:0:1')) else: # OpenSSL 0.9.7 doesn't support IPv6 addresses in subjectAltName san = (('DNS', 'altnull.python.org\x00example.com'), @@ -527,7 +527,7 @@ def test_parse_all_sans(self): (('commonName', 'dirname example'),))), ('URI', 'https://www.python.org/'), ('IP Address', '127.0.0.1'), - ('IP Address', '0:0:0:0:0:0:0:1\n'), + ('IP Address', '0:0:0:0:0:0:0:1'), ('Registered ID', '1.2.3.4.5') ) ) @@ -554,11 +554,11 @@ def test_openssl_version(self): # Some sanity checks follow # >= 0.9 self.assertGreaterEqual(n, 0x900000) - # < 3.0 - self.assertLess(n, 0x30000000) + # < 4.0 + self.assertLess(n, 0x40000000) major, minor, fix, patch, status = t - self.assertGreaterEqual(major, 0) - self.assertLess(major, 3) + self.assertGreaterEqual(major, 1) + self.assertLess(major, 4) self.assertGreaterEqual(minor, 0) self.assertLess(minor, 256) self.assertGreaterEqual(fix, 0) diff --git a/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst b/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst new file mode 100644 index 0000000000000..2c6a6e853c25f --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst @@ -0,0 +1,2 @@ +Make Python compatible with OpenSSL 3.0.0. :func:`ssl.SSLSocket.getpeercert` +no longer returns IPv6 addresses with a trailing new line. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index a94dbbaec8493..4611710a95def 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -1377,6 +1377,54 @@ _get_peer_alt_names (X509 *certificate) { PyTuple_SET_ITEM(t, 1, v); break; + case GEN_IPADD: + /* OpenSSL < 3.0.0 adds a trailing \n to IPv6. 3.0.0 removed + * the trailing newline. Remove it in all versions + */ + t = PyTuple_New(2); + if (t == NULL) + goto fail; + + v = PyUnicode_FromString("IP Address"); + if (v == NULL) { + Py_DECREF(t); + goto fail; + } + PyTuple_SET_ITEM(t, 0, v); + + if (name->d.ip->length == 4) { + unsigned char *p = name->d.ip->data; + v = PyUnicode_FromFormat( + "%d.%d.%d.%d", + p[0], p[1], p[2], p[3] + ); + } else if (name->d.ip->length == 16) { + /* PyUnicode_FromFormat() does not support %X */ + unsigned char *p = name->d.ip->data; + len = sprintf( + buf, + "%X:%X:%X:%X:%X:%X:%X:%X", + p[0] << 8 | p[1], + p[2] << 8 | p[3], + p[4] << 8 | p[5], + p[6] << 8 | p[7], + p[8] << 8 | p[9], + p[10] << 8 | p[11], + p[12] << 8 | p[13], + p[14] << 8 | p[15] + ); + v = PyUnicode_FromStringAndSize(buf, len); + } else { + v = PyUnicode_FromString(""); + } + + if (v == NULL) { + Py_DECREF(t); + goto fail; + } + PyTuple_SET_ITEM(t, 1, v); + break; + default: /* for everything else, we use the OpenSSL print form */ switch (gntype) { @@ -1384,7 +1432,6 @@ _get_peer_alt_names (X509 *certificate) { case GEN_OTHERNAME: case GEN_X400: case GEN_EDIPARTY: - case GEN_IPADD: case GEN_RID: break; default: From webhook-mailer at python.org Sun Dec 8 02:38:22 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Sun, 08 Dec 2019 07:38:22 -0000 Subject: [Python-checkins] bpo-38991: Remove test.support.strip_python_stderr() (GH-17490) Message-ID: https://github.com/python/cpython/commit/6cac1136665b70f72db291b95876d7affcf1d2db commit: 6cac1136665b70f72db291b95876d7affcf1d2db branch: master author: Victor Stinner committer: GitHub date: 2019-12-08T08:38:16+01:00 summary: bpo-38991: Remove test.support.strip_python_stderr() (GH-17490) test.support: run_python_until_end(), assert_python_ok() and assert_python_failure() functions no longer strip whitespaces from stderr. files: A Misc/NEWS.d/next/Tests/2019-12-07-00-52-09.bpo-38991.JE3_o-.rst M Doc/library/test.rst M Lib/test/support/__init__.py M Lib/test/support/script_helper.py M Lib/test/test_cmd_line.py M Lib/test/test_cmd_line_script.py M Lib/test/test_faulthandler.py M Lib/test/test_gc.py M Lib/test/test_subprocess.py M Lib/test/test_support.py M Lib/test/test_warnings/__init__.py diff --git a/Doc/library/test.rst b/Doc/library/test.rst index 4a61566c2239a..73b3fe5cf06f8 100644 --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -686,13 +686,6 @@ The :mod:`test.support` module defines the following functions: ``sys.stdout`` if it's not set. -.. function:: strip_python_strerr(stderr) - - Strip the *stderr* of a Python process from potential debug output - emitted by the interpreter. This will typically be run on the result of - :meth:`subprocess.Popen.communicate`. - - .. function:: args_from_interpreter_flags() Return a list of command line arguments reproducing the current settings @@ -1499,6 +1492,9 @@ script execution tests. in a subprocess. The values can include ``__isolated``, ``__cleanenv``, ``__cwd``, and ``TERM``. + .. versionchanged:: 3.9 + The function no longer strips whitespaces from *stderr*. + .. function:: assert_python_ok(*args, **env_vars) @@ -1512,6 +1508,9 @@ script execution tests. Python is started in isolated mode (command line option ``-I``), except if the ``__isolated`` keyword is set to ``False``. + .. versionchanged:: 3.9 + The function no longer strips whitespaces from *stderr*. + .. function:: assert_python_failure(*args, **env_vars) @@ -1521,6 +1520,9 @@ script execution tests. See :func:`assert_python_ok` for more options. + .. versionchanged:: 3.9 + The function no longer strips whitespaces from *stderr*. + .. function:: spawn_python(*args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **kw) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 7e1b30cc160ca..215bab8131a04 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -2512,16 +2512,6 @@ def swap_item(obj, item, new_val): if item in obj: del obj[item] -def strip_python_stderr(stderr): - """Strip the stderr of a Python process from potential debug output - emitted by the interpreter. - - This will typically be run on the result of the communicate() method - of a subprocess.Popen object. - """ - stderr = re.sub(br"\[\d+ refs, \d+ blocks\]\r?\n?", b"", stderr).strip() - return stderr - requires_type_collecting = unittest.skipIf(hasattr(sys, 'getcounts'), 'types are immortal if COUNT_ALLOCS is defined') diff --git a/Lib/test/support/script_helper.py b/Lib/test/support/script_helper.py index 83519988e3947..37e576d4a770e 100644 --- a/Lib/test/support/script_helper.py +++ b/Lib/test/support/script_helper.py @@ -11,7 +11,7 @@ import zipfile from importlib.util import source_from_cache -from test.support import make_legacy_pyc, strip_python_stderr +from test.support import make_legacy_pyc # Cached result of the expensive test performed in the function below. @@ -134,7 +134,6 @@ def run_python_until_end(*args, **env_vars): proc.kill() subprocess._cleanup() rc = proc.returncode - err = strip_python_stderr(err) return _PythonRunResult(rc, out, err), cmd_line def _assert_python(expected_success, /, *args, **env_vars): diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index 497bfa9eb89de..47810020dd353 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -332,10 +332,10 @@ def test_output_newline(self): if sys.platform == 'win32': self.assertEqual(b'1\r\n2\r\n', out) - self.assertEqual(b'3\r\n4', err) + self.assertEqual(b'3\r\n4\r\n', err) else: self.assertEqual(b'1\n2\n', out) - self.assertEqual(b'3\n4', err) + self.assertEqual(b'3\n4\n', err) def test_unmached_quote(self): # Issue #10206: python program starting with unmatched quote @@ -391,7 +391,7 @@ def preexec(): stderr=subprocess.PIPE, preexec_fn=preexec) out, err = p.communicate() - self.assertEqual(support.strip_python_stderr(err), b'') + self.assertEqual(err, b'') self.assertEqual(p.returncode, 42) def test_no_stdin(self): diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py index 60723078efc6b..2ac926deac485 100644 --- a/Lib/test/test_cmd_line_script.py +++ b/Lib/test/test_cmd_line_script.py @@ -535,7 +535,7 @@ def test_pep_409_verbiage(self): script_name = _make_test_script(script_dir, 'script', script) exitcode, stdout, stderr = assert_python_failure(script_name) text = stderr.decode('ascii').split('\n') - self.assertEqual(len(text), 4) + self.assertEqual(len(text), 5) self.assertTrue(text[0].startswith('Traceback')) self.assertTrue(text[1].startswith(' File ')) self.assertTrue(text[3].startswith('NameError')) @@ -579,7 +579,7 @@ def test_issue20500_exit_with_exception_value(self): script_name = _make_test_script(script_dir, 'script', script) exitcode, stdout, stderr = assert_python_failure(script_name) text = stderr.decode('ascii') - self.assertEqual(text, "some text") + self.assertEqual(text.rstrip(), "some text") def test_syntaxerror_unindented_caret_position(self): script = "1 + 1 = 2\n" diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py index a4427a537d1f8..ac8cf4686bf8c 100644 --- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -71,9 +71,8 @@ def get_output(self, code, filename=None, fd=None): with support.SuppressCrashReport(): process = script_helper.spawn_python('-c', code, pass_fds=pass_fds) with process: - stdout, stderr = process.communicate() + output, stderr = process.communicate() exitcode = process.wait() - output = support.strip_python_stderr(stdout) output = output.decode('ascii', 'backslashreplace') if filename: self.assertEqual(output, '') diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py index fdb8752b66817..c0d4a7507ae0d 100644 --- a/Lib/test/test_gc.py +++ b/Lib/test/test_gc.py @@ -1,7 +1,7 @@ import unittest import unittest.mock from test.support import (verbose, refcount_test, run_unittest, - strip_python_stderr, cpython_only, start_threads, + cpython_only, start_threads, temp_dir, requires_type_collecting, TESTFN, unlink, import_module) from test.support.script_helper import assert_python_ok, make_script @@ -671,8 +671,8 @@ def run_command(code): p.stdout.close() p.stderr.close() self.assertEqual(p.returncode, 0) - self.assertEqual(stdout.strip(), b"") - return strip_python_stderr(stderr) + self.assertEqual(stdout, b"") + return stderr stderr = run_command(code % "0") self.assertIn(b"ResourceWarning: gc: 2 uncollectable objects at " diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 97dc09c564965..f806be817b55b 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -85,15 +85,6 @@ def tearDown(self): self.doCleanups() support.reap_children() - def assertStderrEqual(self, stderr, expected, msg=None): - # In a debug build, stuff like "[6580 refs]" is printed to stderr at - # shutdown time. That frustrates tests trying to check stderr produced - # from a spawned Python process. - actual = support.strip_python_stderr(stderr) - # strip_python_stderr also strips whitespace, so we do too. - expected = expected.strip() - self.assertEqual(actual, expected, msg) - class PopenTestException(Exception): pass @@ -547,7 +538,7 @@ def test_stderr_pipe(self): 'import sys; sys.stderr.write("strawberry")'], stderr=subprocess.PIPE) with p: - self.assertStderrEqual(p.stderr.read(), b"strawberry") + self.assertEqual(p.stderr.read(), b"strawberry") def test_stderr_filedes(self): # stderr is set to open file descriptor @@ -559,7 +550,7 @@ def test_stderr_filedes(self): stderr=d) p.wait() os.lseek(d, 0, 0) - self.assertStderrEqual(os.read(d, 1024), b"strawberry") + self.assertEqual(os.read(d, 1024), b"strawberry") def test_stderr_fileobj(self): # stderr is set to open file object @@ -570,7 +561,7 @@ def test_stderr_fileobj(self): stderr=tf) p.wait() tf.seek(0) - self.assertStderrEqual(tf.read(), b"strawberry") + self.assertEqual(tf.read(), b"strawberry") def test_stderr_redirect_with_no_stdout_redirect(self): # test stderr=STDOUT while stdout=None (not set) @@ -589,8 +580,8 @@ def test_stderr_redirect_with_no_stdout_redirect(self): stderr=subprocess.PIPE) stdout, stderr = p.communicate() #NOTE: stdout should get stderr from grandchild - self.assertStderrEqual(stdout, b'42') - self.assertStderrEqual(stderr, b'') # should be empty + self.assertEqual(stdout, b'42') + self.assertEqual(stderr, b'') # should be empty self.assertEqual(p.returncode, 0) def test_stdout_stderr_pipe(self): @@ -603,7 +594,7 @@ def test_stdout_stderr_pipe(self): stdout=subprocess.PIPE, stderr=subprocess.STDOUT) with p: - self.assertStderrEqual(p.stdout.read(), b"appleorange") + self.assertEqual(p.stdout.read(), b"appleorange") def test_stdout_stderr_file(self): # capture stdout and stderr to the same open file @@ -618,7 +609,7 @@ def test_stdout_stderr_file(self): stderr=tf) p.wait() tf.seek(0) - self.assertStderrEqual(tf.read(), b"appleorange") + self.assertEqual(tf.read(), b"appleorange") def test_stdout_filedes_of_stdout(self): # stdout is set to 1 (#1531862). @@ -767,7 +758,7 @@ def test_communicate_stderr(self): stderr=subprocess.PIPE) (stdout, stderr) = p.communicate() self.assertEqual(stdout, None) - self.assertStderrEqual(stderr, b"pineapple") + self.assertEqual(stderr, b"pineapple") def test_communicate(self): p = subprocess.Popen([sys.executable, "-c", @@ -782,7 +773,7 @@ def test_communicate(self): self.addCleanup(p.stdin.close) (stdout, stderr) = p.communicate(b"banana") self.assertEqual(stdout, b"banana") - self.assertStderrEqual(stderr, b"pineapple") + self.assertEqual(stderr, b"pineapple") def test_communicate_timeout(self): p = subprocess.Popen([sys.executable, "-c", @@ -801,7 +792,7 @@ def test_communicate_timeout(self): # after it completes. (stdout, stderr) = p.communicate() self.assertEqual(stdout, "banana") - self.assertStderrEqual(stderr.encode(), b"pineapple\npear\n") + self.assertEqual(stderr.encode(), b"pineapple\npear\n") def test_communicate_timeout_large_output(self): # Test an expiring timeout while the child is outputting lots of data. @@ -887,7 +878,7 @@ def test_writes_before_communicate(self): p.stdin.write(b"banana") (stdout, stderr) = p.communicate(b"split") self.assertEqual(stdout, b"bananasplit") - self.assertStderrEqual(stderr, b"") + self.assertEqual(stderr, b"") def test_universal_newlines_and_text(self): args = [ @@ -1005,7 +996,6 @@ def test_universal_newlines_communicate_stdin_stdout_stderr(self): self.assertEqual("line1\nline2\nline3\nline4\nline5\n", stdout) # Python debug build push something like "[42442 refs]\n" # to stderr at exit of subprocess. - # Don't use assertStderrEqual because it strips CR and LF from output. self.assertTrue(stderr.startswith("eline2\neline6\neline7\n")) def test_universal_newlines_communicate_encodings(self): @@ -2240,13 +2230,13 @@ def test_send_signal(self): def test_kill(self): p = self._kill_process('kill') _, stderr = p.communicate() - self.assertStderrEqual(stderr, b'') + self.assertEqual(stderr, b'') self.assertEqual(p.wait(), -signal.SIGKILL) def test_terminate(self): p = self._kill_process('terminate') _, stderr = p.communicate() - self.assertStderrEqual(stderr, b'') + self.assertEqual(stderr, b'') self.assertEqual(p.wait(), -signal.SIGTERM) def test_send_signal_dead(self): @@ -2294,8 +2284,8 @@ def check_close_std_fds(self, fds): stdin=stdin, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() - err = support.strip_python_stderr(err) - self.assertEqual((out, err), (b'apple', b'orange')) + self.assertEqual(out, b'apple') + self.assertEqual(err, b'orange') finally: self._restore_fds(saved_fds) @@ -2380,7 +2370,7 @@ def test_remapping_std_fds(self): os.lseek(fd, 0, 0) out = os.read(temp_fds[2], 1024) - err = support.strip_python_stderr(os.read(temp_fds[0], 1024)) + err = os.read(temp_fds[0], 1024).strip() self.assertEqual(out, b"got STDIN") self.assertEqual(err, b"err") @@ -2422,7 +2412,7 @@ def check_swap_fds(self, stdin_no, stdout_no, stderr_no): os.lseek(fd, 0, 0) out = os.read(stdout_no, 1024) - err = support.strip_python_stderr(os.read(stderr_no, 1024)) + err = os.read(stderr_no, 1024).strip() finally: self._restore_fds(saved_fds) @@ -3338,7 +3328,7 @@ def _kill_process(self, method, *args): p.stdout.read(1) getattr(p, method)(*args) _, stderr = p.communicate() - self.assertStderrEqual(stderr, b'') + self.assertEqual(stderr, b'') returncode = p.wait() self.assertNotEqual(returncode, 0) @@ -3361,7 +3351,7 @@ def _kill_dead_process(self, method, *args): # This shouldn't raise even though the child is now dead getattr(p, method)(*args) _, stderr = p.communicate() - self.assertStderrEqual(stderr, b'') + self.assertEqual(stderr, b'') rc = p.wait() self.assertEqual(rc, 42) @@ -3550,7 +3540,7 @@ def test_pipe(self): stdout=subprocess.PIPE, stderr=subprocess.PIPE) as proc: self.assertEqual(proc.stdout.read(), b"stdout") - self.assertStderrEqual(proc.stderr.read(), b"stderr") + self.assertEqual(proc.stderr.read(), b"stderr") self.assertTrue(proc.stdout.closed) self.assertTrue(proc.stderr.closed) diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index e3ce670b8437f..eb27c0cf866b5 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -653,7 +653,6 @@ def test_fd_count(self): # run_doctest # threading_cleanup # reap_threads - # strip_python_stderr # can_symlink # skip_unless_symlink # SuppressCrashReport diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py index d1031829514b2..3a6d64eaad1f8 100644 --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -1219,7 +1219,8 @@ def __del__(self): a=A() """ rc, out, err = assert_python_ok("-c", code) - self.assertEqual(err.decode(), ':7: UserWarning: test') + self.assertEqual(err.decode().rstrip(), + ':7: UserWarning: test') def test_late_resource_warning(self): # Issue #21925: Emitting a ResourceWarning late during the Python diff --git a/Misc/NEWS.d/next/Tests/2019-12-07-00-52-09.bpo-38991.JE3_o-.rst b/Misc/NEWS.d/next/Tests/2019-12-07-00-52-09.bpo-38991.JE3_o-.rst new file mode 100644 index 0000000000000..cff5a65646551 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-12-07-00-52-09.bpo-38991.JE3_o-.rst @@ -0,0 +1,5 @@ +:mod:`test.support`: :func:`~test.support.run_python_until_end`, +:func:`~test.support.assert_python_ok` and +:func:`~test.support.assert_python_failure` functions no longer strip +whitespaces from stderr. Remove ``test.support.strip_python_stderr()`` +function. From webhook-mailer at python.org Sun Dec 8 02:40:19 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Sun, 08 Dec 2019 07:40:19 -0000 Subject: [Python-checkins] bpo-38852: Set thread stack size to 8 Mb for debug builds on android platforms (GH-17337) Message-ID: https://github.com/python/cpython/commit/00ada2c1d57c5b8b468bad32ff24fa14113ae5c7 commit: 00ada2c1d57c5b8b468bad32ff24fa14113ae5c7 branch: master author: xdegaye committer: Victor Stinner date: 2019-12-08T08:40:14+01:00 summary: bpo-38852: Set thread stack size to 8 Mb for debug builds on android platforms (GH-17337) files: A Misc/NEWS.d/next/Core and Builtins/2019-11-22-09-55-21.bpo-38852.y7oPEa.rst M Python/thread_pthread.h diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-22-09-55-21.bpo-38852.y7oPEa.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-22-09-55-21.bpo-38852.y7oPEa.rst new file mode 100644 index 0000000000000..915a936aae2d3 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-11-22-09-55-21.bpo-38852.y7oPEa.rst @@ -0,0 +1 @@ +Set the thread stack size to 8 Mb for debug builds on android platforms. diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h index b9a340530cfe9..ff4266c72b4b3 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -51,6 +51,16 @@ #undef THREAD_STACK_SIZE #define THREAD_STACK_SIZE 0x200000 #endif +/* bpo-38852: test_threading.test_recursion_limit() checks that 1000 recursive + Python calls (default recursion limit) doesn't crash, but raise a regular + RecursionError exception. In debug mode, Python function calls allocates + more memory on the stack, so use a stack of 8 MiB. */ +#if defined(__ANDROID__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0 +# ifdef Py_DEBUG +# undef THREAD_STACK_SIZE +# define THREAD_STACK_SIZE 0x800000 +# endif +#endif /* for safety, ensure a viable minimum stacksize */ #define THREAD_STACK_MIN 0x8000 /* 32 KiB */ #else /* !_POSIX_THREAD_ATTR_STACKSIZE */ From webhook-mailer at python.org Sun Dec 8 06:36:07 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 08 Dec 2019 11:36:07 -0000 Subject: [Python-checkins] bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497) Message-ID: https://github.com/python/cpython/commit/28c91631c24e53713ad0e8a2bbae716373f5e53d commit: 28c91631c24e53713ad0e8a2bbae716373f5e53d branch: master author: AMIR <31338382+amiremohamadi at users.noreply.github.com> committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-08T03:35:59-08:00 summary: bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497) now contextvars.ContextVar "__class_getitem__" method returns ContextVar class, not None. https://bugs.python.org/issue38979 Automerge-Triggered-By: @asvetlov files: A Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst M Lib/test/test_context.py M Python/context.c diff --git a/Lib/test/test_context.py b/Lib/test/test_context.py index efd7319a23ae0..b9e991a400092 100644 --- a/Lib/test/test_context.py +++ b/Lib/test/test_context.py @@ -38,9 +38,6 @@ def test_context_var_new_1(self): self.assertNotEqual(hash(c), hash('aaa')) - def test_context_var_new_2(self): - self.assertIsNone(contextvars.ContextVar[int]) - @isolated_context def test_context_var_repr_1(self): c = contextvars.ContextVar('a') @@ -361,6 +358,10 @@ def sub(num): tp.shutdown() self.assertEqual(results, list(range(10))) + def test_contextvar_getitem(self): + clss = contextvars.ContextVar + self.assertEqual(clss[str], clss) + # HAMT Tests diff --git a/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst b/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst new file mode 100644 index 0000000000000..6a91a12e4930a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst @@ -0,0 +1 @@ +Return class from ``ContextVar.__class_getitem__`` to simplify subclassing. diff --git a/Python/context.c b/Python/context.c index 26f22994eecb7..e0338c97e1873 100644 --- a/Python/context.c +++ b/Python/context.c @@ -1024,9 +1024,10 @@ _contextvars_ContextVar_reset(PyContextVar *self, PyObject *token) static PyObject * -contextvar_cls_getitem(PyObject *self, PyObject *args) +contextvar_cls_getitem(PyObject *self, PyObject *arg) { - Py_RETURN_NONE; + Py_INCREF(self); + return self; } static PyMemberDef PyContextVar_members[] = { @@ -1039,7 +1040,7 @@ static PyMethodDef PyContextVar_methods[] = { _CONTEXTVARS_CONTEXTVAR_SET_METHODDEF _CONTEXTVARS_CONTEXTVAR_RESET_METHODDEF {"__class_getitem__", contextvar_cls_getitem, - METH_VARARGS | METH_STATIC, NULL}, + METH_O | METH_CLASS, NULL}, {NULL, NULL} }; From webhook-mailer at python.org Sun Dec 8 06:53:12 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 08 Dec 2019 11:53:12 -0000 Subject: [Python-checkins] bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497) Message-ID: https://github.com/python/cpython/commit/9baa870c27b54c26f9dd292c26936b70bdb64a06 commit: 9baa870c27b54c26f9dd292c26936b70bdb64a06 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-08T03:53:07-08:00 summary: bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497) now contextvars.ContextVar "__class_getitem__" method returns ContextVar class, not None. https://bugs.python.org/issue38979 Automerge-Triggered-By: @asvetlov (cherry picked from commit 28c91631c24e53713ad0e8a2bbae716373f5e53d) Co-authored-by: AMIR <31338382+amiremohamadi at users.noreply.github.com> files: A Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst M Lib/test/test_context.py M Python/context.c diff --git a/Lib/test/test_context.py b/Lib/test/test_context.py index efd7319a23ae0..b9e991a400092 100644 --- a/Lib/test/test_context.py +++ b/Lib/test/test_context.py @@ -38,9 +38,6 @@ def test_context_var_new_1(self): self.assertNotEqual(hash(c), hash('aaa')) - def test_context_var_new_2(self): - self.assertIsNone(contextvars.ContextVar[int]) - @isolated_context def test_context_var_repr_1(self): c = contextvars.ContextVar('a') @@ -361,6 +358,10 @@ def sub(num): tp.shutdown() self.assertEqual(results, list(range(10))) + def test_contextvar_getitem(self): + clss = contextvars.ContextVar + self.assertEqual(clss[str], clss) + # HAMT Tests diff --git a/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst b/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst new file mode 100644 index 0000000000000..6a91a12e4930a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst @@ -0,0 +1 @@ +Return class from ``ContextVar.__class_getitem__`` to simplify subclassing. diff --git a/Python/context.c b/Python/context.c index 90c71e386d53a..c1575c9e20e80 100644 --- a/Python/context.c +++ b/Python/context.c @@ -974,9 +974,10 @@ _contextvars_ContextVar_reset(PyContextVar *self, PyObject *token) static PyObject * -contextvar_cls_getitem(PyObject *self, PyObject *args) +contextvar_cls_getitem(PyObject *self, PyObject *arg) { - Py_RETURN_NONE; + Py_INCREF(self); + return self; } static PyMemberDef PyContextVar_members[] = { @@ -989,7 +990,7 @@ static PyMethodDef PyContextVar_methods[] = { _CONTEXTVARS_CONTEXTVAR_SET_METHODDEF _CONTEXTVARS_CONTEXTVAR_RESET_METHODDEF {"__class_getitem__", contextvar_cls_getitem, - METH_VARARGS | METH_STATIC, NULL}, + METH_O | METH_CLASS, NULL}, {NULL, NULL} }; From webhook-mailer at python.org Sun Dec 8 07:49:12 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 08 Dec 2019 12:49:12 -0000 Subject: [Python-checkins] bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497) Message-ID: https://github.com/python/cpython/commit/960fca1a5887a277fd6031cf4c4b6fb31b08ebf5 commit: 960fca1a5887a277fd6031cf4c4b6fb31b08ebf5 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-08T04:49:07-08:00 summary: bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497) now contextvars.ContextVar "__class_getitem__" method returns ContextVar class, not None. https://bugs.python.org/issue38979 Automerge-Triggered-By: @asvetlov (cherry picked from commit 28c91631c24e53713ad0e8a2bbae716373f5e53d) Co-authored-by: AMIR <31338382+amiremohamadi at users.noreply.github.com> files: A Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst M Lib/test/test_context.py M Python/context.c diff --git a/Lib/test/test_context.py b/Lib/test/test_context.py index efd7319a23ae0..b9e991a400092 100644 --- a/Lib/test/test_context.py +++ b/Lib/test/test_context.py @@ -38,9 +38,6 @@ def test_context_var_new_1(self): self.assertNotEqual(hash(c), hash('aaa')) - def test_context_var_new_2(self): - self.assertIsNone(contextvars.ContextVar[int]) - @isolated_context def test_context_var_repr_1(self): c = contextvars.ContextVar('a') @@ -361,6 +358,10 @@ def sub(num): tp.shutdown() self.assertEqual(results, list(range(10))) + def test_contextvar_getitem(self): + clss = contextvars.ContextVar + self.assertEqual(clss[str], clss) + # HAMT Tests diff --git a/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst b/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst new file mode 100644 index 0000000000000..6a91a12e4930a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst @@ -0,0 +1 @@ +Return class from ``ContextVar.__class_getitem__`` to simplify subclassing. diff --git a/Python/context.c b/Python/context.c index f48c376b4ffaa..5c30e47f35dd7 100644 --- a/Python/context.c +++ b/Python/context.c @@ -1010,9 +1010,10 @@ _contextvars_ContextVar_reset(PyContextVar *self, PyObject *token) static PyObject * -contextvar_cls_getitem(PyObject *self, PyObject *args) +contextvar_cls_getitem(PyObject *self, PyObject *arg) { - Py_RETURN_NONE; + Py_INCREF(self); + return self; } static PyMemberDef PyContextVar_members[] = { @@ -1025,7 +1026,7 @@ static PyMethodDef PyContextVar_methods[] = { _CONTEXTVARS_CONTEXTVAR_SET_METHODDEF _CONTEXTVARS_CONTEXTVAR_RESET_METHODDEF {"__class_getitem__", contextvar_cls_getitem, - METH_VARARGS | METH_STATIC, NULL}, + METH_O | METH_CLASS, NULL}, {NULL, NULL} }; From webhook-mailer at python.org Sun Dec 8 15:14:45 2019 From: webhook-mailer at python.org (Chris Withers) Date: Sun, 08 Dec 2019 20:14:45 -0000 Subject: [Python-checkins] bpo-38669: patch.object now raises a helpful error (GH17034) Message-ID: https://github.com/python/cpython/commit/cd90a52983db34896a6335a572d55bdda274778f commit: cd90a52983db34896a6335a572d55bdda274778f branch: master author: Elena Oat committer: Chris Withers date: 2019-12-08T20:14:38Z summary: bpo-38669: patch.object now raises a helpful error (GH17034) This means a clearer message is now shown when patch.object is called with two string arguments, rather than a class and a string argument. files: A Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst M Lib/unittest/mock.py M Lib/unittest/test/testmock/testpatch.py diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index b06e29cf01c95..cd5a2aeb6084d 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -1601,6 +1601,10 @@ def _patch_object( When used as a class decorator `patch.object` honours `patch.TEST_PREFIX` for choosing which methods to wrap. """ + if type(target) is str: + raise TypeError( + f"{target!r} must be the actual object to be patched, not a str" + ) getter = lambda: target return _patch( getter, attribute, new, spec, create, diff --git a/Lib/unittest/test/testmock/testpatch.py b/Lib/unittest/test/testmock/testpatch.py index 0632d95e58fec..e065a2c35fbee 100644 --- a/Lib/unittest/test/testmock/testpatch.py +++ b/Lib/unittest/test/testmock/testpatch.py @@ -105,6 +105,10 @@ def test(): self.assertEqual(Something.attribute, sentinel.Original, "patch not restored") + def test_patchobject_with_string_as_target(self): + msg = "'Something' must be the actual object to be patched, not a str" + with self.assertRaisesRegex(TypeError, msg): + patch.object('Something', 'do_something') def test_patchobject_with_none(self): class Something(object): diff --git a/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst b/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst new file mode 100644 index 0000000000000..5060ecf2dc5a4 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst @@ -0,0 +1 @@ +Raise :exc:`TypeError` when passing target as a string with :meth:`unittest.mock.patch.object`. \ No newline at end of file From webhook-mailer at python.org Sun Dec 8 15:31:23 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 08 Dec 2019 20:31:23 -0000 Subject: [Python-checkins] bpo-38994: Implement __class_getitem__ for PathLike (GH-17498) Message-ID: https://github.com/python/cpython/commit/526606baf76e7a5309bb00f3bfaefa861a2014ba commit: 526606baf76e7a5309bb00f3bfaefa861a2014ba branch: master author: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-08T12:31:15-08:00 summary: bpo-38994: Implement __class_getitem__ for PathLike (GH-17498) https://bugs.python.org/issue38994 files: A Misc/NEWS.d/next/Library/2019-12-07-18-58-44.bpo-38994.IJYhz_.rst M Lib/os.py M Lib/pathlib.py M Lib/test/test_os.py M Lib/test/test_pathlib.py diff --git a/Lib/os.py b/Lib/os.py index 52d3f1d741585..c901bd1b8ed9d 100644 --- a/Lib/os.py +++ b/Lib/os.py @@ -1072,6 +1072,9 @@ def __fspath__(self): def __subclasshook__(cls, subclass): return hasattr(subclass, '__fspath__') + def __class_getitem__(cls, type): + return cls + if name == 'nt': class _AddedDllDirectory: diff --git a/Lib/pathlib.py b/Lib/pathlib.py index d70fde0ea3b45..f0537cfea19ab 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -777,6 +777,9 @@ def __ge__(self, other): return NotImplemented return self._cparts >= other._cparts + def __class_getitem__(cls, type): + return cls + drive = property(attrgetter('_drv'), doc="""The drive prefix (letter or UNC path), if any.""") diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index bf40cb1e8fa7d..f44ddbad7d641 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -4048,6 +4048,9 @@ def test_bad_pathlike(self): self.assertRaises(ZeroDivisionError, self.fspath, FakePath(ZeroDivisionError())) + def test_pathlike_class_getitem(self): + self.assertIs(os.PathLike[bytes], os.PathLike) + class TimesTests(unittest.TestCase): def test_times(self): diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 058a201aebc1d..b8e7fcc2e3029 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -2217,6 +2217,9 @@ def test_complex_symlinks_relative_dot_dot(self): class PathTest(_BasePathTest, unittest.TestCase): cls = pathlib.Path + def test_class_getitem(self): + self.assertIs(self.cls[str], self.cls) + def test_concrete_class(self): p = self.cls('a') self.assertIs(type(p), diff --git a/Misc/NEWS.d/next/Library/2019-12-07-18-58-44.bpo-38994.IJYhz_.rst b/Misc/NEWS.d/next/Library/2019-12-07-18-58-44.bpo-38994.IJYhz_.rst new file mode 100644 index 0000000000000..b9cb4176350cb --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-07-18-58-44.bpo-38994.IJYhz_.rst @@ -0,0 +1 @@ +Implement ``__class_getitem__`` for ``os.PathLike``, ``pathlib.Path`` From webhook-mailer at python.org Sun Dec 8 15:56:05 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Sun, 08 Dec 2019 20:56:05 -0000 Subject: [Python-checkins] bpo-38858: Fix ref leak in pycore_interp_init() (GH-17512) Message-ID: https://github.com/python/cpython/commit/080ee5a88406fb68aaab741145cd5d2a7c5f2ad6 commit: 080ee5a88406fb68aaab741145cd5d2a7c5f2ad6 branch: master author: Victor Stinner committer: GitHub date: 2019-12-08T21:55:58+01:00 summary: bpo-38858: Fix ref leak in pycore_interp_init() (GH-17512) bpo-38858, bpo-38997: _PySys_Create() returns a strong reference to the sys module: Py_DECREF() is needed when we are done with the module. files: M Python/pylifecycle.c diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 8bd71a350de86..823d96e86a438 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -705,24 +705,29 @@ static PyStatus pycore_interp_init(PyThreadState *tstate) { PyStatus status; + PyObject *sysmod = NULL; status = pycore_init_types(tstate); if (_PyStatus_EXCEPTION(status)) { - return status; + goto done; } - PyObject *sysmod; status = _PySys_Create(tstate, &sysmod); if (_PyStatus_EXCEPTION(status)) { - return status; + goto done; } status = pycore_init_builtins(tstate); if (_PyStatus_EXCEPTION(status)) { - return status; + goto done; } - return pycore_init_import_warnings(tstate, sysmod); + status = pycore_init_import_warnings(tstate, sysmod); + +done: + /* sys.modules['sys'] contains a strong reference to the module */ + Py_XDECREF(sysmod); + return status; } From webhook-mailer at python.org Sun Dec 8 20:35:45 2019 From: webhook-mailer at python.org (Abhilash Raj) Date: Mon, 09 Dec 2019 01:35:45 -0000 Subject: [Python-checkins] bpo-38698: Add a new InvalidMessageID token to email header parser. (GH-17503) Message-ID: https://github.com/python/cpython/commit/68157da8b42b26408af5d157d2dba4fcf29c6320 commit: 68157da8b42b26408af5d157d2dba4fcf29c6320 branch: master author: Abhilash Raj committer: GitHub date: 2019-12-08T17:35:38-08:00 summary: bpo-38698: Add a new InvalidMessageID token to email header parser. (GH-17503) This adds a new InvalidMessageID token to the email header parser which can be used to represent invalid message-id headers in the parse tree. files: A Misc/NEWS.d/next/Library/2019-12-07-21-49-50.bpo-38698.HxoSym.rst M Lib/email/_header_value_parser.py M Lib/test/test_email/test__header_value_parser.py diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py index abdef8189ca6f..cb013225ec60c 100644 --- a/Lib/email/_header_value_parser.py +++ b/Lib/email/_header_value_parser.py @@ -850,10 +850,15 @@ def fold(self, policy): # message-id tokens may not be folded. return str(self) + policy.linesep + class MessageID(MsgID): token_type = 'message-id' +class InvalidMessageID(MessageID): + token_type = 'invalid-message-id' + + class Header(TokenList): token_type = 'header' @@ -2110,11 +2115,18 @@ def parse_message_id(value): message_id = MessageID() try: token, value = get_msg_id(value) - except errors.HeaderParseError: - message_id.defects.append(errors.InvalidHeaderDefect( - "Expected msg-id but found {!r}".format(value))) - else: message_id.append(token) + except errors.HeaderParseError as ex: + token = get_unstructured(value) + message_id = InvalidMessageID(token) + message_id.defects.append( + errors.InvalidHeaderDefect("Invalid msg-id: {!r}".format(ex))) + else: + # Value after parsing a valid msg_id should be None. + if value: + message_id.defects.append(errors.InvalidHeaderDefect( + "Unexpected {!r}".format(value))) + return message_id # diff --git a/Lib/test/test_email/test__header_value_parser.py b/Lib/test/test_email/test__header_value_parser.py index 71168f3183d23..d59d70117b810 100644 --- a/Lib/test/test_email/test__header_value_parser.py +++ b/Lib/test/test_email/test__header_value_parser.py @@ -2639,10 +2639,44 @@ def test_get_msg_id_no_id_right_part(self): self.assertEqual(msg_id.token_type, 'msg-id') def test_get_msg_id_invalid_expected_msg_id_not_found(self): - text = "Message-Id: 935-XPB-567:0:86089:180874:0:45327:9:90305:17843586-40 at example.com" + text = "935-XPB-567:0:45327:9:90305:17843586-40 at example.com" msg_id = parser.parse_message_id(text) - self.assertDefectsEqual(msg_id.all_defects, - [errors.InvalidHeaderDefect]) + self.assertDefectsEqual( + msg_id.all_defects, + [errors.InvalidHeaderDefect]) + + def test_parse_invalid_message_id(self): + message_id = self._test_parse_x( + parser.parse_message_id, + "935-XPB-567:0:45327:9:90305:17843586-40 at example.com", + "935-XPB-567:0:45327:9:90305:17843586-40 at example.com", + "935-XPB-567:0:45327:9:90305:17843586-40 at example.com", + [errors.InvalidHeaderDefect], + ) + self.assertEqual(message_id.token_type, 'invalid-message-id') + + def test_parse_valid_message_id(self): + message_id = self._test_parse_x( + parser.parse_message_id, + "", + "", + "", + [], + ) + self.assertEqual(message_id.token_type, 'message-id') + + def test_parse_message_id_with_remaining(self): + message_id = self._test_parse_x( + parser.parse_message_id, + "thensomething", + "", + "", + [errors.InvalidHeaderDefect], + [], + ) + self.assertEqual(message_id.token_type, 'message-id') + self.assertEqual(str(message_id.all_defects[0]), + "Unexpected 'thensomething'") def test_get_msg_id_no_angle_start(self): with self.assertRaises(errors.HeaderParseError): diff --git a/Misc/NEWS.d/next/Library/2019-12-07-21-49-50.bpo-38698.HxoSym.rst b/Misc/NEWS.d/next/Library/2019-12-07-21-49-50.bpo-38698.HxoSym.rst new file mode 100644 index 0000000000000..b930dea0fa7bc --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-07-21-49-50.bpo-38698.HxoSym.rst @@ -0,0 +1,3 @@ +Add a new ``InvalidMessageID`` token to email parser to represent invalid +Message-ID headers. Also, add defects when there is remaining value after +parsing the header. From webhook-mailer at python.org Sun Dec 8 20:37:39 2019 From: webhook-mailer at python.org (Abhilash Raj) Date: Mon, 09 Dec 2019 01:37:39 -0000 Subject: [Python-checkins] bpo-38708: email: Fix a potential IndexError when parsing Message-ID (GH-17504) Message-ID: https://github.com/python/cpython/commit/3ae4ea1931361dd2743e464790e739d9285501bf commit: 3ae4ea1931361dd2743e464790e739d9285501bf branch: master author: Abhilash Raj committer: GitHub date: 2019-12-08T17:37:34-08:00 summary: bpo-38708: email: Fix a potential IndexError when parsing Message-ID (GH-17504) Fix a potential IndexError when passing an empty value to the message-id parser. Instead, HeaderParseError should be raised. files: A Misc/NEWS.d/next/Library/2019-12-07-22-25-39.bpo-38708.rZTUfk.rst M Lib/email/_header_value_parser.py M Lib/test/test_email/test__header_value_parser.py diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py index cb013225ec60c..9c55ef7fb453b 100644 --- a/Lib/email/_header_value_parser.py +++ b/Lib/email/_header_value_parser.py @@ -2047,7 +2047,7 @@ def get_msg_id(value): no-fold-literal = "[" *dtext "]" """ msg_id = MsgID() - if value[0] in CFWS_LEADER: + if value and value[0] in CFWS_LEADER: token, value = get_cfws(value) msg_id.append(token) if not value or value[0] != '<': diff --git a/Lib/test/test_email/test__header_value_parser.py b/Lib/test/test_email/test__header_value_parser.py index d59d70117b810..1bdcfa129b4c8 100644 --- a/Lib/test/test_email/test__header_value_parser.py +++ b/Lib/test/test_email/test__header_value_parser.py @@ -2583,6 +2583,11 @@ def test_invalid_content_transfer_encoding(self): # get_msg_id + def test_get_msg_id_empty(self): + # bpo-38708: Test that HeaderParseError is raised and not IndexError. + with self.assertRaises(errors.HeaderParseError): + parser.get_msg_id('') + def test_get_msg_id_valid(self): msg_id = self._test_get_x( parser.get_msg_id, @@ -2694,6 +2699,7 @@ def test_get_msg_id_no_angle_end(self): self.assertEqual(msg_id.token_type, 'msg-id') + @parameterize class Test_parse_mime_parameters(TestParserMixin, TestEmailBase): diff --git a/Misc/NEWS.d/next/Library/2019-12-07-22-25-39.bpo-38708.rZTUfk.rst b/Misc/NEWS.d/next/Library/2019-12-07-22-25-39.bpo-38708.rZTUfk.rst new file mode 100644 index 0000000000000..23a0a46d1fea1 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-07-22-25-39.bpo-38708.rZTUfk.rst @@ -0,0 +1 @@ +Fix a potential IndexError in email parser when parsing an empty msg-id. From webhook-mailer at python.org Sun Dec 8 21:11:38 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 09 Dec 2019 02:11:38 -0000 Subject: [Python-checkins] bpo-38698: Add a new InvalidMessageID token to email header parser. (GH-17503) Message-ID: https://github.com/python/cpython/commit/f66f4a09d0b6817fe6a86a567fd506aa223f1563 commit: f66f4a09d0b6817fe6a86a567fd506aa223f1563 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-08T18:11:31-08:00 summary: bpo-38698: Add a new InvalidMessageID token to email header parser. (GH-17503) This adds a new InvalidMessageID token to the email header parser which can be used to represent invalid message-id headers in the parse tree. (cherry picked from commit 68157da8b42b26408af5d157d2dba4fcf29c6320) Co-authored-by: Abhilash Raj files: A Misc/NEWS.d/next/Library/2019-12-07-21-49-50.bpo-38698.HxoSym.rst M Lib/email/_header_value_parser.py M Lib/test/test_email/test__header_value_parser.py diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py index abdef8189ca6f..cb013225ec60c 100644 --- a/Lib/email/_header_value_parser.py +++ b/Lib/email/_header_value_parser.py @@ -850,10 +850,15 @@ def fold(self, policy): # message-id tokens may not be folded. return str(self) + policy.linesep + class MessageID(MsgID): token_type = 'message-id' +class InvalidMessageID(MessageID): + token_type = 'invalid-message-id' + + class Header(TokenList): token_type = 'header' @@ -2110,11 +2115,18 @@ def parse_message_id(value): message_id = MessageID() try: token, value = get_msg_id(value) - except errors.HeaderParseError: - message_id.defects.append(errors.InvalidHeaderDefect( - "Expected msg-id but found {!r}".format(value))) - else: message_id.append(token) + except errors.HeaderParseError as ex: + token = get_unstructured(value) + message_id = InvalidMessageID(token) + message_id.defects.append( + errors.InvalidHeaderDefect("Invalid msg-id: {!r}".format(ex))) + else: + # Value after parsing a valid msg_id should be None. + if value: + message_id.defects.append(errors.InvalidHeaderDefect( + "Unexpected {!r}".format(value))) + return message_id # diff --git a/Lib/test/test_email/test__header_value_parser.py b/Lib/test/test_email/test__header_value_parser.py index 2f63a3b3e0524..7c9f9877d7be2 100644 --- a/Lib/test/test_email/test__header_value_parser.py +++ b/Lib/test/test_email/test__header_value_parser.py @@ -2639,10 +2639,44 @@ def test_get_msg_id_no_id_right_part(self): self.assertEqual(msg_id.token_type, 'msg-id') def test_get_msg_id_invalid_expected_msg_id_not_found(self): - text = "Message-Id: 935-XPB-567:0:86089:180874:0:45327:9:90305:17843586-40 at example.com" + text = "935-XPB-567:0:45327:9:90305:17843586-40 at example.com" msg_id = parser.parse_message_id(text) - self.assertDefectsEqual(msg_id.all_defects, - [errors.InvalidHeaderDefect]) + self.assertDefectsEqual( + msg_id.all_defects, + [errors.InvalidHeaderDefect]) + + def test_parse_invalid_message_id(self): + message_id = self._test_parse_x( + parser.parse_message_id, + "935-XPB-567:0:45327:9:90305:17843586-40 at example.com", + "935-XPB-567:0:45327:9:90305:17843586-40 at example.com", + "935-XPB-567:0:45327:9:90305:17843586-40 at example.com", + [errors.InvalidHeaderDefect], + ) + self.assertEqual(message_id.token_type, 'invalid-message-id') + + def test_parse_valid_message_id(self): + message_id = self._test_parse_x( + parser.parse_message_id, + "", + "", + "", + [], + ) + self.assertEqual(message_id.token_type, 'message-id') + + def test_parse_message_id_with_remaining(self): + message_id = self._test_parse_x( + parser.parse_message_id, + "thensomething", + "", + "", + [errors.InvalidHeaderDefect], + [], + ) + self.assertEqual(message_id.token_type, 'message-id') + self.assertEqual(str(message_id.all_defects[0]), + "Unexpected 'thensomething'") def test_get_msg_id_no_angle_start(self): with self.assertRaises(errors.HeaderParseError): diff --git a/Misc/NEWS.d/next/Library/2019-12-07-21-49-50.bpo-38698.HxoSym.rst b/Misc/NEWS.d/next/Library/2019-12-07-21-49-50.bpo-38698.HxoSym.rst new file mode 100644 index 0000000000000..b930dea0fa7bc --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-07-21-49-50.bpo-38698.HxoSym.rst @@ -0,0 +1,3 @@ +Add a new ``InvalidMessageID`` token to email parser to represent invalid +Message-ID headers. Also, add defects when there is remaining value after +parsing the header. From webhook-mailer at python.org Sun Dec 8 21:12:54 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 09 Dec 2019 02:12:54 -0000 Subject: [Python-checkins] bpo-38708: email: Fix a potential IndexError when parsing Message-ID (GH-17504) Message-ID: https://github.com/python/cpython/commit/2abd3a8f580e6c7b1ce88b2ae9f9a783f4aea5d3 commit: 2abd3a8f580e6c7b1ce88b2ae9f9a783f4aea5d3 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-08T18:12:50-08:00 summary: bpo-38708: email: Fix a potential IndexError when parsing Message-ID (GH-17504) Fix a potential IndexError when passing an empty value to the message-id parser. Instead, HeaderParseError should be raised. (cherry picked from commit 3ae4ea1931361dd2743e464790e739d9285501bf) Co-authored-by: Abhilash Raj files: A Misc/NEWS.d/next/Library/2019-12-07-22-25-39.bpo-38708.rZTUfk.rst M Lib/email/_header_value_parser.py M Lib/test/test_email/test__header_value_parser.py diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py index cb013225ec60c..9c55ef7fb453b 100644 --- a/Lib/email/_header_value_parser.py +++ b/Lib/email/_header_value_parser.py @@ -2047,7 +2047,7 @@ def get_msg_id(value): no-fold-literal = "[" *dtext "]" """ msg_id = MsgID() - if value[0] in CFWS_LEADER: + if value and value[0] in CFWS_LEADER: token, value = get_cfws(value) msg_id.append(token) if not value or value[0] != '<': diff --git a/Lib/test/test_email/test__header_value_parser.py b/Lib/test/test_email/test__header_value_parser.py index 7c9f9877d7be2..4b5b44258b228 100644 --- a/Lib/test/test_email/test__header_value_parser.py +++ b/Lib/test/test_email/test__header_value_parser.py @@ -2583,6 +2583,11 @@ def test_invalid_content_transfer_encoding(self): # get_msg_id + def test_get_msg_id_empty(self): + # bpo-38708: Test that HeaderParseError is raised and not IndexError. + with self.assertRaises(errors.HeaderParseError): + parser.get_msg_id('') + def test_get_msg_id_valid(self): msg_id = self._test_get_x( parser.get_msg_id, @@ -2694,6 +2699,7 @@ def test_get_msg_id_no_angle_end(self): self.assertEqual(msg_id.token_type, 'msg-id') + @parameterize class Test_parse_mime_parameters(TestParserMixin, TestEmailBase): diff --git a/Misc/NEWS.d/next/Library/2019-12-07-22-25-39.bpo-38708.rZTUfk.rst b/Misc/NEWS.d/next/Library/2019-12-07-22-25-39.bpo-38708.rZTUfk.rst new file mode 100644 index 0000000000000..23a0a46d1fea1 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-07-22-25-39.bpo-38708.rZTUfk.rst @@ -0,0 +1 @@ +Fix a potential IndexError in email parser when parsing an empty msg-id. From webhook-mailer at python.org Sun Dec 8 23:36:40 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 09 Dec 2019 04:36:40 -0000 Subject: [Python-checkins] bpo-38673: dont switch to ps2 if the line starts with comment or whitespace (GH-17421) Message-ID: https://github.com/python/cpython/commit/109fc2792a490ee5cd8a423e17d415fbdedec5c8 commit: 109fc2792a490ee5cd8a423e17d415fbdedec5c8 branch: master author: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-08T20:36:27-08:00 summary: bpo-38673: dont switch to ps2 if the line starts with comment or whitespace (GH-17421) https://bugs.python.org/issue38673 files: A Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst M Parser/tokenizer.c diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst new file mode 100644 index 0000000000000..8f8cf88e5e210 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst @@ -0,0 +1 @@ +In REPL mode, don't switch to PS2 if the line starts with comment or whitespace. Based on work by Batuhan Ta?kaya. diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index 5763e47c4b00b..f84093dae5b62 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -1148,6 +1148,12 @@ tok_get(struct tok_state *tok, char **p_start, char **p_end) if (col == 0 && c == '\n' && tok->prompt != NULL) { blankline = 0; /* Let it through */ } + else if (tok->prompt != NULL && tok->lineno == 1) { + /* In interactive mode, if the first line contains + only spaces and/or a comment, let it through. */ + blankline = 0; + col = altcol = 0; + } else { blankline = 1; /* Ignore completely */ } From webhook-mailer at python.org Sun Dec 8 23:56:26 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 09 Dec 2019 04:56:26 -0000 Subject: [Python-checkins] bpo-38673: dont switch to ps2 if the line starts with comment or whitespace (GH-17421) Message-ID: https://github.com/python/cpython/commit/184a3812b81e2f7d4bc6453bf7ceabe8ac590202 commit: 184a3812b81e2f7d4bc6453bf7ceabe8ac590202 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-08T20:56:19-08:00 summary: bpo-38673: dont switch to ps2 if the line starts with comment or whitespace (GH-17421) https://bugs.python.org/issue38673 (cherry picked from commit 109fc2792a490ee5cd8a423e17d415fbdedec5c8) Co-authored-by: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> files: A Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst M Parser/tokenizer.c diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst new file mode 100644 index 0000000000000..8f8cf88e5e210 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst @@ -0,0 +1 @@ +In REPL mode, don't switch to PS2 if the line starts with comment or whitespace. Based on work by Batuhan Ta?kaya. diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index 5763e47c4b00b..f84093dae5b62 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -1148,6 +1148,12 @@ tok_get(struct tok_state *tok, char **p_start, char **p_end) if (col == 0 && c == '\n' && tok->prompt != NULL) { blankline = 0; /* Let it through */ } + else if (tok->prompt != NULL && tok->lineno == 1) { + /* In interactive mode, if the first line contains + only spaces and/or a comment, let it through. */ + blankline = 0; + col = altcol = 0; + } else { blankline = 1; /* Ignore completely */ } From webhook-mailer at python.org Mon Dec 9 01:59:17 2019 From: webhook-mailer at python.org (Chris Withers) Date: Mon, 09 Dec 2019 06:59:17 -0000 Subject: [Python-checkins] bpo-38669: patch.object now raises a helpful error (GH17510) Message-ID: https://github.com/python/cpython/commit/4594565b56e9c99d2d3fb7549041bbca5ecba8e2 commit: 4594565b56e9c99d2d3fb7549041bbca5ecba8e2 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Chris Withers date: 2019-12-09T06:59:04Z summary: bpo-38669: patch.object now raises a helpful error (GH17510) This means a clearer message is now shown when patch.object is called with two string arguments, rather than a class and a string argument. (cherry picked from commit cd90a52983db34896a6335a572d55bdda274778f) Co-authored-by: Elena Oat files: A Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst M Lib/unittest/mock.py M Lib/unittest/test/testmock/testpatch.py diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index d6e30679456a5..e92ccf168dbbd 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -1587,6 +1587,10 @@ def _patch_object( When used as a class decorator `patch.object` honours `patch.TEST_PREFIX` for choosing which methods to wrap. """ + if type(target) is str: + raise TypeError( + f"{target!r} must be the actual object to be patched, not a str" + ) getter = lambda: target return _patch( getter, attribute, new, spec, create, diff --git a/Lib/unittest/test/testmock/testpatch.py b/Lib/unittest/test/testmock/testpatch.py index 0632d95e58fec..e065a2c35fbee 100644 --- a/Lib/unittest/test/testmock/testpatch.py +++ b/Lib/unittest/test/testmock/testpatch.py @@ -105,6 +105,10 @@ def test(): self.assertEqual(Something.attribute, sentinel.Original, "patch not restored") + def test_patchobject_with_string_as_target(self): + msg = "'Something' must be the actual object to be patched, not a str" + with self.assertRaisesRegex(TypeError, msg): + patch.object('Something', 'do_something') def test_patchobject_with_none(self): class Something(object): diff --git a/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst b/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst new file mode 100644 index 0000000000000..5060ecf2dc5a4 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst @@ -0,0 +1 @@ +Raise :exc:`TypeError` when passing target as a string with :meth:`unittest.mock.patch.object`. \ No newline at end of file From webhook-mailer at python.org Mon Dec 9 01:59:27 2019 From: webhook-mailer at python.org (Chris Withers) Date: Mon, 09 Dec 2019 06:59:27 -0000 Subject: [Python-checkins] bpo-38669: patch.object now raises a helpful error (GH17511) Message-ID: https://github.com/python/cpython/commit/41973c99fdfdc78315e819661e279bdcc2f058b1 commit: 41973c99fdfdc78315e819661e279bdcc2f058b1 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Chris Withers date: 2019-12-09T06:59:23Z summary: bpo-38669: patch.object now raises a helpful error (GH17511) This means a clearer message is now shown when patch.object is called with two string arguments, rather than a class and a string argument. (cherry picked from commit cd90a52983db34896a6335a572d55bdda274778f) Co-authored-by: Elena Oat files: A Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst M Lib/unittest/mock.py M Lib/unittest/test/testmock/testpatch.py diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index 2b9e7f14a7563..213e596629965 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -1492,6 +1492,10 @@ def _patch_object( When used as a class decorator `patch.object` honours `patch.TEST_PREFIX` for choosing which methods to wrap. """ + if type(target) is str: + raise TypeError( + f"{target!r} must be the actual object to be patched, not a str" + ) getter = lambda: target return _patch( getter, attribute, new, spec, create, diff --git a/Lib/unittest/test/testmock/testpatch.py b/Lib/unittest/test/testmock/testpatch.py index 6358154b3e5e6..7453c4902a6dc 100644 --- a/Lib/unittest/test/testmock/testpatch.py +++ b/Lib/unittest/test/testmock/testpatch.py @@ -112,6 +112,10 @@ def test(): self.assertEqual(Something.attribute, sentinel.Original, "patch not restored") + def test_patchobject_with_string_as_target(self): + msg = "'Something' must be the actual object to be patched, not a str" + with self.assertRaisesRegex(TypeError, msg): + patch.object('Something', 'do_something') def test_patchobject_with_none(self): class Something(object): diff --git a/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst b/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst new file mode 100644 index 0000000000000..5060ecf2dc5a4 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst @@ -0,0 +1 @@ +Raise :exc:`TypeError` when passing target as a string with :meth:`unittest.mock.patch.object`. \ No newline at end of file From webhook-mailer at python.org Mon Dec 9 05:57:18 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 09 Dec 2019 10:57:18 -0000 Subject: [Python-checkins] bpo-38547: Fix test_pty if the process is the session leader (GH-17519) Message-ID: https://github.com/python/cpython/commit/a1838ec2592e5082c75c77888f2a7a3eb21133e5 commit: a1838ec2592e5082c75c77888f2a7a3eb21133e5 branch: master author: Victor Stinner committer: GitHub date: 2019-12-09T11:57:05+01:00 summary: bpo-38547: Fix test_pty if the process is the session leader (GH-17519) Fix test_pty: if the process is the session leader, closing the master file descriptor raises a SIGHUP signal: simply ignore SIGHUP when running the tests. files: A Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst M Lib/test/test_pty.py diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py index 3b448569a2ffc..ce85f575a0830 100644 --- a/Lib/test/test_pty.py +++ b/Lib/test/test_pty.py @@ -66,16 +66,27 @@ def _readline(fd): # XXX(nnorwitz): these tests leak fds when there is an error. class PtyTest(unittest.TestCase): def setUp(self): - # isatty() and close() can hang on some platforms. Set an alarm - # before running the test to make sure we don't hang forever. old_alarm = signal.signal(signal.SIGALRM, self.handle_sig) self.addCleanup(signal.signal, signal.SIGALRM, old_alarm) + + old_sighup = signal.signal(signal.SIGHUP, self.handle_sighup) + self.addCleanup(signal.signal, signal.SIGHUP, old_alarm) + + # isatty() and close() can hang on some platforms. Set an alarm + # before running the test to make sure we don't hang forever. self.addCleanup(signal.alarm, 0) signal.alarm(10) def handle_sig(self, sig, frame): self.fail("isatty hung") + @staticmethod + def handle_sighup(sig, frame): + # if the process is the session leader, os.close(master_fd) + # of "master_fd, slave_name = pty.master_open()" raises SIGHUP + # signal: just ignore the signal. + pass + def test_basic(self): try: debug("Calling master_open()") @@ -122,9 +133,11 @@ def test_basic(self): self.assertEqual(b'For my pet fish, Eric.\n', normalize_output(s2)) os.close(slave_fd) + # closing master_fd can raise a SIGHUP if the process is + # the session leader: we installed a SIGHUP signal handler + # to ignore this signal. os.close(master_fd) - def test_fork(self): debug("calling pty.fork()") pid, master_fd = pty.fork() diff --git a/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst b/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst new file mode 100644 index 0000000000000..10f3cc08511dd --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst @@ -0,0 +1,3 @@ +Fix test_pty: if the process is the session leader, closing the master file +descriptor raises a SIGHUP signal: simply ignore SIGHUP when running the +tests. From webhook-mailer at python.org Mon Dec 9 06:15:11 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 09 Dec 2019 11:15:11 -0000 Subject: [Python-checkins] bpo-38547: Fix test_pty if the process is the session leader (GH-17519) Message-ID: https://github.com/python/cpython/commit/b9f4b49c6e525afd6fce02cfc14be52e98a18f67 commit: b9f4b49c6e525afd6fce02cfc14be52e98a18f67 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-09T03:15:07-08:00 summary: bpo-38547: Fix test_pty if the process is the session leader (GH-17519) Fix test_pty: if the process is the session leader, closing the master file descriptor raises a SIGHUP signal: simply ignore SIGHUP when running the tests. (cherry picked from commit a1838ec2592e5082c75c77888f2a7a3eb21133e5) Co-authored-by: Victor Stinner files: A Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst M Lib/test/test_pty.py diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py index 3b448569a2ffc..ce85f575a0830 100644 --- a/Lib/test/test_pty.py +++ b/Lib/test/test_pty.py @@ -66,16 +66,27 @@ def _readline(fd): # XXX(nnorwitz): these tests leak fds when there is an error. class PtyTest(unittest.TestCase): def setUp(self): - # isatty() and close() can hang on some platforms. Set an alarm - # before running the test to make sure we don't hang forever. old_alarm = signal.signal(signal.SIGALRM, self.handle_sig) self.addCleanup(signal.signal, signal.SIGALRM, old_alarm) + + old_sighup = signal.signal(signal.SIGHUP, self.handle_sighup) + self.addCleanup(signal.signal, signal.SIGHUP, old_alarm) + + # isatty() and close() can hang on some platforms. Set an alarm + # before running the test to make sure we don't hang forever. self.addCleanup(signal.alarm, 0) signal.alarm(10) def handle_sig(self, sig, frame): self.fail("isatty hung") + @staticmethod + def handle_sighup(sig, frame): + # if the process is the session leader, os.close(master_fd) + # of "master_fd, slave_name = pty.master_open()" raises SIGHUP + # signal: just ignore the signal. + pass + def test_basic(self): try: debug("Calling master_open()") @@ -122,9 +133,11 @@ def test_basic(self): self.assertEqual(b'For my pet fish, Eric.\n', normalize_output(s2)) os.close(slave_fd) + # closing master_fd can raise a SIGHUP if the process is + # the session leader: we installed a SIGHUP signal handler + # to ignore this signal. os.close(master_fd) - def test_fork(self): debug("calling pty.fork()") pid, master_fd = pty.fork() diff --git a/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst b/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst new file mode 100644 index 0000000000000..10f3cc08511dd --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst @@ -0,0 +1,3 @@ +Fix test_pty: if the process is the session leader, closing the master file +descriptor raises a SIGHUP signal: simply ignore SIGHUP when running the +tests. From webhook-mailer at python.org Mon Dec 9 06:15:28 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 09 Dec 2019 11:15:28 -0000 Subject: [Python-checkins] bpo-38547: Fix test_pty if the process is the session leader (GH-17519) Message-ID: https://github.com/python/cpython/commit/d08fd298dc8d5631f6c504d01ee4f9cfb47db79d commit: d08fd298dc8d5631f6c504d01ee4f9cfb47db79d branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-09T03:15:23-08:00 summary: bpo-38547: Fix test_pty if the process is the session leader (GH-17519) Fix test_pty: if the process is the session leader, closing the master file descriptor raises a SIGHUP signal: simply ignore SIGHUP when running the tests. (cherry picked from commit a1838ec2592e5082c75c77888f2a7a3eb21133e5) Co-authored-by: Victor Stinner files: A Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst M Lib/test/test_pty.py diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py index 3b448569a2ffc..ce85f575a0830 100644 --- a/Lib/test/test_pty.py +++ b/Lib/test/test_pty.py @@ -66,16 +66,27 @@ def _readline(fd): # XXX(nnorwitz): these tests leak fds when there is an error. class PtyTest(unittest.TestCase): def setUp(self): - # isatty() and close() can hang on some platforms. Set an alarm - # before running the test to make sure we don't hang forever. old_alarm = signal.signal(signal.SIGALRM, self.handle_sig) self.addCleanup(signal.signal, signal.SIGALRM, old_alarm) + + old_sighup = signal.signal(signal.SIGHUP, self.handle_sighup) + self.addCleanup(signal.signal, signal.SIGHUP, old_alarm) + + # isatty() and close() can hang on some platforms. Set an alarm + # before running the test to make sure we don't hang forever. self.addCleanup(signal.alarm, 0) signal.alarm(10) def handle_sig(self, sig, frame): self.fail("isatty hung") + @staticmethod + def handle_sighup(sig, frame): + # if the process is the session leader, os.close(master_fd) + # of "master_fd, slave_name = pty.master_open()" raises SIGHUP + # signal: just ignore the signal. + pass + def test_basic(self): try: debug("Calling master_open()") @@ -122,9 +133,11 @@ def test_basic(self): self.assertEqual(b'For my pet fish, Eric.\n', normalize_output(s2)) os.close(slave_fd) + # closing master_fd can raise a SIGHUP if the process is + # the session leader: we installed a SIGHUP signal handler + # to ignore this signal. os.close(master_fd) - def test_fork(self): debug("calling pty.fork()") pid, master_fd = pty.fork() diff --git a/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst b/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst new file mode 100644 index 0000000000000..10f3cc08511dd --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst @@ -0,0 +1,3 @@ +Fix test_pty: if the process is the session leader, closing the master file +descriptor raises a SIGHUP signal: simply ignore SIGHUP when running the +tests. From webhook-mailer at python.org Mon Dec 9 06:38:42 2019 From: webhook-mailer at python.org (Ned Deily) Date: Mon, 09 Dec 2019 11:38:42 -0000 Subject: [Python-checkins] bpo-38673: dont switch to ps2 if the line starts with comment or whitespace (GH-17421) (GH-17522) Message-ID: https://github.com/python/cpython/commit/188d5ae6f047342f3d6860646ccf1a523ef8b0ed commit: 188d5ae6f047342f3d6860646ccf1a523ef8b0ed branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Ned Deily date: 2019-12-09T06:38:36-05:00 summary: bpo-38673: dont switch to ps2 if the line starts with comment or whitespace (GH-17421) (GH-17522) https://bugs.python.org/issue38673 (cherry picked from commit 109fc2792a490ee5cd8a423e17d415fbdedec5c8) Co-authored-by: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> files: A Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst M Parser/tokenizer.c diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst new file mode 100644 index 0000000000000..8f8cf88e5e210 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst @@ -0,0 +1 @@ +In REPL mode, don't switch to PS2 if the line starts with comment or whitespace. Based on work by Batuhan Ta?kaya. diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index d720f19eca9db..1739bb7ad5565 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -1395,6 +1395,12 @@ tok_get(struct tok_state *tok, char **p_start, char **p_end) if (col == 0 && c == '\n' && tok->prompt != NULL) { blankline = 0; /* Let it through */ } + else if (tok->prompt != NULL && tok->lineno == 1) { + /* In interactive mode, if the first line contains + only spaces and/or a comment, let it through. */ + blankline = 0; + col = altcol = 0; + } else { blankline = 1; /* Ignore completely */ } From webhook-mailer at python.org Mon Dec 9 08:09:37 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 09 Dec 2019 13:09:37 -0000 Subject: [Python-checkins] bpo-38916: array.array: remove fromstring() and tostring() (GH-17487) Message-ID: https://github.com/python/cpython/commit/0131aba5ae20d704b972ecd2ef0fc6c9e370a1b3 commit: 0131aba5ae20d704b972ecd2ef0fc6c9e370a1b3 branch: master author: Victor Stinner committer: GitHub date: 2019-12-09T14:09:14+01:00 summary: bpo-38916: array.array: remove fromstring() and tostring() (GH-17487) array.array: Remove tostring() and fromstring() methods. They were aliases to tobytes() and frombytes(), deprecated since Python 3.2. files: A Misc/NEWS.d/next/Library/2019-12-06-18-47-56.bpo-38916.K-raU8.rst M Doc/library/array.rst M Doc/whatsnew/3.9.rst M Lib/test/test_array.py M Modules/arraymodule.c M Modules/clinic/arraymodule.c.h diff --git a/Doc/library/array.rst b/Doc/library/array.rst index 2ae2a071262a1..c9a9b1dabb2a7 100644 --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -169,11 +169,6 @@ The following data items and methods are also supported: a.append(x)`` except that if there is a type error, the array is unchanged. -.. method:: array.fromstring() - - Deprecated alias for :meth:`frombytes`. - - .. method:: array.fromunicode(s) Extends this array with data from the given unicode string. The array must @@ -231,11 +226,6 @@ The following data items and methods are also supported: Convert the array to an ordinary list with the same items. -.. method:: array.tostring() - - Deprecated alias for :meth:`tobytes`. - - .. method:: array.tounicode() Convert the array to a unicode string. The array must be a type ``'u'`` array; diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index 1cd96ef3b07af..7cf49bfbb93f9 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -279,6 +279,11 @@ Deprecated Removed ======= +* :class:`array.array`: ``tostring()`` and ``fromstring()`` methods have been + removed. They were aliases to ``tobytes()`` and ``frombytes()``, deprecated + since Python 3.2. + (Contributed by Victor Stinner in :issue:`38916`.) + * The abstract base classes in :mod:`collections.abc` no longer are exposed in the regular :mod:`collections` module. This will help create a clearer distinction between the concrete classes and the abstract diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index c2439579e8ee5..5f612fba8a497 100644 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -426,26 +426,6 @@ def test_tofromlist(self): b.fromlist(a.tolist()) self.assertEqual(a, b) - def test_tofromstring(self): - # Warnings not raised when arguments are incorrect as Argument Clinic - # handles that before the warning can be raised. - nb_warnings = 2 - with warnings.catch_warnings(record=True) as r: - warnings.filterwarnings("always", - message=r"(to|from)string\(\) is deprecated", - category=DeprecationWarning) - a = array.array(self.typecode, 2*self.example) - b = array.array(self.typecode) - self.assertRaises(TypeError, a.tostring, 42) - self.assertRaises(TypeError, b.fromstring) - self.assertRaises(TypeError, b.fromstring, 42) - b.fromstring(a.tostring()) - self.assertEqual(a, b) - if a.itemsize>1: - self.assertRaises(ValueError, b.fromstring, "x") - nb_warnings += 1 - self.assertEqual(len(r), nb_warnings) - def test_tofrombytes(self): a = array.array(self.typecode, 2*self.example) b = array.array(self.typecode) diff --git a/Misc/NEWS.d/next/Library/2019-12-06-18-47-56.bpo-38916.K-raU8.rst b/Misc/NEWS.d/next/Library/2019-12-06-18-47-56.bpo-38916.K-raU8.rst new file mode 100644 index 0000000000000..cb4c4c03c128a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-06-18-47-56.bpo-38916.K-raU8.rst @@ -0,0 +1,3 @@ +:class:`array.array`: Remove ``tostring()`` and ``fromstring()`` methods. +They were aliases to ``tobytes()`` and ``frombytes()``, deprecated since +Python 3.2. diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 1ceba9e63cbdf..edb56ab6e1873 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1623,27 +1623,6 @@ frombytes(arrayobject *self, Py_buffer *buffer) Py_RETURN_NONE; } -/*[clinic input] -array.array.fromstring - - buffer: Py_buffer(accept={str, buffer}) - / - -Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method). - -This method is deprecated. Use frombytes instead. -[clinic start generated code]*/ - -static PyObject * -array_array_fromstring_impl(arrayobject *self, Py_buffer *buffer) -/*[clinic end generated code: output=31c4baa779df84ce input=a3341a512e11d773]*/ -{ - if (PyErr_WarnEx(PyExc_DeprecationWarning, - "fromstring() is deprecated. Use frombytes() instead.", 2) != 0) - return NULL; - return frombytes(self, buffer); -} - /*[clinic input] array.array.frombytes @@ -1678,24 +1657,6 @@ array_array_tobytes_impl(arrayobject *self) } } -/*[clinic input] -array.array.tostring - -Convert the array to an array of machine values and return the bytes representation. - -This method is deprecated. Use tobytes instead. -[clinic start generated code]*/ - -static PyObject * -array_array_tostring_impl(arrayobject *self) -/*[clinic end generated code: output=7d6bd92745a2c8f3 input=b6c0ddee7b30457e]*/ -{ - if (PyErr_WarnEx(PyExc_DeprecationWarning, - "tostring() is deprecated. Use tobytes() instead.", 2) != 0) - return NULL; - return array_array_tobytes_impl(self); -} - /*[clinic input] array.array.fromunicode @@ -2283,7 +2244,6 @@ static PyMethodDef array_methods[] = { ARRAY_ARRAY_EXTEND_METHODDEF ARRAY_ARRAY_FROMFILE_METHODDEF ARRAY_ARRAY_FROMLIST_METHODDEF - ARRAY_ARRAY_FROMSTRING_METHODDEF ARRAY_ARRAY_FROMBYTES_METHODDEF ARRAY_ARRAY_FROMUNICODE_METHODDEF ARRAY_ARRAY_INDEX_METHODDEF @@ -2294,7 +2254,6 @@ static PyMethodDef array_methods[] = { ARRAY_ARRAY_REVERSE_METHODDEF ARRAY_ARRAY_TOFILE_METHODDEF ARRAY_ARRAY_TOLIST_METHODDEF - ARRAY_ARRAY_TOSTRING_METHODDEF ARRAY_ARRAY_TOBYTES_METHODDEF ARRAY_ARRAY_TOUNICODE_METHODDEF ARRAY_ARRAY___SIZEOF___METHODDEF diff --git a/Modules/clinic/arraymodule.c.h b/Modules/clinic/arraymodule.c.h index 33f82d4da8b6c..e1f4b0397b9cb 100644 --- a/Modules/clinic/arraymodule.c.h +++ b/Modules/clinic/arraymodule.c.h @@ -312,54 +312,6 @@ array_array_tolist(arrayobject *self, PyObject *Py_UNUSED(ignored)) return array_array_tolist_impl(self); } -PyDoc_STRVAR(array_array_fromstring__doc__, -"fromstring($self, buffer, /)\n" -"--\n" -"\n" -"Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method).\n" -"\n" -"This method is deprecated. Use frombytes instead."); - -#define ARRAY_ARRAY_FROMSTRING_METHODDEF \ - {"fromstring", (PyCFunction)array_array_fromstring, METH_O, array_array_fromstring__doc__}, - -static PyObject * -array_array_fromstring_impl(arrayobject *self, Py_buffer *buffer); - -static PyObject * -array_array_fromstring(arrayobject *self, PyObject *arg) -{ - PyObject *return_value = NULL; - Py_buffer buffer = {NULL, NULL}; - - if (PyUnicode_Check(arg)) { - Py_ssize_t len; - const char *ptr = PyUnicode_AsUTF8AndSize(arg, &len); - if (ptr == NULL) { - goto exit; - } - PyBuffer_FillInfo(&buffer, arg, (void *)ptr, len, 1, 0); - } - else { /* any bytes-like object */ - if (PyObject_GetBuffer(arg, &buffer, PyBUF_SIMPLE) != 0) { - goto exit; - } - if (!PyBuffer_IsContiguous(&buffer, 'C')) { - _PyArg_BadArgument("fromstring", "argument", "contiguous buffer", arg); - goto exit; - } - } - return_value = array_array_fromstring_impl(self, &buffer); - -exit: - /* Cleanup for buffer */ - if (buffer.obj) { - PyBuffer_Release(&buffer); - } - - return return_value; -} - PyDoc_STRVAR(array_array_frombytes__doc__, "frombytes($self, buffer, /)\n" "--\n" @@ -414,26 +366,6 @@ array_array_tobytes(arrayobject *self, PyObject *Py_UNUSED(ignored)) return array_array_tobytes_impl(self); } -PyDoc_STRVAR(array_array_tostring__doc__, -"tostring($self, /)\n" -"--\n" -"\n" -"Convert the array to an array of machine values and return the bytes representation.\n" -"\n" -"This method is deprecated. Use tobytes instead."); - -#define ARRAY_ARRAY_TOSTRING_METHODDEF \ - {"tostring", (PyCFunction)array_array_tostring, METH_NOARGS, array_array_tostring__doc__}, - -static PyObject * -array_array_tostring_impl(arrayobject *self); - -static PyObject * -array_array_tostring(arrayobject *self, PyObject *Py_UNUSED(ignored)) -{ - return array_array_tostring_impl(self); -} - PyDoc_STRVAR(array_array_fromunicode__doc__, "fromunicode($self, ustr, /)\n" "--\n" @@ -599,4 +531,4 @@ PyDoc_STRVAR(array_arrayiterator___setstate____doc__, #define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \ {"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__}, -/*[clinic end generated code: output=6aa421571e2c0756 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=f649fc0bc9f6b13a input=a9049054013a1b77]*/ From webhook-mailer at python.org Mon Dec 9 08:46:37 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 09 Dec 2019 13:46:37 -0000 Subject: [Python-checkins] bpo-38916: Document array.array deprecation (GH-17523) Message-ID: https://github.com/python/cpython/commit/0381ea79ac2da03179c8512c581cac588b69cff9 commit: 0381ea79ac2da03179c8512c581cac588b69cff9 branch: 3.8 author: Victor Stinner committer: GitHub date: 2019-12-09T14:46:33+01:00 summary: bpo-38916: Document array.array deprecation (GH-17523) array.array: Document that tostring() and fromstring() deprecated aliases will be removed in Python 3.9. files: M Doc/library/array.rst diff --git a/Doc/library/array.rst b/Doc/library/array.rst index 2ae2a071262a1..6809c512b3f02 100644 --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -173,6 +173,8 @@ The following data items and methods are also supported: Deprecated alias for :meth:`frombytes`. + .. deprecated-removed:: 3.2 3.9 + .. method:: array.fromunicode(s) @@ -235,6 +237,8 @@ The following data items and methods are also supported: Deprecated alias for :meth:`tobytes`. + .. deprecated-removed:: 3.2 3.9 + .. method:: array.tounicode() From webhook-mailer at python.org Mon Dec 9 08:52:12 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 09 Dec 2019 13:52:12 -0000 Subject: [Python-checkins] bpo-38916: Document array.array deprecation (GH-17523) Message-ID: https://github.com/python/cpython/commit/21e11383cc59146184da0d69a3f19f004215f9a7 commit: 21e11383cc59146184da0d69a3f19f004215f9a7 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-09T05:52:07-08:00 summary: bpo-38916: Document array.array deprecation (GH-17523) array.array: Document that tostring() and fromstring() deprecated aliases will be removed in Python 3.9. (cherry picked from commit 0381ea79ac2da03179c8512c581cac588b69cff9) Co-authored-by: Victor Stinner files: M Doc/library/array.rst diff --git a/Doc/library/array.rst b/Doc/library/array.rst index 0da6b48721fb9..901a1356758a3 100644 --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -172,6 +172,8 @@ The following data items and methods are also supported: Deprecated alias for :meth:`frombytes`. + .. deprecated-removed:: 3.2 3.9 + .. method:: array.fromunicode(s) @@ -234,6 +236,8 @@ The following data items and methods are also supported: Deprecated alias for :meth:`tobytes`. + .. deprecated-removed:: 3.2 3.9 + .. method:: array.tounicode() From webhook-mailer at python.org Mon Dec 9 09:02:09 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 09 Dec 2019 14:02:09 -0000 Subject: [Python-checkins] bpo-39006: Fix asyncio when the ssl module is missing (GH-17524) Message-ID: https://github.com/python/cpython/commit/82b4950b5e92bec343a436b3f9c116400b66e1b9 commit: 82b4950b5e92bec343a436b3f9c116400b66e1b9 branch: master author: Victor Stinner committer: GitHub date: 2019-12-09T15:02:03+01:00 summary: bpo-39006: Fix asyncio when the ssl module is missing (GH-17524) Fix asyncio when the ssl module is missing: only check for ssl.SSLSocket instance if the ssl module is available. files: A Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst M Lib/asyncio/selector_events.py diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py index e1abf5118619c..a05cbb6bdd69d 100644 --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -40,6 +40,11 @@ def _test_selector_event(selector, fd, event): return bool(key.events & event) +def _check_ssl_socket(sock): + if ssl is not None and isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") + + class BaseSelectorEventLoop(base_events.BaseEventLoop): """Selector event loop. @@ -348,8 +353,7 @@ def remove_writer(self, fd): The maximum amount of data to be received at once is specified by nbytes. """ - if isinstance(sock, ssl.SSLSocket): - raise TypeError("Socket cannot be of type SSLSocket") + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: @@ -388,8 +392,7 @@ def _sock_recv(self, fut, sock, n): The received data is written into *buf* (a writable buffer). The return value is the number of bytes written. """ - if isinstance(sock, ssl.SSLSocket): - raise TypeError("Socket cannot be of type SSLSocket") + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: @@ -429,8 +432,7 @@ def _sock_recv_into(self, fut, sock, buf): raised, and there is no way to determine how much data, if any, was successfully processed by the receiving end of the connection. """ - if isinstance(sock, ssl.SSLSocket): - raise TypeError("Socket cannot be of type SSLSocket") + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: @@ -478,8 +480,7 @@ def _sock_sendall(self, fut, sock, view, pos): This method is a coroutine. """ - if isinstance(sock, ssl.SSLSocket): - raise TypeError("Socket cannot be of type SSLSocket") + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") @@ -541,8 +542,7 @@ def _sock_connect_cb(self, fut, sock, address): object usable to send and receive data on the connection, and address is the address bound to the socket on the other end of the connection. """ - if isinstance(sock, ssl.SSLSocket): - raise TypeError("Socket cannot be of type SSLSocket") + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() diff --git a/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst b/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst new file mode 100644 index 0000000000000..8402845a5a047 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst @@ -0,0 +1,2 @@ +Fix asyncio when the ssl module is missing: only check for ssl.SSLSocket +instance if the ssl module is available. From webhook-mailer at python.org Mon Dec 9 09:19:53 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 09 Dec 2019 14:19:53 -0000 Subject: [Python-checkins] bpo-39006: Fix asyncio when the ssl module is missing (GH-17524) Message-ID: https://github.com/python/cpython/commit/b22183f2738e0e6c23f8c5fb5b232768c184ec96 commit: b22183f2738e0e6c23f8c5fb5b232768c184ec96 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-09T06:19:48-08:00 summary: bpo-39006: Fix asyncio when the ssl module is missing (GH-17524) Fix asyncio when the ssl module is missing: only check for ssl.SSLSocket instance if the ssl module is available. (cherry picked from commit 82b4950b5e92bec343a436b3f9c116400b66e1b9) Co-authored-by: Victor Stinner files: A Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst M Lib/asyncio/selector_events.py diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py index e1abf5118619c..a05cbb6bdd69d 100644 --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -40,6 +40,11 @@ def _test_selector_event(selector, fd, event): return bool(key.events & event) +def _check_ssl_socket(sock): + if ssl is not None and isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") + + class BaseSelectorEventLoop(base_events.BaseEventLoop): """Selector event loop. @@ -348,8 +353,7 @@ def remove_writer(self, fd): The maximum amount of data to be received at once is specified by nbytes. """ - if isinstance(sock, ssl.SSLSocket): - raise TypeError("Socket cannot be of type SSLSocket") + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: @@ -388,8 +392,7 @@ def _sock_recv(self, fut, sock, n): The received data is written into *buf* (a writable buffer). The return value is the number of bytes written. """ - if isinstance(sock, ssl.SSLSocket): - raise TypeError("Socket cannot be of type SSLSocket") + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: @@ -429,8 +432,7 @@ def _sock_recv_into(self, fut, sock, buf): raised, and there is no way to determine how much data, if any, was successfully processed by the receiving end of the connection. """ - if isinstance(sock, ssl.SSLSocket): - raise TypeError("Socket cannot be of type SSLSocket") + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") try: @@ -478,8 +480,7 @@ def _sock_sendall(self, fut, sock, view, pos): This method is a coroutine. """ - if isinstance(sock, ssl.SSLSocket): - raise TypeError("Socket cannot be of type SSLSocket") + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") @@ -541,8 +542,7 @@ def _sock_connect_cb(self, fut, sock, address): object usable to send and receive data on the connection, and address is the address bound to the socket on the other end of the connection. """ - if isinstance(sock, ssl.SSLSocket): - raise TypeError("Socket cannot be of type SSLSocket") + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() diff --git a/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst b/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst new file mode 100644 index 0000000000000..8402845a5a047 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst @@ -0,0 +1,2 @@ +Fix asyncio when the ssl module is missing: only check for ssl.SSLSocket +instance if the ssl module is available. From webhook-mailer at python.org Mon Dec 9 09:20:32 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 09 Dec 2019 14:20:32 -0000 Subject: [Python-checkins] bpo-39006: Fix asyncio when the ssl module is missing (GH-17524) Message-ID: https://github.com/python/cpython/commit/a0078d9a3335a5e99afe97590fdcb8e2f526ed7b commit: a0078d9a3335a5e99afe97590fdcb8e2f526ed7b branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-09T06:20:27-08:00 summary: bpo-39006: Fix asyncio when the ssl module is missing (GH-17524) Fix asyncio when the ssl module is missing: only check for ssl.SSLSocket instance if the ssl module is available. (cherry picked from commit 82b4950b5e92bec343a436b3f9c116400b66e1b9) Co-authored-by: Victor Stinner files: A Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst M Lib/asyncio/selector_events.py diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py index c539b5d387196..fa8f0cd759898 100644 --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -39,6 +39,11 @@ def _test_selector_event(selector, fd, event): return bool(key.events & event) +def _check_ssl_socket(sock): + if ssl is not None and isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") + + class BaseSelectorEventLoop(base_events.BaseEventLoop): """Selector event loop. @@ -345,8 +350,7 @@ def remove_writer(self, fd): The maximum amount of data to be received at once is specified by nbytes. """ - if isinstance(sock, ssl.SSLSocket): - raise TypeError("Socket cannot be of type SSLSocket") + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() @@ -380,8 +384,7 @@ def _sock_recv(self, fut, registered_fd, sock, n): The received data is written into *buf* (a writable buffer). The return value is the number of bytes written. """ - if isinstance(sock, ssl.SSLSocket): - raise TypeError("Socket cannot be of type SSLSocket") + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() @@ -419,8 +422,7 @@ def _sock_recv_into(self, fut, registered_fd, sock, buf): raised, and there is no way to determine how much data, if any, was successfully processed by the receiving end of the connection. """ - if isinstance(sock, ssl.SSLSocket): - raise TypeError("Socket cannot be of type SSLSocket") + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() @@ -457,8 +459,7 @@ def _sock_sendall(self, fut, registered_fd, sock, data): This method is a coroutine. """ - if isinstance(sock, ssl.SSLSocket): - raise TypeError("Socket cannot be of type SSLSocket") + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") @@ -516,8 +517,7 @@ def _sock_connect_cb(self, fut, sock, address): object usable to send and receive data on the connection, and address is the address bound to the socket on the other end of the connection. """ - if isinstance(sock, ssl.SSLSocket): - raise TypeError("Socket cannot be of type SSLSocket") + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() diff --git a/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst b/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst new file mode 100644 index 0000000000000..8402845a5a047 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst @@ -0,0 +1,2 @@ +Fix asyncio when the ssl module is missing: only check for ssl.SSLSocket +instance if the ssl module is available. From webhook-mailer at python.org Mon Dec 9 09:36:39 2019 From: webhook-mailer at python.org (Mark Dickinson) Date: Mon, 09 Dec 2019 14:36:39 -0000 Subject: [Python-checkins] bpo-38992: avoid fsum test failure from constant-folding (GH-17513) Message-ID: https://github.com/python/cpython/commit/bba873e633f0f1e88ea12fb935cbd58faa77f976 commit: bba873e633f0f1e88ea12fb935cbd58faa77f976 branch: master author: Mark Dickinson committer: GitHub date: 2019-12-09T08:36:34-06:00 summary: bpo-38992: avoid fsum test failure from constant-folding (GH-17513) * Issue 38992: avoid fsum test failure * Add NEWS entry files: A Misc/NEWS.d/next/Tests/2019-12-08-15-11-06.bpo-38992.cVoHOZ.rst M Lib/test/test_math.py diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index f832246dda322..5c35c8cff129b 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -676,7 +676,6 @@ def msum(iterable): float.fromhex('0x1.df11f45f4e61ap+2')), ([(-1.)**n/n for n in range(1, 1001)], float.fromhex('-0x1.62a2af1bd3624p-1')), - ([1.7**(i+1)-1.7**i for i in range(1000)] + [-1.7**1000], -1.0), ([1e16, 1., 1e-16], 10000000000000002.0), ([1e16-2., 1.-2.**-53, -(1e16-2.), -(1.-2.**-53)], 0.0), # exercise code for resizing partials array @@ -685,6 +684,13 @@ def msum(iterable): float.fromhex('0x1.5555555555555p+970')), ] + # Telescoping sum, with exact differences (due to Sterbenz) + terms = [1.7**i for i in range(1001)] + test_values.append(( + [terms[i+1] - terms[i] for i in range(1000)] + [-terms[1000]], + -terms[0] + )) + for i, (vals, expected) in enumerate(test_values): try: actual = math.fsum(vals) diff --git a/Misc/NEWS.d/next/Tests/2019-12-08-15-11-06.bpo-38992.cVoHOZ.rst b/Misc/NEWS.d/next/Tests/2019-12-08-15-11-06.bpo-38992.cVoHOZ.rst new file mode 100644 index 0000000000000..815ae0f65c873 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-12-08-15-11-06.bpo-38992.cVoHOZ.rst @@ -0,0 +1 @@ +Fix a test for :func:`math.fsum` that was failing due to constant folding. From webhook-mailer at python.org Mon Dec 9 11:34:07 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 09 Dec 2019 16:34:07 -0000 Subject: [Python-checkins] bpo-20443: No longer make sys.argv[0] absolute for script (GH-17534) Message-ID: https://github.com/python/cpython/commit/a1a99b4bb7cbe2dbc55a1d92c3c509b4466d3c3b commit: a1a99b4bb7cbe2dbc55a1d92c3c509b4466d3c3b branch: master author: Victor Stinner committer: GitHub date: 2019-12-09T17:34:02+01:00 summary: bpo-20443: No longer make sys.argv[0] absolute for script (GH-17534) In Python 3.9.0a1, sys.argv[0] was made an asolute path if a filename was specified on the command line. Revert this change, since most users expect sys.argv to be unmodified. files: A Misc/NEWS.d/next/Core and Builtins/2019-12-09-17-05-53.bpo-20443.8OyT5P.rst M Lib/test/test_cmd_line_script.py M Lib/test/test_embed.py M Python/initconfig.c diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py index 2ac926deac485..adfb8ce5ed245 100644 --- a/Lib/test/test_cmd_line_script.py +++ b/Lib/test/test_cmd_line_script.py @@ -223,12 +223,13 @@ def test_basic_script(self): def test_script_abspath(self): # pass the script using the relative path, expect the absolute path - # in __file__ and sys.argv[0] + # in __file__ with support.temp_cwd() as script_dir: self.assertTrue(os.path.isabs(script_dir), script_dir) script_name = _make_test_script(script_dir, 'script') - self._check_script(os.path.basename(script_name), script_name, script_name, + relative_name = os.path.basename(script_name) + self._check_script(relative_name, script_name, relative_name, script_dir, None, importlib.machinery.SourceFileLoader) diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index b87863a372a6c..60f7f7a93ea1a 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -858,10 +858,9 @@ def test_preinit_parse_argv(self): preconfig = { 'allocator': PYMEM_ALLOCATOR_DEBUG, } - script_abspath = os.path.abspath('script.py') config = { - 'argv': [script_abspath], - 'run_filename': script_abspath, + 'argv': ['script.py'], + 'run_filename': os.path.abspath('script.py'), 'dev_mode': 1, 'faulthandler': 1, 'warnoptions': ['default'], diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-09-17-05-53.bpo-20443.8OyT5P.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-09-17-05-53.bpo-20443.8OyT5P.rst new file mode 100644 index 0000000000000..d3855f293b9f0 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-09-17-05-53.bpo-20443.8OyT5P.rst @@ -0,0 +1,3 @@ +In Python 3.9.0a1, sys.argv[0] was made an asolute path if a filename was +specified on the command line. Revert this change, since most users expect +sys.argv to be unmodified. diff --git a/Python/initconfig.c b/Python/initconfig.c index caa9bf5f5689e..74c9ca007ed70 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -2198,10 +2198,6 @@ config_update_argv(PyConfig *config, Py_ssize_t opt_index) /* Force sys.argv[0] = '-m'*/ arg0 = L"-m"; } - else if (config->run_filename != NULL) { - /* run_filename is converted to an absolute path: update argv */ - arg0 = config->run_filename; - } if (arg0 != NULL) { arg0 = _PyMem_RawWcsdup(arg0); From webhook-mailer at python.org Mon Dec 9 11:43:20 2019 From: webhook-mailer at python.org (Steve Dower) Date: Mon, 09 Dec 2019 16:43:20 -0000 Subject: [Python-checkins] Fix APPX registry key generation (GH-17489) Message-ID: https://github.com/python/cpython/commit/e89e159b18cc9f32a0a4a818d080eb6a63d888a7 commit: e89e159b18cc9f32a0a4a818d080eb6a63d888a7 branch: master author: Steve Dower committer: GitHub date: 2019-12-09T08:43:13-08:00 summary: Fix APPX registry key generation (GH-17489) files: M PC/layout/support/appxmanifest.py diff --git a/PC/layout/support/appxmanifest.py b/PC/layout/support/appxmanifest.py index 9e008f793cf55..9a7439d027126 100644 --- a/PC/layout/support/appxmanifest.py +++ b/PC/layout/support/appxmanifest.py @@ -339,7 +339,17 @@ def _get_registry_entries(ns, root="", d=None): for key, value in d.items(): if key == "_condition": continue - elif isinstance(value, dict): + if value is SPECIAL_LOOKUP: + if key == "SysArchitecture": + value = { + "win32": "32bit", + "amd64": "64bit", + "arm32": "32bit", + "arm64": "64bit", + }[ns.arch] + else: + raise ValueError(f"Key '{key}' unhandled for special lookup") + if isinstance(value, dict): cond = value.get("_condition") if cond and not cond(ns): continue @@ -349,16 +359,6 @@ def _get_registry_entries(ns, root="", d=None): if len(fullkey.parts) > 1: yield str(fullkey), None, None yield from _get_registry_entries(ns, fullkey, value) - elif value is SPECIAL_LOOKUP: - if key == "SysArchitecture": - return { - "win32": "32bit", - "amd64": "64bit", - "arm32": "32bit", - "arm64": "64bit", - }[ns.arch] - else: - raise ValueError(f"Key '{key}' unhandled for special lookup") elif len(r.parts) > 1: yield str(r), key, value From webhook-mailer at python.org Mon Dec 9 12:02:29 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 09 Dec 2019 17:02:29 -0000 Subject: [Python-checkins] Fix APPX registry key generation (GH-17489) Message-ID: https://github.com/python/cpython/commit/c5a2a974d3608810dc0b06b46876542e1216f7e6 commit: c5a2a974d3608810dc0b06b46876542e1216f7e6 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-09T09:02:22-08:00 summary: Fix APPX registry key generation (GH-17489) (cherry picked from commit e89e159b18cc9f32a0a4a818d080eb6a63d888a7) Co-authored-by: Steve Dower files: M PC/layout/support/appxmanifest.py diff --git a/PC/layout/support/appxmanifest.py b/PC/layout/support/appxmanifest.py index 9e008f793cf55..9a7439d027126 100644 --- a/PC/layout/support/appxmanifest.py +++ b/PC/layout/support/appxmanifest.py @@ -339,7 +339,17 @@ def _get_registry_entries(ns, root="", d=None): for key, value in d.items(): if key == "_condition": continue - elif isinstance(value, dict): + if value is SPECIAL_LOOKUP: + if key == "SysArchitecture": + value = { + "win32": "32bit", + "amd64": "64bit", + "arm32": "32bit", + "arm64": "64bit", + }[ns.arch] + else: + raise ValueError(f"Key '{key}' unhandled for special lookup") + if isinstance(value, dict): cond = value.get("_condition") if cond and not cond(ns): continue @@ -349,16 +359,6 @@ def _get_registry_entries(ns, root="", d=None): if len(fullkey.parts) > 1: yield str(fullkey), None, None yield from _get_registry_entries(ns, fullkey, value) - elif value is SPECIAL_LOOKUP: - if key == "SysArchitecture": - return { - "win32": "32bit", - "amd64": "64bit", - "arm32": "32bit", - "arm64": "64bit", - }[ns.arch] - else: - raise ValueError(f"Key '{key}' unhandled for special lookup") elif len(r.parts) > 1: yield str(r), key, value From webhook-mailer at python.org Mon Dec 9 12:32:41 2019 From: webhook-mailer at python.org (Mark Dickinson) Date: Mon, 09 Dec 2019 17:32:41 -0000 Subject: [Python-checkins] bpo-38992: avoid fsum test failure from constant-folding (GH-17513) (GH-17530) Message-ID: https://github.com/python/cpython/commit/3c5feaffde1944052830c896ae39c54e76a2e063 commit: 3c5feaffde1944052830c896ae39c54e76a2e063 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mark Dickinson date: 2019-12-09T11:32:34-06:00 summary: bpo-38992: avoid fsum test failure from constant-folding (GH-17513) (GH-17530) * Issue 38992: avoid fsum test failure * Add NEWS entry (cherry picked from commit bba873e633f0f1e88ea12fb935cbd58faa77f976) Co-authored-by: Mark Dickinson files: A Misc/NEWS.d/next/Tests/2019-12-08-15-11-06.bpo-38992.cVoHOZ.rst M Lib/test/test_math.py diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index 6edc3e1a547a4..ac978247fc917 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -654,7 +654,6 @@ def msum(iterable): float.fromhex('0x1.df11f45f4e61ap+2')), ([(-1.)**n/n for n in range(1, 1001)], float.fromhex('-0x1.62a2af1bd3624p-1')), - ([1.7**(i+1)-1.7**i for i in range(1000)] + [-1.7**1000], -1.0), ([1e16, 1., 1e-16], 10000000000000002.0), ([1e16-2., 1.-2.**-53, -(1e16-2.), -(1.-2.**-53)], 0.0), # exercise code for resizing partials array @@ -663,6 +662,13 @@ def msum(iterable): float.fromhex('0x1.5555555555555p+970')), ] + # Telescoping sum, with exact differences (due to Sterbenz) + terms = [1.7**i for i in range(1001)] + test_values.append(( + [terms[i+1] - terms[i] for i in range(1000)] + [-terms[1000]], + -terms[0] + )) + for i, (vals, expected) in enumerate(test_values): try: actual = math.fsum(vals) diff --git a/Misc/NEWS.d/next/Tests/2019-12-08-15-11-06.bpo-38992.cVoHOZ.rst b/Misc/NEWS.d/next/Tests/2019-12-08-15-11-06.bpo-38992.cVoHOZ.rst new file mode 100644 index 0000000000000..815ae0f65c873 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-12-08-15-11-06.bpo-38992.cVoHOZ.rst @@ -0,0 +1 @@ +Fix a test for :func:`math.fsum` that was failing due to constant folding. From webhook-mailer at python.org Mon Dec 9 12:42:24 2019 From: webhook-mailer at python.org (Raymond Hettinger) Date: Mon, 09 Dec 2019 17:42:24 -0000 Subject: [Python-checkins] bpo-39002: Fix simple typo: tranlation -> translation (GH-17517) Message-ID: https://github.com/python/cpython/commit/c18b805ac6a2d22176240ca93982fa1fb6559ec7 commit: c18b805ac6a2d22176240ca93982fa1fb6559ec7 branch: master author: Tim Gates committer: Raymond Hettinger date: 2019-12-09T09:42:17-08:00 summary: bpo-39002: Fix simple typo: tranlation -> translation (GH-17517) files: A Misc/NEWS.d/next/Documentation/2019-12-09-10-12-00.bpo-39002.AfgvfO.rst M Lib/test/test_statistics.py M Misc/ACKS diff --git a/Lib/test/test_statistics.py b/Lib/test/test_statistics.py index bebd9b5d6f502..a9a427bc8d972 100644 --- a/Lib/test/test_statistics.py +++ b/Lib/test/test_statistics.py @@ -2192,7 +2192,7 @@ def test_specific_cases(self): quantiles(padded_data, n=n, method='inclusive'), (n, data), ) - # Invariant under tranlation and scaling + # Invariant under translation and scaling def f(x): return 3.5 * x - 1234.675 exp = list(map(f, expected)) @@ -2232,7 +2232,7 @@ def test_specific_cases_inclusive(self): result = quantiles(map(datatype, data), n=n, method="inclusive") self.assertTrue(all(type(x) == datatype) for x in result) self.assertEqual(result, list(map(datatype, expected))) - # Invariant under tranlation and scaling + # Invariant under translation and scaling def f(x): return 3.5 * x - 1234.675 exp = list(map(f, expected)) diff --git a/Misc/ACKS b/Misc/ACKS index 2286f7b5017fa..253e2f6133d58 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1900,3 +1900,4 @@ Robert Leenders Tim Hopper Dan Lidral-Porter Ngalim Siregar +Tim Gates diff --git a/Misc/NEWS.d/next/Documentation/2019-12-09-10-12-00.bpo-39002.AfgvfO.rst b/Misc/NEWS.d/next/Documentation/2019-12-09-10-12-00.bpo-39002.AfgvfO.rst new file mode 100644 index 0000000000000..a6dfa22eb7a16 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2019-12-09-10-12-00.bpo-39002.AfgvfO.rst @@ -0,0 +1 @@ +Fix simple typo in Lib/test/test_statistics.py. From webhook-mailer at python.org Mon Dec 9 12:57:58 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Mon, 09 Dec 2019 17:57:58 -0000 Subject: [Python-checkins] bpo-39003: Make sure all test are the same when using -R in test_unparse (GH-17537) Message-ID: https://github.com/python/cpython/commit/ac229116a34a679511c20bfeca167cc6a9df9807 commit: ac229116a34a679511c20bfeca167cc6a9df9807 branch: master author: Pablo Galindo committer: GitHub date: 2019-12-09T17:57:50Z summary: bpo-39003: Make sure all test are the same when using -R in test_unparse (GH-17537) files: M Lib/test/test_unparse.py diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py index 9197c8a4a9eae..96110260f550a 100644 --- a/Lib/test/test_unparse.py +++ b/Lib/test/test_unparse.py @@ -288,15 +288,17 @@ class DirectoryTestCase(ASTTestCase): test_directories = (lib_dir, lib_dir / "test") skip_files = {"test_fstring.py"} - @functools.cached_property - def files_to_test(self): - # bpo-31174: Use cached_property to store the names sample - # to always test the same files. It prevents false alarms - # when hunting reference leaks. + _files_to_test = None + + @classmethod + def files_to_test(cls): + + if cls._files_to_test is not None: + return cls._files_to_test items = [ item.resolve() - for directory in self.test_directories + for directory in cls.test_directories for item in directory.glob("*.py") if not item.name.startswith("bad") ] @@ -304,10 +306,15 @@ def files_to_test(self): # Test limited subset of files unless the 'cpu' resource is specified. if not test.support.is_resource_enabled("cpu"): items = random.sample(items, 10) + + # bpo-31174: Store the names sample to always test the same files. + # It prevents false alarms when hunting reference leaks. + cls._files_to_test = items + return items def test_files(self): - for item in self.files_to_test: + for item in self.files_to_test(): if test.support.verbose: print(f"Testing {item.absolute()}") From webhook-mailer at python.org Mon Dec 9 14:05:47 2019 From: webhook-mailer at python.org (Steve Dower) Date: Mon, 09 Dec 2019 19:05:47 -0000 Subject: [Python-checkins] bpo-39008: Require Py_ssize_t for PySys_Audit formats rather than raise a deprecation warning (GH-17540) Message-ID: https://github.com/python/cpython/commit/b8cbe74c3498c617f0e73fd0cdc5c07f2c532092 commit: b8cbe74c3498c617f0e73fd0cdc5c07f2c532092 branch: master author: Steve Dower committer: GitHub date: 2019-12-09T11:05:39-08:00 summary: bpo-39008: Require Py_ssize_t for PySys_Audit formats rather than raise a deprecation warning (GH-17540) files: A Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008.Rrp6f1.rst M Doc/c-api/sys.rst M Python/sysmodule.c diff --git a/Doc/c-api/sys.rst b/Doc/c-api/sys.rst index eccb8a67e82a5..c851ff66487d5 100644 --- a/Doc/c-api/sys.rst +++ b/Doc/c-api/sys.rst @@ -320,10 +320,18 @@ accessible to C code. They all work with the current interpreter thread's arguments to this function will be consumed, using it may cause reference leaks.) + Note that ``#`` format characters should always be treated as + ``Py_ssize_t``, regardless of whether ``PY_SSIZE_T_CLEAN`` was defined. + :func:`sys.audit` performs the same function from Python code. .. versionadded:: 3.8 + .. versionchanged:: 3.8.2 + + Require ``Py_ssize_t`` for ``#`` format characters. Previously, an + unavoidable deprecation warning was raised. + .. c:function:: int PySys_AddAuditHook(Py_AuditHookFunction hook, void *userData) diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008.Rrp6f1.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008.Rrp6f1.rst new file mode 100644 index 0000000000000..35237ce2714a0 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008.Rrp6f1.rst @@ -0,0 +1,3 @@ +:c:func:`PySys_Audit` now requires ``Py_ssize_t`` to be used for size +arguments in the format string, regardless of whethen ``PY_SSIZE_T_CLEAN`` +was defined at include time. diff --git a/Python/sysmodule.c b/Python/sysmodule.c index b6bdf51bce333..9f866a2a3d2fa 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -181,7 +181,7 @@ PySys_Audit(const char *event, const char *argFormat, ...) if (argFormat && argFormat[0]) { va_list args; va_start(args, argFormat); - eventArgs = Py_VaBuildValue(argFormat, args); + eventArgs = _Py_VaBuildValue_SizeT(argFormat, args); va_end(args); if (eventArgs && !PyTuple_Check(eventArgs)) { PyObject *argTuple = PyTuple_Pack(1, eventArgs); From webhook-mailer at python.org Mon Dec 9 14:18:17 2019 From: webhook-mailer at python.org (Steve Dower) Date: Mon, 09 Dec 2019 19:18:17 -0000 Subject: [Python-checkins] bpo-39007: Add auditing events to functions in winreg (GH-17541) Message-ID: https://github.com/python/cpython/commit/ee17e3735634c5fe15a43f897707de8011618627 commit: ee17e3735634c5fe15a43f897707de8011618627 branch: master author: Steve Dower committer: GitHub date: 2019-12-09T11:18:12-08:00 summary: bpo-39007: Add auditing events to functions in winreg (GH-17541) Also allows winreg.CloseKey() to accept same types as other functions. files: A Misc/NEWS.d/next/Windows/2019-12-09-10-40-34.bpo-39007.vtarxo.rst M Doc/library/winreg.rst M Lib/test/audit-tests.py M Lib/test/test_audit.py M PC/winreg.c diff --git a/Doc/library/winreg.rst b/Doc/library/winreg.rst index 5e810680b2643..dccb7db27e90c 100644 --- a/Doc/library/winreg.rst +++ b/Doc/library/winreg.rst @@ -53,6 +53,8 @@ This module offers the following functions: The return value is the handle of the opened key. If the function fails, an :exc:`OSError` exception is raised. + .. audit-event:: winreg.ConnectRegistry computer_name,key winreg.ConnectRegistry + .. versionchanged:: 3.3 See :ref:`above `. @@ -75,6 +77,10 @@ This module offers the following functions: The return value is the handle of the opened key. If the function fails, an :exc:`OSError` exception is raised. + .. audit-event:: winreg.CreateKey key,sub_key,access winreg.CreateKey + + .. audit-event:: winreg.OpenKey/result key winreg.CreateKey + .. versionchanged:: 3.3 See :ref:`above `. @@ -103,6 +109,10 @@ This module offers the following functions: The return value is the handle of the opened key. If the function fails, an :exc:`OSError` exception is raised. + .. audit-event:: winreg.CreateKey key,sub_key,access winreg.CreateKeyEx + + .. audit-event:: winreg.OpenKey/result key winreg.CreateKeyEx + .. versionadded:: 3.2 .. versionchanged:: 3.3 @@ -124,6 +134,8 @@ This module offers the following functions: If the method succeeds, the entire key, including all of its values, is removed. If the method fails, an :exc:`OSError` exception is raised. + .. audit-event:: winreg.DeleteKey key,sub_key,access winreg.DeleteKey + .. versionchanged:: 3.3 See :ref:`above `. @@ -158,6 +170,8 @@ This module offers the following functions: On unsupported Windows versions, :exc:`NotImplementedError` is raised. + .. audit-event:: winreg.DeleteKey key,sub_key,access winreg.DeleteKeyEx + .. versionadded:: 3.2 .. versionchanged:: 3.3 @@ -173,6 +187,8 @@ This module offers the following functions: *value* is a string that identifies the value to remove. + .. audit-event:: winreg.DeleteValue key,value winreg.DeleteValue + .. function:: EnumKey(key, index) @@ -187,6 +203,8 @@ This module offers the following functions: typically called repeatedly until an :exc:`OSError` exception is raised, indicating, no more values are available. + .. audit-event:: winreg.EnumKey key,index winreg.EnumKey + .. versionchanged:: 3.3 See :ref:`above `. @@ -220,6 +238,8 @@ This module offers the following functions: | | :meth:`SetValueEx`) | +-------+--------------------------------------------+ + .. audit-event:: winreg.EnumValue key,index winreg.EnumValue + .. versionchanged:: 3.3 See :ref:`above `. @@ -235,6 +255,8 @@ This module offers the following functions: >>> ExpandEnvironmentStrings('%windir%') 'C:\\Windows' + .. audit-event:: winreg.ExpandEnvironmentStrings str winreg.ExpandEnvironmentStrings + .. function:: FlushKey(key) @@ -279,6 +301,8 @@ This module offers the following functions: If *key* is a handle returned by :func:`ConnectRegistry`, then the path specified in *file_name* is relative to the remote computer. + .. audit-event:: winreg.LoadKey key,sub_key,file_name winreg.LoadKey + .. function:: OpenKey(key, sub_key, reserved=0, access=KEY_READ) OpenKeyEx(key, sub_key, reserved=0, access=KEY_READ) @@ -300,6 +324,10 @@ This module offers the following functions: If the function fails, :exc:`OSError` is raised. + .. audit-event:: winreg.OpenKey key,sub_key,access winreg.OpenKey + + .. audit-event:: winreg.OpenKey/result key winreg.OpenKey + .. versionchanged:: 3.2 Allow the use of named arguments. @@ -330,6 +358,8 @@ This module offers the following functions: | | nanoseconds since Jan 1, 1601. | +-------+---------------------------------------------+ + .. audit-event:: winreg.QueryInfoKey key winreg.QueryInfoKey + .. function:: QueryValue(key, sub_key) @@ -347,6 +377,8 @@ This module offers the following functions: underlying API call doesn't return the type, so always use :func:`QueryValueEx` if possible. + .. audit-event:: winreg.QueryValue key,sub_key,value_name winreg.QueryValue + .. function:: QueryValueEx(key, value_name) @@ -370,6 +402,8 @@ This module offers the following functions: | | :meth:`SetValueEx`) | +-------+-----------------------------------------+ + .. audit-event:: winreg.QueryValue key,sub_key,value_name winreg.QueryValueEx + .. function:: SaveKey(key, file_name) @@ -393,6 +427,8 @@ This module offers the following functions: This function passes ``NULL`` for *security_attributes* to the API. + .. audit-event:: winreg.SaveKey key,file_name winreg.SaveKey + .. function:: SetValue(key, sub_key, type, value) @@ -419,6 +455,8 @@ This module offers the following functions: The key identified by the *key* parameter must have been opened with :const:`KEY_SET_VALUE` access. + .. audit-event:: winreg.SetValue key,sub_key,type,value winreg.SetValue + .. function:: SetValueEx(key, value_name, reserved, type, value) @@ -447,6 +485,8 @@ This module offers the following functions: bytes) should be stored as files with the filenames stored in the configuration registry. This helps the registry perform efficiently. + .. audit-event:: winreg.SetValue key,sub_key,type,value winreg.SetValueEx + .. function:: DisableReflectionKey(key) @@ -463,6 +503,8 @@ This module offers the following functions: effect. Disabling reflection for a key does not affect reflection of any subkeys. + .. audit-event:: winreg.DisableReflectionKey key winreg.DisableReflectionKey + .. function:: EnableReflectionKey(key) @@ -476,6 +518,8 @@ This module offers the following functions: Restoring reflection for a key does not affect reflection of any subkeys. + .. audit-event:: winreg.EnableReflectionKey key winreg.EnableReflectionKey + .. function:: QueryReflectionKey(key) @@ -489,6 +533,8 @@ This module offers the following functions: Will generally raise :exc:`NotImplementedError` if executed on a 32-bit operating system. + .. audit-event:: winreg.QueryReflectionKey key winreg.QueryReflectionKey + .. _constants: @@ -741,6 +787,9 @@ integer handle, and also disconnect the Windows handle from the handle object. handle is not closed. You would call this function when you need the underlying Win32 handle to exist beyond the lifetime of the handle object. + .. audit-event:: winreg.PyHKEY.Detach key winreg.PyHKEY.Detach + + .. method:: PyHKEY.__enter__() PyHKEY.__exit__(\*exc_info) diff --git a/Lib/test/audit-tests.py b/Lib/test/audit-tests.py index ed08612c0417f..33f320992bb23 100644 --- a/Lib/test/audit-tests.py +++ b/Lib/test/audit-tests.py @@ -304,6 +304,29 @@ def hook(event, args): write_unraisable_exc(RuntimeError("nonfatal-error"), "for audit hook test", None) +def test_winreg(): + from winreg import OpenKey, EnumKey, CloseKey, HKEY_LOCAL_MACHINE + + def hook(event, args): + if not event.startswith("winreg."): + return + print(event, *args) + + sys.addaudithook(hook) + + k = OpenKey(HKEY_LOCAL_MACHINE, "Software") + EnumKey(k, 0) + try: + EnumKey(k, 10000) + except OSError: + pass + else: + raise RuntimeError("Expected EnumKey(HKLM, 10000) to fail") + + kv = k.Detach() + CloseKey(kv) + + if __name__ == "__main__": from test.libregrtest.setup import suppress_msvcrt_asserts diff --git a/Lib/test/test_audit.py b/Lib/test/test_audit.py index 31a08559273ee..73dd5c5b7db30 100644 --- a/Lib/test/test_audit.py +++ b/Lib/test/test_audit.py @@ -104,6 +104,20 @@ def test_unraisablehook(self): "RuntimeError('nonfatal-error') Exception ignored for audit hook test", ) + def test_winreg(self): + support.import_module("winreg") + returncode, events, stderr = self.run_python("test_winreg") + if returncode: + self.fail(stderr) + + self.assertEqual(events[0][0], "winreg.OpenKey") + self.assertEqual(events[1][0], "winreg.OpenKey/result") + expected = events[1][2] + self.assertTrue(expected) + self.assertSequenceEqual(["winreg.EnumKey", " ", f"{expected} 0"], events[2]) + self.assertSequenceEqual(["winreg.EnumKey", " ", f"{expected} 10000"], events[3]) + self.assertSequenceEqual(["winreg.PyHKEY.Detach", " ", expected], events[4]) + if __name__ == "__main__": unittest.main() diff --git a/Misc/NEWS.d/next/Windows/2019-12-09-10-40-34.bpo-39007.vtarxo.rst b/Misc/NEWS.d/next/Windows/2019-12-09-10-40-34.bpo-39007.vtarxo.rst new file mode 100644 index 0000000000000..f2f72f9dad3f6 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2019-12-09-10-40-34.bpo-39007.vtarxo.rst @@ -0,0 +1 @@ +Add auditing events to functions in :mod:`winreg`. diff --git a/PC/winreg.c b/PC/winreg.c index 72a7c380beefe..5dff7deadf767 100644 --- a/PC/winreg.c +++ b/PC/winreg.c @@ -293,6 +293,9 @@ winreg_HKEYType_Detach_impl(PyHKEYObject *self) /*[clinic end generated code: output=dda5a9e1a01ae78f input=dd2cc09e6c6ba833]*/ { void* ret; + if (PySys_Audit("winreg.PyHKEY.Detach", "n", (Py_ssize_t)self->hkey) < 0) { + return NULL; + } ret = (void*)self->hkey; self->hkey = 0; return PyLong_FromVoidPtr(ret); @@ -397,15 +400,15 @@ BOOL PyHKEY_Close(PyObject *ob_handle) { LONG rc; - PyHKEYObject *key; + HKEY key; - if (!PyHKEY_Check(ob_handle)) { - PyErr_SetString(PyExc_TypeError, "bad operand type"); + if (!PyHKEY_AsHKEY(ob_handle, &key, TRUE)) { return FALSE; } - key = (PyHKEYObject *)ob_handle; - rc = key->hkey ? RegCloseKey((HKEY)key->hkey) : ERROR_SUCCESS; - key->hkey = 0; + if (PyHKEY_Check(ob_handle)) { + ((PyHKEYObject*)ob_handle)->hkey = 0; + } + rc = key ? RegCloseKey(key) : ERROR_SUCCESS; if (rc != ERROR_SUCCESS) PyErr_SetFromWindowsErrWithFunction(rc, "RegCloseKey"); return rc == ERROR_SUCCESS; @@ -841,6 +844,10 @@ winreg_ConnectRegistry_impl(PyObject *module, { HKEY retKey; long rc; + if (PySys_Audit("winreg.ConnectRegistry", "un", + computer_name, (Py_ssize_t)key) < 0) { + return NULL; + } Py_BEGIN_ALLOW_THREADS rc = RegConnectRegistryW(computer_name, key, &retKey); Py_END_ALLOW_THREADS @@ -878,11 +885,20 @@ winreg_CreateKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key) HKEY retKey; long rc; + if (PySys_Audit("winreg.CreateKey", "nun", + (Py_ssize_t)key, sub_key, + (Py_ssize_t)KEY_WRITE) < 0) { + return NULL; + } rc = RegCreateKeyW(key, sub_key, &retKey); if (rc != ERROR_SUCCESS) { PyErr_SetFromWindowsErrWithFunction(rc, "CreateKey"); return NULL; } + if (PySys_Audit("winreg.OpenKey/result", "n", + (Py_ssize_t)retKey) < 0) { + return NULL; + } return retKey; } @@ -919,12 +935,21 @@ winreg_CreateKeyEx_impl(PyObject *module, HKEY key, HKEY retKey; long rc; + if (PySys_Audit("winreg.CreateKey", "nun", + (Py_ssize_t)key, sub_key, + (Py_ssize_t)access) < 0) { + return NULL; + } rc = RegCreateKeyExW(key, sub_key, reserved, NULL, 0, access, NULL, &retKey, NULL); if (rc != ERROR_SUCCESS) { PyErr_SetFromWindowsErrWithFunction(rc, "CreateKeyEx"); return NULL; } + if (PySys_Audit("winreg.OpenKey/result", "n", + (Py_ssize_t)retKey) < 0) { + return NULL; + } return retKey; } @@ -951,6 +976,11 @@ winreg_DeleteKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key) /*[clinic end generated code: output=d2652a84f70e0862 input=b31d225b935e4211]*/ { long rc; + if (PySys_Audit("winreg.DeleteKey", "nun", + (Py_ssize_t)key, sub_key, + (Py_ssize_t)0) < 0) { + return NULL; + } rc = RegDeleteKeyW(key, sub_key ); if (rc != ERROR_SUCCESS) return PyErr_SetFromWindowsErrWithFunction(rc, "RegDeleteKey"); @@ -992,13 +1022,17 @@ winreg_DeleteKeyEx_impl(PyObject *module, HKEY key, RDKEFunc pfn = NULL; long rc; + if (PySys_Audit("winreg.DeleteKey", "nun", + (Py_ssize_t)key, sub_key, + (Py_ssize_t)access) < 0) { + return NULL; + } /* Only available on 64bit platforms, so we must load it dynamically. */ Py_BEGIN_ALLOW_THREADS hMod = GetModuleHandleW(L"advapi32.dll"); if (hMod) - pfn = (RDKEFunc)GetProcAddress(hMod, - "RegDeleteKeyExW"); + pfn = (RDKEFunc)GetProcAddress(hMod, "RegDeleteKeyExW"); Py_END_ALLOW_THREADS if (!pfn) { PyErr_SetString(PyExc_NotImplementedError, @@ -1031,6 +1065,10 @@ winreg_DeleteValue_impl(PyObject *module, HKEY key, const Py_UNICODE *value) /*[clinic end generated code: output=56fa9d21f3a54371 input=a78d3407a4197b21]*/ { long rc; + if (PySys_Audit("winreg.DeleteValue", "nu", + (Py_ssize_t)key, value) < 0) { + return NULL; + } Py_BEGIN_ALLOW_THREADS rc = RegDeleteValueW(key, value); Py_END_ALLOW_THREADS @@ -1063,6 +1101,10 @@ winreg_EnumKey_impl(PyObject *module, HKEY key, int index) long rc; PyObject *retStr; + if (PySys_Audit("winreg.EnumKey", "ni", + (Py_ssize_t)key, index) < 0) { + return NULL; + } /* The Windows docs claim that the max key name length is 255 * characters, plus a terminating nul character. However, * empirical testing demonstrates that it is possible to @@ -1121,6 +1163,10 @@ winreg_EnumValue_impl(PyObject *module, HKEY key, int index) PyObject *obData; PyObject *retVal; + if (PySys_Audit("winreg.EnumValue", "ni", + (Py_ssize_t)key, index) < 0) { + return NULL; + } if ((rc = RegQueryInfoKeyW(key, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &retValueSize, &retDataSize, NULL, NULL)) @@ -1204,6 +1250,11 @@ winreg_ExpandEnvironmentStrings_impl(PyObject *module, DWORD rc; PyObject *o; + if (PySys_Audit("winreg.ExpandEnvironmentStrings", "u", + string) < 0) { + return NULL; + } + retValueSize = ExpandEnvironmentStringsW(string, retValue, 0); if (retValueSize == 0) { return PyErr_SetFromWindowsErrWithFunction(retValueSize, @@ -1295,6 +1346,10 @@ winreg_LoadKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key, { long rc; + if (PySys_Audit("winreg.LoadKey", "nuu", + (Py_ssize_t)key, sub_key, file_name) < 0) { + return NULL; + } Py_BEGIN_ALLOW_THREADS rc = RegLoadKeyW(key, sub_key, file_name ); Py_END_ALLOW_THREADS @@ -1330,6 +1385,11 @@ winreg_OpenKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key, HKEY retKey; long rc; + if (PySys_Audit("winreg.OpenKey", "nun", + (Py_ssize_t)key, sub_key, + (Py_ssize_t)access) < 0) { + return NULL; + } Py_BEGIN_ALLOW_THREADS rc = RegOpenKeyExW(key, sub_key, reserved, access, &retKey); Py_END_ALLOW_THREADS @@ -1337,6 +1397,10 @@ winreg_OpenKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key, PyErr_SetFromWindowsErrWithFunction(rc, "RegOpenKeyEx"); return NULL; } + if (PySys_Audit("winreg.OpenKey/result", "n", + (Py_ssize_t)retKey) < 0) { + return NULL; + } return retKey; } @@ -1377,25 +1441,30 @@ static PyObject * winreg_QueryInfoKey_impl(PyObject *module, HKEY key) /*[clinic end generated code: output=dc657b8356a4f438 input=c3593802390cde1f]*/ { - long rc; - DWORD nSubKeys, nValues; - FILETIME ft; - LARGE_INTEGER li; - PyObject *l; - PyObject *ret; - - if ((rc = RegQueryInfoKey(key, NULL, NULL, 0, &nSubKeys, NULL, NULL, - &nValues, NULL, NULL, NULL, &ft)) - != ERROR_SUCCESS) - return PyErr_SetFromWindowsErrWithFunction(rc, "RegQueryInfoKey"); - li.LowPart = ft.dwLowDateTime; - li.HighPart = ft.dwHighDateTime; - l = PyLong_FromLongLong(li.QuadPart); - if (l == NULL) - return NULL; - ret = Py_BuildValue("iiO", nSubKeys, nValues, l); - Py_DECREF(l); - return ret; + long rc; + DWORD nSubKeys, nValues; + FILETIME ft; + LARGE_INTEGER li; + PyObject *l; + PyObject *ret; + + if (PySys_Audit("winreg.QueryInfoKey", "n", (Py_ssize_t)key) < 0) { + return NULL; + } + if ((rc = RegQueryInfoKey(key, NULL, NULL, 0, &nSubKeys, NULL, NULL, + &nValues, NULL, NULL, NULL, &ft)) + != ERROR_SUCCESS) { + return PyErr_SetFromWindowsErrWithFunction(rc, "RegQueryInfoKey"); + } + li.LowPart = ft.dwLowDateTime; + li.HighPart = ft.dwHighDateTime; + l = PyLong_FromLongLong(li.QuadPart); + if (l == NULL) { + return NULL; + } + ret = Py_BuildValue("iiO", nSubKeys, nValues, l); + Py_DECREF(l); + return ret; } /*[clinic input] @@ -1430,6 +1499,10 @@ winreg_QueryValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key) DWORD retSize = 0; wchar_t *tmp; + if (PySys_Audit("winreg.QueryValue", "nuu", + (Py_ssize_t)key, sub_key, NULL) < 0) { + return NULL; + } rc = RegQueryValueW(key, sub_key, NULL, &retSize); if (rc == ERROR_MORE_DATA) retSize = 256; @@ -1497,6 +1570,10 @@ winreg_QueryValueEx_impl(PyObject *module, HKEY key, const Py_UNICODE *name) PyObject *obData; PyObject *result; + if (PySys_Audit("winreg.QueryValue", "nuu", + (Py_ssize_t)key, NULL, name) < 0) { + return NULL; + } rc = RegQueryValueExW(key, name, NULL, NULL, NULL, &bufSize); if (rc == ERROR_MORE_DATA) bufSize = 256; @@ -1570,6 +1647,10 @@ winreg_SaveKey_impl(PyObject *module, HKEY key, const Py_UNICODE *file_name) if (!PyWinObject_AsSECURITY_ATTRIBUTES(obSA, &pSA, TRUE)) return NULL; */ + if (PySys_Audit("winreg.SaveKey", "nu", + (Py_ssize_t)key, file_name) < 0) { + return NULL; + } Py_BEGIN_ALLOW_THREADS rc = RegSaveKeyW(key, file_name, pSA ); Py_END_ALLOW_THREADS @@ -1622,6 +1703,12 @@ winreg_SetValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key, return NULL; } + if (PySys_Audit("winreg.SetValue", "nunu#", + (Py_ssize_t)key, sub_key, (Py_ssize_t)type, + value, value_length) < 0) { + return NULL; + } + Py_BEGIN_ALLOW_THREADS rc = RegSetValueW(key, sub_key, REG_SZ, value, (DWORD)(value_length + 1)); Py_END_ALLOW_THREADS @@ -1692,6 +1779,11 @@ winreg_SetValueEx_impl(PyObject *module, HKEY key, "Could not convert the data to the specified type."); return NULL; } + if (PySys_Audit("winreg.SetValue", "nunO", + (Py_ssize_t)key, value_name, (Py_ssize_t)type, + value) < 0) { + return NULL; + } Py_BEGIN_ALLOW_THREADS rc = RegSetValueExW(key, value_name, 0, type, data, len); Py_END_ALLOW_THREADS @@ -1727,6 +1819,10 @@ winreg_DisableReflectionKey_impl(PyObject *module, HKEY key) RDRKFunc pfn = NULL; LONG rc; + if (PySys_Audit("winreg.DisableReflectionKey", "n", (Py_ssize_t)key) < 0) { + return NULL; + } + /* Only available on 64bit platforms, so we must load it dynamically.*/ Py_BEGIN_ALLOW_THREADS @@ -1772,6 +1868,10 @@ winreg_EnableReflectionKey_impl(PyObject *module, HKEY key) RERKFunc pfn = NULL; LONG rc; + if (PySys_Audit("winreg.EnableReflectionKey", "n", (Py_ssize_t)key) < 0) { + return NULL; + } + /* Only available on 64bit platforms, so we must load it dynamically.*/ Py_BEGIN_ALLOW_THREADS @@ -1816,6 +1916,10 @@ winreg_QueryReflectionKey_impl(PyObject *module, HKEY key) BOOL result; LONG rc; + if (PySys_Audit("winreg.QueryReflectionKey", "n", (Py_ssize_t)key) < 0) { + return NULL; + } + /* Only available on 64bit platforms, so we must load it dynamically.*/ Py_BEGIN_ALLOW_THREADS From webhook-mailer at python.org Mon Dec 9 14:22:39 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 09 Dec 2019 19:22:39 -0000 Subject: [Python-checkins] bpo-39008: Require Py_ssize_t for PySys_Audit formats rather than raise a deprecation warning (GH-17540) Message-ID: https://github.com/python/cpython/commit/c93d68bbb986ee0879f5627223e0bd2bb91f63dd commit: c93d68bbb986ee0879f5627223e0bd2bb91f63dd branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-09T11:22:30-08:00 summary: bpo-39008: Require Py_ssize_t for PySys_Audit formats rather than raise a deprecation warning (GH-17540) (cherry picked from commit b8cbe74c3498c617f0e73fd0cdc5c07f2c532092) Co-authored-by: Steve Dower files: A Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008.Rrp6f1.rst M Doc/c-api/sys.rst M Python/sysmodule.c diff --git a/Doc/c-api/sys.rst b/Doc/c-api/sys.rst index eccb8a67e82a5..c851ff66487d5 100644 --- a/Doc/c-api/sys.rst +++ b/Doc/c-api/sys.rst @@ -320,10 +320,18 @@ accessible to C code. They all work with the current interpreter thread's arguments to this function will be consumed, using it may cause reference leaks.) + Note that ``#`` format characters should always be treated as + ``Py_ssize_t``, regardless of whether ``PY_SSIZE_T_CLEAN`` was defined. + :func:`sys.audit` performs the same function from Python code. .. versionadded:: 3.8 + .. versionchanged:: 3.8.2 + + Require ``Py_ssize_t`` for ``#`` format characters. Previously, an + unavoidable deprecation warning was raised. + .. c:function:: int PySys_AddAuditHook(Py_AuditHookFunction hook, void *userData) diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008.Rrp6f1.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008.Rrp6f1.rst new file mode 100644 index 0000000000000..35237ce2714a0 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008.Rrp6f1.rst @@ -0,0 +1,3 @@ +:c:func:`PySys_Audit` now requires ``Py_ssize_t`` to be used for size +arguments in the format string, regardless of whethen ``PY_SSIZE_T_CLEAN`` +was defined at include time. diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 1255665d024c3..da4b6e1a7806b 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -159,7 +159,7 @@ PySys_Audit(const char *event, const char *argFormat, ...) if (argFormat && argFormat[0]) { va_list args; va_start(args, argFormat); - eventArgs = Py_VaBuildValue(argFormat, args); + eventArgs = _Py_VaBuildValue_SizeT(argFormat, args); va_end(args); if (eventArgs && !PyTuple_Check(eventArgs)) { PyObject *argTuple = PyTuple_Pack(1, eventArgs); From webhook-mailer at python.org Mon Dec 9 14:36:30 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 09 Dec 2019 19:36:30 -0000 Subject: [Python-checkins] bpo-39007: Add auditing events to functions in winreg (GH-17541) Message-ID: https://github.com/python/cpython/commit/0ac9aaeb9727aa60bef918b619116a729d3ea56d commit: 0ac9aaeb9727aa60bef918b619116a729d3ea56d branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-09T11:36:25-08:00 summary: bpo-39007: Add auditing events to functions in winreg (GH-17541) Also allows winreg.CloseKey() to accept same types as other functions. (cherry picked from commit ee17e3735634c5fe15a43f897707de8011618627) Co-authored-by: Steve Dower files: A Misc/NEWS.d/next/Windows/2019-12-09-10-40-34.bpo-39007.vtarxo.rst M Doc/library/winreg.rst M Lib/test/audit-tests.py M Lib/test/test_audit.py M PC/winreg.c diff --git a/Doc/library/winreg.rst b/Doc/library/winreg.rst index 5e810680b2643..dccb7db27e90c 100644 --- a/Doc/library/winreg.rst +++ b/Doc/library/winreg.rst @@ -53,6 +53,8 @@ This module offers the following functions: The return value is the handle of the opened key. If the function fails, an :exc:`OSError` exception is raised. + .. audit-event:: winreg.ConnectRegistry computer_name,key winreg.ConnectRegistry + .. versionchanged:: 3.3 See :ref:`above `. @@ -75,6 +77,10 @@ This module offers the following functions: The return value is the handle of the opened key. If the function fails, an :exc:`OSError` exception is raised. + .. audit-event:: winreg.CreateKey key,sub_key,access winreg.CreateKey + + .. audit-event:: winreg.OpenKey/result key winreg.CreateKey + .. versionchanged:: 3.3 See :ref:`above `. @@ -103,6 +109,10 @@ This module offers the following functions: The return value is the handle of the opened key. If the function fails, an :exc:`OSError` exception is raised. + .. audit-event:: winreg.CreateKey key,sub_key,access winreg.CreateKeyEx + + .. audit-event:: winreg.OpenKey/result key winreg.CreateKeyEx + .. versionadded:: 3.2 .. versionchanged:: 3.3 @@ -124,6 +134,8 @@ This module offers the following functions: If the method succeeds, the entire key, including all of its values, is removed. If the method fails, an :exc:`OSError` exception is raised. + .. audit-event:: winreg.DeleteKey key,sub_key,access winreg.DeleteKey + .. versionchanged:: 3.3 See :ref:`above `. @@ -158,6 +170,8 @@ This module offers the following functions: On unsupported Windows versions, :exc:`NotImplementedError` is raised. + .. audit-event:: winreg.DeleteKey key,sub_key,access winreg.DeleteKeyEx + .. versionadded:: 3.2 .. versionchanged:: 3.3 @@ -173,6 +187,8 @@ This module offers the following functions: *value* is a string that identifies the value to remove. + .. audit-event:: winreg.DeleteValue key,value winreg.DeleteValue + .. function:: EnumKey(key, index) @@ -187,6 +203,8 @@ This module offers the following functions: typically called repeatedly until an :exc:`OSError` exception is raised, indicating, no more values are available. + .. audit-event:: winreg.EnumKey key,index winreg.EnumKey + .. versionchanged:: 3.3 See :ref:`above `. @@ -220,6 +238,8 @@ This module offers the following functions: | | :meth:`SetValueEx`) | +-------+--------------------------------------------+ + .. audit-event:: winreg.EnumValue key,index winreg.EnumValue + .. versionchanged:: 3.3 See :ref:`above `. @@ -235,6 +255,8 @@ This module offers the following functions: >>> ExpandEnvironmentStrings('%windir%') 'C:\\Windows' + .. audit-event:: winreg.ExpandEnvironmentStrings str winreg.ExpandEnvironmentStrings + .. function:: FlushKey(key) @@ -279,6 +301,8 @@ This module offers the following functions: If *key* is a handle returned by :func:`ConnectRegistry`, then the path specified in *file_name* is relative to the remote computer. + .. audit-event:: winreg.LoadKey key,sub_key,file_name winreg.LoadKey + .. function:: OpenKey(key, sub_key, reserved=0, access=KEY_READ) OpenKeyEx(key, sub_key, reserved=0, access=KEY_READ) @@ -300,6 +324,10 @@ This module offers the following functions: If the function fails, :exc:`OSError` is raised. + .. audit-event:: winreg.OpenKey key,sub_key,access winreg.OpenKey + + .. audit-event:: winreg.OpenKey/result key winreg.OpenKey + .. versionchanged:: 3.2 Allow the use of named arguments. @@ -330,6 +358,8 @@ This module offers the following functions: | | nanoseconds since Jan 1, 1601. | +-------+---------------------------------------------+ + .. audit-event:: winreg.QueryInfoKey key winreg.QueryInfoKey + .. function:: QueryValue(key, sub_key) @@ -347,6 +377,8 @@ This module offers the following functions: underlying API call doesn't return the type, so always use :func:`QueryValueEx` if possible. + .. audit-event:: winreg.QueryValue key,sub_key,value_name winreg.QueryValue + .. function:: QueryValueEx(key, value_name) @@ -370,6 +402,8 @@ This module offers the following functions: | | :meth:`SetValueEx`) | +-------+-----------------------------------------+ + .. audit-event:: winreg.QueryValue key,sub_key,value_name winreg.QueryValueEx + .. function:: SaveKey(key, file_name) @@ -393,6 +427,8 @@ This module offers the following functions: This function passes ``NULL`` for *security_attributes* to the API. + .. audit-event:: winreg.SaveKey key,file_name winreg.SaveKey + .. function:: SetValue(key, sub_key, type, value) @@ -419,6 +455,8 @@ This module offers the following functions: The key identified by the *key* parameter must have been opened with :const:`KEY_SET_VALUE` access. + .. audit-event:: winreg.SetValue key,sub_key,type,value winreg.SetValue + .. function:: SetValueEx(key, value_name, reserved, type, value) @@ -447,6 +485,8 @@ This module offers the following functions: bytes) should be stored as files with the filenames stored in the configuration registry. This helps the registry perform efficiently. + .. audit-event:: winreg.SetValue key,sub_key,type,value winreg.SetValueEx + .. function:: DisableReflectionKey(key) @@ -463,6 +503,8 @@ This module offers the following functions: effect. Disabling reflection for a key does not affect reflection of any subkeys. + .. audit-event:: winreg.DisableReflectionKey key winreg.DisableReflectionKey + .. function:: EnableReflectionKey(key) @@ -476,6 +518,8 @@ This module offers the following functions: Restoring reflection for a key does not affect reflection of any subkeys. + .. audit-event:: winreg.EnableReflectionKey key winreg.EnableReflectionKey + .. function:: QueryReflectionKey(key) @@ -489,6 +533,8 @@ This module offers the following functions: Will generally raise :exc:`NotImplementedError` if executed on a 32-bit operating system. + .. audit-event:: winreg.QueryReflectionKey key winreg.QueryReflectionKey + .. _constants: @@ -741,6 +787,9 @@ integer handle, and also disconnect the Windows handle from the handle object. handle is not closed. You would call this function when you need the underlying Win32 handle to exist beyond the lifetime of the handle object. + .. audit-event:: winreg.PyHKEY.Detach key winreg.PyHKEY.Detach + + .. method:: PyHKEY.__enter__() PyHKEY.__exit__(\*exc_info) diff --git a/Lib/test/audit-tests.py b/Lib/test/audit-tests.py index ed08612c0417f..33f320992bb23 100644 --- a/Lib/test/audit-tests.py +++ b/Lib/test/audit-tests.py @@ -304,6 +304,29 @@ def hook(event, args): write_unraisable_exc(RuntimeError("nonfatal-error"), "for audit hook test", None) +def test_winreg(): + from winreg import OpenKey, EnumKey, CloseKey, HKEY_LOCAL_MACHINE + + def hook(event, args): + if not event.startswith("winreg."): + return + print(event, *args) + + sys.addaudithook(hook) + + k = OpenKey(HKEY_LOCAL_MACHINE, "Software") + EnumKey(k, 0) + try: + EnumKey(k, 10000) + except OSError: + pass + else: + raise RuntimeError("Expected EnumKey(HKLM, 10000) to fail") + + kv = k.Detach() + CloseKey(kv) + + if __name__ == "__main__": from test.libregrtest.setup import suppress_msvcrt_asserts diff --git a/Lib/test/test_audit.py b/Lib/test/test_audit.py index 31a08559273ee..73dd5c5b7db30 100644 --- a/Lib/test/test_audit.py +++ b/Lib/test/test_audit.py @@ -104,6 +104,20 @@ def test_unraisablehook(self): "RuntimeError('nonfatal-error') Exception ignored for audit hook test", ) + def test_winreg(self): + support.import_module("winreg") + returncode, events, stderr = self.run_python("test_winreg") + if returncode: + self.fail(stderr) + + self.assertEqual(events[0][0], "winreg.OpenKey") + self.assertEqual(events[1][0], "winreg.OpenKey/result") + expected = events[1][2] + self.assertTrue(expected) + self.assertSequenceEqual(["winreg.EnumKey", " ", f"{expected} 0"], events[2]) + self.assertSequenceEqual(["winreg.EnumKey", " ", f"{expected} 10000"], events[3]) + self.assertSequenceEqual(["winreg.PyHKEY.Detach", " ", expected], events[4]) + if __name__ == "__main__": unittest.main() diff --git a/Misc/NEWS.d/next/Windows/2019-12-09-10-40-34.bpo-39007.vtarxo.rst b/Misc/NEWS.d/next/Windows/2019-12-09-10-40-34.bpo-39007.vtarxo.rst new file mode 100644 index 0000000000000..f2f72f9dad3f6 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2019-12-09-10-40-34.bpo-39007.vtarxo.rst @@ -0,0 +1 @@ +Add auditing events to functions in :mod:`winreg`. diff --git a/PC/winreg.c b/PC/winreg.c index 72a7c380beefe..5dff7deadf767 100644 --- a/PC/winreg.c +++ b/PC/winreg.c @@ -293,6 +293,9 @@ winreg_HKEYType_Detach_impl(PyHKEYObject *self) /*[clinic end generated code: output=dda5a9e1a01ae78f input=dd2cc09e6c6ba833]*/ { void* ret; + if (PySys_Audit("winreg.PyHKEY.Detach", "n", (Py_ssize_t)self->hkey) < 0) { + return NULL; + } ret = (void*)self->hkey; self->hkey = 0; return PyLong_FromVoidPtr(ret); @@ -397,15 +400,15 @@ BOOL PyHKEY_Close(PyObject *ob_handle) { LONG rc; - PyHKEYObject *key; + HKEY key; - if (!PyHKEY_Check(ob_handle)) { - PyErr_SetString(PyExc_TypeError, "bad operand type"); + if (!PyHKEY_AsHKEY(ob_handle, &key, TRUE)) { return FALSE; } - key = (PyHKEYObject *)ob_handle; - rc = key->hkey ? RegCloseKey((HKEY)key->hkey) : ERROR_SUCCESS; - key->hkey = 0; + if (PyHKEY_Check(ob_handle)) { + ((PyHKEYObject*)ob_handle)->hkey = 0; + } + rc = key ? RegCloseKey(key) : ERROR_SUCCESS; if (rc != ERROR_SUCCESS) PyErr_SetFromWindowsErrWithFunction(rc, "RegCloseKey"); return rc == ERROR_SUCCESS; @@ -841,6 +844,10 @@ winreg_ConnectRegistry_impl(PyObject *module, { HKEY retKey; long rc; + if (PySys_Audit("winreg.ConnectRegistry", "un", + computer_name, (Py_ssize_t)key) < 0) { + return NULL; + } Py_BEGIN_ALLOW_THREADS rc = RegConnectRegistryW(computer_name, key, &retKey); Py_END_ALLOW_THREADS @@ -878,11 +885,20 @@ winreg_CreateKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key) HKEY retKey; long rc; + if (PySys_Audit("winreg.CreateKey", "nun", + (Py_ssize_t)key, sub_key, + (Py_ssize_t)KEY_WRITE) < 0) { + return NULL; + } rc = RegCreateKeyW(key, sub_key, &retKey); if (rc != ERROR_SUCCESS) { PyErr_SetFromWindowsErrWithFunction(rc, "CreateKey"); return NULL; } + if (PySys_Audit("winreg.OpenKey/result", "n", + (Py_ssize_t)retKey) < 0) { + return NULL; + } return retKey; } @@ -919,12 +935,21 @@ winreg_CreateKeyEx_impl(PyObject *module, HKEY key, HKEY retKey; long rc; + if (PySys_Audit("winreg.CreateKey", "nun", + (Py_ssize_t)key, sub_key, + (Py_ssize_t)access) < 0) { + return NULL; + } rc = RegCreateKeyExW(key, sub_key, reserved, NULL, 0, access, NULL, &retKey, NULL); if (rc != ERROR_SUCCESS) { PyErr_SetFromWindowsErrWithFunction(rc, "CreateKeyEx"); return NULL; } + if (PySys_Audit("winreg.OpenKey/result", "n", + (Py_ssize_t)retKey) < 0) { + return NULL; + } return retKey; } @@ -951,6 +976,11 @@ winreg_DeleteKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key) /*[clinic end generated code: output=d2652a84f70e0862 input=b31d225b935e4211]*/ { long rc; + if (PySys_Audit("winreg.DeleteKey", "nun", + (Py_ssize_t)key, sub_key, + (Py_ssize_t)0) < 0) { + return NULL; + } rc = RegDeleteKeyW(key, sub_key ); if (rc != ERROR_SUCCESS) return PyErr_SetFromWindowsErrWithFunction(rc, "RegDeleteKey"); @@ -992,13 +1022,17 @@ winreg_DeleteKeyEx_impl(PyObject *module, HKEY key, RDKEFunc pfn = NULL; long rc; + if (PySys_Audit("winreg.DeleteKey", "nun", + (Py_ssize_t)key, sub_key, + (Py_ssize_t)access) < 0) { + return NULL; + } /* Only available on 64bit platforms, so we must load it dynamically. */ Py_BEGIN_ALLOW_THREADS hMod = GetModuleHandleW(L"advapi32.dll"); if (hMod) - pfn = (RDKEFunc)GetProcAddress(hMod, - "RegDeleteKeyExW"); + pfn = (RDKEFunc)GetProcAddress(hMod, "RegDeleteKeyExW"); Py_END_ALLOW_THREADS if (!pfn) { PyErr_SetString(PyExc_NotImplementedError, @@ -1031,6 +1065,10 @@ winreg_DeleteValue_impl(PyObject *module, HKEY key, const Py_UNICODE *value) /*[clinic end generated code: output=56fa9d21f3a54371 input=a78d3407a4197b21]*/ { long rc; + if (PySys_Audit("winreg.DeleteValue", "nu", + (Py_ssize_t)key, value) < 0) { + return NULL; + } Py_BEGIN_ALLOW_THREADS rc = RegDeleteValueW(key, value); Py_END_ALLOW_THREADS @@ -1063,6 +1101,10 @@ winreg_EnumKey_impl(PyObject *module, HKEY key, int index) long rc; PyObject *retStr; + if (PySys_Audit("winreg.EnumKey", "ni", + (Py_ssize_t)key, index) < 0) { + return NULL; + } /* The Windows docs claim that the max key name length is 255 * characters, plus a terminating nul character. However, * empirical testing demonstrates that it is possible to @@ -1121,6 +1163,10 @@ winreg_EnumValue_impl(PyObject *module, HKEY key, int index) PyObject *obData; PyObject *retVal; + if (PySys_Audit("winreg.EnumValue", "ni", + (Py_ssize_t)key, index) < 0) { + return NULL; + } if ((rc = RegQueryInfoKeyW(key, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &retValueSize, &retDataSize, NULL, NULL)) @@ -1204,6 +1250,11 @@ winreg_ExpandEnvironmentStrings_impl(PyObject *module, DWORD rc; PyObject *o; + if (PySys_Audit("winreg.ExpandEnvironmentStrings", "u", + string) < 0) { + return NULL; + } + retValueSize = ExpandEnvironmentStringsW(string, retValue, 0); if (retValueSize == 0) { return PyErr_SetFromWindowsErrWithFunction(retValueSize, @@ -1295,6 +1346,10 @@ winreg_LoadKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key, { long rc; + if (PySys_Audit("winreg.LoadKey", "nuu", + (Py_ssize_t)key, sub_key, file_name) < 0) { + return NULL; + } Py_BEGIN_ALLOW_THREADS rc = RegLoadKeyW(key, sub_key, file_name ); Py_END_ALLOW_THREADS @@ -1330,6 +1385,11 @@ winreg_OpenKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key, HKEY retKey; long rc; + if (PySys_Audit("winreg.OpenKey", "nun", + (Py_ssize_t)key, sub_key, + (Py_ssize_t)access) < 0) { + return NULL; + } Py_BEGIN_ALLOW_THREADS rc = RegOpenKeyExW(key, sub_key, reserved, access, &retKey); Py_END_ALLOW_THREADS @@ -1337,6 +1397,10 @@ winreg_OpenKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key, PyErr_SetFromWindowsErrWithFunction(rc, "RegOpenKeyEx"); return NULL; } + if (PySys_Audit("winreg.OpenKey/result", "n", + (Py_ssize_t)retKey) < 0) { + return NULL; + } return retKey; } @@ -1377,25 +1441,30 @@ static PyObject * winreg_QueryInfoKey_impl(PyObject *module, HKEY key) /*[clinic end generated code: output=dc657b8356a4f438 input=c3593802390cde1f]*/ { - long rc; - DWORD nSubKeys, nValues; - FILETIME ft; - LARGE_INTEGER li; - PyObject *l; - PyObject *ret; - - if ((rc = RegQueryInfoKey(key, NULL, NULL, 0, &nSubKeys, NULL, NULL, - &nValues, NULL, NULL, NULL, &ft)) - != ERROR_SUCCESS) - return PyErr_SetFromWindowsErrWithFunction(rc, "RegQueryInfoKey"); - li.LowPart = ft.dwLowDateTime; - li.HighPart = ft.dwHighDateTime; - l = PyLong_FromLongLong(li.QuadPart); - if (l == NULL) - return NULL; - ret = Py_BuildValue("iiO", nSubKeys, nValues, l); - Py_DECREF(l); - return ret; + long rc; + DWORD nSubKeys, nValues; + FILETIME ft; + LARGE_INTEGER li; + PyObject *l; + PyObject *ret; + + if (PySys_Audit("winreg.QueryInfoKey", "n", (Py_ssize_t)key) < 0) { + return NULL; + } + if ((rc = RegQueryInfoKey(key, NULL, NULL, 0, &nSubKeys, NULL, NULL, + &nValues, NULL, NULL, NULL, &ft)) + != ERROR_SUCCESS) { + return PyErr_SetFromWindowsErrWithFunction(rc, "RegQueryInfoKey"); + } + li.LowPart = ft.dwLowDateTime; + li.HighPart = ft.dwHighDateTime; + l = PyLong_FromLongLong(li.QuadPart); + if (l == NULL) { + return NULL; + } + ret = Py_BuildValue("iiO", nSubKeys, nValues, l); + Py_DECREF(l); + return ret; } /*[clinic input] @@ -1430,6 +1499,10 @@ winreg_QueryValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key) DWORD retSize = 0; wchar_t *tmp; + if (PySys_Audit("winreg.QueryValue", "nuu", + (Py_ssize_t)key, sub_key, NULL) < 0) { + return NULL; + } rc = RegQueryValueW(key, sub_key, NULL, &retSize); if (rc == ERROR_MORE_DATA) retSize = 256; @@ -1497,6 +1570,10 @@ winreg_QueryValueEx_impl(PyObject *module, HKEY key, const Py_UNICODE *name) PyObject *obData; PyObject *result; + if (PySys_Audit("winreg.QueryValue", "nuu", + (Py_ssize_t)key, NULL, name) < 0) { + return NULL; + } rc = RegQueryValueExW(key, name, NULL, NULL, NULL, &bufSize); if (rc == ERROR_MORE_DATA) bufSize = 256; @@ -1570,6 +1647,10 @@ winreg_SaveKey_impl(PyObject *module, HKEY key, const Py_UNICODE *file_name) if (!PyWinObject_AsSECURITY_ATTRIBUTES(obSA, &pSA, TRUE)) return NULL; */ + if (PySys_Audit("winreg.SaveKey", "nu", + (Py_ssize_t)key, file_name) < 0) { + return NULL; + } Py_BEGIN_ALLOW_THREADS rc = RegSaveKeyW(key, file_name, pSA ); Py_END_ALLOW_THREADS @@ -1622,6 +1703,12 @@ winreg_SetValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key, return NULL; } + if (PySys_Audit("winreg.SetValue", "nunu#", + (Py_ssize_t)key, sub_key, (Py_ssize_t)type, + value, value_length) < 0) { + return NULL; + } + Py_BEGIN_ALLOW_THREADS rc = RegSetValueW(key, sub_key, REG_SZ, value, (DWORD)(value_length + 1)); Py_END_ALLOW_THREADS @@ -1692,6 +1779,11 @@ winreg_SetValueEx_impl(PyObject *module, HKEY key, "Could not convert the data to the specified type."); return NULL; } + if (PySys_Audit("winreg.SetValue", "nunO", + (Py_ssize_t)key, value_name, (Py_ssize_t)type, + value) < 0) { + return NULL; + } Py_BEGIN_ALLOW_THREADS rc = RegSetValueExW(key, value_name, 0, type, data, len); Py_END_ALLOW_THREADS @@ -1727,6 +1819,10 @@ winreg_DisableReflectionKey_impl(PyObject *module, HKEY key) RDRKFunc pfn = NULL; LONG rc; + if (PySys_Audit("winreg.DisableReflectionKey", "n", (Py_ssize_t)key) < 0) { + return NULL; + } + /* Only available on 64bit platforms, so we must load it dynamically.*/ Py_BEGIN_ALLOW_THREADS @@ -1772,6 +1868,10 @@ winreg_EnableReflectionKey_impl(PyObject *module, HKEY key) RERKFunc pfn = NULL; LONG rc; + if (PySys_Audit("winreg.EnableReflectionKey", "n", (Py_ssize_t)key) < 0) { + return NULL; + } + /* Only available on 64bit platforms, so we must load it dynamically.*/ Py_BEGIN_ALLOW_THREADS @@ -1816,6 +1916,10 @@ winreg_QueryReflectionKey_impl(PyObject *module, HKEY key) BOOL result; LONG rc; + if (PySys_Audit("winreg.QueryReflectionKey", "n", (Py_ssize_t)key) < 0) { + return NULL; + } + /* Only available on 64bit platforms, so we must load it dynamically.*/ Py_BEGIN_ALLOW_THREADS From webhook-mailer at python.org Mon Dec 9 15:22:24 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 09 Dec 2019 20:22:24 -0000 Subject: [Python-checkins] bpo-27961: Replace PY_ULLONG_MAX with ULLONG_MAX (GH-17539) Message-ID: https://github.com/python/cpython/commit/a2ff283d519be11f50220885ddc4d029eb8cb0a0 commit: a2ff283d519be11f50220885ddc4d029eb8cb0a0 branch: master author: Sergey Fedoseev committer: Victor Stinner date: 2019-12-09T21:22:19+01:00 summary: bpo-27961: Replace PY_ULLONG_MAX with ULLONG_MAX (GH-17539) files: M Doc/c-api/long.rst diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index 5a6d09ad1bddd..c360104592078 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -304,7 +304,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate. it to a :c:type:`PyLongObject`. If the value of *obj* is out of range for an :c:type:`unsigned long long`, - return the reduction of that value modulo ``PY_ULLONG_MAX + 1``. + return the reduction of that value modulo ``ULLONG_MAX + 1``. Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate. From webhook-mailer at python.org Mon Dec 9 17:16:05 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Mon, 09 Dec 2019 22:16:05 -0000 Subject: [Python-checkins] bpo-39009: Fix typo in test__locale (GH-17544) Message-ID: https://github.com/python/cpython/commit/2ad7651c00c9b58b2b8b9e3687c82c203ece576c commit: 2ad7651c00c9b58b2b8b9e3687c82c203ece576c branch: master author: Tim Gates committer: Pablo Galindo date: 2019-12-09T22:16:00Z summary: bpo-39009: Fix typo in test__locale (GH-17544) files: M Lib/test/test__locale.py diff --git a/Lib/test/test__locale.py b/Lib/test/test__locale.py index ab4e24796188c..cda0ee91b700f 100644 --- a/Lib/test/test__locale.py +++ b/Lib/test/test__locale.py @@ -30,7 +30,7 @@ def setUpModule(): global candidate_locales # Issue #13441: Skip some locales (e.g. cs_CZ and hu_HU) on Solaris to # workaround a mbstowcs() bug. For example, on Solaris, the hu_HU locale uses - # the locale encoding ISO-8859-2, the thousauds separator is b'\xA0' and it is + # the locale encoding ISO-8859-2, the thousands separator is b'\xA0' and it is # decoded as U+30000020 (an invalid character) by mbstowcs(). if sys.platform == 'sunos5': old_locale = locale.setlocale(locale.LC_ALL) From webhook-mailer at python.org Mon Dec 9 18:22:21 2019 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Mon, 09 Dec 2019 23:22:21 -0000 Subject: [Python-checkins] bpo-38944: Escape key now closes IDLE completion windows. (GH-17419) Message-ID: https://github.com/python/cpython/commit/232689b40d8fcbbac27c8705607ff482ea5b46f8 commit: 232689b40d8fcbbac27c8705607ff482ea5b46f8 branch: master author: JohnnyNajera <58344607+JohnnyNajera at users.noreply.github.com> committer: Terry Jan Reedy date: 2019-12-09T18:22:16-05:00 summary: bpo-38944: Escape key now closes IDLE completion windows. (GH-17419) files: A Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst M Lib/idlelib/NEWS.txt M Lib/idlelib/autocomplete_w.py diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 5eb77398d95e6..90e7d801535f5 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,6 +3,9 @@ Released on 2020-10-05? ====================================== +bpo-38944: Excape key now closes IDLE completion windows. Patch by +Johnny Najera. + bpo-38862: 'Strip Trailing Whitespace' on the Format menu removes extra newlines at the end of non-shell files. diff --git a/Lib/idlelib/autocomplete_w.py b/Lib/idlelib/autocomplete_w.py index 5035e067392e5..f20b633099788 100644 --- a/Lib/idlelib/autocomplete_w.py +++ b/Lib/idlelib/autocomplete_w.py @@ -17,7 +17,7 @@ # before the default specific IDLE function KEYPRESS_SEQUENCES = ("", "", "", "", "", "", "", "", - "", "") + "", "", "") KEYRELEASE_VIRTUAL_EVENT_NAME = "<>" KEYRELEASE_SEQUENCE = "" LISTUPDATE_SEQUENCE = "" diff --git a/Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst b/Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst new file mode 100644 index 0000000000000..38084fafd2f56 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst @@ -0,0 +1 @@ +Excape key now closes IDLE completion windows. Patch by Johnny Najera. From webhook-mailer at python.org Mon Dec 9 18:38:38 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 09 Dec 2019 23:38:38 -0000 Subject: [Python-checkins] bpo-38944: Escape key now closes IDLE completion windows. (GH-17419) Message-ID: https://github.com/python/cpython/commit/2b2c7bf231aadc0dd985e02549b1a8b93334047a commit: 2b2c7bf231aadc0dd985e02549b1a8b93334047a branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-09T15:38:33-08:00 summary: bpo-38944: Escape key now closes IDLE completion windows. (GH-17419) (cherry picked from commit 232689b40d8fcbbac27c8705607ff482ea5b46f8) Co-authored-by: JohnnyNajera <58344607+JohnnyNajera at users.noreply.github.com> files: A Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst M Lib/idlelib/NEWS.txt M Lib/idlelib/autocomplete_w.py diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index ed5cd4dc03b31..900ec5b33d30d 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,6 +3,9 @@ Released on 2019-12-16? ====================================== +bpo-38944: Excape key now closes IDLE completion windows. Patch by +Johnny Najera. + bpo-38862: 'Strip Trailing Whitespace' on the Format menu removes extra newlines at the end of non-shell files. diff --git a/Lib/idlelib/autocomplete_w.py b/Lib/idlelib/autocomplete_w.py index 5035e067392e5..f20b633099788 100644 --- a/Lib/idlelib/autocomplete_w.py +++ b/Lib/idlelib/autocomplete_w.py @@ -17,7 +17,7 @@ # before the default specific IDLE function KEYPRESS_SEQUENCES = ("", "", "", "", "", "", "", "", - "", "") + "", "", "") KEYRELEASE_VIRTUAL_EVENT_NAME = "<>" KEYRELEASE_SEQUENCE = "" LISTUPDATE_SEQUENCE = "" diff --git a/Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst b/Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst new file mode 100644 index 0000000000000..38084fafd2f56 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst @@ -0,0 +1 @@ +Excape key now closes IDLE completion windows. Patch by Johnny Najera. From webhook-mailer at python.org Mon Dec 9 18:40:17 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 09 Dec 2019 23:40:17 -0000 Subject: [Python-checkins] bpo-38944: Escape key now closes IDLE completion windows. (GH-17419) Message-ID: https://github.com/python/cpython/commit/4e0e452dd06a0f3565d94075188d1fd1f60d4d65 commit: 4e0e452dd06a0f3565d94075188d1fd1f60d4d65 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-09T15:40:09-08:00 summary: bpo-38944: Escape key now closes IDLE completion windows. (GH-17419) (cherry picked from commit 232689b40d8fcbbac27c8705607ff482ea5b46f8) Co-authored-by: JohnnyNajera <58344607+JohnnyNajera at users.noreply.github.com> files: A Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst M Lib/idlelib/NEWS.txt M Lib/idlelib/autocomplete_w.py diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index efac152e4d03c..0aede29d64899 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,6 +3,9 @@ Released on 2019-12-16? ====================================== +bpo-38944: Excape key now closes IDLE completion windows. Patch by +Johnny Najera. + bpo-38862: 'Strip Trailing Whitespace' on the Format menu removes extra newlines at the end of non-shell files. diff --git a/Lib/idlelib/autocomplete_w.py b/Lib/idlelib/autocomplete_w.py index 5035e067392e5..f20b633099788 100644 --- a/Lib/idlelib/autocomplete_w.py +++ b/Lib/idlelib/autocomplete_w.py @@ -17,7 +17,7 @@ # before the default specific IDLE function KEYPRESS_SEQUENCES = ("", "", "", "", "", "", "", "", - "", "") + "", "", "") KEYRELEASE_VIRTUAL_EVENT_NAME = "<>" KEYRELEASE_SEQUENCE = "" LISTUPDATE_SEQUENCE = "" diff --git a/Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst b/Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst new file mode 100644 index 0000000000000..38084fafd2f56 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst @@ -0,0 +1 @@ +Excape key now closes IDLE completion windows. Patch by Johnny Najera. From webhook-mailer at python.org Mon Dec 9 19:30:09 2019 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Tue, 10 Dec 2019 00:30:09 -0000 Subject: [Python-checkins] bpo-38943: Fix IDLE autocomplete window not always appearing (GH-17416) Message-ID: https://github.com/python/cpython/commit/bbc4162bafe018f07bab0b624b37974cc33daad9 commit: bbc4162bafe018f07bab0b624b37974cc33daad9 branch: master author: JohnnyNajera <58344607+JohnnyNajera at users.noreply.github.com> committer: Terry Jan Reedy date: 2019-12-09T19:30:01-05:00 summary: bpo-38943: Fix IDLE autocomplete window not always appearing (GH-17416) This has happened on some versions of Ubuntu. files: A Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst M Lib/idlelib/NEWS.txt M Lib/idlelib/autocomplete_w.py diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 90e7d801535f5..304cf6375f7dc 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,6 +3,9 @@ Released on 2020-10-05? ====================================== +bpo-38943: Fix autocomplete windows not always appearing on some +systems. Patch by Johnny Najera. + bpo-38944: Excape key now closes IDLE completion windows. Patch by Johnny Najera. diff --git a/Lib/idlelib/autocomplete_w.py b/Lib/idlelib/autocomplete_w.py index f20b633099788..0643c092c6e54 100644 --- a/Lib/idlelib/autocomplete_w.py +++ b/Lib/idlelib/autocomplete_w.py @@ -257,6 +257,7 @@ def winconfig_event(self, event): # place acw above current line new_y -= acw_height acw.wm_geometry("+%d+%d" % (new_x, new_y)) + acw.update_idletasks() if platform.system().startswith('Windows'): # See issue 15786. When on Windows platform, Tk will misbehave diff --git a/Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst b/Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst new file mode 100644 index 0000000000000..5c9323e246787 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst @@ -0,0 +1,2 @@ +Fix IDLE autocomplete windows not always appearing on some systems. +Patch by Johnny Najera. From webhook-mailer at python.org Mon Dec 9 19:37:55 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Tue, 10 Dec 2019 00:37:55 -0000 Subject: [Python-checkins] Clean imports in test_unparse (GH-17545) Message-ID: https://github.com/python/cpython/commit/e9df88e8e9ce8e5a6be30dd1d06bc76b8e9f0fdc commit: e9df88e8e9ce8e5a6be30dd1d06bc76b8e9f0fdc branch: master author: Pablo Galindo committer: GitHub date: 2019-12-10T00:37:47Z summary: Clean imports in test_unparse (GH-17545) files: M Lib/test/test_unparse.py diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py index 96110260f550a..45d819f175bb9 100644 --- a/Lib/test/test_unparse.py +++ b/Lib/test/test_unparse.py @@ -2,12 +2,10 @@ import unittest import test.support -import io import pathlib import random import tokenize import ast -import functools def read_pyfile(filename): From webhook-mailer at python.org Mon Dec 9 19:46:21 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 10 Dec 2019 00:46:21 -0000 Subject: [Python-checkins] bpo-38943: Fix IDLE autocomplete window not always appearing (GH-17416) Message-ID: https://github.com/python/cpython/commit/1b0e88dde146eb290735f4b486d4a67074132100 commit: 1b0e88dde146eb290735f4b486d4a67074132100 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-09T16:46:14-08:00 summary: bpo-38943: Fix IDLE autocomplete window not always appearing (GH-17416) This has happened on some versions of Ubuntu. (cherry picked from commit bbc4162bafe018f07bab0b624b37974cc33daad9) Co-authored-by: JohnnyNajera <58344607+JohnnyNajera at users.noreply.github.com> files: A Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst M Lib/idlelib/NEWS.txt M Lib/idlelib/autocomplete_w.py diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 0aede29d64899..5caa98e3fcc9b 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,6 +3,9 @@ Released on 2019-12-16? ====================================== +bpo-38943: Fix autocomplete windows not always appearing on some +systems. Patch by Johnny Najera. + bpo-38944: Excape key now closes IDLE completion windows. Patch by Johnny Najera. diff --git a/Lib/idlelib/autocomplete_w.py b/Lib/idlelib/autocomplete_w.py index f20b633099788..0643c092c6e54 100644 --- a/Lib/idlelib/autocomplete_w.py +++ b/Lib/idlelib/autocomplete_w.py @@ -257,6 +257,7 @@ def winconfig_event(self, event): # place acw above current line new_y -= acw_height acw.wm_geometry("+%d+%d" % (new_x, new_y)) + acw.update_idletasks() if platform.system().startswith('Windows'): # See issue 15786. When on Windows platform, Tk will misbehave diff --git a/Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst b/Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst new file mode 100644 index 0000000000000..5c9323e246787 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst @@ -0,0 +1,2 @@ +Fix IDLE autocomplete windows not always appearing on some systems. +Patch by Johnny Najera. From webhook-mailer at python.org Mon Dec 9 19:48:24 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 10 Dec 2019 00:48:24 -0000 Subject: [Python-checkins] bpo-38943: Fix IDLE autocomplete window not always appearing (GH-17416) Message-ID: https://github.com/python/cpython/commit/34d5d5e096ee804e94199bf242469cdf9bbc3316 commit: 34d5d5e096ee804e94199bf242469cdf9bbc3316 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-09T16:48:20-08:00 summary: bpo-38943: Fix IDLE autocomplete window not always appearing (GH-17416) This has happened on some versions of Ubuntu. (cherry picked from commit bbc4162bafe018f07bab0b624b37974cc33daad9) Co-authored-by: JohnnyNajera <58344607+JohnnyNajera at users.noreply.github.com> files: A Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst M Lib/idlelib/NEWS.txt M Lib/idlelib/autocomplete_w.py diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 900ec5b33d30d..e829bc910ea87 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,6 +3,9 @@ Released on 2019-12-16? ====================================== +bpo-38943: Fix autocomplete windows not always appearing on some +systems. Patch by Johnny Najera. + bpo-38944: Excape key now closes IDLE completion windows. Patch by Johnny Najera. diff --git a/Lib/idlelib/autocomplete_w.py b/Lib/idlelib/autocomplete_w.py index f20b633099788..0643c092c6e54 100644 --- a/Lib/idlelib/autocomplete_w.py +++ b/Lib/idlelib/autocomplete_w.py @@ -257,6 +257,7 @@ def winconfig_event(self, event): # place acw above current line new_y -= acw_height acw.wm_geometry("+%d+%d" % (new_x, new_y)) + acw.update_idletasks() if platform.system().startswith('Windows'): # See issue 15786. When on Windows platform, Tk will misbehave diff --git a/Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst b/Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst new file mode 100644 index 0000000000000..5c9323e246787 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst @@ -0,0 +1,2 @@ +Fix IDLE autocomplete windows not always appearing on some systems. +Patch by Johnny Najera. From webhook-mailer at python.org Mon Dec 9 20:35:32 2019 From: webhook-mailer at python.org (Raymond Hettinger) Date: Tue, 10 Dec 2019 01:35:32 -0000 Subject: [Python-checkins] bpo-39002: Fix simple typo: tranlation -> translation (GH-17517) (GH-17538) Message-ID: https://github.com/python/cpython/commit/859767d58ea8e34313f00fc102a810efff285941 commit: 859767d58ea8e34313f00fc102a810efff285941 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Raymond Hettinger date: 2019-12-09T17:35:25-08:00 summary: bpo-39002: Fix simple typo: tranlation -> translation (GH-17517) (GH-17538) (cherry picked from commit c18b805ac6a2d22176240ca93982fa1fb6559ec7) Co-authored-by: Tim Gates files: A Misc/NEWS.d/next/Documentation/2019-12-09-10-12-00.bpo-39002.AfgvfO.rst M Lib/test/test_statistics.py M Misc/ACKS diff --git a/Lib/test/test_statistics.py b/Lib/test/test_statistics.py index bebd9b5d6f502..a9a427bc8d972 100644 --- a/Lib/test/test_statistics.py +++ b/Lib/test/test_statistics.py @@ -2192,7 +2192,7 @@ def test_specific_cases(self): quantiles(padded_data, n=n, method='inclusive'), (n, data), ) - # Invariant under tranlation and scaling + # Invariant under translation and scaling def f(x): return 3.5 * x - 1234.675 exp = list(map(f, expected)) @@ -2232,7 +2232,7 @@ def test_specific_cases_inclusive(self): result = quantiles(map(datatype, data), n=n, method="inclusive") self.assertTrue(all(type(x) == datatype) for x in result) self.assertEqual(result, list(map(datatype, expected))) - # Invariant under tranlation and scaling + # Invariant under translation and scaling def f(x): return 3.5 * x - 1234.675 exp = list(map(f, expected)) diff --git a/Misc/ACKS b/Misc/ACKS index 62c5928c508ff..a17db45657631 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1885,3 +1885,4 @@ Batuhan Taskaya Aleksandr Balezin Robert Leenders Ngalim Siregar +Tim Gates diff --git a/Misc/NEWS.d/next/Documentation/2019-12-09-10-12-00.bpo-39002.AfgvfO.rst b/Misc/NEWS.d/next/Documentation/2019-12-09-10-12-00.bpo-39002.AfgvfO.rst new file mode 100644 index 0000000000000..a6dfa22eb7a16 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2019-12-09-10-12-00.bpo-39002.AfgvfO.rst @@ -0,0 +1 @@ +Fix simple typo in Lib/test/test_statistics.py. From webhook-mailer at python.org Tue Dec 10 00:10:29 2019 From: webhook-mailer at python.org (Steve Dower) Date: Tue, 10 Dec 2019 05:10:29 -0000 Subject: [Python-checkins] Fix Windows release builds (GH-17550) Message-ID: https://github.com/python/cpython/commit/abdeb57a212556b4cd3568cca7d316d71a5b8cf0 commit: abdeb57a212556b4cd3568cca7d316d71a5b8cf0 branch: master author: Steve Dower committer: GitHub date: 2019-12-09T21:10:22-08:00 summary: Fix Windows release builds (GH-17550) files: M .azure-pipelines/windows-release/build-steps.yml M .azure-pipelines/windows-release/stage-build.yml diff --git a/.azure-pipelines/windows-release/build-steps.yml b/.azure-pipelines/windows-release/build-steps.yml index e2b6683f46e3c..5ca2016d65f9e 100644 --- a/.azure-pipelines/windows-release/build-steps.yml +++ b/.azure-pipelines/windows-release/build-steps.yml @@ -43,7 +43,7 @@ steps: - powershell: | $env:SigningCertificate = $null - python PC\layout -vv -b "$(Build.BinariesDirectory)\bin" -t "$(Build.BinariesDirectory)\catalog" --catalog "${env:CAT}.cdf" --preset-default --arch $(Arch) + $(_HostPython) PC\layout -vv -b "$(Build.BinariesDirectory)\bin" -t "$(Build.BinariesDirectory)\catalog" --catalog "${env:CAT}.cdf" --preset-default --arch $(Arch) makecat "${env:CAT}.cdf" del "${env:CAT}.cdf" if (-not (Test-Path "${env:CAT}.cat")) { diff --git a/.azure-pipelines/windows-release/stage-build.yml b/.azure-pipelines/windows-release/stage-build.yml index 60d72b282d1e5..9391a91e30b5e 100644 --- a/.azure-pipelines/windows-release/stage-build.yml +++ b/.azure-pipelines/windows-release/stage-build.yml @@ -57,26 +57,31 @@ jobs: Arch: win32 Platform: x86 Configuration: Release + _HostPython: .\python win32_d: Name: win32_d Arch: win32 Platform: x86 Configuration: Debug + _HostPython: .\python amd64_d: Name: amd64_d Arch: amd64 Platform: x64 Configuration: Debug + _HostPython: .\python arm64: Name: arm64 Arch: arm64 Platform: ARM64 Configuration: Release + _HostPython: python arm64_d: Name: arm64_d Arch: arm64 Platform: ARM64 Configuration: Debug + _HostPython: python steps: - template: ./build-steps.yml @@ -98,6 +103,7 @@ jobs: Arch: amd64 Platform: x64 Configuration: Release + _HostPython: .\python steps: - template: ./build-steps.yml @@ -123,6 +129,7 @@ jobs: Arch: amd64 Platform: x64 Configuration: Release + _HostPython: .\python steps: - template: ./build-steps.yml From webhook-mailer at python.org Tue Dec 10 00:28:18 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 10 Dec 2019 05:28:18 -0000 Subject: [Python-checkins] Fix Windows release builds (GH-17550) Message-ID: https://github.com/python/cpython/commit/4ce626eeff8e3fce3cf3d9692a9c6e3ed013442a commit: 4ce626eeff8e3fce3cf3d9692a9c6e3ed013442a branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-09T21:28:10-08:00 summary: Fix Windows release builds (GH-17550) (cherry picked from commit abdeb57a212556b4cd3568cca7d316d71a5b8cf0) Co-authored-by: Steve Dower files: M .azure-pipelines/windows-release/build-steps.yml M .azure-pipelines/windows-release/stage-build.yml diff --git a/.azure-pipelines/windows-release/build-steps.yml b/.azure-pipelines/windows-release/build-steps.yml index e2b6683f46e3c..5ca2016d65f9e 100644 --- a/.azure-pipelines/windows-release/build-steps.yml +++ b/.azure-pipelines/windows-release/build-steps.yml @@ -43,7 +43,7 @@ steps: - powershell: | $env:SigningCertificate = $null - python PC\layout -vv -b "$(Build.BinariesDirectory)\bin" -t "$(Build.BinariesDirectory)\catalog" --catalog "${env:CAT}.cdf" --preset-default --arch $(Arch) + $(_HostPython) PC\layout -vv -b "$(Build.BinariesDirectory)\bin" -t "$(Build.BinariesDirectory)\catalog" --catalog "${env:CAT}.cdf" --preset-default --arch $(Arch) makecat "${env:CAT}.cdf" del "${env:CAT}.cdf" if (-not (Test-Path "${env:CAT}.cat")) { diff --git a/.azure-pipelines/windows-release/stage-build.yml b/.azure-pipelines/windows-release/stage-build.yml index 60d72b282d1e5..9391a91e30b5e 100644 --- a/.azure-pipelines/windows-release/stage-build.yml +++ b/.azure-pipelines/windows-release/stage-build.yml @@ -57,26 +57,31 @@ jobs: Arch: win32 Platform: x86 Configuration: Release + _HostPython: .\python win32_d: Name: win32_d Arch: win32 Platform: x86 Configuration: Debug + _HostPython: .\python amd64_d: Name: amd64_d Arch: amd64 Platform: x64 Configuration: Debug + _HostPython: .\python arm64: Name: arm64 Arch: arm64 Platform: ARM64 Configuration: Release + _HostPython: python arm64_d: Name: arm64_d Arch: arm64 Platform: ARM64 Configuration: Debug + _HostPython: python steps: - template: ./build-steps.yml @@ -98,6 +103,7 @@ jobs: Arch: amd64 Platform: x64 Configuration: Release + _HostPython: .\python steps: - template: ./build-steps.yml @@ -123,6 +129,7 @@ jobs: Arch: amd64 Platform: x64 Configuration: Release + _HostPython: .\python steps: - template: ./build-steps.yml From webhook-mailer at python.org Tue Dec 10 04:31:24 2019 From: webhook-mailer at python.org (Giampaolo Rodola) Date: Tue, 10 Dec 2019 09:31:24 -0000 Subject: [Python-checkins] bpo-39004: increment large sendfile() test timeout (GH-17552) Message-ID: https://github.com/python/cpython/commit/82374979ec7e01e23385dca1d02b2aa3de16fea5 commit: 82374979ec7e01e23385dca1d02b2aa3de16fea5 branch: master author: Giampaolo Rodola committer: GitHub date: 2019-12-10T17:31:06+08:00 summary: bpo-39004: increment large sendfile() test timeout (GH-17552) files: M Lib/test/test_largefile.py diff --git a/Lib/test/test_largefile.py b/Lib/test/test_largefile.py index 6c8813e062602..e309282d73e2a 100644 --- a/Lib/test/test_largefile.py +++ b/Lib/test/test_largefile.py @@ -9,6 +9,7 @@ import shutil import threading from test.support import TESTFN, requires, unlink, bigmemtest, find_unused_port +from test.support import SHORT_TIMEOUT import io # C implementation of io import _pyio as pyio # Python implementation of io @@ -168,7 +169,7 @@ def test_it(self): @unittest.skipIf(not hasattr(os, 'sendfile'), 'sendfile not supported') class TestSocketSendfile(LargeFileTest, unittest.TestCase): open = staticmethod(io.open) - timeout = 3 + timeout = SHORT_TIMEOUT def setUp(self): super().setUp() @@ -184,6 +185,7 @@ def tcp_server(self, sock): def run(sock): with sock: conn, _ = sock.accept() + conn.settimeout(self.timeout) with conn, open(TESTFN2, 'wb') as f: event.wait(self.timeout) while True: From webhook-mailer at python.org Tue Dec 10 11:10:06 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Tue, 10 Dec 2019 16:10:06 -0000 Subject: [Python-checkins] Minor fixes to the NEWS entries (GH-17556) Message-ID: https://github.com/python/cpython/commit/680068c28896baba36fa7361976e07bb0f588561 commit: 680068c28896baba36fa7361976e07bb0f588561 branch: master author: Pablo Galindo committer: GitHub date: 2019-12-10T16:09:58Z summary: Minor fixes to the NEWS entries (GH-17556) files: D Misc/NEWS.d/next/Documentation/2019-12-09-10-12-00.bpo-39002.AfgvfO.rst M Misc/NEWS.d/3.9.0a1.rst diff --git a/Misc/NEWS.d/3.9.0a1.rst b/Misc/NEWS.d/3.9.0a1.rst index 2c79bcaf41fef..fb74d3622263d 100644 --- a/Misc/NEWS.d/3.9.0a1.rst +++ b/Misc/NEWS.d/3.9.0a1.rst @@ -5451,7 +5451,7 @@ to pathscript.py script: add flags. .. nonce: oOGVdo .. section: C API -Re?xport some function compatibility wrappers for macros in ``pythonrun.h``. +Re-export some function compatibility wrappers for macros in ``pythonrun.h``. .. diff --git a/Misc/NEWS.d/next/Documentation/2019-12-09-10-12-00.bpo-39002.AfgvfO.rst b/Misc/NEWS.d/next/Documentation/2019-12-09-10-12-00.bpo-39002.AfgvfO.rst deleted file mode 100644 index a6dfa22eb7a16..0000000000000 --- a/Misc/NEWS.d/next/Documentation/2019-12-09-10-12-00.bpo-39002.AfgvfO.rst +++ /dev/null @@ -1 +0,0 @@ -Fix simple typo in Lib/test/test_statistics.py. From webhook-mailer at python.org Tue Dec 10 11:11:38 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 10 Dec 2019 16:11:38 -0000 Subject: [Python-checkins] [3.8] Minor fixes to the NEWS entries (GH-17557) Message-ID: https://github.com/python/cpython/commit/3ac65a7161ddf492050302e0c7d67d1d81cb4930 commit: 3ac65a7161ddf492050302e0c7d67d1d81cb4930 branch: 3.8 author: Pablo Galindo committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-10T08:11:33-08:00 summary: [3.8] Minor fixes to the NEWS entries (GH-17557) Automerge-Triggered-By: @pablogsal files: D Misc/NEWS.d/next/Documentation/2019-12-09-10-12-00.bpo-39002.AfgvfO.rst M Misc/NEWS.d/3.8.1rc1.rst diff --git a/Misc/NEWS.d/3.8.1rc1.rst b/Misc/NEWS.d/3.8.1rc1.rst index 958a8b7b80025..351996433c4cf 100644 --- a/Misc/NEWS.d/3.8.1rc1.rst +++ b/Misc/NEWS.d/3.8.1rc1.rst @@ -753,7 +753,7 @@ Do not try to compile IDLE shell or output windows .. nonce: oOGVdo .. section: C API -Re?xport some function compatibility wrappers for macros in ``pythonrun.h``. +Re-export some function compatibility wrappers for macros in ``pythonrun.h``. .. diff --git a/Misc/NEWS.d/next/Documentation/2019-12-09-10-12-00.bpo-39002.AfgvfO.rst b/Misc/NEWS.d/next/Documentation/2019-12-09-10-12-00.bpo-39002.AfgvfO.rst deleted file mode 100644 index a6dfa22eb7a16..0000000000000 --- a/Misc/NEWS.d/next/Documentation/2019-12-09-10-12-00.bpo-39002.AfgvfO.rst +++ /dev/null @@ -1 +0,0 @@ -Fix simple typo in Lib/test/test_statistics.py. From webhook-mailer at python.org Tue Dec 10 14:33:13 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 10 Dec 2019 19:33:13 -0000 Subject: [Python-checkins] bpo-38614: Use test.support.LOOPBACK_TIMEOUT constant (GH-17554) Message-ID: https://github.com/python/cpython/commit/07871b256c76ca561554d1f82b430fc64a5c7ee0 commit: 07871b256c76ca561554d1f82b430fc64a5c7ee0 branch: master author: Victor Stinner committer: GitHub date: 2019-12-10T20:32:59+01:00 summary: bpo-38614: Use test.support.LOOPBACK_TIMEOUT constant (GH-17554) Replace hardcoded timeout constants in tests with LOOPBACK_TIMEOUT of test.support, so it's easier to ajdust this timeout for all tests at once. files: A Misc/NEWS.d/next/Tests/2019-12-10-14-26-23.bpo-38614.89JpNh.rst M Lib/test/ssl_servers.py M Lib/test/test_asyncio/functional.py M Lib/test/test_asyncio/test_events.py M Lib/test/test_asyncio/test_sslproto.py M Lib/test/test_asyncio/utils.py M Lib/test/test_ftplib.py M Lib/test/test_imaplib.py M Lib/test/test_smtplib.py M Lib/test/test_timeout.py diff --git a/Lib/test/ssl_servers.py b/Lib/test/ssl_servers.py index bfe533c48011d..2e7e2359f565b 100644 --- a/Lib/test/ssl_servers.py +++ b/Lib/test/ssl_servers.py @@ -49,7 +49,7 @@ class RootedHTTPRequestHandler(SimpleHTTPRequestHandler): server_version = "TestHTTPS/1.0" root = here # Avoid hanging when a request gets interrupted by the client - timeout = 5 + timeout = support.LOOPBACK_TIMEOUT def translate_path(self, path): """Translate a /-separated PATH to the local filename syntax. diff --git a/Lib/test/test_asyncio/functional.py b/Lib/test/test_asyncio/functional.py index 4620d3e7a3319..5cd0659387d84 100644 --- a/Lib/test/test_asyncio/functional.py +++ b/Lib/test/test_asyncio/functional.py @@ -7,6 +7,7 @@ import socket import tempfile import threading +from test import support class FunctionalTestCaseMixin: @@ -49,7 +50,7 @@ def tearDown(self): def tcp_server(self, server_prog, *, family=socket.AF_INET, addr=None, - timeout=5, + timeout=support.LOOPBACK_TIMEOUT, backlog=1, max_clients=10): @@ -72,7 +73,7 @@ def tcp_server(self, server_prog, *, def tcp_client(self, client_prog, family=socket.AF_INET, - timeout=10): + timeout=support.LOOPBACK_TIMEOUT): sock = socket.socket(family, socket.SOCK_STREAM) diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index 7256758465da1..5ffb3d3fbac53 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -724,7 +724,7 @@ def test_connect_accepted_socket_ssl_timeout_for_plain_socket(self): sock = socket.socket() self.addCleanup(sock.close) coro = self.loop.connect_accepted_socket( - MyProto, sock, ssl_handshake_timeout=1) + MyProto, sock, ssl_handshake_timeout=support.LOOPBACK_TIMEOUT) with self.assertRaisesRegex( ValueError, 'ssl_handshake_timeout is only meaningful with ssl'): diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py index a7c089018ab43..7ba3d7361ad8a 100644 --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -3,6 +3,7 @@ import logging import socket import sys +from test import support import unittest import weakref from unittest import mock @@ -699,7 +700,7 @@ def server(sock): ssl=client_sslctx, server_hostname='', loop=self.loop, - ssl_handshake_timeout=1.0) + ssl_handshake_timeout=support.LOOPBACK_TIMEOUT) with self.tcp_server(server, max_clients=1, diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py index ea608f4a10c7f..6d8a6e2ac1368 100644 --- a/Lib/test/test_asyncio/utils.py +++ b/Lib/test/test_asyncio/utils.py @@ -139,7 +139,7 @@ def log_message(self, format, *args): class SilentWSGIServer(WSGIServer): - request_timeout = 2 + request_timeout = support.LOOPBACK_TIMEOUT def get_request(self): request, client_addr = super().get_request() @@ -220,7 +220,7 @@ def server_bind(self): class UnixWSGIServer(UnixHTTPServer, WSGIServer): - request_timeout = 2 + request_timeout = support.LOOPBACK_TIMEOUT def server_bind(self): UnixHTTPServer.server_bind(self) diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py index b8eef82b15fb3..62f673c06156a 100644 --- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@ -21,7 +21,7 @@ from test import support from test.support import HOST, HOSTv6 -TIMEOUT = 3 +TIMEOUT = support.LOOPBACK_TIMEOUT # the dummy data returned by server over the data channel when # RETR, LIST, NLST, MLSD commands are issued RETR_DATA = 'abcde12345\r\n' * 1000 diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index 03cffbe39c6c7..846392ebcb68a 100644 --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -109,7 +109,7 @@ class SecureTCPServer: class SimpleIMAPHandler(socketserver.StreamRequestHandler): - timeout = 1 + timeout = support.LOOPBACK_TIMEOUT continuation = None capabilities = '' diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py index d0c9862edea93..a3e5b3f3774c6 100644 --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -245,7 +245,8 @@ def get_output_without_xpeer(self): def testBasic(self): # connect - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) smtp.quit() def testSourceAddress(self): @@ -253,7 +254,8 @@ def testSourceAddress(self): src_port = support.find_unused_port() try: smtp = smtplib.SMTP(self.host, self.port, local_hostname='localhost', - timeout=3, source_address=(self.host, src_port)) + timeout=support.LOOPBACK_TIMEOUT, + source_address=(self.host, src_port)) self.addCleanup(smtp.close) self.assertEqual(smtp.source_address, (self.host, src_port)) self.assertEqual(smtp.local_hostname, 'localhost') @@ -264,14 +266,16 @@ def testSourceAddress(self): raise def testNOOP(self): - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) expected = (250, b'OK') self.assertEqual(smtp.noop(), expected) smtp.quit() def testRSET(self): - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) expected = (250, b'OK') self.assertEqual(smtp.rset(), expected) @@ -279,7 +283,8 @@ def testRSET(self): def testELHO(self): # EHLO isn't implemented in DebuggingServer - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) expected = (250, b'\nSIZE 33554432\nHELP') self.assertEqual(smtp.ehlo(), expected) @@ -287,7 +292,8 @@ def testELHO(self): def testEXPNNotImplemented(self): # EXPN isn't implemented in DebuggingServer - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) expected = (502, b'EXPN not implemented') smtp.putcmd('EXPN') @@ -295,7 +301,8 @@ def testEXPNNotImplemented(self): smtp.quit() def testVRFY(self): - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) expected = (252, b'Cannot VRFY user, but will accept message ' + \ b'and attempt delivery') @@ -306,7 +313,8 @@ def testVRFY(self): def testSecondHELO(self): # check that a second HELO returns a message that it's a duplicate # (this behavior is specific to smtpd.SMTPChannel) - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) smtp.helo() expected = (503, b'Duplicate HELO/EHLO') @@ -314,7 +322,8 @@ def testSecondHELO(self): smtp.quit() def testHELP(self): - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) self.assertEqual(smtp.help(), b'Supported commands: EHLO HELO MAIL ' + \ b'RCPT DATA RSET NOOP QUIT VRFY') @@ -323,7 +332,8 @@ def testHELP(self): def testSend(self): # connect and send mail m = 'A test message' - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) smtp.sendmail('John', 'Sally', m) # XXX(nnorwitz): this test is flaky and dies with a bad file descriptor @@ -340,7 +350,8 @@ def testSend(self): def testSendBinary(self): m = b'A test message' - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) smtp.sendmail('John', 'Sally', m) # XXX (see comment in testSend) @@ -356,7 +367,8 @@ def testSendBinary(self): def testSendNeedingDotQuote(self): # Issue 12283 m = '.A test\n.mes.sage.' - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) smtp.sendmail('John', 'Sally', m) # XXX (see comment in testSend) @@ -371,7 +383,8 @@ def testSendNeedingDotQuote(self): def testSendNullSender(self): m = 'A test message' - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) smtp.sendmail('<>', 'Sally', m) # XXX (see comment in testSend) @@ -389,7 +402,8 @@ def testSendNullSender(self): def testSendMessage(self): m = email.mime.text.MIMEText('A test message') - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) smtp.send_message(m, from_addr='John', to_addrs='Sally') # XXX (see comment in testSend) @@ -414,7 +428,8 @@ def testSendMessageWithAddresses(self): m['To'] = 'John' m['CC'] = 'Sally, Fred' m['Bcc'] = 'John Root , "Dinsdale" ' - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) smtp.send_message(m) # XXX (see comment in testSend) @@ -448,7 +463,8 @@ def testSendMessageWithSomeAddresses(self): m = email.mime.text.MIMEText('A test message') m['From'] = 'foo at bar.com' m['To'] = 'John, Dinsdale' - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) smtp.send_message(m) # XXX (see comment in testSend) @@ -476,7 +492,8 @@ def testSendMessageWithSpecifiedAddresses(self): m = email.mime.text.MIMEText('A test message') m['From'] = 'foo at bar.com' m['To'] = 'John, Dinsdale' - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) smtp.send_message(m, from_addr='joe at example.com', to_addrs='foo at example.net') # XXX (see comment in testSend) @@ -507,7 +524,8 @@ def testSendMessageWithMultipleFrom(self): m['From'] = 'Bernard, Bianca' m['Sender'] = 'the_rescuers at Rescue-Aid-Society.com' m['To'] = 'John, Dinsdale' - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) smtp.send_message(m) # XXX (see comment in testSend) @@ -540,7 +558,8 @@ def testSendMessageResent(self): m['Resent-From'] = 'holy at grail.net' m['Resent-To'] = 'Martha , Jeff' m['Resent-Bcc'] = 'doe at losthope.net' - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) smtp.send_message(m) # XXX (see comment in testSend) @@ -579,7 +598,8 @@ def testSendMessageMultipleResentRaises(self): m['Resent-Date'] = 'Thu, 2 Jan 1970 17:42:00 +0000' m['Resent-To'] = 'holy at grail.net' m['Resent-From'] = 'Martha , Jeff' - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) with self.assertRaises(ValueError): smtp.send_message(m) @@ -1130,7 +1150,8 @@ def found_terminator(self): def test_smtputf8_NotSupportedError_if_no_server_support(self): smtp = smtplib.SMTP( - HOST, self.port, local_hostname='localhost', timeout=3) + HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) smtp.ehlo() self.assertTrue(smtp.does_esmtp) @@ -1145,7 +1166,8 @@ def test_smtputf8_NotSupportedError_if_no_server_support(self): def test_send_unicode_without_SMTPUTF8(self): smtp = smtplib.SMTP( - HOST, self.port, local_hostname='localhost', timeout=3) + HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) self.assertRaises(UnicodeEncodeError, smtp.sendmail, 'Alice', 'B?b', '') self.assertRaises(UnicodeEncodeError, smtp.mail, '?lice') @@ -1158,15 +1180,16 @@ def test_send_message_error_on_non_ascii_addrs_if_no_smtputf8(self): msg['To'] = 'Dinsdale' msg['Subject'] = 'Nudge nudge, wink, wink \u1F609' smtp = smtplib.SMTP( - HOST, self.port, local_hostname='localhost', timeout=3) + HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) with self.assertRaises(smtplib.SMTPNotSupportedError): smtp.send_message(msg) def test_name_field_not_included_in_envelop_addresses(self): smtp = smtplib.SMTP( - HOST, self.port, local_hostname='localhost', timeout=3 - ) + HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) message = EmailMessage() @@ -1242,7 +1265,8 @@ def tearDown(self): def test_test_server_supports_extensions(self): smtp = smtplib.SMTP( - HOST, self.port, local_hostname='localhost', timeout=3) + HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) smtp.ehlo() self.assertTrue(smtp.does_esmtp) @@ -1251,7 +1275,8 @@ def test_test_server_supports_extensions(self): def test_send_unicode_with_SMTPUTF8_via_sendmail(self): m = '?a test message containing unicode!'.encode('utf-8') smtp = smtplib.SMTP( - HOST, self.port, local_hostname='localhost', timeout=3) + HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) smtp.sendmail('J?hn', 'S?lly', m, mail_options=['BODY=8BITMIME', 'SMTPUTF8']) @@ -1265,7 +1290,8 @@ def test_send_unicode_with_SMTPUTF8_via_sendmail(self): def test_send_unicode_with_SMTPUTF8_via_low_level_API(self): m = '?a test message containing unicode!'.encode('utf-8') smtp = smtplib.SMTP( - HOST, self.port, local_hostname='localhost', timeout=3) + HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) smtp.ehlo() self.assertEqual( @@ -1301,7 +1327,8 @@ def test_send_message_uses_smtputf8_if_addrs_non_ascii(self): oh l? l?, know what I mean, know what I mean? """) smtp = smtplib.SMTP( - HOST, self.port, local_hostname='localhost', timeout=3) + HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(smtp.close) self.assertEqual(smtp.send_message(msg), {}) self.assertEqual(self.serv.last_mailfrom, 'f?o at bar.com') diff --git a/Lib/test/test_timeout.py b/Lib/test/test_timeout.py index 0fe4c7ab6e755..ff41b13a6c839 100644 --- a/Lib/test/test_timeout.py +++ b/Lib/test/test_timeout.py @@ -199,10 +199,7 @@ def testConnectTimeout(self): skip = True sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - # Use a timeout of 3 seconds. Why 3? Because it's more than 1, and - # less than 5. i.e. no particular reason. Feel free to tweak it if - # you feel a different value would be more appropriate. - timeout = 3 + timeout = support.LOOPBACK_TIMEOUT sock.settimeout(timeout) try: sock.connect((whitehole)) diff --git a/Misc/NEWS.d/next/Tests/2019-12-10-14-26-23.bpo-38614.89JpNh.rst b/Misc/NEWS.d/next/Tests/2019-12-10-14-26-23.bpo-38614.89JpNh.rst new file mode 100644 index 0000000000000..df20f48d46308 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-12-10-14-26-23.bpo-38614.89JpNh.rst @@ -0,0 +1,3 @@ +Replace hardcoded timeout constants in tests with +:data:`~test.support.LOOPBACK_TIMEOUT` of :mod:`test.support`, so it's easier +to ajdust this timeout for all tests at once. From webhook-mailer at python.org Tue Dec 10 14:41:31 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 10 Dec 2019 19:41:31 -0000 Subject: [Python-checkins] bpo-38614: Use default join_thread() timeout in tests (GH-17559) Message-ID: https://github.com/python/cpython/commit/bbc8b7965bb9f46763c96878326966f4231c7d39 commit: bbc8b7965bb9f46763c96878326966f4231c7d39 branch: master author: Victor Stinner committer: GitHub date: 2019-12-10T20:41:23+01:00 summary: bpo-38614: Use default join_thread() timeout in tests (GH-17559) Tests no longer pass a timeout value to join_thread() of test.support: use the default join_thread() timeout instead (SHORT_TIMEOUT constant of test.support). files: M Lib/test/test_asynchat.py M Lib/test/test_asyncio/test_events.py M Lib/test/test_asyncore.py M Lib/test/test_imaplib.py M Lib/test/test_logging.py M Lib/test/test_queue.py M Lib/test/test_sched.py diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py index 74041ed58ef70..ce8505777a2ef 100644 --- a/Lib/test/test_asynchat.py +++ b/Lib/test/test_asynchat.py @@ -14,7 +14,6 @@ HOST = support.HOST SERVER_QUIT = b'QUIT\n' -TIMEOUT = 3.0 class echo_server(threading.Thread): @@ -122,7 +121,7 @@ def line_terminator_check(self, term, server_chunk): c.push(b"I'm not dead yet!" + term) c.push(SERVER_QUIT) asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) - support.join_thread(s, timeout=TIMEOUT) + support.join_thread(s) self.assertEqual(c.contents, [b"hello world", b"I'm not dead yet!"]) @@ -153,7 +152,7 @@ def numeric_terminator_check(self, termlen): c.push(data) c.push(SERVER_QUIT) asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) - support.join_thread(s, timeout=TIMEOUT) + support.join_thread(s) self.assertEqual(c.contents, [data[:termlen]]) @@ -173,7 +172,7 @@ def test_none_terminator(self): c.push(data) c.push(SERVER_QUIT) asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) - support.join_thread(s, timeout=TIMEOUT) + support.join_thread(s) self.assertEqual(c.contents, []) self.assertEqual(c.buffer, data) @@ -185,7 +184,7 @@ def test_simple_producer(self): p = asynchat.simple_producer(data+SERVER_QUIT, buffer_size=8) c.push_with_producer(p) asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) - support.join_thread(s, timeout=TIMEOUT) + support.join_thread(s) self.assertEqual(c.contents, [b"hello world", b"I'm not dead yet!"]) @@ -195,7 +194,7 @@ def test_string_producer(self): data = b"hello world\nI'm not dead yet!\n" c.push_with_producer(data+SERVER_QUIT) asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) - support.join_thread(s, timeout=TIMEOUT) + support.join_thread(s) self.assertEqual(c.contents, [b"hello world", b"I'm not dead yet!"]) @@ -206,7 +205,7 @@ def test_empty_line(self): c.push(b"hello world\n\nI'm not dead yet!\n") c.push(SERVER_QUIT) asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) - support.join_thread(s, timeout=TIMEOUT) + support.join_thread(s) self.assertEqual(c.contents, [b"hello world", b"", b"I'm not dead yet!"]) @@ -225,7 +224,7 @@ def test_close_when_done(self): # where the server echoes all of its data before we can check that it # got any down below. s.start_resend_event.set() - support.join_thread(s, timeout=TIMEOUT) + support.join_thread(s) self.assertEqual(c.contents, []) # the server might have been able to send a byte or two back, but this @@ -246,7 +245,7 @@ def test_push(self): self.assertRaises(TypeError, c.push, 'unicode') c.push(SERVER_QUIT) asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) - support.join_thread(s, timeout=TIMEOUT) + support.join_thread(s) self.assertEqual(c.contents, [b'bytes', b'bytes', b'bytes']) diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index 5ffb3d3fbac53..52467d8b290b3 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -699,7 +699,7 @@ def client(): proto.transport.close() lsock.close() - support.join_thread(thread, timeout=1) + support.join_thread(thread) self.assertFalse(thread.is_alive()) self.assertEqual(proto.state, 'CLOSED') self.assertEqual(proto.nbytes, len(message)) diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index 3fcedb58ec18a..6c84ac47a65dc 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -16,7 +16,6 @@ raise unittest.SkipTest("test is not helpful for PGO") -TIMEOUT = 3 HAS_UNIX_SOCKETS = hasattr(socket, 'AF_UNIX') class dummysocket: @@ -360,7 +359,7 @@ def test_send(self): self.assertEqual(cap.getvalue(), data*2) finally: - support.join_thread(t, timeout=TIMEOUT) + support.join_thread(t) @unittest.skipUnless(hasattr(asyncore, 'file_wrapper'), @@ -788,7 +787,7 @@ def test_quick_connect(self): except OSError: pass finally: - support.join_thread(t, timeout=TIMEOUT) + support.join_thread(t) class TestAPI_UseIPv4Sockets(BaseTestAPI): family = socket.AF_INET diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index 846392ebcb68a..795276e0a7aa3 100644 --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -238,7 +238,7 @@ def _cleanup(self): # cleanup the server self.server.shutdown() self.server.server_close() - support.join_thread(self.thread, 3.0) + support.join_thread(self.thread) # Explicitly clear the attribute to prevent dangling thread self.thread = None diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index c47ad4ac75206..3b135b8ddf966 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -869,16 +869,13 @@ def serve_forever(self, poll_interval): """ asyncore.loop(poll_interval, map=self._map) - def stop(self, timeout=None): + def stop(self): """ Stop the thread by closing the server instance. Wait for the server thread to terminate. - - :param timeout: How long to wait for the server thread - to terminate. """ self.close() - support.join_thread(self._thread, timeout) + support.join_thread(self._thread) self._thread = None asyncore.close_all(map=self._map, ignore_all=True) @@ -922,16 +919,13 @@ def serve_forever(self, poll_interval): self.ready.set() super(ControlMixin, self).serve_forever(poll_interval) - def stop(self, timeout=None): + def stop(self): """ Tell the server thread to stop, and wait for it to do so. - - :param timeout: How long to wait for the server thread - to terminate. """ self.shutdown() if self._thread is not None: - support.join_thread(self._thread, timeout) + support.join_thread(self._thread) self._thread = None self.server_close() self.ready.clear() @@ -1699,7 +1693,7 @@ def tearDown(self): self.root_logger.removeHandler(self.sock_hdlr) self.sock_hdlr.close() if self.server: - self.server.stop(2.0) + self.server.stop() finally: BaseTest.tearDown(self) @@ -1736,7 +1730,7 @@ def test_noserver(self): # one-second timeout on socket.create_connection() (issue #16264). self.sock_hdlr.retryStart = 2.5 # Kill the server - self.server.stop(2.0) + self.server.stop() # The logging call should try to connect, which should fail try: raise RuntimeError('Deliberate mistake') @@ -1810,7 +1804,7 @@ def tearDown(self): """Shutdown the UDP server.""" try: if self.server: - self.server.stop(2.0) + self.server.stop() if self.sock_hdlr: self.root_logger.removeHandler(self.sock_hdlr) self.sock_hdlr.close() @@ -1891,7 +1885,7 @@ def tearDown(self): """Shutdown the server.""" try: if self.server: - self.server.stop(2.0) + self.server.stop() if self.sl_hdlr: self.root_logger.removeHandler(self.sl_hdlr) self.sl_hdlr.close() @@ -2028,7 +2022,7 @@ def test_output(self): self.assertEqual(d['funcName'], ['test_output']) self.assertEqual(d['msg'], [msg]) - self.server.stop(2.0) + self.server.stop() self.root_logger.removeHandler(self.h_hdlr) self.h_hdlr.close() @@ -3228,7 +3222,7 @@ def setup_via_listener(self, text, verify=None): finally: t.ready.wait(2.0) logging.config.stopListening() - support.join_thread(t, 2.0) + support.join_thread(t) def test_listen_config_10_ok(self): with support.captured_stdout() as output: diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py index 46e2a8c540a72..d88e28a9146ef 100644 --- a/Lib/test/test_queue.py +++ b/Lib/test/test_queue.py @@ -63,7 +63,7 @@ def do_blocking_test(self, block_func, block_args, trigger_func, trigger_args): block_func) return self.result finally: - support.join_thread(thread, 10) # make sure the thread terminates + support.join_thread(thread) # make sure the thread terminates # Call this instead if block_func is supposed to raise an exception. def do_exceptional_blocking_test(self,block_func, block_args, trigger_func, @@ -79,7 +79,7 @@ def do_exceptional_blocking_test(self,block_func, block_args, trigger_func, self.fail("expected exception of kind %r" % expected_exception_class) finally: - support.join_thread(thread, 10) # make sure the thread terminates + support.join_thread(thread) # make sure the thread terminates if not thread.startedEvent.is_set(): self.fail("trigger thread ended but event never set") diff --git a/Lib/test/test_sched.py b/Lib/test/test_sched.py index 3f84af2a4c2a9..f78944fd18822 100644 --- a/Lib/test/test_sched.py +++ b/Lib/test/test_sched.py @@ -82,7 +82,7 @@ def test_enter_concurrent(self): self.assertEqual(q.get(timeout=TIMEOUT), 5) self.assertTrue(q.empty()) timer.advance(1000) - support.join_thread(t, timeout=TIMEOUT) + support.join_thread(t) self.assertTrue(q.empty()) self.assertEqual(timer.time(), 5) @@ -137,7 +137,7 @@ def test_cancel_concurrent(self): self.assertEqual(q.get(timeout=TIMEOUT), 4) self.assertTrue(q.empty()) timer.advance(1000) - support.join_thread(t, timeout=TIMEOUT) + support.join_thread(t) self.assertTrue(q.empty()) self.assertEqual(timer.time(), 4) From webhook-mailer at python.org Tue Dec 10 15:12:32 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 10 Dec 2019 20:12:32 -0000 Subject: [Python-checkins] bpo-38614: Use test.support.LONG_TIMEOUT constant (GH-17562) Message-ID: https://github.com/python/cpython/commit/c98b0199a984430312833ef403d265be314f7244 commit: c98b0199a984430312833ef403d265be314f7244 branch: master author: Victor Stinner committer: GitHub date: 2019-12-10T21:12:26+01:00 summary: bpo-38614: Use test.support.LONG_TIMEOUT constant (GH-17562) Replace hardcoded timeout constants in tests with LONG_TIMEOUT of test.support, so it's easier to ajdust this timeout for all tests at once. LONG_TIMEOUT is 5 minutes by default, but it can be longer depending on --timeout command line option. files: M Lib/test/_test_multiprocessing.py M Lib/test/test_asyncio/test_sslproto.py M Lib/test/test_logging.py diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 611291cbbaf93..86f3d1ca3a36a 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -295,7 +295,7 @@ def test_parent_process(self): target=self._test_create_grandchild_process, args=(wconn, )) p.start() - if not rconn.poll(timeout=60): + if not rconn.poll(timeout=support.LONG_TIMEOUT): raise AssertionError("Could not communicate with child process") parent_process_status = rconn.recv() self.assertEqual(parent_process_status, "alive") @@ -303,7 +303,7 @@ def test_parent_process(self): p.terminate() p.join() - if not rconn.poll(timeout=60): + if not rconn.poll(timeout=support.LONG_TIMEOUT): raise AssertionError("Could not communicate with child process") parent_process_status = rconn.recv() self.assertEqual(parent_process_status, "not alive") diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py index 7ba3d7361ad8a..8e9d4c5194f6f 100644 --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -16,6 +16,7 @@ from asyncio import log from asyncio import protocols from asyncio import sslproto +from test import support from test.test_asyncio import utils as test_utils from test.test_asyncio import functional as func_tests @@ -163,7 +164,7 @@ def test_write_after_closing(self): class BaseStartTLS(func_tests.FunctionalTestCaseMixin): PAYLOAD_SIZE = 1024 * 100 - TIMEOUT = 60 + TIMEOUT = support.LONG_TIMEOUT def new_loop(self): raise NotImplementedError diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 3b135b8ddf966..4feed03fec2a8 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -1059,8 +1059,8 @@ class TestUnixDatagramServer(TestUDPServer): # - end of server_helper section class SMTPHandlerTest(BaseTest): - # bpo-14314, bpo-19665, bpo-34092: don't wait forever, timeout of 1 minute - TIMEOUT = 60.0 + # bpo-14314, bpo-19665, bpo-34092: don't wait forever + TIMEOUT = support.LONG_TIMEOUT def test_basic(self): sockmap = {} From webhook-mailer at python.org Tue Dec 10 16:09:33 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 10 Dec 2019 21:09:33 -0000 Subject: [Python-checkins] bpo-38614: Use test.support.INTERNET_TIMEOUT constant (GH-17565) Message-ID: https://github.com/python/cpython/commit/1d0f9b316a290f0e1f330fdbceb027deb96ce109 commit: 1d0f9b316a290f0e1f330fdbceb027deb96ce109 branch: master author: Victor Stinner committer: GitHub date: 2019-12-10T22:09:23+01:00 summary: bpo-38614: Use test.support.INTERNET_TIMEOUT constant (GH-17565) Replace hardcoded timeout constants in tests with INTERNET_TIMEOUT of test.support, so it's easier to ajdust this timeout for all tests at once. files: M Lib/test/test_nntplib.py M Lib/test/test_urllib2net.py M Lib/test/test_urllibnet.py diff --git a/Lib/test/test_nntplib.py b/Lib/test/test_nntplib.py index 618b403bfb5bd..daa4a7945c1f8 100644 --- a/Lib/test/test_nntplib.py +++ b/Lib/test/test_nntplib.py @@ -19,7 +19,6 @@ ssl = None -TIMEOUT = 30 certfile = os.path.join(os.path.dirname(__file__), 'keycert3.pem') if ssl is not None: @@ -270,12 +269,18 @@ def is_connected(): return True try: - with self.NNTP_CLASS(self.NNTP_HOST, timeout=TIMEOUT, usenetrc=False) as server: + server = self.NNTP_CLASS(self.NNTP_HOST, + timeout=support.INTERNET_TIMEOUT, + usenetrc=False) + with server: self.assertTrue(is_connected()) self.assertTrue(server.help()) self.assertFalse(is_connected()) - with self.NNTP_CLASS(self.NNTP_HOST, timeout=TIMEOUT, usenetrc=False) as server: + server = self.NNTP_CLASS(self.NNTP_HOST, + timeout=support.INTERNET_TIMEOUT, + usenetrc=False) + with server: server.quit() self.assertFalse(is_connected()) except SSLError as ssl_err: @@ -307,7 +312,8 @@ def setUpClass(cls): support.requires("network") with support.transient_internet(cls.NNTP_HOST): try: - cls.server = cls.NNTP_CLASS(cls.NNTP_HOST, timeout=TIMEOUT, + cls.server = cls.NNTP_CLASS(cls.NNTP_HOST, + timeout=support.INTERNET_TIMEOUT, usenetrc=False) except SSLError as ssl_err: # matches "[SSL: DH_KEY_TOO_SMALL] dh key too small" diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py index bb0500e12a49a..b3a5e8974df32 100644 --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -10,8 +10,6 @@ support.requires("network") -TIMEOUT = 60 # seconds - def _retry_thrice(func, exc, *args, **kwargs): for i in range(3): @@ -227,7 +225,7 @@ def _test_urls(self, urls, handlers, retry=True): with support.transient_internet(url): try: - f = urlopen(url, req, TIMEOUT) + f = urlopen(url, req, support.INTERNET_TIMEOUT) # urllib.error.URLError is a subclass of OSError except OSError as err: if expected_err: diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py index 848ab84bc408f..422d529a70074 100644 --- a/Lib/test/test_urllibnet.py +++ b/Lib/test/test_urllibnet.py @@ -16,10 +16,8 @@ class URLTimeoutTest(unittest.TestCase): # XXX this test doesn't seem to test anything useful. - TIMEOUT = 30.0 - def setUp(self): - socket.setdefaulttimeout(self.TIMEOUT) + socket.setdefaulttimeout(support.INTERNET_TIMEOUT) def tearDown(self): socket.setdefaulttimeout(None) From webhook-mailer at python.org Tue Dec 10 18:19:21 2019 From: webhook-mailer at python.org (Steve Dower) Date: Tue, 10 Dec 2019 23:19:21 -0000 Subject: [Python-checkins] bpo-39012: Fix RC version suffix for nuget release files (GH-17564) Message-ID: https://github.com/python/cpython/commit/d0802d07d2c864b95480a9b24c7cc050e19189d5 commit: d0802d07d2c864b95480a9b24c7cc050e19189d5 branch: master author: Steve Dower committer: GitHub date: 2019-12-10T15:19:03-08:00 summary: bpo-39012: Fix RC version suffix for nuget release files (GH-17564) files: M PC/layout/support/constants.py diff --git a/PC/layout/support/constants.py b/PC/layout/support/constants.py index a8647631e9b4c..6cf0fe1d34c4a 100644 --- a/PC/layout/support/constants.py +++ b/PC/layout/support/constants.py @@ -20,7 +20,7 @@ def _unpack_hexversion(): def _get_suffix(field4): - name = {0xA0: "a", 0xB0: "b", 0xC0: "c"}.get(field4 & 0xF0, "") + name = {0xA0: "a", 0xB0: "b", 0xC0: "rc"}.get(field4 & 0xF0, "") if name: serial = field4 & 0x0F return f"{name}{serial}" From webhook-mailer at python.org Tue Dec 10 18:40:11 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 10 Dec 2019 23:40:11 -0000 Subject: [Python-checkins] bpo-39012: Fix RC version suffix for nuget release files (GH-17564) Message-ID: https://github.com/python/cpython/commit/00e2fe4f214eadd5714751968e158c78a8a3f04b commit: 00e2fe4f214eadd5714751968e158c78a8a3f04b branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-10T15:40:02-08:00 summary: bpo-39012: Fix RC version suffix for nuget release files (GH-17564) (cherry picked from commit d0802d07d2c864b95480a9b24c7cc050e19189d5) Co-authored-by: Steve Dower files: M PC/layout/support/constants.py diff --git a/PC/layout/support/constants.py b/PC/layout/support/constants.py index a8647631e9b4c..6cf0fe1d34c4a 100644 --- a/PC/layout/support/constants.py +++ b/PC/layout/support/constants.py @@ -20,7 +20,7 @@ def _unpack_hexversion(): def _get_suffix(field4): - name = {0xA0: "a", 0xB0: "b", 0xC0: "c"}.get(field4 & 0xF0, "") + name = {0xA0: "a", 0xB0: "b", 0xC0: "rc"}.get(field4 & 0xF0, "") if name: serial = field4 & 0x0F return f"{name}{serial}" From webhook-mailer at python.org Tue Dec 10 20:05:19 2019 From: webhook-mailer at python.org (Jason R. Coombs) Date: Wed, 11 Dec 2019 01:05:19 -0000 Subject: [Python-checkins] bpo-39022, bpo-38594: Sync with importlib_metadata 1.3 (GH-17568) Message-ID: https://github.com/python/cpython/commit/b7a0109cd2bafaa21a4d50aad307e901c68f9156 commit: b7a0109cd2bafaa21a4d50aad307e901c68f9156 branch: master author: Jason R. Coombs committer: GitHub date: 2019-12-10T20:05:10-05:00 summary: bpo-39022, bpo-38594: Sync with importlib_metadata 1.3 (GH-17568) * bpo-39022, bpo-38594: Sync with importlib_metadata 1.3 including improved docs for custom finders and better serialization support in EntryPoints. * ?? Added by blurb_it. * Correct module reference files: A Misc/NEWS.d/next/Library/2019-12-10-23-34-48.bpo-39022.QDtIxI.rst M Doc/library/importlib.metadata.rst M Lib/importlib/metadata.py M Lib/test/test_importlib/test_main.py diff --git a/Doc/library/importlib.metadata.rst b/Doc/library/importlib.metadata.rst index 4a4a8f7dfa0f8..dc6b66ca384d0 100644 --- a/Doc/library/importlib.metadata.rst +++ b/Doc/library/importlib.metadata.rst @@ -216,9 +216,9 @@ system `finders`_. To find a distribution package's metadata, ``importlib.metadata`` queries the list of `meta path finders`_ on `sys.meta_path`_. -By default ``importlib.metadata`` installs a finder for distribution packages -found on the file system. This finder doesn't actually find any *packages*, -but it can find the packages' metadata. +The default ``PathFinder`` for Python includes a hook that calls into +``importlib.metadata.MetadataPathFinder`` for finding distributions +loaded from typical file-system-based paths. The abstract class :py:class:`importlib.abc.MetaPathFinder` defines the interface expected of finders by Python's import system. @@ -239,9 +239,9 @@ properties indicating the path to search and names to match and may supply other relevant context. What this means in practice is that to support finding distribution package -metadata in locations other than the file system, you should derive from -``Distribution`` and implement the ``load_metadata()`` method. Then from -your finder, return instances of this derived ``Distribution`` in the +metadata in locations other than the file system, subclass +``Distribution`` and implement the abstract methods. Then from +a custom finder, return instances of this derived ``Distribution`` in the ``find_distributions()`` method. diff --git a/Lib/importlib/metadata.py b/Lib/importlib/metadata.py index 8cb45ec1ef3a2..53f9fb5934668 100644 --- a/Lib/importlib/metadata.py +++ b/Lib/importlib/metadata.py @@ -37,7 +37,8 @@ class PackageNotFoundError(ModuleNotFoundError): """The package was not found.""" -class EntryPoint(collections.namedtuple('EntryPointBase', 'name value group')): +class EntryPoint( + collections.namedtuple('EntryPointBase', 'name value group')): """An entry point as defined by Python packaging conventions. See `the packaging docs on entry points @@ -107,6 +108,12 @@ def __iter__(self): """ return iter((self.name, self)) + def __reduce__(self): + return ( + self.__class__, + (self.name, self.value, self.group), + ) + class PackagePath(pathlib.PurePosixPath): """A reference to a path in a package""" @@ -334,10 +341,21 @@ class DistributionFinder(MetaPathFinder): """ class Context: + """ + Keyword arguments presented by the caller to + ``distributions()`` or ``Distribution.discover()`` + to narrow the scope of a search for distributions + in all DistributionFinders. + + Each DistributionFinder may expect any parameters + and should attempt to honor the canonical + parameters defined below when appropriate. + """ name = None """ Specific name for which a distribution finder should match. + A name of ``None`` matches all distributions. """ def __init__(self, **kwargs): @@ -347,6 +365,9 @@ def __init__(self, **kwargs): def path(self): """ The path that a distribution finder should search. + + Typically refers to Python package paths and defaults + to ``sys.path``. """ return vars(self).get('path', sys.path) diff --git a/Lib/test/test_importlib/test_main.py b/Lib/test/test_importlib/test_main.py index 4d5b1273d9d10..c5f1dbbae325e 100644 --- a/Lib/test/test_importlib/test_main.py +++ b/Lib/test/test_importlib/test_main.py @@ -1,6 +1,8 @@ # coding: utf-8 import re +import json +import pickle import textwrap import unittest import importlib.metadata @@ -181,3 +183,34 @@ def test_egg(self): with self.add_sys_path(egg): with self.assertRaises(PackageNotFoundError): version('foo') + + +class TestEntryPoints(unittest.TestCase): + def __init__(self, *args): + super(TestEntryPoints, self).__init__(*args) + self.ep = importlib.metadata.EntryPoint('name', 'value', 'group') + + def test_entry_point_pickleable(self): + revived = pickle.loads(pickle.dumps(self.ep)) + assert revived == self.ep + + def test_immutable(self): + """EntryPoints should be immutable""" + with self.assertRaises(AttributeError): + self.ep.name = 'badactor' + + def test_repr(self): + assert 'EntryPoint' in repr(self.ep) + assert 'name=' in repr(self.ep) + assert "'name'" in repr(self.ep) + + def test_hashable(self): + """EntryPoints should be hashable""" + hash(self.ep) + + def test_json_dump(self): + """ + json should not expect to be able to dump an EntryPoint + """ + with self.assertRaises(Exception): + json.dumps(self.ep) diff --git a/Misc/NEWS.d/next/Library/2019-12-10-23-34-48.bpo-39022.QDtIxI.rst b/Misc/NEWS.d/next/Library/2019-12-10-23-34-48.bpo-39022.QDtIxI.rst new file mode 100644 index 0000000000000..4af21be607426 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-10-23-34-48.bpo-39022.QDtIxI.rst @@ -0,0 +1 @@ +Update importliib.metadata to include improvements from importlib_metadata 1.3 including better serialization of EntryPoints and improved documentation for custom finders. \ No newline at end of file From webhook-mailer at python.org Tue Dec 10 20:47:14 2019 From: webhook-mailer at python.org (Jason R. Coombs) Date: Wed, 11 Dec 2019 01:47:14 -0000 Subject: [Python-checkins] bpo-39022, bpo-38594: Sync with importlib_metadata 1.3 (GH-17568) (GH-17569) Message-ID: https://github.com/python/cpython/commit/b738237d6792acba85b1f6e6c8993a812c7fd815 commit: b738237d6792acba85b1f6e6c8993a812c7fd815 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Jason R. Coombs date: 2019-12-10T20:47:06-05:00 summary: bpo-39022, bpo-38594: Sync with importlib_metadata 1.3 (GH-17568) (GH-17569) * bpo-39022, bpo-38594: Sync with importlib_metadata 1.3 including improved docs for custom finders and better serialization support in EntryPoints. * ?? Added by blurb_it. * Correct module reference (cherry picked from commit b7a0109cd2bafaa21a4d50aad307e901c68f9156) Co-authored-by: Jason R. Coombs files: A Misc/NEWS.d/next/Library/2019-12-10-23-34-48.bpo-39022.QDtIxI.rst M Doc/library/importlib.metadata.rst M Lib/importlib/metadata.py M Lib/test/test_importlib/test_main.py diff --git a/Doc/library/importlib.metadata.rst b/Doc/library/importlib.metadata.rst index 4a4a8f7dfa0f8..dc6b66ca384d0 100644 --- a/Doc/library/importlib.metadata.rst +++ b/Doc/library/importlib.metadata.rst @@ -216,9 +216,9 @@ system `finders`_. To find a distribution package's metadata, ``importlib.metadata`` queries the list of `meta path finders`_ on `sys.meta_path`_. -By default ``importlib.metadata`` installs a finder for distribution packages -found on the file system. This finder doesn't actually find any *packages*, -but it can find the packages' metadata. +The default ``PathFinder`` for Python includes a hook that calls into +``importlib.metadata.MetadataPathFinder`` for finding distributions +loaded from typical file-system-based paths. The abstract class :py:class:`importlib.abc.MetaPathFinder` defines the interface expected of finders by Python's import system. @@ -239,9 +239,9 @@ properties indicating the path to search and names to match and may supply other relevant context. What this means in practice is that to support finding distribution package -metadata in locations other than the file system, you should derive from -``Distribution`` and implement the ``load_metadata()`` method. Then from -your finder, return instances of this derived ``Distribution`` in the +metadata in locations other than the file system, subclass +``Distribution`` and implement the abstract methods. Then from +a custom finder, return instances of this derived ``Distribution`` in the ``find_distributions()`` method. diff --git a/Lib/importlib/metadata.py b/Lib/importlib/metadata.py index 8cb45ec1ef3a2..53f9fb5934668 100644 --- a/Lib/importlib/metadata.py +++ b/Lib/importlib/metadata.py @@ -37,7 +37,8 @@ class PackageNotFoundError(ModuleNotFoundError): """The package was not found.""" -class EntryPoint(collections.namedtuple('EntryPointBase', 'name value group')): +class EntryPoint( + collections.namedtuple('EntryPointBase', 'name value group')): """An entry point as defined by Python packaging conventions. See `the packaging docs on entry points @@ -107,6 +108,12 @@ def __iter__(self): """ return iter((self.name, self)) + def __reduce__(self): + return ( + self.__class__, + (self.name, self.value, self.group), + ) + class PackagePath(pathlib.PurePosixPath): """A reference to a path in a package""" @@ -334,10 +341,21 @@ class DistributionFinder(MetaPathFinder): """ class Context: + """ + Keyword arguments presented by the caller to + ``distributions()`` or ``Distribution.discover()`` + to narrow the scope of a search for distributions + in all DistributionFinders. + + Each DistributionFinder may expect any parameters + and should attempt to honor the canonical + parameters defined below when appropriate. + """ name = None """ Specific name for which a distribution finder should match. + A name of ``None`` matches all distributions. """ def __init__(self, **kwargs): @@ -347,6 +365,9 @@ def __init__(self, **kwargs): def path(self): """ The path that a distribution finder should search. + + Typically refers to Python package paths and defaults + to ``sys.path``. """ return vars(self).get('path', sys.path) diff --git a/Lib/test/test_importlib/test_main.py b/Lib/test/test_importlib/test_main.py index 4d5b1273d9d10..c5f1dbbae325e 100644 --- a/Lib/test/test_importlib/test_main.py +++ b/Lib/test/test_importlib/test_main.py @@ -1,6 +1,8 @@ # coding: utf-8 import re +import json +import pickle import textwrap import unittest import importlib.metadata @@ -181,3 +183,34 @@ def test_egg(self): with self.add_sys_path(egg): with self.assertRaises(PackageNotFoundError): version('foo') + + +class TestEntryPoints(unittest.TestCase): + def __init__(self, *args): + super(TestEntryPoints, self).__init__(*args) + self.ep = importlib.metadata.EntryPoint('name', 'value', 'group') + + def test_entry_point_pickleable(self): + revived = pickle.loads(pickle.dumps(self.ep)) + assert revived == self.ep + + def test_immutable(self): + """EntryPoints should be immutable""" + with self.assertRaises(AttributeError): + self.ep.name = 'badactor' + + def test_repr(self): + assert 'EntryPoint' in repr(self.ep) + assert 'name=' in repr(self.ep) + assert "'name'" in repr(self.ep) + + def test_hashable(self): + """EntryPoints should be hashable""" + hash(self.ep) + + def test_json_dump(self): + """ + json should not expect to be able to dump an EntryPoint + """ + with self.assertRaises(Exception): + json.dumps(self.ep) diff --git a/Misc/NEWS.d/next/Library/2019-12-10-23-34-48.bpo-39022.QDtIxI.rst b/Misc/NEWS.d/next/Library/2019-12-10-23-34-48.bpo-39022.QDtIxI.rst new file mode 100644 index 0000000000000..4af21be607426 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-10-23-34-48.bpo-39022.QDtIxI.rst @@ -0,0 +1 @@ +Update importliib.metadata to include improvements from importlib_metadata 1.3 including better serialization of EntryPoints and improved documentation for custom finders. \ No newline at end of file From webhook-mailer at python.org Tue Dec 10 23:49:31 2019 From: webhook-mailer at python.org (Ned Deily) Date: Wed, 11 Dec 2019 04:49:31 -0000 Subject: [Python-checkins] bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR (GH-17311) (GH-17570) Message-ID: https://github.com/python/cpython/commit/95157c6a281ccfc7a92a17dfb8d7b5338cad5cb7 commit: 95157c6a281ccfc7a92a17dfb8d7b5338cad5cb7 branch: 3.7 author: Ned Deily committer: GitHub date: 2019-12-10T23:49:23-05:00 summary: bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR (GH-17311) (GH-17570) (cherry picked from commit ab513a38c98695f271e448fe2cb7c5e39eeaaaaf) Co-authored-by: Kyle Stanley files: A Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst M Doc/library/asyncio-eventloop.rst M Lib/asyncio/base_events.py M Lib/test/test_asyncio/test_base_events.py diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index 7e1d571ef59d2..d8e1a7443fa94 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -429,6 +429,21 @@ Opening network connections reuse_address=None, reuse_port=None, \ allow_broadcast=None, sock=None) + .. note:: + The parameter *reuse_address* is no longer supported, as using + :py:data:`~sockets.SO_REUSEADDR` poses a significant security concern for + UDP. Explicitly passing ``reuse_address=True`` will raise an exception. + + When multiple processes with differing UIDs assign sockets to an + indentical UDP socket address with ``SO_REUSEADDR``, incoming packets can + become randomly distributed among the sockets. + + For supported platforms, *reuse_port* can be used as a replacement for + similar functionality. With *reuse_port*, + :py:data:`~sockets.SO_REUSEPORT` is used instead, which specifically + prevents processes with differing UIDs from assigning sockets to the same + socket address. + Create a datagram connection. The socket family can be either :py:data:`~socket.AF_INET`, @@ -457,11 +472,6 @@ Opening network connections resolution. If given, these should all be integers from the corresponding :mod:`socket` module constants. - * *reuse_address* tells the kernel to reuse a local socket in - ``TIME_WAIT`` state, without waiting for its natural timeout to - expire. If not specified will automatically be set to ``True`` on - Unix. - * *reuse_port* tells the kernel to allow this endpoint to be bound to the same port as other existing endpoints are bound to, so long as they all set this flag when being created. This option is not supported on Windows @@ -485,6 +495,10 @@ Opening network connections The *family*, *proto*, *flags*, *reuse_address*, *reuse_port, *allow_broadcast*, and *sock* parameters were added. + .. versionchanged:: 3.7.6 + The *reuse_address* parameter is no longer supported due to security + concerns. + .. coroutinemethod:: loop.create_unix_connection(protocol_factory, \ path=None, \*, ssl=None, sock=None, \ server_hostname=None, ssl_handshake_timeout=None) diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 52134372fa9f3..fdd80bcfdd906 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -61,6 +61,10 @@ # Maximum timeout passed to select to avoid OS limitations MAXIMUM_SELECT_TIMEOUT = 24 * 3600 +# Used for deprecation and removal of `loop.create_datagram_endpoint()`'s +# *reuse_address* parameter +_unset = object() + def _format_handle(handle): cb = handle._callback @@ -1138,7 +1142,7 @@ def _check_sendfile_params(self, sock, file, offset, count): async def create_datagram_endpoint(self, protocol_factory, local_addr=None, remote_addr=None, *, family=0, proto=0, flags=0, - reuse_address=None, reuse_port=None, + reuse_address=_unset, reuse_port=None, allow_broadcast=None, sock=None): """Create datagram connection.""" if sock is not None: @@ -1147,7 +1151,7 @@ def _check_sendfile_params(self, sock, file, offset, count): f'A UDP Socket was expected, got {sock!r}') if (local_addr or remote_addr or family or proto or flags or - reuse_address or reuse_port or allow_broadcast): + reuse_port or allow_broadcast): # show the problematic kwargs in exception msg opts = dict(local_addr=local_addr, remote_addr=remote_addr, family=family, proto=proto, flags=flags, @@ -1201,8 +1205,18 @@ def _check_sendfile_params(self, sock, file, offset, count): exceptions = [] - if reuse_address is None: - reuse_address = os.name == 'posix' and sys.platform != 'cygwin' + # bpo-37228 + if reuse_address is not _unset: + if reuse_address: + raise ValueError("Passing `reuse_address=True` is no " + "longer supported, as the usage of " + "SO_REUSEPORT in UDP poses a significant " + "security concern.") + else: + warnings.warn("The *reuse_address* parameter has been " + "deprecated as of 3.7.6 and is scheduled " + "for removal in 3.11.", DeprecationWarning, + stacklevel=2) for ((family, proto), (local_address, remote_address)) in addr_pairs_info: @@ -1211,9 +1225,6 @@ def _check_sendfile_params(self, sock, file, offset, count): try: sock = socket.socket( family=family, type=socket.SOCK_DGRAM, proto=proto) - if reuse_address: - sock.setsockopt( - socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) if reuse_port: _set_reuseport(sock) if allow_broadcast: diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py index 178ffa69d4a36..2a4723a3330a6 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -1708,10 +1708,6 @@ class FakeSock: MyDatagramProto, flags=1, sock=FakeSock()) self.assertRaises(ValueError, self.loop.run_until_complete, fut) - fut = self.loop.create_datagram_endpoint( - MyDatagramProto, reuse_address=True, sock=FakeSock()) - self.assertRaises(ValueError, self.loop.run_until_complete, fut) - fut = self.loop.create_datagram_endpoint( MyDatagramProto, reuse_port=True, sock=FakeSock()) self.assertRaises(ValueError, self.loop.run_until_complete, fut) @@ -1722,7 +1718,6 @@ class FakeSock: def test_create_datagram_endpoint_sockopts(self): # Socket options should not be applied unless asked for. - # SO_REUSEADDR defaults to on for UNIX. # SO_REUSEPORT is not available on all platforms. coro = self.loop.create_datagram_endpoint( @@ -1731,18 +1726,8 @@ def test_create_datagram_endpoint_sockopts(self): transport, protocol = self.loop.run_until_complete(coro) sock = transport.get_extra_info('socket') - reuse_address_default_on = ( - os.name == 'posix' and sys.platform != 'cygwin') reuseport_supported = hasattr(socket, 'SO_REUSEPORT') - if reuse_address_default_on: - self.assertTrue( - sock.getsockopt( - socket.SOL_SOCKET, socket.SO_REUSEADDR)) - else: - self.assertFalse( - sock.getsockopt( - socket.SOL_SOCKET, socket.SO_REUSEADDR)) if reuseport_supported: self.assertFalse( sock.getsockopt( @@ -1758,13 +1743,12 @@ def test_create_datagram_endpoint_sockopts(self): coro = self.loop.create_datagram_endpoint( lambda: MyDatagramProto(create_future=True, loop=self.loop), local_addr=('127.0.0.1', 0), - reuse_address=True, reuse_port=reuseport_supported, allow_broadcast=True) transport, protocol = self.loop.run_until_complete(coro) sock = transport.get_extra_info('socket') - self.assertTrue( + self.assertFalse( sock.getsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR)) if reuseport_supported: @@ -1779,6 +1763,29 @@ def test_create_datagram_endpoint_sockopts(self): self.loop.run_until_complete(protocol.done) self.assertEqual('CLOSED', protocol.state) + def test_create_datagram_endpoint_reuse_address_error(self): + # bpo-37228: Ensure that explicit passing of `reuse_address=True` + # raises an error, as it is not safe to use SO_REUSEADDR when using UDP + + coro = self.loop.create_datagram_endpoint( + lambda: MyDatagramProto(create_future=True, loop=self.loop), + local_addr=('127.0.0.1', 0), + reuse_address=True) + + with self.assertRaises(ValueError): + self.loop.run_until_complete(coro) + + def test_create_datagram_endpoint_reuse_address_warning(self): + # bpo-37228: Deprecate *reuse_address* parameter + + coro = self.loop.create_datagram_endpoint( + lambda: MyDatagramProto(create_future=True, loop=self.loop), + local_addr=('127.0.0.1', 0), + reuse_address=False) + + with self.assertWarns(DeprecationWarning): + self.loop.run_until_complete(coro) + @patch_socket def test_create_datagram_endpoint_nosoreuseport(self, m_socket): del m_socket.SO_REUSEPORT diff --git a/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst b/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst new file mode 100644 index 0000000000000..0fafb63402e46 --- /dev/null +++ b/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst @@ -0,0 +1,6 @@ +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is +because of the behavior of ``SO_REUSEADDR`` in UDP. For more details, see the +documentation for ``loop.create_datagram_endpoint()``. +(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in +:issue:`37228`.) From webhook-mailer at python.org Wed Dec 11 01:54:15 2019 From: webhook-mailer at python.org (Ned Deily) Date: Wed, 11 Dec 2019 06:54:15 -0000 Subject: [Python-checkins] [3.6] bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR (GH-17311). (GH-17571) Message-ID: https://github.com/python/cpython/commit/b23c0840ce07e03f2705fb08d94f8f03e5c5d5b8 commit: b23c0840ce07e03f2705fb08d94f8f03e5c5d5b8 branch: 3.6 author: Kyle Stanley committer: Ned Deily date: 2019-12-11T01:54:02-05:00 summary: [3.6] bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR (GH-17311). (GH-17571) (cherry picked from commit ab513a38c98695f271e448fe2cb7c5e39eeaaaaf) Co-authored-by: Kyle Stanley files: A Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst M Doc/library/asyncio-eventloop.rst M Lib/asyncio/base_events.py M Lib/test/test_asyncio/test_base_events.py diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index bdba9962df622..d053a60a9ea6c 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -341,6 +341,23 @@ Creating connections .. coroutinemethod:: AbstractEventLoop.create_datagram_endpoint(protocol_factory, local_addr=None, remote_addr=None, \*, family=0, proto=0, flags=0, reuse_address=None, reuse_port=None, allow_broadcast=None, sock=None) + .. note:: + The parameter *reuse_address* is no longer supported, as using + :py:data:`~sockets.SO_REUSEADDR` poses a significant security concern for + UDP. Explicitly passing ``reuse_address=True`` will raise an exception. + + When multiple processes with differing UIDs assign sockets to an + indentical UDP socket address with ``SO_REUSEADDR``, incoming packets can + become randomly distributed among the sockets. + + For supported platforms, *reuse_port* can be used as a replacement for + similar functionality. With *reuse_port*, + :py:data:`~sockets.SO_REUSEPORT` is used instead, which specifically + prevents processes with differing UIDs from assigning sockets to the same + socket address. + + Create a datagram connection. + Create datagram connection: socket family :py:data:`~socket.AF_INET` or :py:data:`~socket.AF_INET6` depending on *host* (or *family* if specified), socket type :py:data:`~socket.SOCK_DGRAM`. *protocol_factory* must be a @@ -365,11 +382,6 @@ Creating connections resolution. If given, these should all be integers from the corresponding :mod:`socket` module constants. - * *reuse_address* tells the kernel to reuse a local socket in - TIME_WAIT state, without waiting for its natural timeout to - expire. If not specified will automatically be set to ``True`` on - UNIX. - * *reuse_port* tells the kernel to allow this endpoint to be bound to the same port as other existing endpoints are bound to, so long as they all set this flag when being created. This option is not supported on Windows @@ -393,6 +405,11 @@ Creating connections The *family*, *proto*, *flags*, *reuse_address*, *reuse_port, *allow_broadcast*, and *sock* parameters were added. + .. versionchanged:: 3.6.10 + The *reuse_address* parameter is no longer supporter due to security + concerns + + .. coroutinemethod:: AbstractEventLoop.create_unix_connection(protocol_factory, path, \*, ssl=None, sock=None, server_hostname=None) Create UNIX connection: socket family :py:data:`~socket.AF_UNIX`, socket diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 48dd1fc54ae42..64a9fd41decae 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -59,6 +59,10 @@ # Maximum timeout passed to select to avoid OS limitations MAXIMUM_SELECT_TIMEOUT = 24 * 3600 +# Used for deprecation and removal of `loop.create_datagram_endpoint()`'s +# *reuse_address* parameter +_unset = object() + def _format_handle(handle): cb = handle._callback @@ -854,7 +858,7 @@ def _create_connection_transport(self, sock, protocol_factory, ssl, def create_datagram_endpoint(self, protocol_factory, local_addr=None, remote_addr=None, *, family=0, proto=0, flags=0, - reuse_address=None, reuse_port=None, + reuse_address=_unset, reuse_port=None, allow_broadcast=None, sock=None): """Create datagram connection.""" if sock is not None: @@ -863,7 +867,7 @@ def create_datagram_endpoint(self, protocol_factory, 'A UDP Socket was expected, got {!r}'.format(sock)) if (local_addr or remote_addr or family or proto or flags or - reuse_address or reuse_port or allow_broadcast): + reuse_port or allow_broadcast): # show the problematic kwargs in exception msg opts = dict(local_addr=local_addr, remote_addr=remote_addr, family=family, proto=proto, flags=flags, @@ -912,8 +916,18 @@ def create_datagram_endpoint(self, protocol_factory, exceptions = [] - if reuse_address is None: - reuse_address = os.name == 'posix' and sys.platform != 'cygwin' + # bpo-37228 + if reuse_address is not _unset: + if reuse_address: + raise ValueError("Passing `reuse_address=True` is no " + "longer supported, as the usage of " + "SO_REUSEPORT in UDP poses a significant " + "security concern.") + else: + warnings.warn("The *reuse_address* parameter has been " + "deprecated as of 3.6.10 and is scheduled " + "for removal in 3.11.", DeprecationWarning, + stacklevel=2) for ((family, proto), (local_address, remote_address)) in addr_pairs_info: @@ -922,9 +936,6 @@ def create_datagram_endpoint(self, protocol_factory, try: sock = socket.socket( family=family, type=socket.SOCK_DGRAM, proto=proto) - if reuse_address: - sock.setsockopt( - socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) if reuse_port: _set_reuseport(sock) if allow_broadcast: diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py index 052a559c3cbb5..93e8903c2ce77 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -1632,10 +1632,6 @@ class FakeSock: MyDatagramProto, flags=1, sock=FakeSock()) self.assertRaises(ValueError, self.loop.run_until_complete, fut) - fut = self.loop.create_datagram_endpoint( - MyDatagramProto, reuse_address=True, sock=FakeSock()) - self.assertRaises(ValueError, self.loop.run_until_complete, fut) - fut = self.loop.create_datagram_endpoint( MyDatagramProto, reuse_port=True, sock=FakeSock()) self.assertRaises(ValueError, self.loop.run_until_complete, fut) @@ -1646,7 +1642,6 @@ class FakeSock: def test_create_datagram_endpoint_sockopts(self): # Socket options should not be applied unless asked for. - # SO_REUSEADDR defaults to on for UNIX. # SO_REUSEPORT is not available on all platforms. coro = self.loop.create_datagram_endpoint( @@ -1655,18 +1650,8 @@ def test_create_datagram_endpoint_sockopts(self): transport, protocol = self.loop.run_until_complete(coro) sock = transport.get_extra_info('socket') - reuse_address_default_on = ( - os.name == 'posix' and sys.platform != 'cygwin') reuseport_supported = hasattr(socket, 'SO_REUSEPORT') - if reuse_address_default_on: - self.assertTrue( - sock.getsockopt( - socket.SOL_SOCKET, socket.SO_REUSEADDR)) - else: - self.assertFalse( - sock.getsockopt( - socket.SOL_SOCKET, socket.SO_REUSEADDR)) if reuseport_supported: self.assertFalse( sock.getsockopt( @@ -1682,13 +1667,12 @@ def test_create_datagram_endpoint_sockopts(self): coro = self.loop.create_datagram_endpoint( lambda: MyDatagramProto(create_future=True, loop=self.loop), local_addr=('127.0.0.1', 0), - reuse_address=True, reuse_port=reuseport_supported, allow_broadcast=True) transport, protocol = self.loop.run_until_complete(coro) sock = transport.get_extra_info('socket') - self.assertTrue( + self.assertFalse( sock.getsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR)) if reuseport_supported: @@ -1703,6 +1687,29 @@ def test_create_datagram_endpoint_sockopts(self): self.loop.run_until_complete(protocol.done) self.assertEqual('CLOSED', protocol.state) + def test_create_datagram_endpoint_reuse_address_error(self): + # bpo-37228: Ensure that explicit passing of `reuse_address=True` + # raises an error, as it is not safe to use SO_REUSEADDR when using UDP + + coro = self.loop.create_datagram_endpoint( + lambda: MyDatagramProto(create_future=True, loop=self.loop), + local_addr=('127.0.0.1', 0), + reuse_address=True) + + with self.assertRaises(ValueError): + self.loop.run_until_complete(coro) + + def test_create_datagram_endpoint_reuse_address_warning(self): + # bpo-37228: Deprecate *reuse_address* parameter + + coro = self.loop.create_datagram_endpoint( + lambda: MyDatagramProto(create_future=True, loop=self.loop), + local_addr=('127.0.0.1', 0), + reuse_address=False) + + with self.assertWarns(DeprecationWarning): + self.loop.run_until_complete(coro) + @patch_socket def test_create_datagram_endpoint_nosoreuseport(self, m_socket): del m_socket.SO_REUSEPORT diff --git a/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst b/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst new file mode 100644 index 0000000000000..0fafb63402e46 --- /dev/null +++ b/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst @@ -0,0 +1,6 @@ +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is +because of the behavior of ``SO_REUSEADDR`` in UDP. For more details, see the +documentation for ``loop.create_datagram_endpoint()``. +(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in +:issue:`37228`.) From webhook-mailer at python.org Wed Dec 11 03:52:29 2019 From: webhook-mailer at python.org (Ned Deily) Date: Wed, 11 Dec 2019 08:52:29 -0000 Subject: [Python-checkins] 3.7.6rc1 Message-ID: https://github.com/python/cpython/commit/bd18254b91272c2f0f0d98f66fdeca962ef1a901 commit: bd18254b91272c2f0f0d98f66fdeca962ef1a901 branch: 3.7 author: Ned Deily committer: Ned Deily date: 2019-12-11T00:24:09-05:00 summary: 3.7.6rc1 files: A Misc/NEWS.d/3.7.6rc1.rst D Misc/NEWS.d/next/Build/2019-10-11-15-32-58.bpo-37415.D9RXrq.rst D Misc/NEWS.d/next/Build/2019-11-15-09-25-44.bpo-38809.9jwta6.rst D Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst D Misc/NEWS.d/next/C API/2019-10-08-01-23-24.bpo-38395.MJ6Ey9.rst D Misc/NEWS.d/next/C API/2019-10-21-09-24-03.bpo-38540.314N_T.rst D Misc/NEWS.d/next/Core and Builtins/2019-07-13-18-01-13.bpo-35409.ozbcsR.rst D Misc/NEWS.d/next/Core and Builtins/2019-10-09-16-50-52.bpo-38379.oz5qZx.rst D Misc/NEWS.d/next/Core and Builtins/2019-10-20-12-43-48.bpo-38535.ESMkVN.rst D Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst D Misc/NEWS.d/next/Documentation/2019-09-27-23-37-41.bpo-38294.go_jFf.rst D Misc/NEWS.d/next/Documentation/2019-10-26-13-19-07.bpo-38592.Y96BYO.rst D Misc/NEWS.d/next/Documentation/2019-11-15-09-22-28.bpo-38351.xwhlse.rst D Misc/NEWS.d/next/IDLE/2019-10-04-18-03-09.bpo-36698.BKcmom.rst D Misc/NEWS.d/next/IDLE/2019-10-26-18-16-24.bpo-38598.6kH9FY.rst D Misc/NEWS.d/next/IDLE/2019-10-28-04-48-03.bpo-4630.upgjiV.rst D Misc/NEWS.d/next/IDLE/2019-10-30-22-11-16.bpo-38636.hUhDeB.rst D Misc/NEWS.d/next/IDLE/2019-11-09-23-55-59.bpo-26353.duYZiF.rst D Misc/NEWS.d/next/IDLE/2019-11-23-21-50-57.bpo-38862.KQ9A0m.rst D Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst D Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst D Misc/NEWS.d/next/Library/2017-12-26-14-32-23.bpo-27657.6BhyVK.rst D Misc/NEWS.d/next/Library/2018-04-24-13-18-48.bpo-33348.XaJDei.rst D Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst D Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst D Misc/NEWS.d/next/Library/2019-05-20-08-54-41.bpo-36952.I_glok.rst D Misc/NEWS.d/next/Library/2019-07-09-05-44-39.bpo-36993.4javqu.rst D Misc/NEWS.d/next/Library/2019-09-29-22-47-37.bpo-13153.0mO9qR.rst D Misc/NEWS.d/next/Library/2019-10-01-21-06-18.bpo-38341.uqwgU_.rst D Misc/NEWS.d/next/Library/2019-10-05-02-07-52.bpo-38332.hwrPN7.rst D Misc/NEWS.d/next/Library/2019-10-08-11-18-40.bpo-38405.0-7e7s.rst D Misc/NEWS.d/next/Library/2019-10-09-18-16-51.bpo-38422.aiM5bq.rst D Misc/NEWS.d/next/Library/2019-10-10-00-25-28.bpo-38109.9w-IGF.rst D Misc/NEWS.d/next/Library/2019-10-20-12-04-48.bpo-31202.NfdIus.rst D Misc/NEWS.d/next/Library/2019-10-27-00-08-49.bpo-38334.pfLLmc.rst D Misc/NEWS.d/next/Library/2019-11-06-15-26-15.bpo-38686.HNFBce.rst D Misc/NEWS.d/next/Library/2019-11-11-21-43-06.bpo-27805.D3zl1_.rst D Misc/NEWS.d/next/Library/2019-11-13-16-17-43.bpo-38785.NEOEfk.rst D Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst D Misc/NEWS.d/next/Library/2019-11-16-23-26-25.bpo-38821.-albNN.rst D Misc/NEWS.d/next/Library/2019-11-21-11-39-17.bpo-37838.lRFcEC.rst D Misc/NEWS.d/next/Library/2019-11-27-16-30-02.bpo-26730.56cdBn.rst D Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst D Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst D Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst D Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst D Misc/NEWS.d/next/Security/2019-11-15-00-54-42.bpo-38804.vjbM8V.rst D Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst D Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst D Misc/NEWS.d/next/Tests/2019-10-08-16-42-05.bpo-37531.7v-_Ca.rst D Misc/NEWS.d/next/Tests/2019-10-16-01-36-15.bpo-35998.G305Bf.rst D Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst D Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst D Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst D Misc/NEWS.d/next/Tools-Demos/2019-10-02-09-48-42.bpo-38347.2Tq5D1.rst D Misc/NEWS.d/next/Tools-Demos/2019-10-08-15-07-52.bpo-38118.pIZD6H.rst D Misc/NEWS.d/next/Windows/2019-10-28-10-48-16.bpo-38589.V69Q1a.rst M Include/patchlevel.h M Lib/pydoc_data/topics.py M README.rst diff --git a/Include/patchlevel.h b/Include/patchlevel.h index 224eb9ae491e2..86301dca0d703 100644 --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -18,12 +18,12 @@ /*--start constants--*/ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 7 -#define PY_MICRO_VERSION 5 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL -#define PY_RELEASE_SERIAL 0 +#define PY_MICRO_VERSION 6 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA +#define PY_RELEASE_SERIAL 1 /* Version as a string */ -#define PY_VERSION "3.7.5+" +#define PY_VERSION "3.7.6rc1" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index ffde9d4309c58..7fee53bfc8578 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Mon Oct 14 18:26:58 2019 +# Autogenerated by Sphinx on Wed Dec 11 00:13:54 2019 topics = {'assert': 'The "assert" statement\n' '**********************\n' '\n' @@ -735,10 +735,11 @@ 'returned.\n' '\n' 'The "__dir__" function should accept no arguments, and ' - 'return a list\n' - 'of strings that represents the names accessible on ' - 'module. If present,\n' - 'this function overrides the standard "dir()" search on a ' + 'return a\n' + 'sequence of strings that represents the names accessible ' + 'on module. If\n' + 'present, this function overrides the standard "dir()" ' + 'search on a\n' 'module.\n' '\n' 'For a more fine grained customization of the module ' @@ -833,6 +834,22 @@ 'created. The\n' ' descriptor has been assigned to *name*.\n' '\n' + ' Note: "__set_name__()" is only called implicitly as ' + 'part of the\n' + ' "type" constructor, so it will need to be called ' + 'explicitly with\n' + ' the appropriate parameters when a descriptor is ' + 'added to a class\n' + ' after initial creation:\n' + '\n' + ' class A:\n' + ' pass\n' + ' descr = custom_descriptor()\n' + ' A.attr = descr\n' + " descr.__set_name__(A, 'attr')\n" + '\n' + ' See Creating the class object for more details.\n' + '\n' ' New in version 3.6.\n' '\n' 'The attribute "__objclass__" is interpreted by the ' @@ -1061,7 +1078,13 @@ 'attributes created by\n' ' slots (the other bases must have empty slot layouts) - ' 'violations\n' - ' raise "TypeError".\n', + ' raise "TypeError".\n' + '\n' + '* If an iterator is used for *__slots__* then a ' + 'descriptor is\n' + ' created for each of the iterator?s values. However, ' + 'the *__slots__*\n' + ' attribute will be an empty iterator.\n', 'attribute-references': 'Attribute references\n' '********************\n' '\n' @@ -4199,6 +4222,17 @@ ' Quit from the debugger. The program being executed is ' 'aborted.\n' '\n' + 'debug code\n' + '\n' + ' Enter a recursive debugger that steps through the code ' + 'argument\n' + ' (which is an arbitrary expression or statement to be executed ' + 'in\n' + ' the current environment).\n' + '\n' + 'retval\n' + 'Print the return value for the last return of a function.\n' + '\n' '-[ Footnotes ]-\n' '\n' '[1] Whether a frame is considered to originate in a certain ' @@ -7419,9 +7453,9 @@ 'to allow\n' 'efficient iteration through the container; for mappings, ' '"__iter__()"\n' - 'should be the same as "keys()"; for sequences, it should ' - 'iterate\n' - 'through the values.\n' + 'should iterate through the object?s keys; for sequences, ' + 'it should\n' + 'iterate through the values.\n' '\n' 'object.__len__(self)\n' '\n' @@ -7573,12 +7607,12 @@ '\n' 'The membership test operators ("in" and "not in") are ' 'normally\n' - 'implemented as an iteration through a sequence. However, ' + 'implemented as an iteration through a container. However, ' 'container\n' 'objects can supply the following special method with a ' 'more efficient\n' 'implementation, which also does not require the object be ' - 'a sequence.\n' + 'iterable.\n' '\n' 'object.__contains__(self, item)\n' '\n' @@ -8358,10 +8392,11 @@ 'returned.\n' '\n' 'The "__dir__" function should accept no arguments, and ' - 'return a list\n' - 'of strings that represents the names accessible on module. ' - 'If present,\n' - 'this function overrides the standard "dir()" search on a ' + 'return a\n' + 'sequence of strings that represents the names accessible on ' + 'module. If\n' + 'present, this function overrides the standard "dir()" search ' + 'on a\n' 'module.\n' '\n' 'For a more fine grained customization of the module behavior ' @@ -8456,6 +8491,22 @@ 'The\n' ' descriptor has been assigned to *name*.\n' '\n' + ' Note: "__set_name__()" is only called implicitly as part ' + 'of the\n' + ' "type" constructor, so it will need to be called ' + 'explicitly with\n' + ' the appropriate parameters when a descriptor is added ' + 'to a class\n' + ' after initial creation:\n' + '\n' + ' class A:\n' + ' pass\n' + ' descr = custom_descriptor()\n' + ' A.attr = descr\n' + " descr.__set_name__(A, 'attr')\n" + '\n' + ' See Creating the class object for more details.\n' + '\n' ' New in version 3.6.\n' '\n' 'The attribute "__objclass__" is interpreted by the "inspect" ' @@ -8682,6 +8733,12 @@ 'violations\n' ' raise "TypeError".\n' '\n' + '* If an iterator is used for *__slots__* then a descriptor ' + 'is\n' + ' created for each of the iterator?s values. However, the ' + '*__slots__*\n' + ' attribute will be an empty iterator.\n' + '\n' '\n' 'Customizing class creation\n' '==========================\n' @@ -9127,9 +9184,9 @@ 'allow\n' 'efficient iteration through the container; for mappings, ' '"__iter__()"\n' - 'should be the same as "keys()"; for sequences, it should ' - 'iterate\n' - 'through the values.\n' + 'should iterate through the object?s keys; for sequences, it ' + 'should\n' + 'iterate through the values.\n' '\n' 'object.__len__(self)\n' '\n' @@ -9280,12 +9337,12 @@ '\n' 'The membership test operators ("in" and "not in") are ' 'normally\n' - 'implemented as an iteration through a sequence. However, ' + 'implemented as an iteration through a container. However, ' 'container\n' 'objects can supply the following special method with a more ' 'efficient\n' - 'implementation, which also does not require the object be a ' - 'sequence.\n' + 'implementation, which also does not require the object be ' + 'iterable.\n' '\n' 'object.__contains__(self, item)\n' '\n' @@ -9881,20 +9938,20 @@ '\n' 'str.isalnum()\n' '\n' - ' Return true if all characters in the string are ' + ' Return "True" if all characters in the string are ' 'alphanumeric and\n' - ' there is at least one character, false otherwise. A ' - 'character "c"\n' - ' is alphanumeric if one of the following returns ' + ' there is at least one character, "False" otherwise. A ' + 'character\n' + ' "c" is alphanumeric if one of the following returns ' '"True":\n' ' "c.isalpha()", "c.isdecimal()", "c.isdigit()", or ' '"c.isnumeric()".\n' '\n' 'str.isalpha()\n' '\n' - ' Return true if all characters in the string are ' + ' Return "True" if all characters in the string are ' 'alphabetic and\n' - ' there is at least one character, false otherwise. ' + ' there is at least one character, "False" otherwise. ' 'Alphabetic\n' ' characters are those characters defined in the Unicode ' 'character\n' @@ -9908,45 +9965,46 @@ '\n' 'str.isascii()\n' '\n' - ' Return true if the string is empty or all characters in ' - 'the string\n' - ' are ASCII, false otherwise. ASCII characters have code ' - 'points in\n' - ' the range U+0000-U+007F.\n' + ' Return "True" if the string is empty or all characters ' + 'in the\n' + ' string are ASCII, "False" otherwise. ASCII characters ' + 'have code\n' + ' points in the range U+0000-U+007F.\n' '\n' ' New in version 3.7.\n' '\n' 'str.isdecimal()\n' '\n' - ' Return true if all characters in the string are decimal ' - 'characters\n' - ' and there is at least one character, false otherwise. ' - 'Decimal\n' - ' characters are those that can be used to form numbers ' - 'in base 10,\n' - ' e.g. U+0660, ARABIC-INDIC DIGIT ZERO. Formally a ' - 'decimal character\n' - ' is a character in the Unicode General Category ?Nd?.\n' + ' Return "True" if all characters in the string are ' + 'decimal\n' + ' characters and there is at least one character, "False" ' + 'otherwise.\n' + ' Decimal characters are those that can be used to form ' + 'numbers in\n' + ' base 10, e.g. U+0660, ARABIC-INDIC DIGIT ZERO. ' + 'Formally a decimal\n' + ' character is a character in the Unicode General ' + 'Category ?Nd?.\n' '\n' 'str.isdigit()\n' '\n' - ' Return true if all characters in the string are digits ' - 'and there is\n' - ' at least one character, false otherwise. Digits ' - 'include decimal\n' - ' characters and digits that need special handling, such ' - 'as the\n' - ' compatibility superscript digits. This covers digits ' - 'which cannot\n' - ' be used to form numbers in base 10, like the Kharosthi ' - 'numbers.\n' - ' Formally, a digit is a character that has the property ' - 'value\n' - ' Numeric_Type=Digit or Numeric_Type=Decimal.\n' + ' Return "True" if all characters in the string are ' + 'digits and there\n' + ' is at least one character, "False" otherwise. Digits ' + 'include\n' + ' decimal characters and digits that need special ' + 'handling, such as\n' + ' the compatibility superscript digits. This covers ' + 'digits which\n' + ' cannot be used to form numbers in base 10, like the ' + 'Kharosthi\n' + ' numbers. Formally, a digit is a character that has the ' + 'property\n' + ' value Numeric_Type=Digit or Numeric_Type=Decimal.\n' '\n' 'str.isidentifier()\n' '\n' - ' Return true if the string is a valid identifier ' + ' Return "True" if the string is a valid identifier ' 'according to the\n' ' language definition, section Identifiers and keywords.\n' '\n' @@ -9956,32 +10014,33 @@ '\n' 'str.islower()\n' '\n' - ' Return true if all cased characters [4] in the string ' - 'are lowercase\n' - ' and there is at least one cased character, false ' - 'otherwise.\n' + ' Return "True" if all cased characters [4] in the string ' + 'are\n' + ' lowercase and there is at least one cased character, ' + '"False"\n' + ' otherwise.\n' '\n' 'str.isnumeric()\n' '\n' - ' Return true if all characters in the string are numeric ' - 'characters,\n' - ' and there is at least one character, false otherwise. ' - 'Numeric\n' - ' characters include digit characters, and all characters ' - 'that have\n' - ' the Unicode numeric value property, e.g. U+2155, VULGAR ' - 'FRACTION\n' - ' ONE FIFTH. Formally, numeric characters are those with ' - 'the\n' - ' property value Numeric_Type=Digit, Numeric_Type=Decimal ' - 'or\n' + ' Return "True" if all characters in the string are ' + 'numeric\n' + ' characters, and there is at least one character, ' + '"False" otherwise.\n' + ' Numeric characters include digit characters, and all ' + 'characters\n' + ' that have the Unicode numeric value property, e.g. ' + 'U+2155, VULGAR\n' + ' FRACTION ONE FIFTH. Formally, numeric characters are ' + 'those with\n' + ' the property value Numeric_Type=Digit, ' + 'Numeric_Type=Decimal or\n' ' Numeric_Type=Numeric.\n' '\n' 'str.isprintable()\n' '\n' - ' Return true if all characters in the string are ' + ' Return "True" if all characters in the string are ' 'printable or the\n' - ' string is empty, false otherwise. Nonprintable ' + ' string is empty, "False" otherwise. Nonprintable ' 'characters are\n' ' those characters defined in the Unicode character ' 'database as\n' @@ -9997,9 +10056,10 @@ '\n' 'str.isspace()\n' '\n' - ' Return true if there are only whitespace characters in ' - 'the string\n' - ' and there is at least one character, false otherwise.\n' + ' Return "True" if there are only whitespace characters ' + 'in the string\n' + ' and there is at least one character, "False" ' + 'otherwise.\n' '\n' ' A character is *whitespace* if in the Unicode character ' 'database\n' @@ -10011,20 +10071,21 @@ '\n' 'str.istitle()\n' '\n' - ' Return true if the string is a titlecased string and ' + ' Return "True" if the string is a titlecased string and ' 'there is at\n' ' least one character, for example uppercase characters ' 'may only\n' ' follow uncased characters and lowercase characters only ' 'cased ones.\n' - ' Return false otherwise.\n' + ' Return "False" otherwise.\n' '\n' 'str.isupper()\n' '\n' - ' Return true if all cased characters [4] in the string ' - 'are uppercase\n' - ' and there is at least one cased character, false ' - 'otherwise.\n' + ' Return "True" if all cased characters [4] in the string ' + 'are\n' + ' uppercase and there is at least one cased character, ' + '"False"\n' + ' otherwise.\n' '\n' 'str.join(iterable)\n' '\n' diff --git a/Misc/NEWS.d/3.7.6rc1.rst b/Misc/NEWS.d/3.7.6rc1.rst new file mode 100644 index 0000000000000..d164c71840f2f --- /dev/null +++ b/Misc/NEWS.d/3.7.6rc1.rst @@ -0,0 +1,577 @@ +.. bpo: 38945 +.. date: 2019-12-01-22-44-40 +.. nonce: ztmNXc +.. release date: 2019-12-11 +.. section: Security + +Newline characters have been escaped when performing uu encoding to prevent +them from overflowing into to content section of the encoded file. This +prevents malicious or accidental modification of data during the decoding +process. + +.. + +.. bpo: 37228 +.. date: 2019-11-21-21-36-54 +.. nonce: yBZnFG +.. section: Security + +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This +is because of the behavior of ``SO_REUSEADDR`` in UDP. For more details, see +the documentation for ``loop.create_datagram_endpoint()``. (Contributed by +Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:`37228`.) + +.. + +.. bpo: 38804 +.. date: 2019-11-15-00-54-42 +.. nonce: vjbM8V +.. section: Security + +Fixes a ReDoS vulnerability in :mod:`http.cookiejar`. Patch by Ben Caller. + +.. + +.. bpo: 38673 +.. date: 2019-12-01-00-17-44 +.. nonce: K_Tze- +.. section: Core and Builtins + +In REPL mode, don't switch to PS2 if the line starts with comment or +whitespace. Based on work by Batuhan Ta?kaya. + +.. + +.. bpo: 38535 +.. date: 2019-10-20-12-43-48 +.. nonce: ESMkVN +.. section: Core and Builtins + +Fixed line numbers and column offsets for AST nodes for calls without +arguments in decorators. + +.. + +.. bpo: 38379 +.. date: 2019-10-09-16-50-52 +.. nonce: oz5qZx +.. section: Core and Builtins + +When cyclic garbage collection (gc) runs finalizers that resurrect +unreachable objects, the current gc run ends, without collecting any cyclic +trash. However, the statistics reported by ``collect()`` and +``get_stats()`` claimed that all cyclic trash found was collected, and that +the resurrected objects were collected. Changed the stats to report that +none were collected. + +.. + +.. bpo: 35409 +.. date: 2019-07-13-18-01-13 +.. nonce: ozbcsR +.. section: Core and Builtins + +Ignore GeneratorExit exceptions when throwing an exception into the aclose +coroutine of an asynchronous generator. + +.. + +.. bpo: 39006 +.. date: 2019-12-09-14-40-09 +.. nonce: v4VsPg +.. section: Library + +Fix asyncio when the ssl module is missing: only check for ssl.SSLSocket +instance if the ssl module is available. + +.. + +.. bpo: 38979 +.. date: 2019-12-07-16-32-42 +.. nonce: q0sIHy +.. section: Library + +Return class from ``ContextVar.__class_getitem__`` to simplify subclassing. + +.. + +.. bpo: 38986 +.. date: 2019-12-06-15-11-42 +.. nonce: bg6iZt +.. section: Library + +Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python +version. + +.. + +.. bpo: 33684 +.. date: 2019-12-04-15-28-40 +.. nonce: QeSmQP +.. section: Library + +Fix ``json.tool`` failed to read a JSON file with non-ASCII characters when +locale encoding is not UTF-8. + +.. + +.. bpo: 26730 +.. date: 2019-11-27-16-30-02 +.. nonce: 56cdBn +.. section: Library + +Fix ``SpooledTemporaryFile.rollover()`` might corrupt the file when it is in +text mode. Patch by Serhiy Storchaka. + +.. + +.. bpo: 37838 +.. date: 2019-11-21-11-39-17 +.. nonce: lRFcEC +.. section: Library + +:meth:`typing.get_type_hints` properly handles functions decorated with +:meth:`functools.wraps`. + +.. + +.. bpo: 38821 +.. date: 2019-11-16-23-26-25 +.. nonce: -albNN +.. section: Library + +Fix unhandled exceptions in :mod:`argparse` when internationalizing error +messages for arguments with ``nargs`` set to special (non-integer) values. +Patch by Federico Bond. + +.. + +.. bpo: 38820 +.. date: 2019-11-16-16-09-07 +.. nonce: ivhUSV +.. section: Library + +Make Python compatible with OpenSSL 3.0.0. :func:`ssl.SSLSocket.getpeercert` +no longer returns IPv6 addresses with a trailing new line. + +.. + +.. bpo: 38785 +.. date: 2019-11-13-16-17-43 +.. nonce: NEOEfk +.. section: Library + +Prevent asyncio from crashing if parent ``__init__`` is not called from a +constructor of object derived from ``asyncio.Future``. + +.. + +.. bpo: 27805 +.. date: 2019-11-11-21-43-06 +.. nonce: D3zl1_ +.. section: Library + +Allow opening pipes and other non-seekable files in append mode with +:func:`open`. + +.. + +.. bpo: 38686 +.. date: 2019-11-06-15-26-15 +.. nonce: HNFBce +.. section: Library + +Added support for multiple ``qop`` values in +:class:`urllib.request.AbstractDigestAuthHandler`. + +.. + +.. bpo: 38334 +.. date: 2019-10-27-00-08-49 +.. nonce: pfLLmc +.. section: Library + +Fixed seeking backward on an encrypted :class:`zipfile.ZipExtFile`. + +.. + +.. bpo: 31202 +.. date: 2019-10-20-12-04-48 +.. nonce: NfdIus +.. section: Library + +The case the result of :func:`pathlib.WindowsPath.glob` matches now the case +of the pattern for literal parts. + +.. + +.. bpo: 38109 +.. date: 2019-10-10-00-25-28 +.. nonce: 9w-IGF +.. section: Library + +Add missing :data:`stat.S_IFDOOR`, :data:`stat.S_IFPORT`, +:data:`stat.S_IFWHT`, :func:`stat.S_ISDOOR`, :func:`stat.S_ISPORT`, and +:func:`stat.S_ISWHT` values to the Python implementation of :mod:`stat`. + +.. + +.. bpo: 38422 +.. date: 2019-10-09-18-16-51 +.. nonce: aiM5bq +.. section: Library + +Clarify docstrings of pathlib suffix(es) + +.. + +.. bpo: 38405 +.. date: 2019-10-08-11-18-40 +.. nonce: 0-7e7s +.. section: Library + +Nested subclasses of :class:`typing.NamedTuple` are now pickleable. + +.. + +.. bpo: 38332 +.. date: 2019-10-05-02-07-52 +.. nonce: hwrPN7 +.. section: Library + +Prevent :exc:`KeyError` thrown by :func:`_encoded_words.decode` when given +an encoded-word with invalid content-type encoding from propagating all the +way to :func:`email.message.get`. + +.. + +.. bpo: 38341 +.. date: 2019-10-01-21-06-18 +.. nonce: uqwgU_ +.. section: Library + +Add :exc:`smtplib.SMTPNotSupportedError` to the :mod:`smtplib` exported +names. + +.. + +.. bpo: 13153 +.. date: 2019-09-29-22-47-37 +.. nonce: 0mO9qR +.. section: Library + +OS native encoding is now used for converting between Python strings and Tcl +objects. This allows to display, copy and paste to clipboard emoji and +other non-BMP characters. Converting strings from Tcl to Python and back +now never fails (except MemoryError). + +.. + +.. bpo: 36993 +.. date: 2019-07-09-05-44-39 +.. nonce: 4javqu +.. section: Library + +Improve error reporting for corrupt zip files with bad zip64 extra data. +Patch by Daniel Hillier. + +.. + +.. bpo: 36952 +.. date: 2019-05-20-08-54-41 +.. nonce: I_glok +.. section: Library + +Starting with Python 3.3, importing ABCs from :mod:`collections` is +deprecated, and import should be done from :mod:`collections.abc`. Still +being able to import from :mod:`collections` was marked for removal in 3.8, +but has been delayed to 3.9; documentation and ``DeprecationWarning`` +clarified. + +.. + +.. bpo: 36820 +.. date: 2019-05-06-15-34-17 +.. nonce: Eh5mIB +.. section: Library + +Break cycle generated when saving an exception in socket.py, codeop.py and +dyld.py as they keep alive not only the exception but user objects through +the ``__traceback__`` attribute. Patch by Mario Corchero. + +.. + +.. bpo: 34776 +.. date: 2018-09-23-14-24-37 +.. nonce: 1SrQe3 +.. section: Library + +Fix dataclasses to support forward references in type annotations + +.. + +.. bpo: 33348 +.. date: 2018-04-24-13-18-48 +.. nonce: XaJDei +.. section: Library + +lib2to3 now recognizes expressions after ``*`` and `**` like in ``f(*[] or +[])``. + +.. + +.. bpo: 27657 +.. date: 2017-12-26-14-32-23 +.. nonce: 6BhyVK +.. section: Library + +Fix urllib.parse.urlparse() with numeric paths. A string like "path:80" is +no longer parsed as a path but as a scheme ("path") and a path ("80"). + +.. + +.. bpo: 38351 +.. date: 2019-11-15-09-22-28 +.. nonce: xwhlse +.. section: Documentation + +Modernize :mod:`email` examples from %-formatting to f-strings. + +.. + +.. bpo: 38592 +.. date: 2019-10-26-13-19-07 +.. nonce: Y96BYO +.. section: Documentation + +Add Brazilian Portuguese to the language switcher at Python Documentation +website. + +.. + +.. bpo: 38294 +.. date: 2019-09-27-23-37-41 +.. nonce: go_jFf +.. section: Documentation + +Add list of no-longer-escaped chars to re.escape documentation + +.. + +.. bpo: 38547 +.. date: 2019-12-09-11-32-34 +.. nonce: Juw54e +.. section: Tests + +Fix test_pty: if the process is the session leader, closing the master file +descriptor raises a SIGHUP signal: simply ignore SIGHUP when running the +tests. + +.. + +.. bpo: 38965 +.. date: 2019-12-04-17-08-55 +.. nonce: yqax3m +.. section: Tests + +Fix test_faulthandler on GCC 10. Use the "volatile" keyword in +``faulthandler._stack_overflow()`` to prevent tail call optimization on any +compiler, rather than relying on compiler specific pragma. + +.. + +.. bpo: 38669 +.. date: 2019-11-04-02-54-16 +.. nonce: pazXZ8 +.. section: Tests + +Raise :exc:`TypeError` when passing target as a string with +:meth:`unittest.mock.patch.object`. + +.. + +.. bpo: 35998 +.. date: 2019-10-16-01-36-15 +.. nonce: G305Bf +.. section: Tests + +Fix a race condition in test_asyncio.test_start_tls_server_1(). Previously, +there was a race condition between the test main() function which replaces +the protocol and the test ServerProto protocol which sends ANSWER once it +gets HELLO. Now, only the test main() function is responsible to send data, +ServerProto no longer sends data. + +.. + +.. bpo: 37531 +.. date: 2019-10-08-16-42-05 +.. nonce: 7v-_Ca +.. section: Tests + +On timeout, regrtest no longer attempts to call ``popen.communicate()`` +again: it can hang until all child processes using stdout and stderr pipes +completes. Kill the worker process and ignores its output. Change also the +faulthandler timeout of the main process from 1 minute to 5 minutes, for +Python slowest buildbots. + +.. + +.. bpo: 37404 +.. date: 2019-12-01-21-45-24 +.. nonce: cNsA7S +.. section: Build + +:mod:`asyncio` now raises :exc:`TyperError` when calling incompatible +methods with an :class:`ssl.SSLSocket` socket. Patch by Ido Michael. + +.. + +.. bpo: 38809 +.. date: 2019-11-15-09-25-44 +.. nonce: 9jwta6 +.. section: Build + +On Windows, build scripts will now recognize and use python.exe from an +active virtual env. + +.. + +.. bpo: 37415 +.. date: 2019-10-11-15-32-58 +.. nonce: D9RXrq +.. section: Build + +Fix stdatomic.h header check for ICC compiler: the ICC implementation lacks +atomic_uintptr_t type which is needed by Python. + +.. + +.. bpo: 38589 +.. date: 2019-10-28-10-48-16 +.. nonce: V69Q1a +.. section: Windows + +Fixes HTML Help shortcut when Windows is not installed to C drive + +.. + +.. bpo: 38944 +.. date: 2019-11-30-12-10-36 +.. nonce: _3xjKG +.. section: IDLE + +Excape key now closes IDLE completion windows. Patch by Johnny Najera. + +.. + +.. bpo: 38943 +.. date: 2019-11-29-23-44-11 +.. nonce: 8pUKKs +.. section: IDLE + +Fix IDLE autocomplete windows not always appearing on some systems. Patch by +Johnny Najera. + +.. + +.. bpo: 38862 +.. date: 2019-11-23-21-50-57 +.. nonce: KQ9A0m +.. section: IDLE + +'Strip Trailing Whitespace' on the Format menu removes extra newlines at the +end of non-shell files. + +.. + +.. bpo: 26353 +.. date: 2019-11-09-23-55-59 +.. nonce: duYZiF +.. section: IDLE + +Stop adding newline when saving an IDLE shell window. + +.. + +.. bpo: 38636 +.. date: 2019-10-30-22-11-16 +.. nonce: hUhDeB +.. section: IDLE + +Fix IDLE Format menu tab toggle and file indent width. These functions +(default shortcuts Alt-T and Alt-U) were mistakenly disabled in 3.7.5 and +3.8.0. + +.. + +.. bpo: 4630 +.. date: 2019-10-28-04-48-03 +.. nonce: upgjiV +.. section: IDLE + +Add an option to toggle IDLE's cursor blink for shell, editor, and output +windows. See Settings, General, Window Preferences, Cursor Blink. Patch by +Zachary Spytz. + +.. + +.. bpo: 38598 +.. date: 2019-10-26-18-16-24 +.. nonce: 6kH9FY +.. section: IDLE + +Do not try to compile IDLE shell or output windows + +.. + +.. bpo: 36698 +.. date: 2019-10-04-18-03-09 +.. nonce: BKcmom +.. section: IDLE + +IDLE no longer fails when write non-encodable characters to stderr. It now +escapes them with a backslash, as the regular Python interpreter. Added the +``errors`` field to the standard streams. + +.. + +.. bpo: 38118 +.. date: 2019-10-08-15-07-52 +.. nonce: pIZD6H +.. section: Tools/Demos + +Update Valgrind suppression file to ignore a false alarm in +:c:func:`PyUnicode_Decode` when using GCC builtin strcmp(). + +.. + +.. bpo: 38347 +.. date: 2019-10-02-09-48-42 +.. nonce: 2Tq5D1 +.. section: Tools/Demos + +pathfix.py: Assume all files that end on '.py' are Python scripts when +working recursively. + +.. + +.. bpo: 38540 +.. date: 2019-10-21-09-24-03 +.. nonce: 314N_T +.. section: C API + +Fixed possible leak in :c:func:`PyArg_Parse` and similar functions for +format units ``"es#"`` and ``"et#"`` when the macro +:c:macro:`PY_SSIZE_T_CLEAN` is not defined. + +.. + +.. bpo: 38395 +.. date: 2019-10-08-01-23-24 +.. nonce: MJ6Ey9 +.. section: C API + +Fix a crash in :class:`weakref.proxy` objects due to incorrect lifetime +management when calling some associated methods that may delete the last +reference to object being referenced by the proxy. Patch by Pablo Galindo. diff --git a/Misc/NEWS.d/next/Build/2019-10-11-15-32-58.bpo-37415.D9RXrq.rst b/Misc/NEWS.d/next/Build/2019-10-11-15-32-58.bpo-37415.D9RXrq.rst deleted file mode 100644 index 98f4a3bf4f545..0000000000000 --- a/Misc/NEWS.d/next/Build/2019-10-11-15-32-58.bpo-37415.D9RXrq.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix stdatomic.h header check for ICC compiler: the ICC implementation lacks -atomic_uintptr_t type which is needed by Python. diff --git a/Misc/NEWS.d/next/Build/2019-11-15-09-25-44.bpo-38809.9jwta6.rst b/Misc/NEWS.d/next/Build/2019-11-15-09-25-44.bpo-38809.9jwta6.rst deleted file mode 100644 index 10eaf844e8aaf..0000000000000 --- a/Misc/NEWS.d/next/Build/2019-11-15-09-25-44.bpo-38809.9jwta6.rst +++ /dev/null @@ -1,2 +0,0 @@ -On Windows, build scripts will now recognize and use python.exe from an -active virtual env. diff --git a/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst b/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst deleted file mode 100644 index 067fc9d3f189d..0000000000000 --- a/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst +++ /dev/null @@ -1,2 +0,0 @@ -:mod:`asyncio` now raises :exc:`TyperError` when calling incompatible methods -with an :class:`ssl.SSLSocket` socket. Patch by Ido Michael. diff --git a/Misc/NEWS.d/next/C API/2019-10-08-01-23-24.bpo-38395.MJ6Ey9.rst b/Misc/NEWS.d/next/C API/2019-10-08-01-23-24.bpo-38395.MJ6Ey9.rst deleted file mode 100644 index 4bc30600ca758..0000000000000 --- a/Misc/NEWS.d/next/C API/2019-10-08-01-23-24.bpo-38395.MJ6Ey9.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix a crash in :class:`weakref.proxy` objects due to incorrect lifetime -management when calling some associated methods that may delete the last -reference to object being referenced by the proxy. Patch by Pablo Galindo. diff --git a/Misc/NEWS.d/next/C API/2019-10-21-09-24-03.bpo-38540.314N_T.rst b/Misc/NEWS.d/next/C API/2019-10-21-09-24-03.bpo-38540.314N_T.rst deleted file mode 100644 index 1d73ad8fe96e6..0000000000000 --- a/Misc/NEWS.d/next/C API/2019-10-21-09-24-03.bpo-38540.314N_T.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed possible leak in :c:func:`PyArg_Parse` and similar functions for -format units ``"es#"`` and ``"et#"`` when the macro -:c:macro:`PY_SSIZE_T_CLEAN` is not defined. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-07-13-18-01-13.bpo-35409.ozbcsR.rst b/Misc/NEWS.d/next/Core and Builtins/2019-07-13-18-01-13.bpo-35409.ozbcsR.rst deleted file mode 100644 index 0f35a91ec74e6..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-07-13-18-01-13.bpo-35409.ozbcsR.rst +++ /dev/null @@ -1,2 +0,0 @@ -Ignore GeneratorExit exceptions when throwing an exception into the aclose -coroutine of an asynchronous generator. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-10-09-16-50-52.bpo-38379.oz5qZx.rst b/Misc/NEWS.d/next/Core and Builtins/2019-10-09-16-50-52.bpo-38379.oz5qZx.rst deleted file mode 100644 index 82dcb525dd49d..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-10-09-16-50-52.bpo-38379.oz5qZx.rst +++ /dev/null @@ -1 +0,0 @@ -When cyclic garbage collection (gc) runs finalizers that resurrect unreachable objects, the current gc run ends, without collecting any cyclic trash. However, the statistics reported by ``collect()`` and ``get_stats()`` claimed that all cyclic trash found was collected, and that the resurrected objects were collected. Changed the stats to report that none were collected. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-10-20-12-43-48.bpo-38535.ESMkVN.rst b/Misc/NEWS.d/next/Core and Builtins/2019-10-20-12-43-48.bpo-38535.ESMkVN.rst deleted file mode 100644 index 7671fd06474ba..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-10-20-12-43-48.bpo-38535.ESMkVN.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed line numbers and column offsets for AST nodes for calls without -arguments in decorators. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst deleted file mode 100644 index 8f8cf88e5e210..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst +++ /dev/null @@ -1 +0,0 @@ -In REPL mode, don't switch to PS2 if the line starts with comment or whitespace. Based on work by Batuhan Ta?kaya. diff --git a/Misc/NEWS.d/next/Documentation/2019-09-27-23-37-41.bpo-38294.go_jFf.rst b/Misc/NEWS.d/next/Documentation/2019-09-27-23-37-41.bpo-38294.go_jFf.rst deleted file mode 100644 index 0bde8c868c9ec..0000000000000 --- a/Misc/NEWS.d/next/Documentation/2019-09-27-23-37-41.bpo-38294.go_jFf.rst +++ /dev/null @@ -1 +0,0 @@ -Add list of no-longer-escaped chars to re.escape documentation \ No newline at end of file diff --git a/Misc/NEWS.d/next/Documentation/2019-10-26-13-19-07.bpo-38592.Y96BYO.rst b/Misc/NEWS.d/next/Documentation/2019-10-26-13-19-07.bpo-38592.Y96BYO.rst deleted file mode 100644 index 3752d48a7cb4f..0000000000000 --- a/Misc/NEWS.d/next/Documentation/2019-10-26-13-19-07.bpo-38592.Y96BYO.rst +++ /dev/null @@ -1 +0,0 @@ -Add Brazilian Portuguese to the language switcher at Python Documentation website. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Documentation/2019-11-15-09-22-28.bpo-38351.xwhlse.rst b/Misc/NEWS.d/next/Documentation/2019-11-15-09-22-28.bpo-38351.xwhlse.rst deleted file mode 100644 index 8e0dc9eb4ca2f..0000000000000 --- a/Misc/NEWS.d/next/Documentation/2019-11-15-09-22-28.bpo-38351.xwhlse.rst +++ /dev/null @@ -1 +0,0 @@ -Modernize :mod:`email` examples from %-formatting to f-strings. \ No newline at end of file diff --git a/Misc/NEWS.d/next/IDLE/2019-10-04-18-03-09.bpo-36698.BKcmom.rst b/Misc/NEWS.d/next/IDLE/2019-10-04-18-03-09.bpo-36698.BKcmom.rst deleted file mode 100644 index 5aaa3c92646a1..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-10-04-18-03-09.bpo-36698.BKcmom.rst +++ /dev/null @@ -1,3 +0,0 @@ -IDLE no longer fails when write non-encodable characters to stderr. It now -escapes them with a backslash, as the regular Python interpreter. Added the -``errors`` field to the standard streams. diff --git a/Misc/NEWS.d/next/IDLE/2019-10-26-18-16-24.bpo-38598.6kH9FY.rst b/Misc/NEWS.d/next/IDLE/2019-10-26-18-16-24.bpo-38598.6kH9FY.rst deleted file mode 100644 index 5d04e4a79b622..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-10-26-18-16-24.bpo-38598.6kH9FY.rst +++ /dev/null @@ -1 +0,0 @@ -Do not try to compile IDLE shell or output windows diff --git a/Misc/NEWS.d/next/IDLE/2019-10-28-04-48-03.bpo-4630.upgjiV.rst b/Misc/NEWS.d/next/IDLE/2019-10-28-04-48-03.bpo-4630.upgjiV.rst deleted file mode 100644 index 759b35b77fb8d..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-10-28-04-48-03.bpo-4630.upgjiV.rst +++ /dev/null @@ -1,3 +0,0 @@ -Add an option to toggle IDLE's cursor blink for shell, editor, and output -windows. See Settings, General, Window Preferences, Cursor Blink. -Patch by Zachary Spytz. diff --git a/Misc/NEWS.d/next/IDLE/2019-10-30-22-11-16.bpo-38636.hUhDeB.rst b/Misc/NEWS.d/next/IDLE/2019-10-30-22-11-16.bpo-38636.hUhDeB.rst deleted file mode 100644 index 4262dbea6d867..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-10-30-22-11-16.bpo-38636.hUhDeB.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix IDLE Format menu tab toggle and file indent width. These functions -(default shortcuts Alt-T and Alt-U) were mistakenly disabled in 3.7.5 -and 3.8.0. diff --git a/Misc/NEWS.d/next/IDLE/2019-11-09-23-55-59.bpo-26353.duYZiF.rst b/Misc/NEWS.d/next/IDLE/2019-11-09-23-55-59.bpo-26353.duYZiF.rst deleted file mode 100644 index fd0a2a3682100..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-11-09-23-55-59.bpo-26353.duYZiF.rst +++ /dev/null @@ -1,2 +0,0 @@ -Stop adding newline when saving an IDLE shell window. - diff --git a/Misc/NEWS.d/next/IDLE/2019-11-23-21-50-57.bpo-38862.KQ9A0m.rst b/Misc/NEWS.d/next/IDLE/2019-11-23-21-50-57.bpo-38862.KQ9A0m.rst deleted file mode 100644 index 14bab9e854bdc..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-11-23-21-50-57.bpo-38862.KQ9A0m.rst +++ /dev/null @@ -1,2 +0,0 @@ -'Strip Trailing Whitespace' on the Format menu removes extra newlines -at the end of non-shell files. diff --git a/Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst b/Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst deleted file mode 100644 index 5c9323e246787..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix IDLE autocomplete windows not always appearing on some systems. -Patch by Johnny Najera. diff --git a/Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst b/Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst deleted file mode 100644 index 38084fafd2f56..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst +++ /dev/null @@ -1 +0,0 @@ -Excape key now closes IDLE completion windows. Patch by Johnny Najera. diff --git a/Misc/NEWS.d/next/Library/2017-12-26-14-32-23.bpo-27657.6BhyVK.rst b/Misc/NEWS.d/next/Library/2017-12-26-14-32-23.bpo-27657.6BhyVK.rst deleted file mode 100644 index 77746c0ce630f..0000000000000 --- a/Misc/NEWS.d/next/Library/2017-12-26-14-32-23.bpo-27657.6BhyVK.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix urllib.parse.urlparse() with numeric paths. A string like "path:80" is -no longer parsed as a path but as a scheme ("path") and a path ("80"). diff --git a/Misc/NEWS.d/next/Library/2018-04-24-13-18-48.bpo-33348.XaJDei.rst b/Misc/NEWS.d/next/Library/2018-04-24-13-18-48.bpo-33348.XaJDei.rst deleted file mode 100644 index f95a73fb57ed4..0000000000000 --- a/Misc/NEWS.d/next/Library/2018-04-24-13-18-48.bpo-33348.XaJDei.rst +++ /dev/null @@ -1,2 +0,0 @@ -lib2to3 now recognizes expressions after ``*`` and `**` like in ``f(*[] or -[])``. diff --git a/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst b/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst deleted file mode 100644 index 815a4876e0b4a..0000000000000 --- a/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst +++ /dev/null @@ -1 +0,0 @@ -Fix dataclasses to support forward references in type annotations diff --git a/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst b/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst deleted file mode 100644 index 82f6635c81582..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst +++ /dev/null @@ -1,3 +0,0 @@ -Break cycle generated when saving an exception in socket.py, codeop.py and -dyld.py as they keep alive not only the exception but user objects through -the ``__traceback__`` attribute. Patch by Mario Corchero. diff --git a/Misc/NEWS.d/next/Library/2019-05-20-08-54-41.bpo-36952.I_glok.rst b/Misc/NEWS.d/next/Library/2019-05-20-08-54-41.bpo-36952.I_glok.rst deleted file mode 100644 index eeb4fd71e67bf..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-05-20-08-54-41.bpo-36952.I_glok.rst +++ /dev/null @@ -1,5 +0,0 @@ -Starting with Python 3.3, importing ABCs from :mod:`collections` is -deprecated, and import should be done from :mod:`collections.abc`. Still -being able to import from :mod:`collections` was marked for removal in 3.8, -but has been delayed to 3.9; documentation and ``DeprecationWarning`` -clarified. diff --git a/Misc/NEWS.d/next/Library/2019-07-09-05-44-39.bpo-36993.4javqu.rst b/Misc/NEWS.d/next/Library/2019-07-09-05-44-39.bpo-36993.4javqu.rst deleted file mode 100644 index 009e07b92d22d..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-07-09-05-44-39.bpo-36993.4javqu.rst +++ /dev/null @@ -1,2 +0,0 @@ -Improve error reporting for corrupt zip files with bad zip64 extra data. Patch -by Daniel Hillier. diff --git a/Misc/NEWS.d/next/Library/2019-09-29-22-47-37.bpo-13153.0mO9qR.rst b/Misc/NEWS.d/next/Library/2019-09-29-22-47-37.bpo-13153.0mO9qR.rst deleted file mode 100644 index 6f9561539d8d3..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-09-29-22-47-37.bpo-13153.0mO9qR.rst +++ /dev/null @@ -1,4 +0,0 @@ -OS native encoding is now used for converting between Python strings and -Tcl objects. This allows to display, copy and paste to clipboard emoji and -other non-BMP characters. Converting strings from Tcl to Python and back -now never fails (except MemoryError). diff --git a/Misc/NEWS.d/next/Library/2019-10-01-21-06-18.bpo-38341.uqwgU_.rst b/Misc/NEWS.d/next/Library/2019-10-01-21-06-18.bpo-38341.uqwgU_.rst deleted file mode 100644 index dd1a6b080b627..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-10-01-21-06-18.bpo-38341.uqwgU_.rst +++ /dev/null @@ -1 +0,0 @@ -Add :exc:`smtplib.SMTPNotSupportedError` to the :mod:`smtplib` exported names. diff --git a/Misc/NEWS.d/next/Library/2019-10-05-02-07-52.bpo-38332.hwrPN7.rst b/Misc/NEWS.d/next/Library/2019-10-05-02-07-52.bpo-38332.hwrPN7.rst deleted file mode 100644 index 600c702cf3bbd..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-10-05-02-07-52.bpo-38332.hwrPN7.rst +++ /dev/null @@ -1,3 +0,0 @@ -Prevent :exc:`KeyError` thrown by :func:`_encoded_words.decode` when given -an encoded-word with invalid content-type encoding from propagating all the -way to :func:`email.message.get`. diff --git a/Misc/NEWS.d/next/Library/2019-10-08-11-18-40.bpo-38405.0-7e7s.rst b/Misc/NEWS.d/next/Library/2019-10-08-11-18-40.bpo-38405.0-7e7s.rst deleted file mode 100644 index ee346a30ec416..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-10-08-11-18-40.bpo-38405.0-7e7s.rst +++ /dev/null @@ -1 +0,0 @@ -Nested subclasses of :class:`typing.NamedTuple` are now pickleable. diff --git a/Misc/NEWS.d/next/Library/2019-10-09-18-16-51.bpo-38422.aiM5bq.rst b/Misc/NEWS.d/next/Library/2019-10-09-18-16-51.bpo-38422.aiM5bq.rst deleted file mode 100644 index 0958fe265db56..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-10-09-18-16-51.bpo-38422.aiM5bq.rst +++ /dev/null @@ -1 +0,0 @@ -Clarify docstrings of pathlib suffix(es) diff --git a/Misc/NEWS.d/next/Library/2019-10-10-00-25-28.bpo-38109.9w-IGF.rst b/Misc/NEWS.d/next/Library/2019-10-10-00-25-28.bpo-38109.9w-IGF.rst deleted file mode 100644 index 3f4484dc644fa..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-10-10-00-25-28.bpo-38109.9w-IGF.rst +++ /dev/null @@ -1,3 +0,0 @@ -Add missing :data:`stat.S_IFDOOR`, :data:`stat.S_IFPORT`, :data:`stat.S_IFWHT`, -:func:`stat.S_ISDOOR`, :func:`stat.S_ISPORT`, and :func:`stat.S_ISWHT` values to -the Python implementation of :mod:`stat`. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Library/2019-10-20-12-04-48.bpo-31202.NfdIus.rst b/Misc/NEWS.d/next/Library/2019-10-20-12-04-48.bpo-31202.NfdIus.rst deleted file mode 100644 index 8edb09d61317b..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-10-20-12-04-48.bpo-31202.NfdIus.rst +++ /dev/null @@ -1,2 +0,0 @@ -The case the result of :func:`pathlib.WindowsPath.glob` matches now the case -of the pattern for literal parts. diff --git a/Misc/NEWS.d/next/Library/2019-10-27-00-08-49.bpo-38334.pfLLmc.rst b/Misc/NEWS.d/next/Library/2019-10-27-00-08-49.bpo-38334.pfLLmc.rst deleted file mode 100644 index 0d05d3f6e6c09..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-10-27-00-08-49.bpo-38334.pfLLmc.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed seeking backward on an encrypted :class:`zipfile.ZipExtFile`. diff --git a/Misc/NEWS.d/next/Library/2019-11-06-15-26-15.bpo-38686.HNFBce.rst b/Misc/NEWS.d/next/Library/2019-11-06-15-26-15.bpo-38686.HNFBce.rst deleted file mode 100644 index 7a419ff1e3338..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-06-15-26-15.bpo-38686.HNFBce.rst +++ /dev/null @@ -1 +0,0 @@ -Added support for multiple ``qop`` values in :class:`urllib.request.AbstractDigestAuthHandler`. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Library/2019-11-11-21-43-06.bpo-27805.D3zl1_.rst b/Misc/NEWS.d/next/Library/2019-11-11-21-43-06.bpo-27805.D3zl1_.rst deleted file mode 100644 index 37be6a5d0b22b..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-11-21-43-06.bpo-27805.D3zl1_.rst +++ /dev/null @@ -1,2 +0,0 @@ -Allow opening pipes and other non-seekable files in append mode with -:func:`open`. diff --git a/Misc/NEWS.d/next/Library/2019-11-13-16-17-43.bpo-38785.NEOEfk.rst b/Misc/NEWS.d/next/Library/2019-11-13-16-17-43.bpo-38785.NEOEfk.rst deleted file mode 100644 index 49e9937998081..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-13-16-17-43.bpo-38785.NEOEfk.rst +++ /dev/null @@ -1,2 +0,0 @@ -Prevent asyncio from crashing if parent ``__init__`` is not called from a -constructor of object derived from ``asyncio.Future``. diff --git a/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst b/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst deleted file mode 100644 index 2c6a6e853c25f..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst +++ /dev/null @@ -1,2 +0,0 @@ -Make Python compatible with OpenSSL 3.0.0. :func:`ssl.SSLSocket.getpeercert` -no longer returns IPv6 addresses with a trailing new line. diff --git a/Misc/NEWS.d/next/Library/2019-11-16-23-26-25.bpo-38821.-albNN.rst b/Misc/NEWS.d/next/Library/2019-11-16-23-26-25.bpo-38821.-albNN.rst deleted file mode 100644 index 2e7a22f661ac6..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-16-23-26-25.bpo-38821.-albNN.rst +++ /dev/null @@ -1 +0,0 @@ -Fix unhandled exceptions in :mod:`argparse` when internationalizing error messages for arguments with ``nargs`` set to special (non-integer) values. Patch by Federico Bond. diff --git a/Misc/NEWS.d/next/Library/2019-11-21-11-39-17.bpo-37838.lRFcEC.rst b/Misc/NEWS.d/next/Library/2019-11-21-11-39-17.bpo-37838.lRFcEC.rst deleted file mode 100644 index 96d804addeb60..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-21-11-39-17.bpo-37838.lRFcEC.rst +++ /dev/null @@ -1 +0,0 @@ -:meth:`typing.get_type_hints` properly handles functions decorated with :meth:`functools.wraps`. diff --git a/Misc/NEWS.d/next/Library/2019-11-27-16-30-02.bpo-26730.56cdBn.rst b/Misc/NEWS.d/next/Library/2019-11-27-16-30-02.bpo-26730.56cdBn.rst deleted file mode 100644 index a92b90a495605..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-27-16-30-02.bpo-26730.56cdBn.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix ``SpooledTemporaryFile.rollover()`` might corrupt the file when it is in -text mode. Patch by Serhiy Storchaka. diff --git a/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst b/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst deleted file mode 100644 index 107f9bb008330..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix ``json.tool`` failed to read a JSON file with non-ASCII characters when -locale encoding is not UTF-8. diff --git a/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst b/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst deleted file mode 100644 index 777535299be17..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst +++ /dev/null @@ -1,2 +0,0 @@ -Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python -version. diff --git a/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst b/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst deleted file mode 100644 index 6a91a12e4930a..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst +++ /dev/null @@ -1 +0,0 @@ -Return class from ``ContextVar.__class_getitem__`` to simplify subclassing. diff --git a/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst b/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst deleted file mode 100644 index 8402845a5a047..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix asyncio when the ssl module is missing: only check for ssl.SSLSocket -instance if the ssl module is available. diff --git a/Misc/NEWS.d/next/Security/2019-11-15-00-54-42.bpo-38804.vjbM8V.rst b/Misc/NEWS.d/next/Security/2019-11-15-00-54-42.bpo-38804.vjbM8V.rst deleted file mode 100644 index 1f45142d9f743..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-11-15-00-54-42.bpo-38804.vjbM8V.rst +++ /dev/null @@ -1 +0,0 @@ -Fixes a ReDoS vulnerability in :mod:`http.cookiejar`. Patch by Ben Caller. diff --git a/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst b/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst deleted file mode 100644 index 0fafb63402e46..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst +++ /dev/null @@ -1,6 +0,0 @@ -Due to significant security concerns, the *reuse_address* parameter of -:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is -because of the behavior of ``SO_REUSEADDR`` in UDP. For more details, see the -documentation for ``loop.create_datagram_endpoint()``. -(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in -:issue:`37228`.) diff --git a/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst b/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst deleted file mode 100644 index 1bf6ed567b241..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst +++ /dev/null @@ -1 +0,0 @@ -Newline characters have been escaped when performing uu encoding to prevent them from overflowing into to content section of the encoded file. This prevents malicious or accidental modification of data during the decoding process. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Tests/2019-10-08-16-42-05.bpo-37531.7v-_Ca.rst b/Misc/NEWS.d/next/Tests/2019-10-08-16-42-05.bpo-37531.7v-_Ca.rst deleted file mode 100644 index 78ab636516514..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-10-08-16-42-05.bpo-37531.7v-_Ca.rst +++ /dev/null @@ -1,5 +0,0 @@ -On timeout, regrtest no longer attempts to call ``popen.communicate()`` -again: it can hang until all child processes using stdout and stderr pipes -completes. Kill the worker process and ignores its output. Change also the -faulthandler timeout of the main process from 1 minute to 5 minutes, for Python -slowest buildbots. diff --git a/Misc/NEWS.d/next/Tests/2019-10-16-01-36-15.bpo-35998.G305Bf.rst b/Misc/NEWS.d/next/Tests/2019-10-16-01-36-15.bpo-35998.G305Bf.rst deleted file mode 100644 index 43d3942fd0772..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-10-16-01-36-15.bpo-35998.G305Bf.rst +++ /dev/null @@ -1,5 +0,0 @@ -Fix a race condition in test_asyncio.test_start_tls_server_1(). Previously, -there was a race condition between the test main() function which replaces the -protocol and the test ServerProto protocol which sends ANSWER once it gets -HELLO. Now, only the test main() function is responsible to send data, -ServerProto no longer sends data. diff --git a/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst b/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst deleted file mode 100644 index 5060ecf2dc5a4..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst +++ /dev/null @@ -1 +0,0 @@ -Raise :exc:`TypeError` when passing target as a string with :meth:`unittest.mock.patch.object`. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst b/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst deleted file mode 100644 index 517a1371eacd9..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix test_faulthandler on GCC 10. Use the "volatile" keyword in -``faulthandler._stack_overflow()`` to prevent tail call optimization on any -compiler, rather than relying on compiler specific pragma. diff --git a/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst b/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst deleted file mode 100644 index 10f3cc08511dd..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix test_pty: if the process is the session leader, closing the master file -descriptor raises a SIGHUP signal: simply ignore SIGHUP when running the -tests. diff --git a/Misc/NEWS.d/next/Tools-Demos/2019-10-02-09-48-42.bpo-38347.2Tq5D1.rst b/Misc/NEWS.d/next/Tools-Demos/2019-10-02-09-48-42.bpo-38347.2Tq5D1.rst deleted file mode 100644 index ae64a319b5756..0000000000000 --- a/Misc/NEWS.d/next/Tools-Demos/2019-10-02-09-48-42.bpo-38347.2Tq5D1.rst +++ /dev/null @@ -1 +0,0 @@ -pathfix.py: Assume all files that end on '.py' are Python scripts when working recursively. diff --git a/Misc/NEWS.d/next/Tools-Demos/2019-10-08-15-07-52.bpo-38118.pIZD6H.rst b/Misc/NEWS.d/next/Tools-Demos/2019-10-08-15-07-52.bpo-38118.pIZD6H.rst deleted file mode 100644 index 13adadb0b8f7a..0000000000000 --- a/Misc/NEWS.d/next/Tools-Demos/2019-10-08-15-07-52.bpo-38118.pIZD6H.rst +++ /dev/null @@ -1,2 +0,0 @@ -Update Valgrind suppression file to ignore a false alarm in -:c:func:`PyUnicode_Decode` when using GCC builtin strcmp(). diff --git a/Misc/NEWS.d/next/Windows/2019-10-28-10-48-16.bpo-38589.V69Q1a.rst b/Misc/NEWS.d/next/Windows/2019-10-28-10-48-16.bpo-38589.V69Q1a.rst deleted file mode 100644 index e864290723e07..0000000000000 --- a/Misc/NEWS.d/next/Windows/2019-10-28-10-48-16.bpo-38589.V69Q1a.rst +++ /dev/null @@ -1 +0,0 @@ -Fixes HTML Help shortcut when Windows is not installed to C drive diff --git a/README.rst b/README.rst index aa80a58d5f0c2..6d471ebea151a 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ -This is Python version 3.7.5+ -============================= +This is Python version 3.7.6 candidate 1 +======================================== .. image:: https://travis-ci.org/python/cpython.svg?branch=3.7 :alt: CPython build status on Travis CI From webhook-mailer at python.org Wed Dec 11 04:40:16 2019 From: webhook-mailer at python.org (Ned Deily) Date: Wed, 11 Dec 2019 09:40:16 -0000 Subject: [Python-checkins] 3.6.10rc1 Message-ID: https://github.com/python/cpython/commit/7ea0551592d80584b318099d5ebde4e7c552679f commit: 7ea0551592d80584b318099d5ebde4e7c552679f branch: 3.6 author: Ned Deily committer: Ned Deily date: 2019-12-11T03:28:36-05:00 summary: 3.6.10rc1 files: A Misc/NEWS.d/3.6.10rc1.rst D Misc/NEWS.d/next/Library/2019-04-08-13-00-13.bpo-36564._n67m_.rst D Misc/NEWS.d/next/Library/2019-09-27-15-24-45.bpo-38216.-7yvZR.rst D Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst D Misc/NEWS.d/next/Security/2019-07-16-08-11-00.bpo-37461.1Ahz7O.rst D Misc/NEWS.d/next/Security/2019-09-23-21-02-46.bpo-38174.MeWuJd.rst D Misc/NEWS.d/next/Security/2019-09-25-13-21-09.bpo-38243.1pfz24.rst D Misc/NEWS.d/next/Security/2019-11-15-00-54-42.bpo-38804.vjbM8V.rst D Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst D Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst M Include/patchlevel.h M Lib/pydoc_data/topics.py M README.rst diff --git a/Include/patchlevel.h b/Include/patchlevel.h index a1ab4d98322dc..7e046e3e3ee4a 100644 --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -18,12 +18,12 @@ /*--start constants--*/ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 6 -#define PY_MICRO_VERSION 9 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL -#define PY_RELEASE_SERIAL 0 +#define PY_MICRO_VERSION 10 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA +#define PY_RELEASE_SERIAL 1 /* Version as a string */ -#define PY_VERSION "3.6.9+" +#define PY_VERSION "3.6.10rc1" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index df3f212eb73ef..b7d7cfa412bc3 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Tue Jun 18 20:31:29 2019 +# Autogenerated by Sphinx on Wed Dec 11 03:20:37 2019 topics = {'assert': 'The "assert" statement\n' '**********************\n' '\n' diff --git a/Misc/NEWS.d/3.6.10rc1.rst b/Misc/NEWS.d/3.6.10rc1.rst new file mode 100644 index 0000000000000..1a902e429d438 --- /dev/null +++ b/Misc/NEWS.d/3.6.10rc1.rst @@ -0,0 +1,97 @@ +.. bpo: 38945 +.. date: 2019-12-01-22-44-40 +.. nonce: ztmNXc +.. release date: 2019-12-11 +.. section: Security + +Newline characters have been escaped when performing uu encoding to prevent +them from overflowing into to content section of the encoded file. This +prevents malicious or accidental modification of data during the decoding +process. + +.. + +.. bpo: 37228 +.. date: 2019-11-21-21-36-54 +.. nonce: yBZnFG +.. section: Security + +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This +is because of the behavior of ``SO_REUSEADDR`` in UDP. For more details, see +the documentation for ``loop.create_datagram_endpoint()``. (Contributed by +Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:`37228`.) + +.. + +.. bpo: 38804 +.. date: 2019-11-15-00-54-42 +.. nonce: vjbM8V +.. section: Security + +Fixes a ReDoS vulnerability in :mod:`http.cookiejar`. Patch by Ben Caller. + +.. + +.. bpo: 38243 +.. date: 2019-09-25-13-21-09 +.. nonce: 1pfz24 +.. section: Security + +Escape the server title of :class:`xmlrpc.server.DocXMLRPCServer` when +rendering the document page as HTML. (Contributed by Dong-hee Na in +:issue:`38243`.) + +.. + +.. bpo: 38174 +.. date: 2019-09-23-21-02-46 +.. nonce: MeWuJd +.. section: Security + +Update vendorized expat library version to 2.2.8, which resolves +CVE-2019-15903. + +.. + +.. bpo: 37461 +.. date: 2019-07-16-08-11-00 +.. nonce: 1Ahz7O +.. section: Security + +Fix an infinite loop when parsing specially crafted email headers. Patch by +Abhilash Raj. + +.. + +.. bpo: 34155 +.. date: 2019-05-04-13-33-37 +.. nonce: MJll68 +.. section: Security + +Fix parsing of invalid email addresses with more than one ``@`` (e.g. +a at b@c.com.) to not return the part before 2nd ``@`` as valid email address. +Patch by maxking & jpic. + +.. + +.. bpo: 38216 +.. date: 2019-09-27-15-24-45 +.. nonce: -7yvZR +.. section: Library + +Allow the rare code that wants to send invalid http requests from the +`http.client` library a way to do so. The fixes for bpo-30458 led to +breakage for some projects that were relying on this ability to test their +own behavior in the face of bad requests. + +.. + +.. bpo: 36564 +.. date: 2019-04-08-13-00-13 +.. nonce: _n67m_ +.. section: Library + +Fix infinite loop in email header folding logic that would be triggered when +an email policy's max_line_length is not long enough to include the required +markup and any values in the message. Patch by Paul Ganssle diff --git a/Misc/NEWS.d/next/Library/2019-04-08-13-00-13.bpo-36564._n67m_.rst b/Misc/NEWS.d/next/Library/2019-04-08-13-00-13.bpo-36564._n67m_.rst deleted file mode 100644 index ddd17aec1dd86..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-04-08-13-00-13.bpo-36564._n67m_.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix infinite loop in email header folding logic that would be triggered when -an email policy's max_line_length is not long enough to include the required -markup and any values in the message. Patch by Paul Ganssle diff --git a/Misc/NEWS.d/next/Library/2019-09-27-15-24-45.bpo-38216.-7yvZR.rst b/Misc/NEWS.d/next/Library/2019-09-27-15-24-45.bpo-38216.-7yvZR.rst deleted file mode 100644 index ac8e2b042d929..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-09-27-15-24-45.bpo-38216.-7yvZR.rst +++ /dev/null @@ -1,4 +0,0 @@ -Allow the rare code that wants to send invalid http requests from the -`http.client` library a way to do so. The fixes for bpo-30458 led to -breakage for some projects that were relying on this ability to test their -own behavior in the face of bad requests. diff --git a/Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst b/Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst deleted file mode 100644 index 50292e29ed1d2..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst +++ /dev/null @@ -1 +0,0 @@ -Fix parsing of invalid email addresses with more than one ``@`` (e.g. a at b@c.com.) to not return the part before 2nd ``@`` as valid email address. Patch by maxking & jpic. diff --git a/Misc/NEWS.d/next/Security/2019-07-16-08-11-00.bpo-37461.1Ahz7O.rst b/Misc/NEWS.d/next/Security/2019-07-16-08-11-00.bpo-37461.1Ahz7O.rst deleted file mode 100644 index 9d47578c62771..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-07-16-08-11-00.bpo-37461.1Ahz7O.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix an infinite loop when parsing specially crafted email headers. Patch by -Abhilash Raj. diff --git a/Misc/NEWS.d/next/Security/2019-09-23-21-02-46.bpo-38174.MeWuJd.rst b/Misc/NEWS.d/next/Security/2019-09-23-21-02-46.bpo-38174.MeWuJd.rst deleted file mode 100644 index e3da6fcdd139f..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-09-23-21-02-46.bpo-38174.MeWuJd.rst +++ /dev/null @@ -1,2 +0,0 @@ -Update vendorized expat library version to 2.2.8, which resolves -CVE-2019-15903. diff --git a/Misc/NEWS.d/next/Security/2019-09-25-13-21-09.bpo-38243.1pfz24.rst b/Misc/NEWS.d/next/Security/2019-09-25-13-21-09.bpo-38243.1pfz24.rst deleted file mode 100644 index 98d7be129573a..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-09-25-13-21-09.bpo-38243.1pfz24.rst +++ /dev/null @@ -1,3 +0,0 @@ -Escape the server title of :class:`xmlrpc.server.DocXMLRPCServer` -when rendering the document page as HTML. -(Contributed by Dong-hee Na in :issue:`38243`.) diff --git a/Misc/NEWS.d/next/Security/2019-11-15-00-54-42.bpo-38804.vjbM8V.rst b/Misc/NEWS.d/next/Security/2019-11-15-00-54-42.bpo-38804.vjbM8V.rst deleted file mode 100644 index 1f45142d9f743..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-11-15-00-54-42.bpo-38804.vjbM8V.rst +++ /dev/null @@ -1 +0,0 @@ -Fixes a ReDoS vulnerability in :mod:`http.cookiejar`. Patch by Ben Caller. diff --git a/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst b/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst deleted file mode 100644 index 0fafb63402e46..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst +++ /dev/null @@ -1,6 +0,0 @@ -Due to significant security concerns, the *reuse_address* parameter of -:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is -because of the behavior of ``SO_REUSEADDR`` in UDP. For more details, see the -documentation for ``loop.create_datagram_endpoint()``. -(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in -:issue:`37228`.) diff --git a/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst b/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst deleted file mode 100644 index 1bf6ed567b241..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst +++ /dev/null @@ -1 +0,0 @@ -Newline characters have been escaped when performing uu encoding to prevent them from overflowing into to content section of the encoded file. This prevents malicious or accidental modification of data during the decoding process. \ No newline at end of file diff --git a/README.rst b/README.rst index 88524f95cad29..e3ef5ec6cc763 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ -This is Python version 3.6.9+ -============================= +This is Python version 3.6.10 candidate 1 +========================================= .. image:: https://travis-ci.org/python/cpython.svg?branch=3.6 :alt: CPython build status on Travis CI From webhook-mailer at python.org Wed Dec 11 05:30:23 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 11 Dec 2019 10:30:23 -0000 Subject: [Python-checkins] bpo-38614: Use test.support.SHORT_TIMEOUT constant (GH-17566) Message-ID: https://github.com/python/cpython/commit/0d63bacefd2e5b937ec6b0ec3053777c09941b4a commit: 0d63bacefd2e5b937ec6b0ec3053777c09941b4a branch: master author: Victor Stinner committer: GitHub date: 2019-12-11T11:30:03+01:00 summary: bpo-38614: Use test.support.SHORT_TIMEOUT constant (GH-17566) Replace hardcoded timeout constants in tests with SHORT_TIMEOUT of test.support, so it's easier to ajdust this timeout for all tests at once. SHORT_TIMEOUT is 30 seconds by default, but it can be longer depending on --timeout command line option. The change makes almost all timeouts longer, except test_reap_children() of test_support which is made 2x shorter: SHORT_TIMEOUT should be enough. If this test starts to fail, LONG_TIMEOUT should be used instead. Uniformize also "from test import support" import in some test files. files: M Lib/test/_test_multiprocessing.py M Lib/test/fork_wait.py M Lib/test/signalinterproctester.py M Lib/test/test_asyncio/test_events.py M Lib/test/test_asyncio/test_sslproto.py M Lib/test/test_asyncio/utils.py M Lib/test/test_concurrent_futures.py M Lib/test/test_fork1.py M Lib/test/test_pydoc.py M Lib/test/test_sched.py M Lib/test/test_signal.py M Lib/test/test_socketserver.py M Lib/test/test_ssl.py M Lib/test/test_subprocess.py M Lib/test/test_support.py M Lib/test/test_threading.py M Lib/test/test_wait3.py M Lib/test/test_wait4.py M Misc/NEWS.d/next/Tests/2019-12-10-14-26-23.bpo-38614.89JpNh.rst diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 86f3d1ca3a36a..399be13f3a260 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -318,7 +318,7 @@ def _test_create_grandchild_process(cls, wconn): def _test_report_parent_status(cls, wconn): from multiprocessing.process import parent_process wconn.send("alive" if parent_process().is_alive() else "not alive") - parent_process().join(timeout=5) + parent_process().join(timeout=support.SHORT_TIMEOUT) wconn.send("alive" if parent_process().is_alive() else "not alive") def test_process(self): diff --git a/Lib/test/fork_wait.py b/Lib/test/fork_wait.py index 9850b06a318ee..f6bbffe1e7fdc 100644 --- a/Lib/test/fork_wait.py +++ b/Lib/test/fork_wait.py @@ -11,7 +11,7 @@ import os, sys, time, unittest import threading -import test.support as support +from test import support LONGSLEEP = 2 @@ -62,7 +62,7 @@ def test_wait(self): self.threads.append(thread) # busy-loop to wait for threads - deadline = time.monotonic() + 10.0 + deadline = time.monotonic() + support.SHORT_TIMEOUT while len(self.alive) < NUM_THREADS: time.sleep(0.1) if deadline < time.monotonic(): diff --git a/Lib/test/signalinterproctester.py b/Lib/test/signalinterproctester.py index 168b5da0f2c0f..bc60b747f7168 100644 --- a/Lib/test/signalinterproctester.py +++ b/Lib/test/signalinterproctester.py @@ -4,6 +4,7 @@ import sys import time import unittest +from test import support class SIGUSR1Exception(Exception): @@ -27,7 +28,7 @@ def wait_signal(self, child, signame): # (if set) child.wait() - timeout = 10.0 + timeout = support.SHORT_TIMEOUT deadline = time.monotonic() + timeout while time.monotonic() < deadline: diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index 52467d8b290b3..4cbd1ed4712d5 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -1475,12 +1475,12 @@ def reader(data): return len(data) test_utils.run_until(self.loop, lambda: reader(data) >= 1, - timeout=10) + timeout=support.SHORT_TIMEOUT) self.assertEqual(b'1', data) transport.write(b'2345') test_utils.run_until(self.loop, lambda: reader(data) >= 5, - timeout=10) + timeout=support.SHORT_TIMEOUT) self.assertEqual(b'12345', data) self.assertEqual('CONNECTED', proto.state) @@ -1531,27 +1531,29 @@ def reader(data): return len(data) write_transport.write(b'1') - test_utils.run_until(self.loop, lambda: reader(data) >= 1, timeout=10) + test_utils.run_until(self.loop, lambda: reader(data) >= 1, + timeout=support.SHORT_TIMEOUT) self.assertEqual(b'1', data) self.assertEqual(['INITIAL', 'CONNECTED'], read_proto.state) self.assertEqual('CONNECTED', write_proto.state) os.write(master, b'a') test_utils.run_until(self.loop, lambda: read_proto.nbytes >= 1, - timeout=10) + timeout=support.SHORT_TIMEOUT) self.assertEqual(['INITIAL', 'CONNECTED'], read_proto.state) self.assertEqual(1, read_proto.nbytes) self.assertEqual('CONNECTED', write_proto.state) write_transport.write(b'2345') - test_utils.run_until(self.loop, lambda: reader(data) >= 5, timeout=10) + test_utils.run_until(self.loop, lambda: reader(data) >= 5, + timeout=support.SHORT_TIMEOUT) self.assertEqual(b'12345', data) self.assertEqual(['INITIAL', 'CONNECTED'], read_proto.state) self.assertEqual('CONNECTED', write_proto.state) os.write(master, b'bcde') test_utils.run_until(self.loop, lambda: read_proto.nbytes >= 5, - timeout=10) + timeout=support.SHORT_TIMEOUT) self.assertEqual(['INITIAL', 'CONNECTED'], read_proto.state) self.assertEqual(5, read_proto.nbytes) self.assertEqual('CONNECTED', write_proto.state) diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py index 8e9d4c5194f6f..c716eacfaf1c0 100644 --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -274,7 +274,8 @@ def eof_received(self): with self.tcp_server(serve, timeout=self.TIMEOUT) as srv: self.loop.run_until_complete( - asyncio.wait_for(client(srv.addr), timeout=10)) + asyncio.wait_for(client(srv.addr), + timeout=support.SHORT_TIMEOUT)) # No garbage is left if SSL is closed uncleanly client_context = weakref.ref(client_context) @@ -335,7 +336,8 @@ def eof_received(self): with self.tcp_server(serve, timeout=self.TIMEOUT) as srv: self.loop.run_until_complete( - asyncio.wait_for(client(srv.addr), timeout=10)) + asyncio.wait_for(client(srv.addr), + timeout=support.SHORT_TIMEOUT)) # No garbage is left for SSL client from loop.create_connection, even # if user stores the SSLTransport in corresponding protocol instance @@ -491,7 +493,8 @@ def eof_received(self): with self.tcp_server(serve, timeout=self.TIMEOUT) as srv: self.loop.run_until_complete( - asyncio.wait_for(client(srv.addr), timeout=10)) + asyncio.wait_for(client(srv.addr), + timeout=support.SHORT_TIMEOUT)) def test_start_tls_server_1(self): HELLO_MSG = b'1' * self.PAYLOAD_SIZE @@ -619,7 +622,7 @@ def server(sock): *addr, ssl=client_sslctx, server_hostname='', - ssl_handshake_timeout=10.0), + ssl_handshake_timeout=support.SHORT_TIMEOUT), 0.5) with self.tcp_server(server, diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py index 6d8a6e2ac1368..804db9166fe7f 100644 --- a/Lib/test/test_asyncio/utils.py +++ b/Lib/test/test_asyncio/utils.py @@ -107,7 +107,7 @@ def run_briefly(loop): gen.close() -def run_until(loop, pred, timeout=30): +def run_until(loop, pred, timeout=support.SHORT_TIMEOUT): deadline = time.monotonic() + timeout while not pred(): if timeout is not None: diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index ff9a493803405..8b7518530193d 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -1,9 +1,9 @@ -import test.support +from test import support # Skip tests if _multiprocessing wasn't built. -test.support.import_module('_multiprocessing') +support.import_module('_multiprocessing') # Skip tests if sem_open implementation is broken. -test.support.import_module('multiprocessing.synchronize') +support.import_module('multiprocessing.synchronize') from test.support.script_helper import assert_python_ok @@ -101,11 +101,11 @@ def make_dummy_object(_): class BaseTestCase(unittest.TestCase): def setUp(self): - self._thread_key = test.support.threading_setup() + self._thread_key = support.threading_setup() def tearDown(self): - test.support.reap_children() - test.support.threading_cleanup(*self._thread_key) + support.reap_children() + support.threading_cleanup(*self._thread_key) class ExecutorMixin: @@ -132,7 +132,7 @@ def tearDown(self): self.executor = None dt = time.monotonic() - self.t1 - if test.support.verbose: + if support.verbose: print("%.2fs" % dt, end=' ') self.assertLess(dt, 300, "synchronization issue: test lasted too long") @@ -712,7 +712,7 @@ def test_shutdown_race_issue12456(self): self.executor.map(str, [2] * (self.worker_count + 1)) self.executor.shutdown() - @test.support.cpython_only + @support.cpython_only def test_no_stale_references(self): # Issue #16284: check that the executors don't unnecessarily hang onto # references. @@ -724,7 +724,7 @@ def test_no_stale_references(self): self.executor.submit(my_object.my_method) del my_object - collected = my_object_collected.wait(timeout=5.0) + collected = my_object_collected.wait(timeout=support.SHORT_TIMEOUT) self.assertTrue(collected, "Stale reference not collected within timeout.") @@ -836,7 +836,7 @@ def test_traceback(self): self.assertIs(type(cause), futures.process._RemoteTraceback) self.assertIn('raise RuntimeError(123) # some comment', cause.tb) - with test.support.captured_stderr() as f1: + with support.captured_stderr() as f1: try: raise exc except RuntimeError: @@ -929,7 +929,7 @@ def __reduce__(self): class ExecutorDeadlockTest: - TIMEOUT = 15 + TIMEOUT = support.SHORT_TIMEOUT @classmethod def _sleep_id(cls, x, delay): @@ -994,7 +994,7 @@ def test_crash(self): for func, args, error, name in crash_cases: with self.subTest(name): # The captured_stderr reduces the noise in the test report - with test.support.captured_stderr(): + with support.captured_stderr(): executor = self.executor_type( max_workers=2, mp_context=get_context(self.ctx)) res = executor.submit(func, *args) @@ -1061,7 +1061,7 @@ def fn(callback_future): self.assertTrue(was_cancelled) def test_done_callback_raises(self): - with test.support.captured_stderr() as stderr: + with support.captured_stderr() as stderr: raising_was_called = False fn_was_called = False @@ -1116,7 +1116,7 @@ def fn(callback_future): self.assertTrue(was_cancelled) def test_done_callback_raises_already_succeeded(self): - with test.support.captured_stderr() as stderr: + with support.captured_stderr() as stderr: def raising_fn(callback_future): raise Exception('doh!') @@ -1235,7 +1235,8 @@ def notification(): t = threading.Thread(target=notification) t.start() - self.assertRaises(futures.CancelledError, f1.result, timeout=5) + self.assertRaises(futures.CancelledError, + f1.result, timeout=support.SHORT_TIMEOUT) t.join() def test_exception_with_timeout(self): @@ -1264,7 +1265,7 @@ def notification(): t = threading.Thread(target=notification) t.start() - self.assertTrue(isinstance(f1.exception(timeout=5), OSError)) + self.assertTrue(isinstance(f1.exception(timeout=support.SHORT_TIMEOUT), OSError)) t.join() def test_multiple_set_result(self): @@ -1300,12 +1301,12 @@ def test_multiple_set_exception(self): def setUpModule(): global _threads_key - _threads_key = test.support.threading_setup() + _threads_key = support.threading_setup() def tearDownModule(): - test.support.threading_cleanup(*_threads_key) - test.support.reap_children() + support.threading_cleanup(*_threads_key) + support.reap_children() # cleanup multiprocessing multiprocessing.process._cleanup() @@ -1315,7 +1316,7 @@ def tearDownModule(): # bpo-37421: Explicitly call _run_finalizers() to remove immediately # temporary directories created by multiprocessing.util.get_temp_dir(). multiprocessing.util._run_finalizers() - test.support.gc_collect() + support.gc_collect() if __name__ == "__main__": diff --git a/Lib/test/test_fork1.py b/Lib/test/test_fork1.py index 2ab856ff56904..ce0a05a541a73 100644 --- a/Lib/test/test_fork1.py +++ b/Lib/test/test_fork1.py @@ -10,15 +10,15 @@ import unittest from test.fork_wait import ForkWait -from test.support import reap_children, get_attribute, verbose +from test import support # Skip test if fork does not exist. -get_attribute(os, 'fork') +support.get_attribute(os, 'fork') class ForkTest(ForkWait): def wait_impl(self, cpid): - deadline = time.monotonic() + 10.0 + deadline = time.monotonic() + support.SHORT_TIMEOUT while time.monotonic() <= deadline: # waitpid() shouldn't hang, but some of the buildbots seem to hang # in the forking tests. This is an attempt to fix the problem. @@ -56,7 +56,7 @@ def importer(): if m == complete_module: os._exit(0) else: - if verbose > 1: + if support.verbose > 1: print("Child encountered partial module") os._exit(1) else: @@ -90,7 +90,7 @@ def fork_with_import_lock(level): imp.release_lock() except RuntimeError: if in_child: - if verbose > 1: + if support.verbose > 1: print("RuntimeError in child") os._exit(1) raise @@ -105,7 +105,7 @@ def fork_with_import_lock(level): def tearDownModule(): - reap_children() + support.reap_children() if __name__ == "__main__": unittest.main() diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py index b803b8bff2f7f..ebd8d4a6c3db1 100644 --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -1336,7 +1336,7 @@ def my_url_handler(url, content_type): self.assertIn('0.0.0.0', serverthread.docserver.address) starttime = time.monotonic() - timeout = 1 #seconds + timeout = test.support.SHORT_TIMEOUT while serverthread.serving: time.sleep(.01) diff --git a/Lib/test/test_sched.py b/Lib/test/test_sched.py index f78944fd18822..26cb4be81e5e4 100644 --- a/Lib/test/test_sched.py +++ b/Lib/test/test_sched.py @@ -6,7 +6,7 @@ from test import support -TIMEOUT = 10 +TIMEOUT = support.SHORT_TIMEOUT class Timer: diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index 119e9e079ac03..5c02c28a90e17 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -644,7 +644,7 @@ def handler(signum, frame): # wait until the child process is loaded and has started first_line = process.stdout.readline() - stdout, stderr = process.communicate(timeout=5.0) + stdout, stderr = process.communicate(timeout=support.SHORT_TIMEOUT) except subprocess.TimeoutExpired: process.kill() return False @@ -1192,7 +1192,7 @@ def second_handler(signum=None, frame=None): self.setsig(signal.SIGALRM, second_handler) # for ITIMER_REAL expected_sigs = 0 - deadline = time.monotonic() + 15.0 + deadline = time.monotonic() + support.SHORT_TIMEOUT while expected_sigs < N: os.kill(os.getpid(), signal.SIGPROF) @@ -1226,7 +1226,7 @@ def handler(signum, frame): self.setsig(signal.SIGALRM, handler) # for ITIMER_REAL expected_sigs = 0 - deadline = time.monotonic() + 15.0 + deadline = time.monotonic() + support.SHORT_TIMEOUT while expected_sigs < N: # Hopefully the SIGALRM will be received somewhere during diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py index 8aed4b61a2374..85382a013136d 100644 --- a/Lib/test/test_socketserver.py +++ b/Lib/test/test_socketserver.py @@ -36,7 +36,7 @@ def signal_alarm(n): # Remember real select() to avoid interferences with mocking _real_select = select.select -def receive(sock, n, timeout=20): +def receive(sock, n, timeout=test.support.SHORT_TIMEOUT): r, w, x = _real_select([sock], [], [], timeout) if sock in r: return sock.recv(n) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 4f70799465ced..0093a49115d26 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -2156,7 +2156,7 @@ def test_context_setget(self): def ssl_io_loop(self, sock, incoming, outgoing, func, *args, **kwargs): # A simple IO loop. Call func(*args) depending on the error we get # (WANT_READ or WANT_WRITE) move data between the socket and the BIOs. - timeout = kwargs.get('timeout', 10) + timeout = kwargs.get('timeout', support.SHORT_TIMEOUT) deadline = time.monotonic() + timeout count = 0 while True: diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index f806be817b55b..87322c6406bd5 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -1121,9 +1121,7 @@ def test_wait_timeout(self): with self.assertRaises(subprocess.TimeoutExpired) as c: p.wait(timeout=0.0001) self.assertIn("0.0001", str(c.exception)) # For coverage of __str__. - # Some heavily loaded buildbots (sparc Debian 3.x) require this much - # time to start. - self.assertEqual(p.wait(timeout=3), 0) + self.assertEqual(p.wait(timeout=support.SHORT_TIMEOUT), 0) def test_invalid_bufsize(self): # an invalid type of the bufsize argument should raise @@ -1289,7 +1287,7 @@ def kill_proc_timer_thread(): # Wait for the process to finish; the thread should kill it # long before it finishes on its own. Supplying a timeout # triggers a different code path for better coverage. - proc.wait(timeout=20) + proc.wait(timeout=support.SHORT_TIMEOUT) self.assertEqual(proc.returncode, expected_errorcode, msg="unexpected result in wait from main thread") diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index eb27c0cf866b5..2f347bd540f33 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -422,7 +422,7 @@ def test_reap_children(self): os._exit(0) t0 = time.monotonic() - deadline = time.monotonic() + 60.0 + deadline = time.monotonic() + support.SHORT_TIMEOUT was_altered = support.environment_altered try: diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 7c16974c1630a..62f2d54ad0a8e 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -265,7 +265,7 @@ def run(self): self.assertEqual(result, 1) # one thread state modified if verbose: print(" waiting for worker to say it caught the exception") - worker_saw_exception.wait(timeout=10) + worker_saw_exception.wait(timeout=support.SHORT_TIMEOUT) self.assertTrue(t.finished) if verbose: print(" all OK -- joining worker") @@ -640,7 +640,7 @@ def f(): finish.release() # When the thread ends, the state_lock can be successfully # acquired. - self.assertTrue(tstate_lock.acquire(timeout=5), False) + self.assertTrue(tstate_lock.acquire(timeout=support.SHORT_TIMEOUT), False) # But is_alive() is still True: we hold _tstate_lock now, which # prevents is_alive() from knowing the thread's end-of-life C code # is done. diff --git a/Lib/test/test_wait3.py b/Lib/test/test_wait3.py index 3825451b058cc..2dc63aaffa346 100644 --- a/Lib/test/test_wait3.py +++ b/Lib/test/test_wait3.py @@ -7,7 +7,7 @@ import time import unittest from test.fork_wait import ForkWait -from test.support import reap_children +from test import support if not hasattr(os, 'fork'): raise unittest.SkipTest("os.fork not defined") @@ -20,7 +20,7 @@ def wait_impl(self, cpid): # This many iterations can be required, since some previously run # tests (e.g. test_ctypes) could have spawned a lot of children # very quickly. - deadline = time.monotonic() + 10.0 + deadline = time.monotonic() + support.SHORT_TIMEOUT while time.monotonic() <= deadline: # wait3() shouldn't hang, but some of the buildbots seem to hang # in the forking tests. This is an attempt to fix the problem. @@ -50,7 +50,7 @@ def test_wait3_rusage_initialized(self): def tearDownModule(): - reap_children() + support.reap_children() if __name__ == "__main__": unittest.main() diff --git a/Lib/test/test_wait4.py b/Lib/test/test_wait4.py index 3e6a79df463cb..a18607252aa96 100644 --- a/Lib/test/test_wait4.py +++ b/Lib/test/test_wait4.py @@ -6,11 +6,11 @@ import sys import unittest from test.fork_wait import ForkWait -from test.support import reap_children, get_attribute +from test import support # If either of these do not exist, skip this test. -get_attribute(os, 'fork') -get_attribute(os, 'wait4') +support.get_attribute(os, 'fork') +support.get_attribute(os, 'wait4') class Wait4Test(ForkWait): @@ -20,7 +20,7 @@ def wait_impl(self, cpid): # Issue #11185: wait4 is broken on AIX and will always return 0 # with WNOHANG. option = 0 - deadline = time.monotonic() + 10.0 + deadline = time.monotonic() + support.SHORT_TIMEOUT while time.monotonic() <= deadline: # wait4() shouldn't hang, but some of the buildbots seem to hang # in the forking tests. This is an attempt to fix the problem. @@ -33,7 +33,7 @@ def wait_impl(self, cpid): self.assertTrue(rusage) def tearDownModule(): - reap_children() + support.reap_children() if __name__ == "__main__": unittest.main() diff --git a/Misc/NEWS.d/next/Tests/2019-12-10-14-26-23.bpo-38614.89JpNh.rst b/Misc/NEWS.d/next/Tests/2019-12-10-14-26-23.bpo-38614.89JpNh.rst index df20f48d46308..102563f5b3b51 100644 --- a/Misc/NEWS.d/next/Tests/2019-12-10-14-26-23.bpo-38614.89JpNh.rst +++ b/Misc/NEWS.d/next/Tests/2019-12-10-14-26-23.bpo-38614.89JpNh.rst @@ -1,3 +1,6 @@ Replace hardcoded timeout constants in tests with -:data:`~test.support.LOOPBACK_TIMEOUT` of :mod:`test.support`, so it's easier -to ajdust this timeout for all tests at once. +new :mod:`test.support` constants: :data:`~test.support.LOOPBACK_TIMEOUT`, +:data:`~test.support.INTERNET_TIMEOUT`, :data:`~test.support.SHORT_TIMEOUT` and +:data:`~test.support.LONG_TIMEOUT`. It becomes easier to adjust these four +timeout constants for all tests at once, rather than having to adjust every +single test file. From webhook-mailer at python.org Wed Dec 11 16:17:29 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 11 Dec 2019 21:17:29 -0000 Subject: [Python-checkins] bpo-38614: Use support timeout constants (GH-17572) Message-ID: https://github.com/python/cpython/commit/7772b1af5ebc9d72d0cfc8332aea6b2143eafa27 commit: 7772b1af5ebc9d72d0cfc8332aea6b2143eafa27 branch: master author: Victor Stinner committer: GitHub date: 2019-12-11T22:17:04+01:00 summary: bpo-38614: Use support timeout constants (GH-17572) files: M Lib/test/_test_multiprocessing.py M Lib/test/test_embed.py M Lib/test/test_poplib.py M Lib/test/test_smtplib.py M Lib/test/test_socket.py diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 399be13f3a260..c0da7d8912e64 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -1144,7 +1144,7 @@ def __reduce__(self): q = self.Queue() q.put(NotSerializable()) q.put(True) - self.assertTrue(q.get(timeout=support.LONG_TIMEOUT)) + self.assertTrue(q.get(timeout=support.SHORT_TIMEOUT)) close_queue(q) with test.support.captured_stderr(): @@ -1159,8 +1159,7 @@ def __reduce__(self): # qsize is not available on all platform as it # relies on sem_getvalue pass - # bpo-30595: use a timeout of 1 second for slow buildbots - self.assertTrue(q.get(timeout=1.0)) + self.assertTrue(q.get(timeout=support.SHORT_TIMEOUT)) # Check that the size of the queue is correct self.assertTrue(q.empty()) close_queue(q) @@ -1197,7 +1196,7 @@ def _on_queue_feeder_error(e, obj): # Verify that q is still functioning correctly q.put(True) - self.assertTrue(q.get(timeout=1.0)) + self.assertTrue(q.get(timeout=support.SHORT_TIMEOUT)) # Assert that the serialization and the hook have been called correctly self.assertTrue(not_serializable_obj.reduce_was_called) diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 60f7f7a93ea1a..73ef96265b711 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -1303,10 +1303,14 @@ def test_audit_subinterpreter(self): self.run_embedded_interpreter("test_audit_subinterpreter") def test_audit_run_command(self): - self.run_embedded_interpreter("test_audit_run_command", timeout=3, returncode=1) + self.run_embedded_interpreter("test_audit_run_command", + timeout=support.SHORT_TIMEOUT, + returncode=1) def test_audit_run_file(self): - self.run_embedded_interpreter("test_audit_run_file", timeout=3, returncode=1) + self.run_embedded_interpreter("test_audit_run_file", + timeout=support.SHORT_TIMEOUT, + returncode=1) def test_audit_run_interactivehook(self): startup = os.path.join(self.oldcwd, support.TESTFN) + ".py" @@ -1315,7 +1319,8 @@ def test_audit_run_interactivehook(self): print("sys.__interactivehook__ = lambda: None", file=f) try: env = {**remove_python_envvars(), "PYTHONSTARTUP": startup} - self.run_embedded_interpreter("test_audit_run_interactivehook", timeout=5, + self.run_embedded_interpreter("test_audit_run_interactivehook", + timeout=support.SHORT_TIMEOUT, returncode=10, env=env) finally: os.unlink(startup) @@ -1326,13 +1331,16 @@ def test_audit_run_startup(self): print("pass", file=f) try: env = {**remove_python_envvars(), "PYTHONSTARTUP": startup} - self.run_embedded_interpreter("test_audit_run_startup", timeout=5, + self.run_embedded_interpreter("test_audit_run_startup", + timeout=support.SHORT_TIMEOUT, returncode=10, env=env) finally: os.unlink(startup) def test_audit_run_stdin(self): - self.run_embedded_interpreter("test_audit_run_stdin", timeout=3, returncode=1) + self.run_embedded_interpreter("test_audit_run_stdin", + timeout=support.SHORT_TIMEOUT, + returncode=1) if __name__ == "__main__": unittest.main() diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py index 7b1d854d1c086..911cba1f1dcd4 100644 --- a/Lib/test/test_poplib.py +++ b/Lib/test/test_poplib.py @@ -255,7 +255,8 @@ def assertOK(self, resp): def setUp(self): self.server = DummyPOP3Server((HOST, PORT)) self.server.start() - self.client = poplib.POP3(self.server.host, self.server.port, timeout=3) + self.client = poplib.POP3(self.server.host, self.server.port, + timeout=test_support.LOOPBACK_TIMEOUT) def tearDown(self): self.client.close() @@ -376,7 +377,8 @@ def test_stls_context(self): self.assertEqual(ctx.check_hostname, True) with self.assertRaises(ssl.CertificateError): resp = self.client.stls(context=ctx) - self.client = poplib.POP3("localhost", self.server.port, timeout=3) + self.client = poplib.POP3("localhost", self.server.port, + timeout=test_support.LOOPBACK_TIMEOUT) resp = self.client.stls(context=ctx) self.assertEqual(resp, expected) @@ -445,7 +447,8 @@ class TestPOP3_TLSClass(TestPOP3Class): def setUp(self): self.server = DummyPOP3Server((HOST, PORT)) self.server.start() - self.client = poplib.POP3(self.server.host, self.server.port, timeout=3) + self.client = poplib.POP3(self.server.host, self.server.port, + timeout=test_support.LOOPBACK_TIMEOUT) self.client.stls() def tearDown(self): diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py index a3e5b3f3774c6..faf013ac9a66e 100644 --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -964,11 +964,13 @@ def tearDown(self): def testBasic(self): # smoke test - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) smtp.quit() def testEHLO(self): - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) # no features should be present before the EHLO self.assertEqual(smtp.esmtp_features, {}) @@ -989,7 +991,8 @@ def testEHLO(self): smtp.quit() def testVRFY(self): - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) for addr_spec, name in sim_users.items(): expected_known = (250, bytes('%s %s' % @@ -1003,7 +1006,8 @@ def testVRFY(self): smtp.quit() def testEXPN(self): - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) for listname, members in sim_lists.items(): users = [] @@ -1019,14 +1023,16 @@ def testEXPN(self): def testAUTH_PLAIN(self): self.serv.add_feature("AUTH PLAIN") - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) resp = smtp.login(sim_auth[0], sim_auth[1]) self.assertEqual(resp, (235, b'Authentication Succeeded')) smtp.close() def testAUTH_LOGIN(self): self.serv.add_feature("AUTH LOGIN") - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) resp = smtp.login(sim_auth[0], sim_auth[1]) self.assertEqual(resp, (235, b'Authentication Succeeded')) smtp.close() @@ -1034,7 +1040,8 @@ def testAUTH_LOGIN(self): @requires_hashdigest('md5') def testAUTH_CRAM_MD5(self): self.serv.add_feature("AUTH CRAM-MD5") - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) resp = smtp.login(sim_auth[0], sim_auth[1]) self.assertEqual(resp, (235, b'Authentication Succeeded')) smtp.close() @@ -1042,7 +1049,8 @@ def testAUTH_CRAM_MD5(self): def testAUTH_multiple(self): # Test that multiple authentication methods are tried. self.serv.add_feature("AUTH BOGUS PLAIN LOGIN CRAM-MD5") - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) resp = smtp.login(sim_auth[0], sim_auth[1]) self.assertEqual(resp, (235, b'Authentication Succeeded')) smtp.close() @@ -1060,7 +1068,8 @@ def test_auth_function(self): for mechanism in supported: with self.subTest(mechanism=mechanism): smtp = smtplib.SMTP(HOST, self.port, - local_hostname='localhost', timeout=15) + local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) smtp.ehlo('foo') smtp.user, smtp.password = sim_auth[0], sim_auth[1] method = 'auth_' + mechanism.lower().replace('-', '_') @@ -1071,7 +1080,7 @@ def test_auth_function(self): def test_quit_resets_greeting(self): smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', - timeout=15) + timeout=support.LOOPBACK_TIMEOUT) code, message = smtp.ehlo() self.assertEqual(code, 250) self.assertIn('size', smtp.esmtp_features) @@ -1105,7 +1114,8 @@ def test_with_statement_QUIT_failure(self): # Issue 17498: make sure _rset does not raise SMTPServerDisconnected exception def test__rest_from_mail_cmd(self): - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) smtp.noop() self.serv._SMTPchannel.mail_response = '451 Requested action aborted' self.serv._SMTPchannel.disconnect = True @@ -1115,7 +1125,8 @@ def test__rest_from_mail_cmd(self): # Issue 5713: make sure close, not rset, is called if we get a 421 error def test_421_from_mail_cmd(self): - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) smtp.noop() self.serv._SMTPchannel.mail_response = '421 closing connection' with self.assertRaises(smtplib.SMTPSenderRefused): @@ -1124,7 +1135,8 @@ def test_421_from_mail_cmd(self): self.assertEqual(self.serv._SMTPchannel.rset_count, 0) def test_421_from_rcpt_cmd(self): - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) smtp.noop() self.serv._SMTPchannel.rcpt_response = ['250 accepted', '421 closing'] with self.assertRaises(smtplib.SMTPRecipientsRefused) as r: @@ -1141,7 +1153,8 @@ def found_terminator(self): else: super().found_terminator() self.serv.channel_class = MySimSMTPChannel - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) smtp.noop() with self.assertRaises(smtplib.SMTPDataError): smtp.sendmail('John at foo.org', ['Sally at foo.org'], 'test message') @@ -1393,15 +1406,15 @@ def tearDown(self): def testAUTH_PLAIN_initial_response_login(self): self.serv.add_feature('AUTH PLAIN') - smtp = smtplib.SMTP(HOST, self.port, - local_hostname='localhost', timeout=15) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) smtp.login('psu', 'doesnotexist') smtp.close() def testAUTH_PLAIN_initial_response_auth(self): self.serv.add_feature('AUTH PLAIN') - smtp = smtplib.SMTP(HOST, self.port, - local_hostname='localhost', timeout=15) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', + timeout=support.LOOPBACK_TIMEOUT) smtp.user = 'psu' smtp.password = 'doesnotexist' code, response = smtp.auth('plain', smtp.auth_plain) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 184c67c56ebd0..64e95ea34b997 100755 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -5063,14 +5063,16 @@ def _justAccept(self): testFamily = _justAccept def _testFamily(self): - self.cli = socket.create_connection((HOST, self.port), timeout=30) + self.cli = socket.create_connection((HOST, self.port), + timeout=support.LOOPBACK_TIMEOUT) self.addCleanup(self.cli.close) self.assertEqual(self.cli.family, 2) testSourceAddress = _justAccept def _testSourceAddress(self): - self.cli = socket.create_connection((HOST, self.port), timeout=30, - source_address=('', self.source_port)) + self.cli = socket.create_connection((HOST, self.port), + timeout=support.LOOPBACK_TIMEOUT, + source_address=('', self.source_port)) self.addCleanup(self.cli.close) self.assertEqual(self.cli.getsockname()[1], self.source_port) # The port number being used is sufficient to show that the bind() @@ -5959,7 +5961,9 @@ def testOffset(self): def _testCount(self): address = self.serv.getsockname() file = open(support.TESTFN, 'rb') - with socket.create_connection(address, timeout=2) as sock, file as file: + sock = socket.create_connection(address, + timeout=support.LOOPBACK_TIMEOUT) + with sock, file: count = 5000007 meth = self.meth_from_sock(sock) sent = meth(file, count=count) @@ -5978,7 +5982,9 @@ def testCount(self): def _testCountSmall(self): address = self.serv.getsockname() file = open(support.TESTFN, 'rb') - with socket.create_connection(address, timeout=2) as sock, file as file: + sock = socket.create_connection(address, + timeout=support.LOOPBACK_TIMEOUT) + with sock, file: count = 1 meth = self.meth_from_sock(sock) sent = meth(file, count=count) @@ -6032,7 +6038,9 @@ def testNonBlocking(self): def _testWithTimeout(self): address = self.serv.getsockname() file = open(support.TESTFN, 'rb') - with socket.create_connection(address, timeout=2) as sock, file as file: + sock = socket.create_connection(address, + timeout=support.LOOPBACK_TIMEOUT) + with sock, file: meth = self.meth_from_sock(sock) sent = meth(file) self.assertEqual(sent, self.FILESIZE) From webhook-mailer at python.org Thu Dec 12 16:40:28 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Thu, 12 Dec 2019 21:40:28 -0000 Subject: [Python-checkins] bpo-39031: Include elif keyword when producing lineno/col-offset info for if_stmt (GH-17582) Message-ID: https://github.com/python/cpython/commit/025a602af7ee284d8db6955c26016f3f27d35536 commit: 025a602af7ee284d8db6955c26016f3f27d35536 branch: master author: Lysandros Nikolaou committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-12T13:40:21-08:00 summary: bpo-39031: Include elif keyword when producing lineno/col-offset info for if_stmt (GH-17582) When parsing an "elif" node, lineno and col_offset of the node now point to the "elif" keyword and not to its condition, making it consistent with the "if" node. https://bugs.python.org/issue39031 Automerge-Triggered-By: @pablogsal files: A Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031.imlCYZ.rst M Lib/test/test_ast.py M Python/ast.c diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index ca75a4ab4570e..955bc0d4ea88a 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -68,6 +68,8 @@ def to_tuple(t): "while v:pass", # If "if v:pass", + # If-Elif + "if a:\n pass\nelif b:\n pass", # With "with x as y: pass", "with x as y, z as q: pass", @@ -861,6 +863,12 @@ def test_multi_line_docstring_col_offset_and_lineno_issue16806(self): self.assertEqual(node.body[2].col_offset, 0) self.assertEqual(node.body[2].lineno, 13) + def test_elif_stmt_start_position(self): + node = ast.parse('if a:\n pass\nelif b:\n pass\n') + elif_stmt = node.body[0].orelse[0] + self.assertEqual(elif_stmt.lineno, 3) + self.assertEqual(elif_stmt.col_offset, 0) + def test_literal_eval(self): self.assertEqual(ast.literal_eval('[1, 2, 3]'), [1, 2, 3]) self.assertEqual(ast.literal_eval('{"foo": 42}'), {"foo": 42}) @@ -1843,6 +1851,7 @@ def main(): ('Module', [('For', (1, 0), ('Name', (1, 4), 'v', ('Store',)), ('Name', (1, 9), 'v', ('Load',)), [('Pass', (1, 11))], [], None)], []), ('Module', [('While', (1, 0), ('Name', (1, 6), 'v', ('Load',)), [('Pass', (1, 8))], [])], []), ('Module', [('If', (1, 0), ('Name', (1, 3), 'v', ('Load',)), [('Pass', (1, 5))], [])], []), +('Module', [('If', (1, 0), ('Name', (1, 3), 'a', ('Load',)), [('Pass', (2, 2))], [('If', (3, 0), ('Name', (3, 5), 'b', ('Load',)), [('Pass', (4, 2))], [])])], []), ('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',)))], [('Pass', (1, 13))], None)], []), ('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',))), ('withitem', ('Name', (1, 13), 'z', ('Load',)), ('Name', (1, 18), 'q', ('Store',)))], [('Pass', (1, 21))], None)], []), ('Module', [('Raise', (1, 0), ('Call', (1, 6), ('Name', (1, 6), 'Exception', ('Load',)), [('Constant', (1, 16), 'string', None)], []), None)], []), diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031.imlCYZ.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031.imlCYZ.rst new file mode 100644 index 0000000000000..738902ce907ad --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031.imlCYZ.rst @@ -0,0 +1,2 @@ +When parsing an "elif" node, lineno and col_offset of the node now point to the "elif" keyword and not to its condition, making it consistent with the "if" node. +Patch by Lysandros Nikolaou. diff --git a/Python/ast.c b/Python/ast.c index 417b347f98741..c450b877f10df 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -4076,8 +4076,8 @@ ast_for_if_stmt(struct compiling *c, const node *n) } asdl_seq_SET(newobj, 0, If(expression, suite_seq, orelse, - LINENO(CHILD(n, off)), - CHILD(n, off)->n_col_offset, + LINENO(CHILD(n, off - 1)), + CHILD(n, off - 1)->n_col_offset, end_lineno, end_col_offset, c->c_arena)); orelse = newobj; } From webhook-mailer at python.org Fri Dec 13 09:04:19 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Fri, 13 Dec 2019 14:04:19 -0000 Subject: [Python-checkins] [3.7] bpo-39031: Include elif keyword when producing lineno/col-offset info for if_stmt (GH-17582) (#17584) Message-ID: https://github.com/python/cpython/commit/0ed45d0cbfc7579dfc5527c19aa6e4bb696db2e0 commit: 0ed45d0cbfc7579dfc5527c19aa6e4bb696db2e0 branch: 3.7 author: Pablo Galindo committer: GitHub date: 2019-12-13T14:04:14Z summary: [3.7] bpo-39031: Include elif keyword when producing lineno/col-offset info for if_stmt (GH-17582) (#17584) When parsing an "elif" node, lineno and col_offset of the node now point to the "elif" keyword and not to its condition, making it consistent with the "if" node. https://bugs.python.org/issue39031 Automerge-Triggered-By: @pablogsal. (cherry picked from commit 025a602af7ee284d8db6955c26016f3f27d35536) Co-authored-by: Lysandros Nikolaou files: A Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031.imlCYZ.rst M Lib/test/test_ast.py M Python/ast.c diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 2d2fb26baa9c0..0daa2f77dc718 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -64,6 +64,8 @@ def to_tuple(t): "while v:pass", # If "if v:pass", + # If-Elif + "if a:\n pass\nelif b:\n pass", # With "with x as y: pass", "with x as y, z as q: pass", @@ -598,6 +600,12 @@ def test_get_docstring_none(self): node = ast.parse('async def foo():\n x = "not docstring"') self.assertIsNone(ast.get_docstring(node.body[0])) + def test_elif_stmt_start_position(self): + node = ast.parse('if a:\n pass\nelif b:\n pass\n') + elif_stmt = node.body[0].orelse[0] + self.assertEqual(elif_stmt.lineno, 3) + self.assertEqual(elif_stmt.col_offset, 0) + def test_literal_eval(self): self.assertEqual(ast.literal_eval('[1, 2, 3]'), [1, 2, 3]) self.assertEqual(ast.literal_eval('{"foo": 42}'), {"foo": 42}) @@ -1235,6 +1243,7 @@ def main(): ('Module', [('For', (1, 0), ('Name', (1, 4), 'v', ('Store',)), ('Name', (1, 9), 'v', ('Load',)), [('Pass', (1, 11))], [])]), ('Module', [('While', (1, 0), ('Name', (1, 6), 'v', ('Load',)), [('Pass', (1, 8))], [])]), ('Module', [('If', (1, 0), ('Name', (1, 3), 'v', ('Load',)), [('Pass', (1, 5))], [])]), +('Module', [('If', (1, 0), ('Name', (1, 3), 'a', ('Load',)), [('Pass', (2, 2))], [('If', (3, 0), ('Name', (3, 5), 'b', ('Load',)), [('Pass', (4, 2))], [])])]), ('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',)))], [('Pass', (1, 13))])]), ('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',))), ('withitem', ('Name', (1, 13), 'z', ('Load',)), ('Name', (1, 18), 'q', ('Store',)))], [('Pass', (1, 21))])]), ('Module', [('Raise', (1, 0), ('Call', (1, 6), ('Name', (1, 6), 'Exception', ('Load',)), [('Str', (1, 16), 'string')], []), None)]), diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031.imlCYZ.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031.imlCYZ.rst new file mode 100644 index 0000000000000..738902ce907ad --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031.imlCYZ.rst @@ -0,0 +1,2 @@ +When parsing an "elif" node, lineno and col_offset of the node now point to the "elif" keyword and not to its condition, making it consistent with the "if" node. +Patch by Lysandros Nikolaou. diff --git a/Python/ast.c b/Python/ast.c index 5a60d6994d6a6..d1b87d888e5c2 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -3622,8 +3622,8 @@ ast_for_if_stmt(struct compiling *c, const node *n) asdl_seq_SET(newobj, 0, If(expression, suite_seq, orelse, - LINENO(CHILD(n, off)), - CHILD(n, off)->n_col_offset, c->c_arena)); + LINENO(CHILD(n, off - 1)), + CHILD(n, off - 1)->n_col_offset, c->c_arena)); orelse = newobj; } expression = ast_for_expr(c, CHILD(n, 1)); From webhook-mailer at python.org Fri Dec 13 11:22:25 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Fri, 13 Dec 2019 16:22:25 -0000 Subject: [Python-checkins] bpo-39031: Include elif keyword when producing lineno/col-offset info for if_stmt (GH-17582) (GH-17589) Message-ID: https://github.com/python/cpython/commit/3b18b17efcee6f968cf85c543254b3611311e9f4 commit: 3b18b17efcee6f968cf85c543254b3611311e9f4 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Pablo Galindo date: 2019-12-13T16:21:54Z summary: bpo-39031: Include elif keyword when producing lineno/col-offset info for if_stmt (GH-17582) (GH-17589) When parsing an "elif" node, lineno and col_offset of the node now point to the "elif" keyword and not to its condition, making it consistent with the "if" node. https://bugs.python.org/issue39031 Automerge-Triggered-By: @pablogsal (cherry picked from commit 025a602af7ee284d8db6955c26016f3f27d35536) Co-authored-by: Lysandros Nikolaou files: A Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031.imlCYZ.rst M Lib/test/test_ast.py M Python/ast.c diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 266075094bcba..7df577985de17 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -68,6 +68,8 @@ def to_tuple(t): "while v:pass", # If "if v:pass", + # If-Elif + "if a:\n pass\nelif b:\n pass", # With "with x as y: pass", "with x as y, z as q: pass", @@ -799,6 +801,12 @@ def test_multi_line_docstring_col_offset_and_lineno_issue16806(self): self.assertEqual(node.body[2].col_offset, 0) self.assertEqual(node.body[2].lineno, 13) + def test_elif_stmt_start_position(self): + node = ast.parse('if a:\n pass\nelif b:\n pass\n') + elif_stmt = node.body[0].orelse[0] + self.assertEqual(elif_stmt.lineno, 3) + self.assertEqual(elif_stmt.col_offset, 0) + def test_literal_eval(self): self.assertEqual(ast.literal_eval('[1, 2, 3]'), [1, 2, 3]) self.assertEqual(ast.literal_eval('{"foo": 42}'), {"foo": 42}) @@ -1781,6 +1789,7 @@ def main(): ('Module', [('For', (1, 0), ('Name', (1, 4), 'v', ('Store',)), ('Name', (1, 9), 'v', ('Load',)), [('Pass', (1, 11))], [], None)], []), ('Module', [('While', (1, 0), ('Name', (1, 6), 'v', ('Load',)), [('Pass', (1, 8))], [])], []), ('Module', [('If', (1, 0), ('Name', (1, 3), 'v', ('Load',)), [('Pass', (1, 5))], [])], []), +('Module', [('If', (1, 0), ('Name', (1, 3), 'a', ('Load',)), [('Pass', (2, 2))], [('If', (3, 0), ('Name', (3, 5), 'b', ('Load',)), [('Pass', (4, 2))], [])])], []), ('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',)))], [('Pass', (1, 13))], None)], []), ('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',))), ('withitem', ('Name', (1, 13), 'z', ('Load',)), ('Name', (1, 18), 'q', ('Store',)))], [('Pass', (1, 21))], None)], []), ('Module', [('Raise', (1, 0), ('Call', (1, 6), ('Name', (1, 6), 'Exception', ('Load',)), [('Constant', (1, 16), 'string', None)], []), None)], []), diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031.imlCYZ.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031.imlCYZ.rst new file mode 100644 index 0000000000000..738902ce907ad --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031.imlCYZ.rst @@ -0,0 +1,2 @@ +When parsing an "elif" node, lineno and col_offset of the node now point to the "elif" keyword and not to its condition, making it consistent with the "if" node. +Patch by Lysandros Nikolaou. diff --git a/Python/ast.c b/Python/ast.c index 2031b88359363..15d20279b16e3 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -4079,8 +4079,8 @@ ast_for_if_stmt(struct compiling *c, const node *n) } asdl_seq_SET(newobj, 0, If(expression, suite_seq, orelse, - LINENO(CHILD(n, off)), - CHILD(n, off)->n_col_offset, + LINENO(CHILD(n, off - 1)), + CHILD(n, off - 1)->n_col_offset, end_lineno, end_col_offset, c->c_arena)); orelse = newobj; } From webhook-mailer at python.org Fri Dec 13 13:07:02 2019 From: webhook-mailer at python.org (Brett Cannon) Date: Fri, 13 Dec 2019 18:07:02 -0000 Subject: [Python-checkins] bpo-36406: Handle namespace packages in doctest (GH-12520) Message-ID: https://github.com/python/cpython/commit/8289e27393395ee903bd096d42e07c112d7f15c6 commit: 8289e27393395ee903bd096d42e07c112d7f15c6 branch: master author: Xtreak committer: Brett Cannon <54418+brettcannon at users.noreply.github.com> date: 2019-12-13T10:06:53-08:00 summary: bpo-36406: Handle namespace packages in doctest (GH-12520) files: A Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst M Lib/doctest.py M Lib/test/test_doctest.py diff --git a/Lib/doctest.py b/Lib/doctest.py index 8fca6280b8aa6..02299514bdb59 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -1059,7 +1059,8 @@ def _get_test(self, obj, name, module, globs, source_lines): if module is None: filename = None else: - filename = getattr(module, '__file__', module.__name__) + # __file__ can be None for namespace packages. + filename = getattr(module, '__file__', None) or module.__name__ if filename[-4:] == ".pyc": filename = filename[:-1] return self._parser.get_doctest(docstring, globs, name, diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py index f7c399e526d17..aa92777efc3c7 100644 --- a/Lib/test/test_doctest.py +++ b/Lib/test/test_doctest.py @@ -701,8 +701,12 @@ def test_empty_namespace_package(self): finally: support.forget(pkg_name) sys.path.pop() - assert doctest.DocTestFinder().find(mod) == [] + include_empty_finder = doctest.DocTestFinder(exclude_empty=False) + exclude_empty_finder = doctest.DocTestFinder(exclude_empty=True) + + self.assertEqual(len(include_empty_finder.find(mod)), 1) + self.assertEqual(len(exclude_empty_finder.find(mod)), 0) def test_DocTestParser(): r""" Unit tests for the `DocTestParser` class. diff --git a/Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst b/Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst new file mode 100644 index 0000000000000..3d81eb50418b0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst @@ -0,0 +1 @@ +Handle namespace packages in :mod:`doctest`. Patch by Karthikeyan Singaravelan. From webhook-mailer at python.org Fri Dec 13 18:30:11 2019 From: webhook-mailer at python.org (Brett Cannon) Date: Fri, 13 Dec 2019 23:30:11 -0000 Subject: [Python-checkins] bpo-36406: Handle namespace packages in doctest (GH-12520) (GH-17592) Message-ID: https://github.com/python/cpython/commit/d3212036aa2510b9e133ba4bfaf1262d6bcbe7f0 commit: d3212036aa2510b9e133ba4bfaf1262d6bcbe7f0 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Brett Cannon <54418+brettcannon at users.noreply.github.com> date: 2019-12-13T15:30:04-08:00 summary: bpo-36406: Handle namespace packages in doctest (GH-12520) (GH-17592) (cherry picked from commit 8289e27393395ee903bd096d42e07c112d7f15c6) Co-authored-by: Xtreak files: A Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst M Lib/doctest.py M Lib/test/test_doctest.py diff --git a/Lib/doctest.py b/Lib/doctest.py index 79d91a040c2ee..2a4b8c7dae012 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -1059,7 +1059,8 @@ def _get_test(self, obj, name, module, globs, source_lines): if module is None: filename = None else: - filename = getattr(module, '__file__', module.__name__) + # __file__ can be None for namespace packages. + filename = getattr(module, '__file__', None) or module.__name__ if filename[-4:] == ".pyc": filename = filename[:-1] return self._parser.get_doctest(docstring, globs, name, diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py index 4a3c488738d39..5f891c50d8fca 100644 --- a/Lib/test/test_doctest.py +++ b/Lib/test/test_doctest.py @@ -697,8 +697,12 @@ def test_empty_namespace_package(self): finally: support.forget(pkg_name) sys.path.pop() - assert doctest.DocTestFinder().find(mod) == [] + include_empty_finder = doctest.DocTestFinder(exclude_empty=False) + exclude_empty_finder = doctest.DocTestFinder(exclude_empty=True) + + self.assertEqual(len(include_empty_finder.find(mod)), 1) + self.assertEqual(len(exclude_empty_finder.find(mod)), 0) def test_DocTestParser(): r""" Unit tests for the `DocTestParser` class. diff --git a/Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst b/Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst new file mode 100644 index 0000000000000..3d81eb50418b0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst @@ -0,0 +1 @@ +Handle namespace packages in :mod:`doctest`. Patch by Karthikeyan Singaravelan. From webhook-mailer at python.org Fri Dec 13 18:30:45 2019 From: webhook-mailer at python.org (Brett Cannon) Date: Fri, 13 Dec 2019 23:30:45 -0000 Subject: [Python-checkins] bpo-36406: Handle namespace packages in doctest (GH-12520) (GH-17591) Message-ID: https://github.com/python/cpython/commit/aa74a53ad61134911ac7904f24fd2630aeaa8ac8 commit: aa74a53ad61134911ac7904f24fd2630aeaa8ac8 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Brett Cannon <54418+brettcannon at users.noreply.github.com> date: 2019-12-13T15:30:41-08:00 summary: bpo-36406: Handle namespace packages in doctest (GH-12520) (GH-17591) (cherry picked from commit 8289e27393395ee903bd096d42e07c112d7f15c6) Co-authored-by: Xtreak files: A Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst M Lib/doctest.py M Lib/test/test_doctest.py diff --git a/Lib/doctest.py b/Lib/doctest.py index bf4889f59e0da..dcbcfe52e90f6 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -1059,7 +1059,8 @@ def _get_test(self, obj, name, module, globs, source_lines): if module is None: filename = None else: - filename = getattr(module, '__file__', module.__name__) + # __file__ can be None for namespace packages. + filename = getattr(module, '__file__', None) or module.__name__ if filename[-4:] == ".pyc": filename = filename[:-1] return self._parser.get_doctest(docstring, globs, name, diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py index 5ea18f52c4fcf..e37d842e37ad0 100644 --- a/Lib/test/test_doctest.py +++ b/Lib/test/test_doctest.py @@ -701,8 +701,12 @@ def test_empty_namespace_package(self): finally: support.forget(pkg_name) sys.path.pop() - assert doctest.DocTestFinder().find(mod) == [] + include_empty_finder = doctest.DocTestFinder(exclude_empty=False) + exclude_empty_finder = doctest.DocTestFinder(exclude_empty=True) + + self.assertEqual(len(include_empty_finder.find(mod)), 1) + self.assertEqual(len(exclude_empty_finder.find(mod)), 0) def test_DocTestParser(): r""" Unit tests for the `DocTestParser` class. diff --git a/Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst b/Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst new file mode 100644 index 0000000000000..3d81eb50418b0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst @@ -0,0 +1 @@ +Handle namespace packages in :mod:`doctest`. Patch by Karthikeyan Singaravelan. From webhook-mailer at python.org Sat Dec 14 00:27:36 2019 From: webhook-mailer at python.org (Inada Naoki) Date: Sat, 14 Dec 2019 05:27:36 -0000 Subject: [Python-checkins] Add PYTHONUTF8 to commandline usage. (GH-17587) Message-ID: https://github.com/python/cpython/commit/95826c773a9004fc5b3c89de55f800504685ab21 commit: 95826c773a9004fc5b3c89de55f800504685ab21 branch: master author: Inada Naoki committer: GitHub date: 2019-12-14T14:27:32+09:00 summary: Add PYTHONUTF8 to commandline usage. (GH-17587) Co-Authored-By: Victor Stinner files: M Python/initconfig.c diff --git a/Python/initconfig.c b/Python/initconfig.c index 74c9ca007ed70..2e46999932f8a 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -80,6 +80,7 @@ static const char usage_5[] = "PYTHONHOME : alternate directory (or %lc).\n" " The default module search path uses %s.\n" "PYTHONCASEOK : ignore case in 'import' statements (Windows).\n" +"PYTHONUTF8: if set to 1, enable the UTF-8 mode.\n" "PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.\n" "PYTHONFAULTHANDLER: dump the Python traceback on fatal errors.\n"; static const char usage_6[] = From webhook-mailer at python.org Sat Dec 14 05:25:02 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Sat, 14 Dec 2019 10:25:02 -0000 Subject: [Python-checkins] Fix elif start column offset when there is an else following (GH-17596) Message-ID: https://github.com/python/cpython/commit/5936a4ce914d42af97b9238e5090dedc8d5b0bd2 commit: 5936a4ce914d42af97b9238e5090dedc8d5b0bd2 branch: master author: Lysandros Nikolaou committer: Pablo Galindo date: 2019-12-14T10:24:57Z summary: Fix elif start column offset when there is an else following (GH-17596) files: M Lib/test/test_ast.py M Python/ast.c diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 955bc0d4ea88a..cd35f96a14663 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -70,6 +70,8 @@ def to_tuple(t): "if v:pass", # If-Elif "if a:\n pass\nelif b:\n pass", + # If-Elif-Else + "if a:\n pass\nelif b:\n pass\nelse:\n pass", # With "with x as y: pass", "with x as y, z as q: pass", @@ -869,6 +871,12 @@ def test_elif_stmt_start_position(self): self.assertEqual(elif_stmt.lineno, 3) self.assertEqual(elif_stmt.col_offset, 0) + def test_elif_stmt_start_position_with_else(self): + node = ast.parse('if a:\n pass\nelif b:\n pass\nelse:\n pass\n') + elif_stmt = node.body[0].orelse[0] + self.assertEqual(elif_stmt.lineno, 3) + self.assertEqual(elif_stmt.col_offset, 0) + def test_literal_eval(self): self.assertEqual(ast.literal_eval('[1, 2, 3]'), [1, 2, 3]) self.assertEqual(ast.literal_eval('{"foo": 42}'), {"foo": 42}) @@ -1852,6 +1860,7 @@ def main(): ('Module', [('While', (1, 0), ('Name', (1, 6), 'v', ('Load',)), [('Pass', (1, 8))], [])], []), ('Module', [('If', (1, 0), ('Name', (1, 3), 'v', ('Load',)), [('Pass', (1, 5))], [])], []), ('Module', [('If', (1, 0), ('Name', (1, 3), 'a', ('Load',)), [('Pass', (2, 2))], [('If', (3, 0), ('Name', (3, 5), 'b', ('Load',)), [('Pass', (4, 2))], [])])], []), +('Module', [('If', (1, 0), ('Name', (1, 3), 'a', ('Load',)), [('Pass', (2, 2))], [('If', (3, 0), ('Name', (3, 5), 'b', ('Load',)), [('Pass', (4, 2))], [('Pass', (6, 2))])])], []), ('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',)))], [('Pass', (1, 13))], None)], []), ('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',))), ('withitem', ('Name', (1, 13), 'z', ('Load',)), ('Name', (1, 18), 'q', ('Store',)))], [('Pass', (1, 21))], None)], []), ('Module', [('Raise', (1, 0), ('Call', (1, 6), ('Name', (1, 6), 'Exception', ('Load',)), [('Constant', (1, 16), 'string', None)], []), None)], []), diff --git a/Python/ast.c b/Python/ast.c index c450b877f10df..55fe58c5f39c2 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -4050,8 +4050,8 @@ ast_for_if_stmt(struct compiling *c, const node *n) asdl_seq_SET(orelse, 0, If(expression, suite_seq, suite_seq2, - LINENO(CHILD(n, NCH(n) - 6)), - CHILD(n, NCH(n) - 6)->n_col_offset, + LINENO(CHILD(n, NCH(n) - 7)), + CHILD(n, NCH(n) - 7)->n_col_offset, end_lineno, end_col_offset, c->c_arena)); /* the just-created orelse handled the last elif */ n_elif--; From webhook-mailer at python.org Sat Dec 14 05:38:02 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Sat, 14 Dec 2019 10:38:02 -0000 Subject: [Python-checkins] Fix typo in site module (GH-17597) Message-ID: https://github.com/python/cpython/commit/40c01c33466b39f942b7f533c0800f258be1eb18 commit: 40c01c33466b39f942b7f533c0800f258be1eb18 branch: master author: Daniel Andersson committer: Pablo Galindo date: 2019-12-14T10:37:58Z summary: Fix typo in site module (GH-17597) files: M Lib/site.py diff --git a/Lib/site.py b/Lib/site.py index a065ab0b5db58..2c717987559e5 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -590,7 +590,7 @@ def _script(): Exit codes with --user-base or --user-site: 0 - user site directory is enabled 1 - user site directory is disabled by user - 2 - uses site directory is disabled by super user + 2 - user site directory is disabled by super user or for security reasons >2 - unknown error """ From webhook-mailer at python.org Sat Dec 14 05:38:39 2019 From: webhook-mailer at python.org (Inada Naoki) Date: Sat, 14 Dec 2019 10:38:39 -0000 Subject: [Python-checkins] Add PYTHONUTF8 to commandline usage. (GH-17587) Message-ID: https://github.com/python/cpython/commit/4a5db78c9a46a9d151635bc09c7c891069c6bf52 commit: 4a5db78c9a46a9d151635bc09c7c891069c6bf52 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Inada Naoki date: 2019-12-14T19:38:35+09:00 summary: Add PYTHONUTF8 to commandline usage. (GH-17587) Co-Authored-By: Victor Stinner (cherry picked from commit 95826c773a9004fc5b3c89de55f800504685ab21) Co-authored-by: Inada Naoki files: M Python/initconfig.c diff --git a/Python/initconfig.c b/Python/initconfig.c index a41a3292d3e2c..a30fdd1bab954 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -80,6 +80,7 @@ static const char usage_5[] = "PYTHONHOME : alternate directory (or %lc).\n" " The default module search path uses %s.\n" "PYTHONCASEOK : ignore case in 'import' statements (Windows).\n" +"PYTHONUTF8: if set to 1, enable the UTF-8 mode.\n" "PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.\n" "PYTHONFAULTHANDLER: dump the Python traceback on fatal errors.\n"; static const char usage_6[] = From webhook-mailer at python.org Sat Dec 14 05:43:47 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Sat, 14 Dec 2019 10:43:47 -0000 Subject: [Python-checkins] Fix elif start column offset when there is an else following (GH-17596) (GH-17600) Message-ID: https://github.com/python/cpython/commit/ce333cd7d5948b501a988bb56d6a1648e973577c commit: ce333cd7d5948b501a988bb56d6a1648e973577c branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Pablo Galindo date: 2019-12-14T10:43:42Z summary: Fix elif start column offset when there is an else following (GH-17596) (GH-17600) (cherry picked from commit 5936a4ce914d42af97b9238e5090dedc8d5b0bd2) Co-authored-by: Lysandros Nikolaou files: M Lib/test/test_ast.py M Python/ast.c diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 7df577985de17..caea84f80f6a4 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -70,6 +70,8 @@ def to_tuple(t): "if v:pass", # If-Elif "if a:\n pass\nelif b:\n pass", + # If-Elif-Else + "if a:\n pass\nelif b:\n pass\nelse:\n pass", # With "with x as y: pass", "with x as y, z as q: pass", @@ -807,6 +809,12 @@ def test_elif_stmt_start_position(self): self.assertEqual(elif_stmt.lineno, 3) self.assertEqual(elif_stmt.col_offset, 0) + def test_elif_stmt_start_position_with_else(self): + node = ast.parse('if a:\n pass\nelif b:\n pass\nelse:\n pass\n') + elif_stmt = node.body[0].orelse[0] + self.assertEqual(elif_stmt.lineno, 3) + self.assertEqual(elif_stmt.col_offset, 0) + def test_literal_eval(self): self.assertEqual(ast.literal_eval('[1, 2, 3]'), [1, 2, 3]) self.assertEqual(ast.literal_eval('{"foo": 42}'), {"foo": 42}) @@ -1790,6 +1798,7 @@ def main(): ('Module', [('While', (1, 0), ('Name', (1, 6), 'v', ('Load',)), [('Pass', (1, 8))], [])], []), ('Module', [('If', (1, 0), ('Name', (1, 3), 'v', ('Load',)), [('Pass', (1, 5))], [])], []), ('Module', [('If', (1, 0), ('Name', (1, 3), 'a', ('Load',)), [('Pass', (2, 2))], [('If', (3, 0), ('Name', (3, 5), 'b', ('Load',)), [('Pass', (4, 2))], [])])], []), +('Module', [('If', (1, 0), ('Name', (1, 3), 'a', ('Load',)), [('Pass', (2, 2))], [('If', (3, 0), ('Name', (3, 5), 'b', ('Load',)), [('Pass', (4, 2))], [('Pass', (6, 2))])])], []), ('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',)))], [('Pass', (1, 13))], None)], []), ('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',))), ('withitem', ('Name', (1, 13), 'z', ('Load',)), ('Name', (1, 18), 'q', ('Store',)))], [('Pass', (1, 21))], None)], []), ('Module', [('Raise', (1, 0), ('Call', (1, 6), ('Name', (1, 6), 'Exception', ('Load',)), [('Constant', (1, 16), 'string', None)], []), None)], []), diff --git a/Python/ast.c b/Python/ast.c index 15d20279b16e3..95caeffc8ff78 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -4053,8 +4053,8 @@ ast_for_if_stmt(struct compiling *c, const node *n) asdl_seq_SET(orelse, 0, If(expression, suite_seq, suite_seq2, - LINENO(CHILD(n, NCH(n) - 6)), - CHILD(n, NCH(n) - 6)->n_col_offset, + LINENO(CHILD(n, NCH(n) - 7)), + CHILD(n, NCH(n) - 7)->n_col_offset, end_lineno, end_col_offset, c->c_arena)); /* the just-created orelse handled the last elif */ n_elif--; From webhook-mailer at python.org Sat Dec 14 05:53:48 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Sat, 14 Dec 2019 10:53:48 -0000 Subject: [Python-checkins] Add PYTHONUTF8 to commandline usage. (GH-17587) (GH-17599) Message-ID: https://github.com/python/cpython/commit/26892c7d5fc761a7f0e5523937283a3deaaead76 commit: 26892c7d5fc761a7f0e5523937283a3deaaead76 branch: 3.7 author: Inada Naoki committer: Victor Stinner date: 2019-12-14T11:53:43+01:00 summary: Add PYTHONUTF8 to commandline usage. (GH-17587) (GH-17599) Co-Authored-By: Victor Stinner (cherry picked from commit 95826c773a9004fc5b3c89de55f800504685ab21) files: M Modules/main.c diff --git a/Modules/main.c b/Modules/main.c index acc59c6c40a99..4d13184f2d184 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -131,6 +131,7 @@ static const char usage_5[] = "PYTHONHOME : alternate directory (or %lc).\n" " The default module search path uses %s.\n" "PYTHONCASEOK : ignore case in 'import' statements (Windows).\n" +"PYTHONUTF8: if set to 1, enable the UTF-8 mode.\n" "PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.\n" "PYTHONFAULTHANDLER: dump the Python traceback on fatal errors.\n"; static const char usage_6[] = From webhook-mailer at python.org Sat Dec 14 05:55:04 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Sat, 14 Dec 2019 10:55:04 -0000 Subject: [Python-checkins] [3.7] Fix elif start column offset when there is an else following (GH-17596) (GH-17601) Message-ID: https://github.com/python/cpython/commit/4b75466f5a539021217cff18bc248c1593cee262 commit: 4b75466f5a539021217cff18bc248c1593cee262 branch: 3.7 author: Pablo Galindo committer: GitHub date: 2019-12-14T10:55:00Z summary: [3.7] Fix elif start column offset when there is an else following (GH-17596) (GH-17601) (cherry picked from commit 5936a4ce914d42af97b9238e5090dedc8d5b0bd2) Co-authored-by: Lysandros Nikolaou files: M Lib/test/test_ast.py M Python/ast.c diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 0daa2f77dc718..830fb58a02b66 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -66,6 +66,8 @@ def to_tuple(t): "if v:pass", # If-Elif "if a:\n pass\nelif b:\n pass", + # If-Elif-Else + "if a:\n pass\nelif b:\n pass\nelse:\n pass", # With "with x as y: pass", "with x as y, z as q: pass", @@ -606,6 +608,12 @@ def test_elif_stmt_start_position(self): self.assertEqual(elif_stmt.lineno, 3) self.assertEqual(elif_stmt.col_offset, 0) + def test_elif_stmt_start_position_with_else(self): + node = ast.parse('if a:\n pass\nelif b:\n pass\nelse:\n pass\n') + elif_stmt = node.body[0].orelse[0] + self.assertEqual(elif_stmt.lineno, 3) + self.assertEqual(elif_stmt.col_offset, 0) + def test_literal_eval(self): self.assertEqual(ast.literal_eval('[1, 2, 3]'), [1, 2, 3]) self.assertEqual(ast.literal_eval('{"foo": 42}'), {"foo": 42}) @@ -1244,6 +1252,7 @@ def main(): ('Module', [('While', (1, 0), ('Name', (1, 6), 'v', ('Load',)), [('Pass', (1, 8))], [])]), ('Module', [('If', (1, 0), ('Name', (1, 3), 'v', ('Load',)), [('Pass', (1, 5))], [])]), ('Module', [('If', (1, 0), ('Name', (1, 3), 'a', ('Load',)), [('Pass', (2, 2))], [('If', (3, 0), ('Name', (3, 5), 'b', ('Load',)), [('Pass', (4, 2))], [])])]), +('Module', [('If', (1, 0), ('Name', (1, 3), 'a', ('Load',)), [('Pass', (2, 2))], [('If', (3, 0), ('Name', (3, 5), 'b', ('Load',)), [('Pass', (4, 2))], [('Pass', (6, 2))])])]), ('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',)))], [('Pass', (1, 13))])]), ('Module', [('With', (1, 0), [('withitem', ('Name', (1, 5), 'x', ('Load',)), ('Name', (1, 10), 'y', ('Store',))), ('withitem', ('Name', (1, 13), 'z', ('Load',)), ('Name', (1, 18), 'q', ('Store',)))], [('Pass', (1, 21))])]), ('Module', [('Raise', (1, 0), ('Call', (1, 6), ('Name', (1, 6), 'Exception', ('Load',)), [('Str', (1, 16), 'string')], []), None)]), diff --git a/Python/ast.c b/Python/ast.c index d1b87d888e5c2..9d8a3544bdfc9 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -3601,8 +3601,8 @@ ast_for_if_stmt(struct compiling *c, const node *n) asdl_seq_SET(orelse, 0, If(expression, suite_seq, suite_seq2, - LINENO(CHILD(n, NCH(n) - 6)), - CHILD(n, NCH(n) - 6)->n_col_offset, + LINENO(CHILD(n, NCH(n) - 7)), + CHILD(n, NCH(n) - 7)->n_col_offset, c->c_arena)); /* the just-created orelse handled the last elif */ n_elif--; From webhook-mailer at python.org Sat Dec 14 06:10:19 2019 From: webhook-mailer at python.org (Inada Naoki) Date: Sat, 14 Dec 2019 11:10:19 -0000 Subject: [Python-checkins] bpo-39035: travis: Don't use beta group (GH-17602) Message-ID: https://github.com/python/cpython/commit/94d2c8df1a7657015a2fcdb4c4d43392f91f8348 commit: 94d2c8df1a7657015a2fcdb4c4d43392f91f8348 branch: master author: Inada Naoki committer: GitHub date: 2019-12-14T20:10:15+09:00 summary: bpo-39035: travis: Don't use beta group (GH-17602) files: M .travis.yml diff --git a/.travis.yml b/.travis.yml index 807a7b2f24a12..b1d50d49ca5cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: c dist: xenial -group: beta # To cache doc-building dependencies and C compiler output. cache: From webhook-mailer at python.org Sat Dec 14 09:02:00 2019 From: webhook-mailer at python.org (Inada Naoki) Date: Sat, 14 Dec 2019 14:02:00 -0000 Subject: [Python-checkins] bpo-39035: travis: Don't use beta group (GH-17603) Message-ID: https://github.com/python/cpython/commit/5c5d8f63d7d235e557ad20e7d722b22772681759 commit: 5c5d8f63d7d235e557ad20e7d722b22772681759 branch: 3.8 author: Inada Naoki committer: GitHub date: 2019-12-14T23:01:54+09:00 summary: bpo-39035: travis: Don't use beta group (GH-17603) files: M .travis.yml diff --git a/.travis.yml b/.travis.yml index 8a960c53426f5..8954a3a8ca0ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: c dist: xenial -group: beta # To cache doc-building dependencies and C compiler output. cache: From webhook-mailer at python.org Sat Dec 14 09:02:24 2019 From: webhook-mailer at python.org (Inada Naoki) Date: Sat, 14 Dec 2019 14:02:24 -0000 Subject: [Python-checkins] bpo-39035: travis: Don't use beta group (GH-17604) Message-ID: https://github.com/python/cpython/commit/be7489cb43e25b6d8bfa077589c18cc0a2367efd commit: be7489cb43e25b6d8bfa077589c18cc0a2367efd branch: 3.7 author: Inada Naoki committer: GitHub date: 2019-12-14T23:02:20+09:00 summary: bpo-39035: travis: Don't use beta group (GH-17604) files: M .travis.yml diff --git a/.travis.yml b/.travis.yml index 1f67b70f799cc..11ea3e922d6ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: c dist: xenial -group: beta # To cache doc-building dependencies and C compiler output. cache: From webhook-mailer at python.org Sat Dec 14 09:02:59 2019 From: webhook-mailer at python.org (Inada Naoki) Date: Sat, 14 Dec 2019 14:02:59 -0000 Subject: [Python-checkins] bpo-39035: travis: Don't use beta group (GH-17605) Message-ID: https://github.com/python/cpython/commit/de4481339dec395d70e350aa2e22d7990d2b3635 commit: de4481339dec395d70e350aa2e22d7990d2b3635 branch: 2.7 author: Inada Naoki committer: GitHub date: 2019-12-14T23:02:55+09:00 summary: bpo-39035: travis: Don't use beta group (GH-17605) files: M .travis.yml diff --git a/.travis.yml b/.travis.yml index cb9c059359380..4150f0b14e779 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: c dist: xenial -group: beta # To cache doc-building dependencies and C compiler output. cache: From webhook-mailer at python.org Sun Dec 15 09:18:00 2019 From: webhook-mailer at python.org (Nick Coghlan) Date: Sun, 15 Dec 2019 14:18:00 -0000 Subject: [Python-checkins] bpo-38021: Modify AIX platform_tag so it covers PEP 425 needs (GH-17303) Message-ID: https://github.com/python/cpython/commit/39afa2d3147e4b05a1161cc90dbf09b95072c2bb commit: 39afa2d3147e4b05a1161cc90dbf09b95072c2bb branch: master author: Michael Felt committer: Nick Coghlan date: 2019-12-16T00:17:53+10:00 summary: bpo-38021: Modify AIX platform_tag so it covers PEP 425 needs (GH-17303) Provides a richer platform tag for AIX that we expect to be sufficient for PEP 425 binary distribution identification. Any backports to earlier Python versions will be handled via setuptools. Patch by Michael Felt. files: A Lib/_aix_support.py A Misc/NEWS.d/next/Core and Builtins/2019-09-03-19-16-57.bpo-38021.KnUhdB.rst M Doc/distutils/apiref.rst M Lib/distutils/util.py M Lib/sysconfig.py M configure M configure.ac M pyconfig.h.in diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst index 80136b8a6bcdd..12e0c0b2c9757 100644 --- a/Doc/distutils/apiref.rst +++ b/Doc/distutils/apiref.rst @@ -1142,6 +1142,24 @@ other utility module. * ``macosx-10.6-intel`` + For AIX, Python 3.9 and later return a string starting with "aix", followed + by additional fields (separated by ``'-'``) that represent the combined + values of AIX Version, Release and Technology Level (first field), Build Date + (second field), and bit-size (third field). Python 3.8 and earlier returned + only a single additional field with the AIX Version and Release. + + Examples of returned values on AIX: + + * ``aix-5307-0747-32`` # 32-bit build on AIX ``oslevel -s``: 5300-07-00-0000 + + * ``aix-7105-1731-64`` # 64-bit build on AIX ``oslevel -s``: 7100-05-01-1731 + + * ``aix-7.2`` # Legacy form reported in Python 3.8 and earlier + + .. versionchanged:: 3.9 + The AIX platform string format now also includes the technology level, + build date, and ABI bit-size. + .. function:: convert_path(pathname) diff --git a/Lib/_aix_support.py b/Lib/_aix_support.py new file mode 100644 index 0000000000000..2c5cd3297de30 --- /dev/null +++ b/Lib/_aix_support.py @@ -0,0 +1,99 @@ +"""Shared AIX support functions.""" + +import sys +from sysconfig import get_config_var + +# subprocess is not necessarily available early in the build process +# if not available, the config_vars are also definitely not available +# supply substitutes to bootstrap the build +try: + import subprocess + _have_subprocess = True + _tmp_bd = get_config_var("AIX_BUILDDATE") + _bgt = get_config_var("BUILD_GNU_TYPE") +except ImportError: # pragma: no cover + _have_subprocess = False + _tmp_bd = None + _bgt = "powerpc-ibm-aix6.1.7.0" + +# if get_config_var("AIX_BUILDDATE") was unknown, provide a substitute, +# impossible builddate to specify 'unknown' +_MISSING_BD = 9898 +try: + _bd = int(_tmp_bd) +except TypeError: + _bd = _MISSING_BD + +# Infer the ABI bitwidth from maxsize (assuming 64 bit as the default) +_sz = 32 if sys.maxsize == (2**31-1) else 64 + + +def _aix_tag(vrtl, bd): + # type: (List[int], int) -> str + # vrtl[version, release, technology_level] + return "aix-{:1x}{:1d}{:02d}-{:04d}-{}".format(vrtl[0], vrtl[1], vrtl[2], bd, _sz) + + +# extract version, release and technology level from a VRMF string +def _aix_vrtl(vrmf): + # type: (str) -> List[int] + v, r, tl = vrmf.split(".")[:3] + return [int(v[-1]), int(r), int(tl)] + + +def _aix_bosmp64(): + # type: () -> Tuple[str, int] + """ + Return a Tuple[str, int] e.g., ['7.1.4.34', 1806] + The fileset bos.mp64 is the AIX kernel. It's VRMF and builddate + reflect the current ABI levels of the runtime environment. + """ + if _have_subprocess: + # We expect all AIX systems to have lslpp installed in this location + out = subprocess.check_output(["/usr/bin/lslpp", "-Lqc", "bos.mp64"]) + out = out.decode("utf-8").strip().split(":") # type: ignore + # Use str() and int() to help mypy see types + return str(out[2]), int(out[-1]) + else: + from os import uname + + osname, host, release, version, machine = uname() + return "{}.{}.0.0".format(version, release), _MISSING_BD + + +def aix_platform(): + # type: () -> str + """ + AIX filesets are identified by four decimal values: V.R.M.F. + V (version) and R (release) can be retreived using ``uname`` + Since 2007, starting with AIX 5.3 TL7, the M value has been + included with the fileset bos.mp64 and represents the Technology + Level (TL) of AIX. The F (Fix) value also increases, but is not + relevant for comparing releases and binary compatibility. + For binary compatibility the so-called builddate is needed. + Again, the builddate of an AIX release is associated with bos.mp64. + AIX ABI compatibility is described as guaranteed at: https://www.ibm.com/\ + support/knowledgecenter/en/ssw_aix_72/install/binary_compatability.html + + For pep425 purposes the AIX platform tag becomes: + "aix-{:1x}{:1d}{:02d}-{:04d}-{}".format(v, r, tl, builddate, bitsize) + e.g., "aix-6107-1415-32" for AIX 6.1 TL7 bd 1415, 32-bit + and, "aix-6107-1415-64" for AIX 6.1 TL7 bd 1415, 64-bit + """ + vrmf, bd = _aix_bosmp64() + return _aix_tag(_aix_vrtl(vrmf), bd) + + +# extract vrtl from the BUILD_GNU_TYPE as an int +def _aix_bgt(): + # type: () -> List[int] + assert _bgt + return _aix_vrtl(vrmf=_bgt) + + +def aix_buildtag(): + # type: () -> str + """ + Return the platform_tag of the system Python was built on. + """ + return _aix_tag(_aix_bgt(), _bd) diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py index 17a94bc428324..4b002ecef1df8 100644 --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -79,7 +79,8 @@ def get_host_platform(): machine += ".%s" % bitness[sys.maxsize] # fall through to standard osname-release-machine representation elif osname[:3] == "aix": - return "%s-%s.%s" % (osname, version, release) + from _aix_support import aix_platform + return aix_platform() elif osname[:6] == "cygwin": osname = "cygwin" rel_re = re.compile (r'[\d.]+', re.ASCII) diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py index b9e2fafbc084a..64cf1560d99e6 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -665,7 +665,8 @@ def get_platform(): machine += ".%s" % bitness[sys.maxsize] # fall through to standard osname-release-machine representation elif osname[:3] == "aix": - return "%s-%s.%s" % (osname, version, release) + from _aix_support import aix_platform + return aix_platform() elif osname[:6] == "cygwin": osname = "cygwin" import re diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-09-03-19-16-57.bpo-38021.KnUhdB.rst b/Misc/NEWS.d/next/Core and Builtins/2019-09-03-19-16-57.bpo-38021.KnUhdB.rst new file mode 100644 index 0000000000000..d971647c21eae --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-09-03-19-16-57.bpo-38021.KnUhdB.rst @@ -0,0 +1,4 @@ +Provide a platform tag for AIX that is sufficient for PEP425 binary +distribution identification. + +Patch by Michael Felt diff --git a/configure b/configure index 44f14c3c2cfe1..a2c7ddf595db2 100755 --- a/configure +++ b/configure @@ -10028,7 +10028,21 @@ $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext;; + conftest$ac_exeext conftest.$ac_ext +# BUILD_GNU_TYPE + AIX_BUILDDATE are used to construct the platform_tag +# of the AIX system used to build/package Python executable. This tag serves +# as a baseline for bdist module packages + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the system builddate" >&5 +$as_echo_n "checking for the system builddate... " >&6; } + AIX_BUILDDATE=$(lslpp -Lcq bos.mp64 | awk -F: '{ print $NF }') + +cat >>confdefs.h <<_ACEOF +#define AIX_BUILDDATE $AIX_BUILDDATE +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AIX_BUILDDATE" >&5 +$as_echo "$AIX_BUILDDATE" >&6; } + ;; *) ;; esac @@ -10267,7 +10281,6 @@ fi - if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. diff --git a/configure.ac b/configure.ac index 0b28dda44cdb8..57dca35723c67 100644 --- a/configure.ac +++ b/configure.ac @@ -2858,7 +2858,17 @@ case "$ac_sys_system" in AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) - ]);; + ]) +dnl The AIX_BUILDDATE is obtained from the kernel fileset - bos.mp64 +# BUILD_GNU_TYPE + AIX_BUILDDATE are used to construct the platform_tag +# of the AIX system used to build/package Python executable. This tag serves +# as a baseline for bdist module packages + AC_MSG_CHECKING(for the system builddate) + AIX_BUILDDATE=$(lslpp -Lcq bos.mp64 | awk -F: '{ print $NF }') + AC_DEFINE_UNQUOTED([AIX_BUILDDATE], [$AIX_BUILDDATE], + [BUILD_GNU_TYPE + AIX_BUILDDATE are used to construct the PEP425 tag of the build system.]) + AC_MSG_RESULT($AIX_BUILDDATE) + ;; *) ;; esac diff --git a/pyconfig.h.in b/pyconfig.h.in index 50af4c6fee43d..e053be15a1180 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -8,6 +8,10 @@ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD +/* BUILD_GNU_TYPE + AIX_BUILDDATE are used to construct the PEP425 tag of the + build system. */ +#undef AIX_BUILDDATE + /* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want support for AIX C++ shared extension modules. */ #undef AIX_GENUINE_CPLUSPLUS From webhook-mailer at python.org Sun Dec 15 13:00:43 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 15 Dec 2019 18:00:43 -0000 Subject: [Python-checkins] The comment in ast_for_namedexpr shouldn't include if_stmt (GH-17586) Message-ID: https://github.com/python/cpython/commit/b08d3f71beab59653edfbbcf7b92a7bc8050d6b8 commit: b08d3f71beab59653edfbbcf7b92a7bc8050d6b8 branch: master author: Guido van Rossum committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-15T10:00:33-08:00 summary: The comment in ast_for_namedexpr shouldn't include if_stmt (GH-17586) Automerge-Triggered-By: @gvanrossum files: M Python/ast.c diff --git a/Python/ast.c b/Python/ast.c index 55fe58c5f39c2..c0d67a15a6d7d 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -1935,9 +1935,7 @@ ast_for_decorated(struct compiling *c, const node *n) static expr_ty ast_for_namedexpr(struct compiling *c, const node *n) { - /* if_stmt: 'if' namedexpr_test ':' suite ('elif' namedexpr_test ':' suite)* - ['else' ':' suite] - namedexpr_test: test [':=' test] + /* namedexpr_test: test [':=' test] argument: ( test [comp_for] | test ':=' test | test '=' test | From webhook-mailer at python.org Sun Dec 15 15:04:12 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 15 Dec 2019 20:04:12 -0000 Subject: [Python-checkins] The comment in ast_for_namedexpr shouldn't include if_stmt (GH-17586) Message-ID: https://github.com/python/cpython/commit/cd968dea28569960e0b78350d43b89b83dbd49c5 commit: cd968dea28569960e0b78350d43b89b83dbd49c5 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-15T12:04:07-08:00 summary: The comment in ast_for_namedexpr shouldn't include if_stmt (GH-17586) Automerge-Triggered-By: @gvanrossum (cherry picked from commit b08d3f71beab59653edfbbcf7b92a7bc8050d6b8) Co-authored-by: Guido van Rossum files: M Python/ast.c diff --git a/Python/ast.c b/Python/ast.c index 95caeffc8ff78..7081394e5844b 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -1935,9 +1935,7 @@ ast_for_decorated(struct compiling *c, const node *n) static expr_ty ast_for_namedexpr(struct compiling *c, const node *n) { - /* if_stmt: 'if' namedexpr_test ':' suite ('elif' namedexpr_test ':' suite)* - ['else' ':' suite] - namedexpr_test: test [':=' test] + /* namedexpr_test: test [':=' test] argument: ( test [comp_for] | test ':=' test | test '=' test | From webhook-mailer at python.org Sun Dec 15 17:00:43 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Sun, 15 Dec 2019 22:00:43 -0000 Subject: [Python-checkins] bpo-38629: implement __floor__ and __ceil__ for float type (GH-16985) Message-ID: https://github.com/python/cpython/commit/cb8b946ac10386e6cab1376945f64f683b5b16d3 commit: cb8b946ac10386e6cab1376945f64f683b5b16d3 branch: master author: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> committer: Victor Stinner date: 2019-12-15T23:00:28+01:00 summary: bpo-38629: implement __floor__ and __ceil__ for float type (GH-16985) files: A Misc/NEWS.d/next/Core and Builtins/2019-10-29-17-11-15.bpo-38629.3qinhF.rst M Lib/test/test_float.py M Objects/clinic/floatobject.c.h M Objects/floatobject.c diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index b656582538e87..9651281e24edb 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -312,6 +312,34 @@ def assertEqualAndEqualSign(self, a, b): # distinguishes -0.0 and 0.0. self.assertEqual((a, copysign(1.0, a)), (b, copysign(1.0, b))) + def test_float_floor(self): + self.assertIsInstance(float(0.5).__floor__(), int) + self.assertEqual(float(0.5).__floor__(), 0) + self.assertEqual(float(1.0).__floor__(), 1) + self.assertEqual(float(1.5).__floor__(), 1) + self.assertEqual(float(-0.5).__floor__(), -1) + self.assertEqual(float(-1.0).__floor__(), -1) + self.assertEqual(float(-1.5).__floor__(), -2) + self.assertEqual(float(1.23e167).__floor__(), 1.23e167) + self.assertEqual(float(-1.23e167).__floor__(), -1.23e167) + self.assertRaises(ValueError, float("nan").__floor__) + self.assertRaises(OverflowError, float("inf").__floor__) + self.assertRaises(OverflowError, float("-inf").__floor__) + + def test_float_ceil(self): + self.assertIsInstance(float(0.5).__ceil__(), int) + self.assertEqual(float(0.5).__ceil__(), 1) + self.assertEqual(float(1.0).__ceil__(), 1) + self.assertEqual(float(1.5).__ceil__(), 2) + self.assertEqual(float(-0.5).__ceil__(), 0) + self.assertEqual(float(-1.0).__ceil__(), -1) + self.assertEqual(float(-1.5).__ceil__(), -1) + self.assertEqual(float(1.23e167).__ceil__(), 1.23e167) + self.assertEqual(float(-1.23e167).__ceil__(), -1.23e167) + self.assertRaises(ValueError, float("nan").__ceil__) + self.assertRaises(OverflowError, float("inf").__ceil__) + self.assertRaises(OverflowError, float("-inf").__ceil__) + @support.requires_IEEE_754 def test_float_mod(self): # Check behaviour of % operator for IEEE 754 special cases. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-10-29-17-11-15.bpo-38629.3qinhF.rst b/Misc/NEWS.d/next/Core and Builtins/2019-10-29-17-11-15.bpo-38629.3qinhF.rst new file mode 100644 index 0000000000000..dadafcd898af5 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-10-29-17-11-15.bpo-38629.3qinhF.rst @@ -0,0 +1 @@ +Added ``__floor__`` and ``__ceil__`` methods to float object. Patch by Batuhan Ta?kaya. diff --git a/Objects/clinic/floatobject.c.h b/Objects/clinic/floatobject.c.h index b684ba0ef27aa..b7554832b5a8a 100644 --- a/Objects/clinic/floatobject.c.h +++ b/Objects/clinic/floatobject.c.h @@ -38,6 +38,42 @@ float___trunc__(PyObject *self, PyObject *Py_UNUSED(ignored)) return float___trunc___impl(self); } +PyDoc_STRVAR(float___floor____doc__, +"__floor__($self, /)\n" +"--\n" +"\n" +"Return the floor as an Integral."); + +#define FLOAT___FLOOR___METHODDEF \ + {"__floor__", (PyCFunction)float___floor__, METH_NOARGS, float___floor____doc__}, + +static PyObject * +float___floor___impl(PyObject *self); + +static PyObject * +float___floor__(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + return float___floor___impl(self); +} + +PyDoc_STRVAR(float___ceil____doc__, +"__ceil__($self, /)\n" +"--\n" +"\n" +"Return the ceiling as an Integral."); + +#define FLOAT___CEIL___METHODDEF \ + {"__ceil__", (PyCFunction)float___ceil__, METH_NOARGS, float___ceil____doc__}, + +static PyObject * +float___ceil___impl(PyObject *self); + +static PyObject * +float___ceil__(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + return float___ceil___impl(self); +} + PyDoc_STRVAR(float___round____doc__, "__round__($self, ndigits=None, /)\n" "--\n" @@ -351,4 +387,4 @@ float___format__(PyObject *self, PyObject *arg) exit: return return_value; } -/*[clinic end generated code: output=1676433b9f04fbc9 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=25fbbe253f44e2df input=a9049054013a1b77]*/ diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 20a5155e07346..4fc412b43f7a3 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -905,6 +905,34 @@ float___trunc___impl(PyObject *self) return PyLong_FromDouble(wholepart); } +/*[clinic input] +float.__floor__ + +Return the floor as an Integral. +[clinic start generated code]*/ + +static PyObject * +float___floor___impl(PyObject *self) +/*[clinic end generated code: output=e0551dbaea8c01d1 input=77bb13eb12e268df]*/ +{ + double x = PyFloat_AS_DOUBLE(self); + return PyLong_FromDouble(floor(x)); +} + +/*[clinic input] +float.__ceil__ + +Return the ceiling as an Integral. +[clinic start generated code]*/ + +static PyObject * +float___ceil___impl(PyObject *self) +/*[clinic end generated code: output=a2fd8858f73736f9 input=79e41ae94aa0a516]*/ +{ + double x = PyFloat_AS_DOUBLE(self); + return PyLong_FromDouble(ceil(x)); +} + /* double_round: rounds a finite double to the closest multiple of 10**-ndigits; here ndigits is within reasonable bounds (typically, -308 <= ndigits <= 323). Returns a Python float, or sets a Python error and @@ -1828,6 +1856,8 @@ float___format___impl(PyObject *self, PyObject *format_spec) static PyMethodDef float_methods[] = { FLOAT_CONJUGATE_METHODDEF FLOAT___TRUNC___METHODDEF + FLOAT___FLOOR___METHODDEF + FLOAT___CEIL___METHODDEF FLOAT___ROUND___METHODDEF FLOAT_AS_INTEGER_RATIO_METHODDEF FLOAT_FROMHEX_METHODDEF From webhook-mailer at python.org Sun Dec 15 17:02:51 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Sun, 15 Dec 2019 22:02:51 -0000 Subject: [Python-checkins] bpo-38316: Fix co_stacksize documentation (GH-16983) Message-ID: https://github.com/python/cpython/commit/d587272fe3b0fcad2f23a490e76f9f82ca7d64ef commit: d587272fe3b0fcad2f23a490e76f9f82ca7d64ef branch: master author: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> committer: Victor Stinner date: 2019-12-15T23:02:47+01:00 summary: bpo-38316: Fix co_stacksize documentation (GH-16983) files: M Doc/reference/datamodel.rst diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index b22ed92ec964d..c242041c73d41 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -925,8 +925,8 @@ Internal types the first line number of the function; :attr:`co_lnotab` is a string encoding the mapping from bytecode offsets to line numbers (for details see the source code of the interpreter); :attr:`co_stacksize` is the - required stack size (including local variables); :attr:`co_flags` is an - integer encoding a number of flags for the interpreter. + required stack size; :attr:`co_flags` is an integer encoding a number + of flags for the interpreter. .. index:: object: generator From webhook-mailer at python.org Sun Dec 15 18:34:19 2019 From: webhook-mailer at python.org (Nick Coghlan) Date: Sun, 15 Dec 2019 23:34:19 -0000 Subject: [Python-checkins] bpo-39033: Fix NameError in zipimport during hash validation (GH-17588) Message-ID: https://github.com/python/cpython/commit/79f02fee1a542c440fd906fd54154c73fc0f8235 commit: 79f02fee1a542c440fd906fd54154c73fc0f8235 branch: master author: Xtreak committer: Nick Coghlan date: 2019-12-16T09:34:12+10:00 summary: bpo-39033: Fix NameError in zipimport during hash validation (GH-17588) Patch by Karthikeyan Singaravelan. files: A Misc/NEWS.d/next/Library/2019-12-13-18-54-49.bpo-39033.cepuyD.rst M Lib/test/test_zipimport.py M Lib/zipimport.py M Misc/ACKS M Python/importlib_zipimport.h diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py index d4f619e9acdb9..2af8689c1d2cb 100644 --- a/Lib/test/test_zipimport.py +++ b/Lib/test/test_zipimport.py @@ -6,6 +6,7 @@ import struct import time import unittest +import unittest.mock from test import support @@ -204,6 +205,21 @@ def check(mod): self.assertEqual(mod.state, 'old') self.doTest(None, files, TESTMOD, call=check) + @unittest.mock.patch('_imp.check_hash_based_pycs', 'always') + def test_checked_hash_based_change_pyc(self): + source = b"state = 'old'" + source_hash = importlib.util.source_hash(source) + bytecode = importlib._bootstrap_external._code_to_hash_pyc( + compile(source, "???", "exec"), + source_hash, + False, + ) + files = {TESTMOD + ".py": (NOW, "state = 'new'"), + TESTMOD + ".pyc": (NOW - 20, bytecode)} + def check(mod): + self.assertEqual(mod.state, 'new') + self.doTest(None, files, TESTMOD, call=check) + def testEmptyPy(self): files = {TESTMOD + ".py": (NOW, "")} self.doTest(None, files, TESTMOD) diff --git a/Lib/zipimport.py b/Lib/zipimport.py index fd917c16b0153..5ef0a17c2a5ed 100644 --- a/Lib/zipimport.py +++ b/Lib/zipimport.py @@ -608,7 +608,7 @@ def _unmarshal_code(self, pathname, fullpath, fullname, data): ) try: - _boostrap_external._validate_hash_pyc( + _bootstrap_external._validate_hash_pyc( data, source_hash, fullname, exc_details) except ImportError: return None diff --git a/Misc/ACKS b/Misc/ACKS index 253e2f6133d58..5f42760cb9267 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1901,3 +1901,4 @@ Tim Hopper Dan Lidral-Porter Ngalim Siregar Tim Gates +Karthikeyan Singaravelan \ No newline at end of file diff --git a/Misc/NEWS.d/next/Library/2019-12-13-18-54-49.bpo-39033.cepuyD.rst b/Misc/NEWS.d/next/Library/2019-12-13-18-54-49.bpo-39033.cepuyD.rst new file mode 100644 index 0000000000000..3dee3c08cc5be --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-13-18-54-49.bpo-39033.cepuyD.rst @@ -0,0 +1 @@ +Fix :exc:`NameError` in :mod:`zipimport`. Patch by Karthikeyan Singaravelan. diff --git a/Python/importlib_zipimport.h b/Python/importlib_zipimport.h index 21633acb9376a..a05a7a3b945a1 100644 --- a/Python/importlib_zipimport.h +++ b/Python/importlib_zipimport.h @@ -795,17 +795,17 @@ const unsigned char _Py_M__zipimport[] = { 106,4,100,5,107,3,114,180,124,8,115,104,116,3,106,4, 100,6,107,2,114,180,116,5,124,0,124,2,131,2,125,9, 124,9,100,0,107,9,114,180,116,3,160,6,116,0,106,7, - 124,9,161,2,125,10,122,20,116,8,160,9,124,4,124,10, + 124,9,161,2,125,10,122,20,116,0,160,8,124,4,124,10, 124,3,124,5,161,4,1,0,87,0,110,22,4,0,116,2, 107,10,114,178,1,0,1,0,1,0,89,0,100,0,83,0, - 48,0,110,84,116,10,124,0,124,2,131,2,92,2,125,11, - 125,12,124,11,144,1,114,10,116,11,116,12,124,4,100,7, - 100,8,133,2,25,0,131,1,124,11,131,2,114,246,116,12, + 48,0,110,84,116,9,124,0,124,2,131,2,92,2,125,11, + 125,12,124,11,144,1,114,10,116,10,116,11,124,4,100,7, + 100,8,133,2,25,0,131,1,124,11,131,2,114,246,116,11, 124,4,100,8,100,9,133,2,25,0,131,1,124,12,107,3, - 144,1,114,10,116,13,160,14,100,10,124,3,155,2,157,2, - 161,1,1,0,100,0,83,0,116,15,160,16,124,4,100,9, - 100,0,133,2,25,0,161,1,125,13,116,17,124,13,116,18, - 131,2,144,1,115,56,116,19,100,11,124,1,155,2,100,12, + 144,1,114,10,116,12,160,13,100,10,124,3,155,2,157,2, + 161,1,1,0,100,0,83,0,116,14,160,15,124,4,100,9, + 100,0,133,2,25,0,161,1,125,13,116,16,124,13,116,17, + 131,2,144,1,115,56,116,18,100,11,124,1,155,2,100,12, 157,3,131,1,130,1,124,13,83,0,41,13,78,41,2,114, 59,0,0,0,114,13,0,0,0,114,5,0,0,0,114,0, 0,0,0,114,86,0,0,0,90,5,110,101,118,101,114,90, @@ -814,271 +814,270 @@ const unsigned char _Py_M__zipimport[] = { 32,105,115,32,115,116,97,108,101,32,102,111,114,32,122,16, 99,111,109,112,105,108,101,100,32,109,111,100,117,108,101,32, 122,21,32,105,115,32,110,111,116,32,97,32,99,111,100,101, - 32,111,98,106,101,99,116,41,20,114,21,0,0,0,90,13, + 32,111,98,106,101,99,116,41,19,114,21,0,0,0,90,13, 95,99,108,97,115,115,105,102,121,95,112,121,99,114,75,0, 0,0,218,4,95,105,109,112,90,21,99,104,101,99,107,95, 104,97,115,104,95,98,97,115,101,100,95,112,121,99,115,218, 15,95,103,101,116,95,112,121,99,95,115,111,117,114,99,101, 218,11,115,111,117,114,99,101,95,104,97,115,104,90,17,95, 82,65,87,95,77,65,71,73,67,95,78,85,77,66,69,82, - 90,18,95,98,111,111,115,116,114,97,112,95,101,120,116,101, - 114,110,97,108,90,18,95,118,97,108,105,100,97,116,101,95, - 104,97,115,104,95,112,121,99,218,29,95,103,101,116,95,109, - 116,105,109,101,95,97,110,100,95,115,105,122,101,95,111,102, - 95,115,111,117,114,99,101,114,147,0,0,0,114,2,0,0, - 0,114,76,0,0,0,114,77,0,0,0,218,7,109,97,114, - 115,104,97,108,90,5,108,111,97,100,115,114,15,0,0,0, - 218,10,95,99,111,100,101,95,116,121,112,101,218,9,84,121, - 112,101,69,114,114,111,114,41,14,114,32,0,0,0,114,53, - 0,0,0,114,63,0,0,0,114,38,0,0,0,114,126,0, - 0,0,90,11,101,120,99,95,100,101,116,97,105,108,115,114, - 129,0,0,0,90,10,104,97,115,104,95,98,97,115,101,100, - 90,12,99,104,101,99,107,95,115,111,117,114,99,101,90,12, - 115,111,117,114,99,101,95,98,121,116,101,115,114,150,0,0, - 0,90,12,115,111,117,114,99,101,95,109,116,105,109,101,90, - 11,115,111,117,114,99,101,95,115,105,122,101,114,46,0,0, - 0,114,9,0,0,0,114,9,0,0,0,114,10,0,0,0, - 218,15,95,117,110,109,97,114,115,104,97,108,95,99,111,100, - 101,75,2,0,0,115,88,0,0,0,0,2,2,1,2,254, - 6,5,2,1,18,1,14,1,8,2,12,1,4,1,12,1, - 10,1,2,255,2,1,8,255,2,2,10,1,8,1,4,1, - 4,1,2,254,4,5,2,1,4,1,2,0,2,0,2,0, - 2,255,8,2,14,1,10,3,8,255,6,3,6,3,22,1, - 18,255,4,2,4,1,8,255,4,2,4,2,18,1,12,1, - 16,1,114,155,0,0,0,99,1,0,0,0,0,0,0,0, - 0,0,0,0,1,0,0,0,4,0,0,0,67,0,0,0, - 115,28,0,0,0,124,0,160,0,100,1,100,2,161,2,125, - 0,124,0,160,0,100,3,100,2,161,2,125,0,124,0,83, - 0,41,4,78,115,2,0,0,0,13,10,243,1,0,0,0, - 10,243,1,0,0,0,13,41,1,114,19,0,0,0,41,1, - 218,6,115,111,117,114,99,101,114,9,0,0,0,114,9,0, - 0,0,114,10,0,0,0,218,23,95,110,111,114,109,97,108, - 105,122,101,95,108,105,110,101,95,101,110,100,105,110,103,115, - 126,2,0,0,115,6,0,0,0,0,1,12,1,12,1,114, - 159,0,0,0,99,2,0,0,0,0,0,0,0,0,0,0, - 0,2,0,0,0,6,0,0,0,67,0,0,0,115,24,0, - 0,0,116,0,124,1,131,1,125,1,116,1,124,1,124,0, - 100,1,100,2,100,3,141,4,83,0,41,4,78,114,74,0, - 0,0,84,41,1,90,12,100,111,110,116,95,105,110,104,101, - 114,105,116,41,2,114,159,0,0,0,218,7,99,111,109,112, - 105,108,101,41,2,114,53,0,0,0,114,158,0,0,0,114, - 9,0,0,0,114,9,0,0,0,114,10,0,0,0,218,15, - 95,99,111,109,112,105,108,101,95,115,111,117,114,99,101,133, - 2,0,0,115,4,0,0,0,0,1,8,1,114,161,0,0, - 0,99,2,0,0,0,0,0,0,0,0,0,0,0,2,0, - 0,0,11,0,0,0,67,0,0,0,115,68,0,0,0,116, - 0,160,1,124,0,100,1,63,0,100,2,23,0,124,0,100, - 3,63,0,100,4,64,0,124,0,100,5,64,0,124,1,100, - 6,63,0,124,1,100,3,63,0,100,7,64,0,124,1,100, - 5,64,0,100,8,20,0,100,9,100,9,100,9,102,9,161, - 1,83,0,41,10,78,233,9,0,0,0,105,188,7,0,0, - 233,5,0,0,0,233,15,0,0,0,233,31,0,0,0,233, - 11,0,0,0,233,63,0,0,0,114,86,0,0,0,114,14, - 0,0,0,41,2,114,131,0,0,0,90,6,109,107,116,105, - 109,101,41,2,218,1,100,114,138,0,0,0,114,9,0,0, - 0,114,9,0,0,0,114,10,0,0,0,218,14,95,112,97, - 114,115,101,95,100,111,115,116,105,109,101,139,2,0,0,115, - 22,0,0,0,0,1,4,1,10,1,10,1,6,1,6,1, - 10,1,10,1,2,0,2,0,2,249,114,169,0,0,0,99, - 2,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0, - 10,0,0,0,67,0,0,0,115,116,0,0,0,122,82,124, - 1,100,1,100,0,133,2,25,0,100,2,107,6,115,22,74, - 0,130,1,124,1,100,0,100,1,133,2,25,0,125,1,124, - 0,106,0,124,1,25,0,125,2,124,2,100,3,25,0,125, - 3,124,2,100,4,25,0,125,4,124,2,100,5,25,0,125, - 5,116,1,124,4,124,3,131,2,124,5,102,2,87,0,83, - 0,4,0,116,2,116,3,116,4,102,3,107,10,114,110,1, - 0,1,0,1,0,89,0,100,6,83,0,48,0,100,0,83, - 0,41,7,78,114,14,0,0,0,169,2,218,1,99,218,1, - 111,114,163,0,0,0,233,6,0,0,0,233,3,0,0,0, - 41,2,114,0,0,0,0,114,0,0,0,0,41,5,114,28, - 0,0,0,114,169,0,0,0,114,26,0,0,0,218,10,73, - 110,100,101,120,69,114,114,111,114,114,154,0,0,0,41,6, - 114,32,0,0,0,114,13,0,0,0,114,54,0,0,0,114, - 131,0,0,0,114,132,0,0,0,90,17,117,110,99,111,109, - 112,114,101,115,115,101,100,95,115,105,122,101,114,9,0,0, - 0,114,9,0,0,0,114,10,0,0,0,114,151,0,0,0, - 152,2,0,0,115,20,0,0,0,0,1,2,2,20,1,12, - 1,10,3,8,1,8,1,8,1,16,1,20,1,114,151,0, - 0,0,99,2,0,0,0,0,0,0,0,0,0,0,0,3, - 0,0,0,8,0,0,0,67,0,0,0,115,86,0,0,0, - 124,1,100,1,100,0,133,2,25,0,100,2,107,6,115,20, - 74,0,130,1,124,1,100,0,100,1,133,2,25,0,125,1, - 122,14,124,0,106,0,124,1,25,0,125,2,87,0,110,22, - 4,0,116,1,107,10,114,68,1,0,1,0,1,0,89,0, - 100,0,83,0,48,0,116,2,124,0,106,3,124,2,131,2, - 83,0,100,0,83,0,41,3,78,114,14,0,0,0,114,170, - 0,0,0,41,4,114,28,0,0,0,114,26,0,0,0,114, - 52,0,0,0,114,29,0,0,0,41,3,114,32,0,0,0, - 114,13,0,0,0,114,54,0,0,0,114,9,0,0,0,114, - 9,0,0,0,114,10,0,0,0,114,149,0,0,0,171,2, - 0,0,115,14,0,0,0,0,2,20,1,12,2,2,1,14, - 1,14,1,8,2,114,149,0,0,0,99,2,0,0,0,0, - 0,0,0,0,0,0,0,11,0,0,0,9,0,0,0,67, - 0,0,0,115,198,0,0,0,116,0,124,0,124,1,131,2, - 125,2,116,1,68,0,93,160,92,3,125,3,125,4,125,5, - 124,2,124,3,23,0,125,6,116,2,106,3,100,1,124,0, - 106,4,116,5,124,6,100,2,100,3,141,5,1,0,122,14, - 124,0,106,6,124,6,25,0,125,7,87,0,110,20,4,0, - 116,7,107,10,114,88,1,0,1,0,1,0,89,0,113,14, - 48,0,124,7,100,4,25,0,125,8,116,8,124,0,106,4, - 124,7,131,2,125,9,124,4,114,132,116,9,124,0,124,8, - 124,6,124,1,124,9,131,5,125,10,110,10,116,10,124,8, - 124,9,131,2,125,10,124,10,100,0,107,8,114,152,113,14, - 124,7,100,4,25,0,125,8,124,10,124,5,124,8,102,3, - 2,0,1,0,83,0,113,14,116,11,100,5,124,1,155,2, - 157,2,124,1,100,6,141,2,130,1,100,0,83,0,41,7, - 78,122,13,116,114,121,105,110,103,32,123,125,123,125,123,125, - 114,86,0,0,0,41,1,90,9,118,101,114,98,111,115,105, - 116,121,114,0,0,0,0,114,57,0,0,0,114,58,0,0, - 0,41,12,114,36,0,0,0,114,89,0,0,0,114,76,0, - 0,0,114,77,0,0,0,114,29,0,0,0,114,20,0,0, - 0,114,28,0,0,0,114,26,0,0,0,114,52,0,0,0, - 114,155,0,0,0,114,161,0,0,0,114,3,0,0,0,41, - 11,114,32,0,0,0,114,38,0,0,0,114,13,0,0,0, - 114,90,0,0,0,114,91,0,0,0,114,47,0,0,0,114, - 63,0,0,0,114,54,0,0,0,114,40,0,0,0,114,126, - 0,0,0,114,46,0,0,0,114,9,0,0,0,114,9,0, - 0,0,114,10,0,0,0,114,44,0,0,0,186,2,0,0, - 115,36,0,0,0,0,1,10,1,14,1,8,1,22,1,2, - 1,14,1,14,1,6,2,8,1,12,1,4,1,18,2,10, - 1,8,3,2,1,8,1,16,2,114,44,0,0,0,99,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2, - 0,0,0,64,0,0,0,115,60,0,0,0,101,0,90,1, - 100,0,90,2,100,1,90,3,100,2,90,4,100,3,100,4, - 132,0,90,5,100,5,100,6,132,0,90,6,100,7,100,8, - 132,0,90,7,100,9,100,10,132,0,90,8,100,11,100,12, - 132,0,90,9,100,13,83,0,41,14,114,80,0,0,0,122, - 165,80,114,105,118,97,116,101,32,99,108,97,115,115,32,117, - 115,101,100,32,116,111,32,115,117,112,112,111,114,116,32,90, - 105,112,73,109,112,111,114,116,46,103,101,116,95,114,101,115, - 111,117,114,99,101,95,114,101,97,100,101,114,40,41,46,10, - 10,32,32,32,32,84,104,105,115,32,99,108,97,115,115,32, - 105,115,32,97,108,108,111,119,101,100,32,116,111,32,114,101, - 102,101,114,101,110,99,101,32,97,108,108,32,116,104,101,32, - 105,110,110,97,114,100,115,32,97,110,100,32,112,114,105,118, - 97,116,101,32,112,97,114,116,115,32,111,102,10,32,32,32, - 32,116,104,101,32,122,105,112,105,109,112,111,114,116,101,114, - 46,10,32,32,32,32,70,99,3,0,0,0,0,0,0,0, - 0,0,0,0,3,0,0,0,2,0,0,0,67,0,0,0, - 115,16,0,0,0,124,1,124,0,95,0,124,2,124,0,95, - 1,100,0,83,0,114,88,0,0,0,41,2,114,4,0,0, - 0,114,38,0,0,0,41,3,114,32,0,0,0,114,4,0, - 0,0,114,38,0,0,0,114,9,0,0,0,114,9,0,0, - 0,114,10,0,0,0,114,34,0,0,0,220,2,0,0,115, - 4,0,0,0,0,1,6,1,122,33,95,90,105,112,73,109, - 112,111,114,116,82,101,115,111,117,114,99,101,82,101,97,100, - 101,114,46,95,95,105,110,105,116,95,95,99,2,0,0,0, - 0,0,0,0,0,0,0,0,5,0,0,0,8,0,0,0, - 67,0,0,0,115,92,0,0,0,124,0,106,0,160,1,100, - 1,100,2,161,2,125,2,124,2,155,0,100,2,124,1,155, - 0,157,3,125,3,100,3,100,4,108,2,109,3,125,4,1, - 0,122,18,124,4,124,0,106,4,160,5,124,3,161,1,131, - 1,87,0,83,0,4,0,116,6,107,10,114,86,1,0,1, - 0,1,0,116,7,124,3,131,1,130,1,89,0,110,2,48, - 0,100,0,83,0,41,5,78,114,85,0,0,0,114,109,0, - 0,0,114,0,0,0,0,41,1,218,7,66,121,116,101,115, - 73,79,41,8,114,38,0,0,0,114,19,0,0,0,90,2, - 105,111,114,176,0,0,0,114,4,0,0,0,114,55,0,0, - 0,114,22,0,0,0,218,17,70,105,108,101,78,111,116,70, - 111,117,110,100,69,114,114,111,114,41,5,114,32,0,0,0, - 218,8,114,101,115,111,117,114,99,101,218,16,102,117,108,108, - 110,97,109,101,95,97,115,95,112,97,116,104,114,13,0,0, - 0,114,176,0,0,0,114,9,0,0,0,114,9,0,0,0, - 114,10,0,0,0,218,13,111,112,101,110,95,114,101,115,111, - 117,114,99,101,224,2,0,0,115,14,0,0,0,0,1,14, - 1,14,1,12,1,2,1,18,1,14,1,122,38,95,90,105, - 112,73,109,112,111,114,116,82,101,115,111,117,114,99,101,82, - 101,97,100,101,114,46,111,112,101,110,95,114,101,115,111,117, - 114,99,101,99,2,0,0,0,0,0,0,0,0,0,0,0, - 2,0,0,0,1,0,0,0,67,0,0,0,115,8,0,0, - 0,116,0,130,1,100,0,83,0,114,88,0,0,0,41,1, - 114,177,0,0,0,41,2,114,32,0,0,0,114,178,0,0, - 0,114,9,0,0,0,114,9,0,0,0,114,10,0,0,0, - 218,13,114,101,115,111,117,114,99,101,95,112,97,116,104,233, - 2,0,0,115,2,0,0,0,0,4,122,38,95,90,105,112, - 73,109,112,111,114,116,82,101,115,111,117,114,99,101,82,101, - 97,100,101,114,46,114,101,115,111,117,114,99,101,95,112,97, - 116,104,99,2,0,0,0,0,0,0,0,0,0,0,0,4, - 0,0,0,8,0,0,0,67,0,0,0,115,72,0,0,0, - 124,0,106,0,160,1,100,1,100,2,161,2,125,2,124,2, - 155,0,100,2,124,1,155,0,157,3,125,3,122,16,124,0, - 106,2,160,3,124,3,161,1,1,0,87,0,110,22,4,0, - 116,4,107,10,114,66,1,0,1,0,1,0,89,0,100,3, - 83,0,48,0,100,4,83,0,41,5,78,114,85,0,0,0, - 114,109,0,0,0,70,84,41,5,114,38,0,0,0,114,19, + 90,18,95,118,97,108,105,100,97,116,101,95,104,97,115,104, + 95,112,121,99,218,29,95,103,101,116,95,109,116,105,109,101, + 95,97,110,100,95,115,105,122,101,95,111,102,95,115,111,117, + 114,99,101,114,147,0,0,0,114,2,0,0,0,114,76,0, + 0,0,114,77,0,0,0,218,7,109,97,114,115,104,97,108, + 90,5,108,111,97,100,115,114,15,0,0,0,218,10,95,99, + 111,100,101,95,116,121,112,101,218,9,84,121,112,101,69,114, + 114,111,114,41,14,114,32,0,0,0,114,53,0,0,0,114, + 63,0,0,0,114,38,0,0,0,114,126,0,0,0,90,11, + 101,120,99,95,100,101,116,97,105,108,115,114,129,0,0,0, + 90,10,104,97,115,104,95,98,97,115,101,100,90,12,99,104, + 101,99,107,95,115,111,117,114,99,101,90,12,115,111,117,114, + 99,101,95,98,121,116,101,115,114,150,0,0,0,90,12,115, + 111,117,114,99,101,95,109,116,105,109,101,90,11,115,111,117, + 114,99,101,95,115,105,122,101,114,46,0,0,0,114,9,0, + 0,0,114,9,0,0,0,114,10,0,0,0,218,15,95,117, + 110,109,97,114,115,104,97,108,95,99,111,100,101,75,2,0, + 0,115,88,0,0,0,0,2,2,1,2,254,6,5,2,1, + 18,1,14,1,8,2,12,1,4,1,12,1,10,1,2,255, + 2,1,8,255,2,2,10,1,8,1,4,1,4,1,2,254, + 4,5,2,1,4,1,2,0,2,0,2,0,2,255,8,2, + 14,1,10,3,8,255,6,3,6,3,22,1,18,255,4,2, + 4,1,8,255,4,2,4,2,18,1,12,1,16,1,114,155, + 0,0,0,99,1,0,0,0,0,0,0,0,0,0,0,0, + 1,0,0,0,4,0,0,0,67,0,0,0,115,28,0,0, + 0,124,0,160,0,100,1,100,2,161,2,125,0,124,0,160, + 0,100,3,100,2,161,2,125,0,124,0,83,0,41,4,78, + 115,2,0,0,0,13,10,243,1,0,0,0,10,243,1,0, + 0,0,13,41,1,114,19,0,0,0,41,1,218,6,115,111, + 117,114,99,101,114,9,0,0,0,114,9,0,0,0,114,10, + 0,0,0,218,23,95,110,111,114,109,97,108,105,122,101,95, + 108,105,110,101,95,101,110,100,105,110,103,115,126,2,0,0, + 115,6,0,0,0,0,1,12,1,12,1,114,159,0,0,0, + 99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0, + 0,6,0,0,0,67,0,0,0,115,24,0,0,0,116,0, + 124,1,131,1,125,1,116,1,124,1,124,0,100,1,100,2, + 100,3,141,4,83,0,41,4,78,114,74,0,0,0,84,41, + 1,90,12,100,111,110,116,95,105,110,104,101,114,105,116,41, + 2,114,159,0,0,0,218,7,99,111,109,112,105,108,101,41, + 2,114,53,0,0,0,114,158,0,0,0,114,9,0,0,0, + 114,9,0,0,0,114,10,0,0,0,218,15,95,99,111,109, + 112,105,108,101,95,115,111,117,114,99,101,133,2,0,0,115, + 4,0,0,0,0,1,8,1,114,161,0,0,0,99,2,0, + 0,0,0,0,0,0,0,0,0,0,2,0,0,0,11,0, + 0,0,67,0,0,0,115,68,0,0,0,116,0,160,1,124, + 0,100,1,63,0,100,2,23,0,124,0,100,3,63,0,100, + 4,64,0,124,0,100,5,64,0,124,1,100,6,63,0,124, + 1,100,3,63,0,100,7,64,0,124,1,100,5,64,0,100, + 8,20,0,100,9,100,9,100,9,102,9,161,1,83,0,41, + 10,78,233,9,0,0,0,105,188,7,0,0,233,5,0,0, + 0,233,15,0,0,0,233,31,0,0,0,233,11,0,0,0, + 233,63,0,0,0,114,86,0,0,0,114,14,0,0,0,41, + 2,114,131,0,0,0,90,6,109,107,116,105,109,101,41,2, + 218,1,100,114,138,0,0,0,114,9,0,0,0,114,9,0, + 0,0,114,10,0,0,0,218,14,95,112,97,114,115,101,95, + 100,111,115,116,105,109,101,139,2,0,0,115,22,0,0,0, + 0,1,4,1,10,1,10,1,6,1,6,1,10,1,10,1, + 2,0,2,0,2,249,114,169,0,0,0,99,2,0,0,0, + 0,0,0,0,0,0,0,0,6,0,0,0,10,0,0,0, + 67,0,0,0,115,116,0,0,0,122,82,124,1,100,1,100, + 0,133,2,25,0,100,2,107,6,115,22,74,0,130,1,124, + 1,100,0,100,1,133,2,25,0,125,1,124,0,106,0,124, + 1,25,0,125,2,124,2,100,3,25,0,125,3,124,2,100, + 4,25,0,125,4,124,2,100,5,25,0,125,5,116,1,124, + 4,124,3,131,2,124,5,102,2,87,0,83,0,4,0,116, + 2,116,3,116,4,102,3,107,10,114,110,1,0,1,0,1, + 0,89,0,100,6,83,0,48,0,100,0,83,0,41,7,78, + 114,14,0,0,0,169,2,218,1,99,218,1,111,114,163,0, + 0,0,233,6,0,0,0,233,3,0,0,0,41,2,114,0, + 0,0,0,114,0,0,0,0,41,5,114,28,0,0,0,114, + 169,0,0,0,114,26,0,0,0,218,10,73,110,100,101,120, + 69,114,114,111,114,114,154,0,0,0,41,6,114,32,0,0, + 0,114,13,0,0,0,114,54,0,0,0,114,131,0,0,0, + 114,132,0,0,0,90,17,117,110,99,111,109,112,114,101,115, + 115,101,100,95,115,105,122,101,114,9,0,0,0,114,9,0, + 0,0,114,10,0,0,0,114,151,0,0,0,152,2,0,0, + 115,20,0,0,0,0,1,2,2,20,1,12,1,10,3,8, + 1,8,1,8,1,16,1,20,1,114,151,0,0,0,99,2, + 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,8, + 0,0,0,67,0,0,0,115,86,0,0,0,124,1,100,1, + 100,0,133,2,25,0,100,2,107,6,115,20,74,0,130,1, + 124,1,100,0,100,1,133,2,25,0,125,1,122,14,124,0, + 106,0,124,1,25,0,125,2,87,0,110,22,4,0,116,1, + 107,10,114,68,1,0,1,0,1,0,89,0,100,0,83,0, + 48,0,116,2,124,0,106,3,124,2,131,2,83,0,100,0, + 83,0,41,3,78,114,14,0,0,0,114,170,0,0,0,41, + 4,114,28,0,0,0,114,26,0,0,0,114,52,0,0,0, + 114,29,0,0,0,41,3,114,32,0,0,0,114,13,0,0, + 0,114,54,0,0,0,114,9,0,0,0,114,9,0,0,0, + 114,10,0,0,0,114,149,0,0,0,171,2,0,0,115,14, + 0,0,0,0,2,20,1,12,2,2,1,14,1,14,1,8, + 2,114,149,0,0,0,99,2,0,0,0,0,0,0,0,0, + 0,0,0,11,0,0,0,9,0,0,0,67,0,0,0,115, + 198,0,0,0,116,0,124,0,124,1,131,2,125,2,116,1, + 68,0,93,160,92,3,125,3,125,4,125,5,124,2,124,3, + 23,0,125,6,116,2,106,3,100,1,124,0,106,4,116,5, + 124,6,100,2,100,3,141,5,1,0,122,14,124,0,106,6, + 124,6,25,0,125,7,87,0,110,20,4,0,116,7,107,10, + 114,88,1,0,1,0,1,0,89,0,113,14,48,0,124,7, + 100,4,25,0,125,8,116,8,124,0,106,4,124,7,131,2, + 125,9,124,4,114,132,116,9,124,0,124,8,124,6,124,1, + 124,9,131,5,125,10,110,10,116,10,124,8,124,9,131,2, + 125,10,124,10,100,0,107,8,114,152,113,14,124,7,100,4, + 25,0,125,8,124,10,124,5,124,8,102,3,2,0,1,0, + 83,0,113,14,116,11,100,5,124,1,155,2,157,2,124,1, + 100,6,141,2,130,1,100,0,83,0,41,7,78,122,13,116, + 114,121,105,110,103,32,123,125,123,125,123,125,114,86,0,0, + 0,41,1,90,9,118,101,114,98,111,115,105,116,121,114,0, + 0,0,0,114,57,0,0,0,114,58,0,0,0,41,12,114, + 36,0,0,0,114,89,0,0,0,114,76,0,0,0,114,77, + 0,0,0,114,29,0,0,0,114,20,0,0,0,114,28,0, + 0,0,114,26,0,0,0,114,52,0,0,0,114,155,0,0, + 0,114,161,0,0,0,114,3,0,0,0,41,11,114,32,0, + 0,0,114,38,0,0,0,114,13,0,0,0,114,90,0,0, + 0,114,91,0,0,0,114,47,0,0,0,114,63,0,0,0, + 114,54,0,0,0,114,40,0,0,0,114,126,0,0,0,114, + 46,0,0,0,114,9,0,0,0,114,9,0,0,0,114,10, + 0,0,0,114,44,0,0,0,186,2,0,0,115,36,0,0, + 0,0,1,10,1,14,1,8,1,22,1,2,1,14,1,14, + 1,6,2,8,1,12,1,4,1,18,2,10,1,8,3,2, + 1,8,1,16,2,114,44,0,0,0,99,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,64, + 0,0,0,115,60,0,0,0,101,0,90,1,100,0,90,2, + 100,1,90,3,100,2,90,4,100,3,100,4,132,0,90,5, + 100,5,100,6,132,0,90,6,100,7,100,8,132,0,90,7, + 100,9,100,10,132,0,90,8,100,11,100,12,132,0,90,9, + 100,13,83,0,41,14,114,80,0,0,0,122,165,80,114,105, + 118,97,116,101,32,99,108,97,115,115,32,117,115,101,100,32, + 116,111,32,115,117,112,112,111,114,116,32,90,105,112,73,109, + 112,111,114,116,46,103,101,116,95,114,101,115,111,117,114,99, + 101,95,114,101,97,100,101,114,40,41,46,10,10,32,32,32, + 32,84,104,105,115,32,99,108,97,115,115,32,105,115,32,97, + 108,108,111,119,101,100,32,116,111,32,114,101,102,101,114,101, + 110,99,101,32,97,108,108,32,116,104,101,32,105,110,110,97, + 114,100,115,32,97,110,100,32,112,114,105,118,97,116,101,32, + 112,97,114,116,115,32,111,102,10,32,32,32,32,116,104,101, + 32,122,105,112,105,109,112,111,114,116,101,114,46,10,32,32, + 32,32,70,99,3,0,0,0,0,0,0,0,0,0,0,0, + 3,0,0,0,2,0,0,0,67,0,0,0,115,16,0,0, + 0,124,1,124,0,95,0,124,2,124,0,95,1,100,0,83, + 0,114,88,0,0,0,41,2,114,4,0,0,0,114,38,0, + 0,0,41,3,114,32,0,0,0,114,4,0,0,0,114,38, + 0,0,0,114,9,0,0,0,114,9,0,0,0,114,10,0, + 0,0,114,34,0,0,0,220,2,0,0,115,4,0,0,0, + 0,1,6,1,122,33,95,90,105,112,73,109,112,111,114,116, + 82,101,115,111,117,114,99,101,82,101,97,100,101,114,46,95, + 95,105,110,105,116,95,95,99,2,0,0,0,0,0,0,0, + 0,0,0,0,5,0,0,0,8,0,0,0,67,0,0,0, + 115,92,0,0,0,124,0,106,0,160,1,100,1,100,2,161, + 2,125,2,124,2,155,0,100,2,124,1,155,0,157,3,125, + 3,100,3,100,4,108,2,109,3,125,4,1,0,122,18,124, + 4,124,0,106,4,160,5,124,3,161,1,131,1,87,0,83, + 0,4,0,116,6,107,10,114,86,1,0,1,0,1,0,116, + 7,124,3,131,1,130,1,89,0,110,2,48,0,100,0,83, + 0,41,5,78,114,85,0,0,0,114,109,0,0,0,114,0, + 0,0,0,41,1,218,7,66,121,116,101,115,73,79,41,8, + 114,38,0,0,0,114,19,0,0,0,90,2,105,111,114,176, 0,0,0,114,4,0,0,0,114,55,0,0,0,114,22,0, - 0,0,41,4,114,32,0,0,0,114,59,0,0,0,114,179, - 0,0,0,114,13,0,0,0,114,9,0,0,0,114,9,0, - 0,0,114,10,0,0,0,218,11,105,115,95,114,101,115,111, - 117,114,99,101,239,2,0,0,115,14,0,0,0,0,3,14, - 1,14,1,2,1,16,1,14,1,8,1,122,36,95,90,105, - 112,73,109,112,111,114,116,82,101,115,111,117,114,99,101,82, - 101,97,100,101,114,46,105,115,95,114,101,115,111,117,114,99, - 101,99,1,0,0,0,0,0,0,0,0,0,0,0,9,0, - 0,0,9,0,0,0,99,0,0,0,115,186,0,0,0,100, - 1,100,2,108,0,109,1,125,1,1,0,124,1,124,0,106, - 2,160,3,124,0,106,4,161,1,131,1,125,2,124,2,160, - 5,124,0,106,2,106,6,161,1,125,3,124,3,106,7,100, - 3,107,2,115,58,74,0,130,1,124,3,106,8,125,4,116, - 9,131,0,125,5,124,0,106,2,106,10,68,0,93,102,125, - 6,122,18,124,1,124,6,131,1,160,5,124,4,161,1,125, - 7,87,0,110,24,4,0,116,11,107,10,114,124,1,0,1, - 0,1,0,89,0,113,78,89,0,110,2,48,0,124,7,106, - 8,106,7,125,8,116,12,124,8,131,1,100,1,107,2,114, - 156,124,7,106,7,86,0,1,0,113,78,124,8,124,5,107, - 7,114,78,124,5,160,13,124,8,161,1,1,0,124,8,86, - 0,1,0,113,78,100,0,83,0,41,4,78,114,0,0,0, - 0,41,1,218,4,80,97,116,104,114,60,0,0,0,41,14, - 90,7,112,97,116,104,108,105,98,114,183,0,0,0,114,4, - 0,0,0,114,56,0,0,0,114,38,0,0,0,90,11,114, - 101,108,97,116,105,118,101,95,116,111,114,29,0,0,0,114, - 59,0,0,0,90,6,112,97,114,101,110,116,218,3,115,101, - 116,114,28,0,0,0,114,23,0,0,0,114,51,0,0,0, - 218,3,97,100,100,41,9,114,32,0,0,0,114,183,0,0, - 0,90,13,102,117,108,108,110,97,109,101,95,112,97,116,104, - 90,13,114,101,108,97,116,105,118,101,95,112,97,116,104,90, - 12,112,97,99,107,97,103,101,95,112,97,116,104,90,12,115, - 117,98,100,105,114,115,95,115,101,101,110,218,8,102,105,108, - 101,110,97,109,101,90,8,114,101,108,97,116,105,118,101,90, - 11,112,97,114,101,110,116,95,110,97,109,101,114,9,0,0, - 0,114,9,0,0,0,114,10,0,0,0,218,8,99,111,110, - 116,101,110,116,115,250,2,0,0,115,34,0,0,0,0,8, - 12,1,18,1,14,3,14,1,6,1,6,1,12,1,2,1, - 18,1,14,1,10,5,8,1,12,1,10,1,8,1,10,1, - 122,33,95,90,105,112,73,109,112,111,114,116,82,101,115,111, - 117,114,99,101,82,101,97,100,101,114,46,99,111,110,116,101, - 110,116,115,78,41,10,114,6,0,0,0,114,7,0,0,0, - 114,8,0,0,0,114,84,0,0,0,114,81,0,0,0,114, - 34,0,0,0,114,180,0,0,0,114,181,0,0,0,114,182, - 0,0,0,114,187,0,0,0,114,9,0,0,0,114,9,0, - 0,0,114,9,0,0,0,114,10,0,0,0,114,80,0,0, - 0,212,2,0,0,115,14,0,0,0,8,1,4,5,4,2, - 8,4,8,9,8,6,8,11,114,80,0,0,0,41,45,114, - 84,0,0,0,90,26,95,102,114,111,122,101,110,95,105,109, - 112,111,114,116,108,105,98,95,101,120,116,101,114,110,97,108, - 114,21,0,0,0,114,1,0,0,0,114,2,0,0,0,90, - 17,95,102,114,111,122,101,110,95,105,109,112,111,114,116,108, - 105,98,114,76,0,0,0,114,148,0,0,0,114,110,0,0, - 0,114,152,0,0,0,114,67,0,0,0,114,131,0,0,0, - 90,7,95,95,97,108,108,95,95,114,20,0,0,0,90,15, - 112,97,116,104,95,115,101,112,97,114,97,116,111,114,115,114, - 18,0,0,0,114,75,0,0,0,114,3,0,0,0,114,25, - 0,0,0,218,4,116,121,112,101,114,70,0,0,0,114,113, - 0,0,0,114,115,0,0,0,114,117,0,0,0,114,4,0, - 0,0,114,89,0,0,0,114,36,0,0,0,114,37,0,0, - 0,114,35,0,0,0,114,27,0,0,0,114,122,0,0,0, - 114,142,0,0,0,114,144,0,0,0,114,52,0,0,0,114, - 147,0,0,0,114,155,0,0,0,218,8,95,95,99,111,100, - 101,95,95,114,153,0,0,0,114,159,0,0,0,114,161,0, - 0,0,114,169,0,0,0,114,151,0,0,0,114,149,0,0, - 0,114,44,0,0,0,114,80,0,0,0,114,9,0,0,0, - 114,9,0,0,0,114,9,0,0,0,114,10,0,0,0,218, - 8,60,109,111,100,117,108,101,62,1,0,0,0,115,88,0, - 0,0,4,16,8,1,16,1,8,1,8,1,8,1,8,1, - 8,1,8,2,8,3,6,1,14,3,16,4,4,2,8,2, - 4,1,4,1,4,2,14,127,0,127,0,1,12,1,12,1, - 2,1,2,252,4,9,8,4,8,9,8,31,8,126,2,254, - 2,29,4,5,8,21,8,46,8,10,8,46,10,5,8,7, - 8,6,8,13,8,19,8,15,8,26, + 0,0,218,17,70,105,108,101,78,111,116,70,111,117,110,100, + 69,114,114,111,114,41,5,114,32,0,0,0,218,8,114,101, + 115,111,117,114,99,101,218,16,102,117,108,108,110,97,109,101, + 95,97,115,95,112,97,116,104,114,13,0,0,0,114,176,0, + 0,0,114,9,0,0,0,114,9,0,0,0,114,10,0,0, + 0,218,13,111,112,101,110,95,114,101,115,111,117,114,99,101, + 224,2,0,0,115,14,0,0,0,0,1,14,1,14,1,12, + 1,2,1,18,1,14,1,122,38,95,90,105,112,73,109,112, + 111,114,116,82,101,115,111,117,114,99,101,82,101,97,100,101, + 114,46,111,112,101,110,95,114,101,115,111,117,114,99,101,99, + 2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, + 1,0,0,0,67,0,0,0,115,8,0,0,0,116,0,130, + 1,100,0,83,0,114,88,0,0,0,41,1,114,177,0,0, + 0,41,2,114,32,0,0,0,114,178,0,0,0,114,9,0, + 0,0,114,9,0,0,0,114,10,0,0,0,218,13,114,101, + 115,111,117,114,99,101,95,112,97,116,104,233,2,0,0,115, + 2,0,0,0,0,4,122,38,95,90,105,112,73,109,112,111, + 114,116,82,101,115,111,117,114,99,101,82,101,97,100,101,114, + 46,114,101,115,111,117,114,99,101,95,112,97,116,104,99,2, + 0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,8, + 0,0,0,67,0,0,0,115,72,0,0,0,124,0,106,0, + 160,1,100,1,100,2,161,2,125,2,124,2,155,0,100,2, + 124,1,155,0,157,3,125,3,122,16,124,0,106,2,160,3, + 124,3,161,1,1,0,87,0,110,22,4,0,116,4,107,10, + 114,66,1,0,1,0,1,0,89,0,100,3,83,0,48,0, + 100,4,83,0,41,5,78,114,85,0,0,0,114,109,0,0, + 0,70,84,41,5,114,38,0,0,0,114,19,0,0,0,114, + 4,0,0,0,114,55,0,0,0,114,22,0,0,0,41,4, + 114,32,0,0,0,114,59,0,0,0,114,179,0,0,0,114, + 13,0,0,0,114,9,0,0,0,114,9,0,0,0,114,10, + 0,0,0,218,11,105,115,95,114,101,115,111,117,114,99,101, + 239,2,0,0,115,14,0,0,0,0,3,14,1,14,1,2, + 1,16,1,14,1,8,1,122,36,95,90,105,112,73,109,112, + 111,114,116,82,101,115,111,117,114,99,101,82,101,97,100,101, + 114,46,105,115,95,114,101,115,111,117,114,99,101,99,1,0, + 0,0,0,0,0,0,0,0,0,0,9,0,0,0,9,0, + 0,0,99,0,0,0,115,186,0,0,0,100,1,100,2,108, + 0,109,1,125,1,1,0,124,1,124,0,106,2,160,3,124, + 0,106,4,161,1,131,1,125,2,124,2,160,5,124,0,106, + 2,106,6,161,1,125,3,124,3,106,7,100,3,107,2,115, + 58,74,0,130,1,124,3,106,8,125,4,116,9,131,0,125, + 5,124,0,106,2,106,10,68,0,93,102,125,6,122,18,124, + 1,124,6,131,1,160,5,124,4,161,1,125,7,87,0,110, + 24,4,0,116,11,107,10,114,124,1,0,1,0,1,0,89, + 0,113,78,89,0,110,2,48,0,124,7,106,8,106,7,125, + 8,116,12,124,8,131,1,100,1,107,2,114,156,124,7,106, + 7,86,0,1,0,113,78,124,8,124,5,107,7,114,78,124, + 5,160,13,124,8,161,1,1,0,124,8,86,0,1,0,113, + 78,100,0,83,0,41,4,78,114,0,0,0,0,41,1,218, + 4,80,97,116,104,114,60,0,0,0,41,14,90,7,112,97, + 116,104,108,105,98,114,183,0,0,0,114,4,0,0,0,114, + 56,0,0,0,114,38,0,0,0,90,11,114,101,108,97,116, + 105,118,101,95,116,111,114,29,0,0,0,114,59,0,0,0, + 90,6,112,97,114,101,110,116,218,3,115,101,116,114,28,0, + 0,0,114,23,0,0,0,114,51,0,0,0,218,3,97,100, + 100,41,9,114,32,0,0,0,114,183,0,0,0,90,13,102, + 117,108,108,110,97,109,101,95,112,97,116,104,90,13,114,101, + 108,97,116,105,118,101,95,112,97,116,104,90,12,112,97,99, + 107,97,103,101,95,112,97,116,104,90,12,115,117,98,100,105, + 114,115,95,115,101,101,110,218,8,102,105,108,101,110,97,109, + 101,90,8,114,101,108,97,116,105,118,101,90,11,112,97,114, + 101,110,116,95,110,97,109,101,114,9,0,0,0,114,9,0, + 0,0,114,10,0,0,0,218,8,99,111,110,116,101,110,116, + 115,250,2,0,0,115,34,0,0,0,0,8,12,1,18,1, + 14,3,14,1,6,1,6,1,12,1,2,1,18,1,14,1, + 10,5,8,1,12,1,10,1,8,1,10,1,122,33,95,90, + 105,112,73,109,112,111,114,116,82,101,115,111,117,114,99,101, + 82,101,97,100,101,114,46,99,111,110,116,101,110,116,115,78, + 41,10,114,6,0,0,0,114,7,0,0,0,114,8,0,0, + 0,114,84,0,0,0,114,81,0,0,0,114,34,0,0,0, + 114,180,0,0,0,114,181,0,0,0,114,182,0,0,0,114, + 187,0,0,0,114,9,0,0,0,114,9,0,0,0,114,9, + 0,0,0,114,10,0,0,0,114,80,0,0,0,212,2,0, + 0,115,14,0,0,0,8,1,4,5,4,2,8,4,8,9, + 8,6,8,11,114,80,0,0,0,41,45,114,84,0,0,0, + 90,26,95,102,114,111,122,101,110,95,105,109,112,111,114,116, + 108,105,98,95,101,120,116,101,114,110,97,108,114,21,0,0, + 0,114,1,0,0,0,114,2,0,0,0,90,17,95,102,114, + 111,122,101,110,95,105,109,112,111,114,116,108,105,98,114,76, + 0,0,0,114,148,0,0,0,114,110,0,0,0,114,152,0, + 0,0,114,67,0,0,0,114,131,0,0,0,90,7,95,95, + 97,108,108,95,95,114,20,0,0,0,90,15,112,97,116,104, + 95,115,101,112,97,114,97,116,111,114,115,114,18,0,0,0, + 114,75,0,0,0,114,3,0,0,0,114,25,0,0,0,218, + 4,116,121,112,101,114,70,0,0,0,114,113,0,0,0,114, + 115,0,0,0,114,117,0,0,0,114,4,0,0,0,114,89, + 0,0,0,114,36,0,0,0,114,37,0,0,0,114,35,0, + 0,0,114,27,0,0,0,114,122,0,0,0,114,142,0,0, + 0,114,144,0,0,0,114,52,0,0,0,114,147,0,0,0, + 114,155,0,0,0,218,8,95,95,99,111,100,101,95,95,114, + 153,0,0,0,114,159,0,0,0,114,161,0,0,0,114,169, + 0,0,0,114,151,0,0,0,114,149,0,0,0,114,44,0, + 0,0,114,80,0,0,0,114,9,0,0,0,114,9,0,0, + 0,114,9,0,0,0,114,10,0,0,0,218,8,60,109,111, + 100,117,108,101,62,1,0,0,0,115,88,0,0,0,4,16, + 8,1,16,1,8,1,8,1,8,1,8,1,8,1,8,2, + 8,3,6,1,14,3,16,4,4,2,8,2,4,1,4,1, + 4,2,14,127,0,127,0,1,12,1,12,1,2,1,2,252, + 4,9,8,4,8,9,8,31,8,126,2,254,2,29,4,5, + 8,21,8,46,8,10,8,46,10,5,8,7,8,6,8,13, + 8,19,8,15,8,26, }; From webhook-mailer at python.org Mon Dec 16 04:54:28 2019 From: webhook-mailer at python.org (Raymond Hettinger) Date: Mon, 16 Dec 2019 09:54:28 -0000 Subject: [Python-checkins] Add tests and design notes for Counter subset/superset operations. (GH-17625) Message-ID: https://github.com/python/cpython/commit/1ca8fb187eb320f87a74b82c2a20acb89f429841 commit: 1ca8fb187eb320f87a74b82c2a20acb89f429841 branch: master author: Raymond Hettinger committer: GitHub date: 2019-12-16T01:54:14-08:00 summary: Add tests and design notes for Counter subset/superset operations. (GH-17625) files: M Lib/test/test_collections.py diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index a2a66a7572204..92520b09bb8f2 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -2064,6 +2064,29 @@ def test_multiset_operations(self): set_result = setop(set(p.elements()), set(q.elements())) self.assertEqual(counter_result, dict.fromkeys(set_result, 1)) + def test_subset_superset_not_implemented(self): + # Verify that multiset comparison operations are not implemented. + + # These operations were intentionally omitted because multiset + # comparison semantics conflict with existing dict equality semantics. + + # For multisets, we would expect that if p<=q and p>=q are both true, + # then p==q. However, dict equality semantics require that p!=q when + # one of sets contains an element with a zero count and the other + # doesn't. + + p = Counter(a=1, b=0) + q = Counter(a=1, c=0) + self.assertNotEqual(p, q) + with self.assertRaises(TypeError): + p < q + with self.assertRaises(TypeError): + p <= q + with self.assertRaises(TypeError): + p > q + with self.assertRaises(TypeError): + p >= q + def test_inplace_operations(self): elements = 'abcd' for i in range(1000): From webhook-mailer at python.org Mon Dec 16 07:24:00 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 16 Dec 2019 12:24:00 -0000 Subject: [Python-checkins] bpo-38811: Check for presence of os.link method in pathlib (GH-17225) Message-ID: https://github.com/python/cpython/commit/092435e932dee1802784ec28f39454f50fdd879a commit: 092435e932dee1802784ec28f39454f50fdd879a branch: master author: Toke H?iland-J?rgensen committer: Victor Stinner date: 2019-12-16T13:23:55+01:00 summary: bpo-38811: Check for presence of os.link method in pathlib (GH-17225) Commit 6b5b013bcc22 ("bpo-26978: Implement pathlib.Path.link_to (Using os.link) (GH-12990)") introduced a new link_to method in pathlib. However, this makes pathlib crash when the 'os' module is missing a 'link' method. Fix this by checking for the presence of the 'link' method on pathlib module import, and if it's not present, turn it into a runtime error like those emitted when there is no lchmod() or symlink(). Signed-off-by: Toke H?iland-J?rgensen files: A Misc/NEWS.d/next/Library/2019-11-15-18-06-04.bpo-38811.AmdQ6M.rst M Lib/pathlib.py M Lib/test/test_pathlib.py diff --git a/Lib/pathlib.py b/Lib/pathlib.py index f0537cfea19ab..7d1d1150b0da8 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -418,7 +418,12 @@ def lchmod(self, pathobj, mode): unlink = os.unlink - link_to = os.link + if hasattr(os, "link"): + link_to = os.link + else: + @staticmethod + def link_to(self, target): + raise NotImplementedError("os.link() not available on this system") rmdir = os.rmdir diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index b8e7fcc2e3029..3232649f55477 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -1759,6 +1759,7 @@ def test_rmdir(self): self.assertFileNotFound(p.stat) self.assertFileNotFound(p.unlink) + @unittest.skipUnless(hasattr(os, "link"), "os.link() is not present") def test_link_to(self): P = self.cls(BASE) p = P / 'fileA' @@ -1778,6 +1779,15 @@ def test_link_to(self): self.assertEqual(os.stat(r).st_size, size) self.assertTrue(q.stat) + @unittest.skipIf(hasattr(os, "link"), "os.link() is present") + def test_link_to_not_implemented(self): + P = self.cls(BASE) + p = P / 'fileA' + # linking to another path. + q = P / 'dirA' / 'fileAA' + with self.assertRaises(NotImplementedError): + p.link_to(q) + def test_rename(self): P = self.cls(BASE) p = P / 'fileA' diff --git a/Misc/NEWS.d/next/Library/2019-11-15-18-06-04.bpo-38811.AmdQ6M.rst b/Misc/NEWS.d/next/Library/2019-11-15-18-06-04.bpo-38811.AmdQ6M.rst new file mode 100644 index 0000000000000..0e4a7f5bdf538 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-11-15-18-06-04.bpo-38811.AmdQ6M.rst @@ -0,0 +1 @@ +Fix an unhandled exception in :mod:`pathlib` when :meth:`os.link` is missing. Patch by Toke H?iland-J?rgensen. From webhook-mailer at python.org Mon Dec 16 07:27:04 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Mon, 16 Dec 2019 12:27:04 -0000 Subject: [Python-checkins] bpo-38870: Remove dead code related with argument unparsing (GH-17613) Message-ID: https://github.com/python/cpython/commit/a322f50c369e2e4138266c88e32ef83af95b2da6 commit: a322f50c369e2e4138266c88e32ef83af95b2da6 branch: master author: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> committer: Pablo Galindo date: 2019-12-16T12:26:58Z summary: bpo-38870: Remove dead code related with argument unparsing (GH-17613) files: M Lib/ast.py diff --git a/Lib/ast.py b/Lib/ast.py index 77eb24971ed24..13ae9e0a70eae 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -1199,11 +1199,8 @@ def visit_arguments(self, node): # keyword-only arguments if node.kwonlyargs: for a, d in zip(node.kwonlyargs, node.kw_defaults): - if first: - first = False - else: - self.write(", ") - self.traverse(a), + self.write(", ") + self.traverse(a) if d: self.write("=") self.traverse(d) From webhook-mailer at python.org Mon Dec 16 07:42:25 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 16 Dec 2019 12:42:25 -0000 Subject: [Python-checkins] bpo-38811: Check for presence of os.link method in pathlib (GH-17225) Message-ID: https://github.com/python/cpython/commit/8d0f36940e728989822c3789025b0813a8fe249a commit: 8d0f36940e728989822c3789025b0813a8fe249a branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-16T04:42:20-08:00 summary: bpo-38811: Check for presence of os.link method in pathlib (GH-17225) Commit 6b5b013bcc22 ("bpo-26978: Implement pathlib.Path.link_to (Using os.link) (GH-12990)") introduced a new link_to method in pathlib. However, this makes pathlib crash when the 'os' module is missing a 'link' method. Fix this by checking for the presence of the 'link' method on pathlib module import, and if it's not present, turn it into a runtime error like those emitted when there is no lchmod() or symlink(). Signed-off-by: Toke H?iland-J?rgensen (cherry picked from commit 092435e932dee1802784ec28f39454f50fdd879a) Co-authored-by: Toke H?iland-J?rgensen files: A Misc/NEWS.d/next/Library/2019-11-15-18-06-04.bpo-38811.AmdQ6M.rst M Lib/pathlib.py M Lib/test/test_pathlib.py diff --git a/Lib/pathlib.py b/Lib/pathlib.py index c42bde459b368..8ed3c883c6006 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -418,7 +418,12 @@ def lchmod(self, pathobj, mode): unlink = os.unlink - link_to = os.link + if hasattr(os, "link"): + link_to = os.link + else: + @staticmethod + def link_to(self, target): + raise NotImplementedError("os.link() not available on this system") rmdir = os.rmdir diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 4543e3773dbf8..b127343982ca9 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -1672,6 +1672,7 @@ def test_rmdir(self): self.assertFileNotFound(p.stat) self.assertFileNotFound(p.unlink) + @unittest.skipUnless(hasattr(os, "link"), "os.link() is not present") def test_link_to(self): P = self.cls(BASE) p = P / 'fileA' @@ -1691,6 +1692,15 @@ def test_link_to(self): self.assertEqual(os.stat(r).st_size, size) self.assertTrue(q.stat) + @unittest.skipIf(hasattr(os, "link"), "os.link() is present") + def test_link_to_not_implemented(self): + P = self.cls(BASE) + p = P / 'fileA' + # linking to another path. + q = P / 'dirA' / 'fileAA' + with self.assertRaises(NotImplementedError): + p.link_to(q) + def test_rename(self): P = self.cls(BASE) p = P / 'fileA' diff --git a/Misc/NEWS.d/next/Library/2019-11-15-18-06-04.bpo-38811.AmdQ6M.rst b/Misc/NEWS.d/next/Library/2019-11-15-18-06-04.bpo-38811.AmdQ6M.rst new file mode 100644 index 0000000000000..0e4a7f5bdf538 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-11-15-18-06-04.bpo-38811.AmdQ6M.rst @@ -0,0 +1 @@ +Fix an unhandled exception in :mod:`pathlib` when :meth:`os.link` is missing. Patch by Toke H?iland-J?rgensen. From webhook-mailer at python.org Mon Dec 16 13:23:37 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 16 Dec 2019 18:23:37 -0000 Subject: [Python-checkins] bpo-38348: Extend command line options of ast parsing tool (GH-16540) Message-ID: https://github.com/python/cpython/commit/814d687c7df3e0c60036943b68ece13f9f19dfef commit: 814d687c7df3e0c60036943b68ece13f9f19dfef branch: master author: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> committer: Victor Stinner date: 2019-12-16T19:23:27+01:00 summary: bpo-38348: Extend command line options of ast parsing tool (GH-16540) Add -i and --indent (indentation level), and --no-type-comments (type comments) command line options to ast parsing tool. files: A Misc/NEWS.d/next/Library/2019-10-02-18-15-28.bpo-38348._-5eq2.rst M Doc/library/ast.rst M Lib/ast.py diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index a7e0729b902d2..baf563f5d7877 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -381,10 +381,19 @@ The following options are accepted: Specify what kind of code must be compiled, like the *mode* argument in :func:`parse`. +.. cmdoption:: --no-type-comments + + Don't parse type comments. + .. cmdoption:: -a, --include-attributes Include attributes such as line numbers and column offsets. +.. cmdoption:: -i + --indent + + Indentation of nodes in AST (number of spaces). + If :file:`infile` is specified its contents are parsed to AST and dumped to stdout. Otherwise, the content is read from stdin. diff --git a/Lib/ast.py b/Lib/ast.py index 13ae9e0a70eae..ee3f74358ee12 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -1258,15 +1258,19 @@ def main(): parser.add_argument('-m', '--mode', default='exec', choices=('exec', 'single', 'eval', 'func_type'), help='specify what kind of code must be parsed') + parser.add_argument('--no-type-comments', default=True, action='store_false', + help="don't add information about type comments") parser.add_argument('-a', '--include-attributes', action='store_true', help='include attributes such as line numbers and ' 'column offsets') + parser.add_argument('-i', '--indent', type=int, default=3, + help='indentation of nodes (number of spaces)') args = parser.parse_args() with args.infile as infile: source = infile.read() - tree = parse(source, args.infile.name, args.mode, type_comments=True) - print(dump(tree, include_attributes=args.include_attributes, indent=3)) + tree = parse(source, args.infile.name, args.mode, type_comments=args.no_type_comments) + print(dump(tree, include_attributes=args.include_attributes, indent=args.indent)) if __name__ == '__main__': main() diff --git a/Misc/NEWS.d/next/Library/2019-10-02-18-15-28.bpo-38348._-5eq2.rst b/Misc/NEWS.d/next/Library/2019-10-02-18-15-28.bpo-38348._-5eq2.rst new file mode 100644 index 0000000000000..5ca72dea97702 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-10-02-18-15-28.bpo-38348._-5eq2.rst @@ -0,0 +1,2 @@ +Add ``-i`` and ``--indent`` (indentation level), and ``--no-type-comments`` +(type comments) command line options to ast parsing tool. From webhook-mailer at python.org Mon Dec 16 13:35:29 2019 From: webhook-mailer at python.org (Steve Dower) Date: Mon, 16 Dec 2019 18:35:29 -0000 Subject: [Python-checkins] bpo-39041: Add GitHub Actions support (GH-17594) Message-ID: https://github.com/python/cpython/commit/a76ba362c4d86adf5e7f8254398135d12d7afd25 commit: a76ba362c4d86adf5e7f8254398135d12d7afd25 branch: master author: Steve Dower committer: GitHub date: 2019-12-16T10:35:22-08:00 summary: bpo-39041: Add GitHub Actions support (GH-17594) files: A .github/workflows/build.yml A .github/workflows/coverage.yml A .github/workflows/doc.yml A .github/workflows/posix-deps-apt.sh M Doc/make.bat M Lib/test/test_py_compile.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000000..16d6f0db8c908 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,85 @@ +name: Tests + +on: + #push: + # branches: + # - master + # - 3.8 + # - 3.7 + # paths-ignore: + # - 'Doc/**' + # - 'Misc/**' + pull_request: + branches: + - master + - 3.8 + - 3.7 + paths-ignore: + - 'Doc/**' + - 'Misc/**' + +jobs: + build_win32: + name: 'Windows (x86)' + runs-on: windows-latest + steps: + - uses: actions/checkout at v1 + - name: Build CPython + run: .\PCbuild\build.bat -e -p Win32 + - name: Display build info + run: .\python.bat -m test.pythoninfo + - name: Tests + run: .\PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 + + build_win_amd64: + name: 'Windows (x64)' + runs-on: windows-latest + steps: + - uses: actions/checkout at v1 + - name: Build CPython + run: .\PCbuild\build.bat -e -p x64 + - name: Display build info + run: .\python.bat -m test.pythoninfo + - name: Tests + run: .\PCbuild\rt.bat -x64 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 + + build_macos: + name: 'macOS' + runs-on: macos-latest + steps: + - uses: actions/checkout at v1 + - name: Configure CPython + run: ./configure --with-pydebug --with-openssl=/usr/local/opt/openssl --prefix=/opt/python-dev + - name: Build CPython + run: make -s -j4 + - name: Display build info + run: make pythoninfo + - name: Tests + run: make buildbottest TESTOPTS="-j4 -uall,-cpu" + + build_ubuntu: + name: 'Ubuntu' + runs-on: ubuntu-latest + env: + OPENSSL_VER: 1.1.1d + steps: + - uses: actions/checkout at v1 + - name: Install Dependencies + run: sudo ./.github/workflows/posix-deps-apt.sh + - name: 'Restore OpenSSL build' + id: cache-openssl + uses: actions/cache at v1 + with: + path: ./multissl/openssl/${{ env.OPENSSL_VER }} + key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }} + - name: Install OpenSSL + if: steps.cache-openssl.outputs.cache-hit != 'true' + run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux + - name: Configure CPython + run: ./configure --with-pydebug --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER + - name: Build CPython + run: make -s -j4 + - name: Display build info + run: make pythoninfo + - name: Tests + run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu" diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000000000..cb05e8e2f71f0 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,89 @@ +name: Coverage + +on: + push: + branches: + - master + - 3.8 + - 3.7 + paths-ignore: + - 'Doc/**' + - 'Misc/**' + #pull_request: + # branches: + # - master + # - 3.8 + # - 3.7 + # paths-ignore: + # - 'Doc/**' + # - 'Misc/**' + +jobs: + coverage_ubuntu: + name: 'Ubuntu (Coverage)' + runs-on: ubuntu-latest + env: + OPENSSL_VER: 1.1.1d + steps: + - uses: actions/checkout at v1 + - name: Install Dependencies + run: sudo ./.github/workflows/posix-deps-apt.sh + - name: 'Restore OpenSSL build' + id: cache-openssl + uses: actions/cache at v1 + with: + path: ./multissl/openssl/${{ env.OPENSSL_VER }} + key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }} + - name: Install OpenSSL + if: steps.cache-openssl.outputs.cache-hit != 'true' + run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux + - name: Configure CPython + run: ./configure --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER + - name: Build CPython + run: make -s -j4 + - name: Display build info + run: make pythoninfo + - name: 'Coverage Preparation' + run: | + ./python -m venv .venv + source ./.venv/bin/activate + python -m pip install -U coverage + python -m test.pythoninfo + - name: 'Tests with coverage' + run: > + source ./.venv/bin/activate && + xvfb-run python -m coverage + run --branch --pylib + -m test + --fail-env-changed + -uall,-cpu + -x test_multiprocessing_fork + -x test_multiprocessing_forkserver + -x test_multiprocessing_spawn + -x test_concurrent_futures + || true + - name: 'Publish code coverage results' + run: | + ./.venv/bin/python -m coverage xml + bash <(curl -s https://codecov.io/bash) + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + c_coverage_ubuntu: + name: 'Ubuntu (C Coverage)' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout at v1 + - name: Install Dependencies + run: sudo ./.github/workflows/posix-deps-apt.sh + - name: Configure CPython + run: ./configure + - name: 'Build CPython and measure coverage' + run: xvfb-run make -j4 coverage-report + - name: 'Publish code coverage results' + if: always() + run: | + make pythoninfo + bash <(curl -s https://codecov.io/bash) + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml new file mode 100644 index 0000000000000..405b12e3d29c9 --- /dev/null +++ b/.github/workflows/doc.yml @@ -0,0 +1,40 @@ +name: Docs + +on: + #push: + # branches: + # - master + # - 3.8 + # - 3.7 + # paths: + # - 'Doc/**' + pull_request: + branches: + - master + - 3.8 + - 3.7 + paths: + - 'Doc/**' + - 'Misc/**' + +jobs: + build_doc: + name: 'Docs' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout at v1 + - uses: actions/setup-python at v1 + with: + python-version: '3.7' + architecture: 'x64' + - name: 'Install build dependencies' + run: python -m pip install sphinx==2.2.0 blurb python-docs-theme + - name: 'Build documentation' + run: | + cd Doc + make check suspicious html PYTHON=python + - name: Upload + uses: actions/upload-artifact at v1 + with: + name: doc-html + path: Doc/build/html diff --git a/.github/workflows/posix-deps-apt.sh b/.github/workflows/posix-deps-apt.sh new file mode 100755 index 0000000000000..2b879d32f8150 --- /dev/null +++ b/.github/workflows/posix-deps-apt.sh @@ -0,0 +1,21 @@ +#!/bin/sh +apt-get update + +apt-get -yq install \ + build-essential \ + zlib1g-dev \ + libbz2-dev \ + liblzma-dev \ + libncurses5-dev \ + libreadline6-dev \ + libsqlite3-dev \ + libssl-dev \ + libgdbm-dev \ + tk-dev \ + lzma \ + lzma-dev \ + liblzma-dev \ + libffi-dev \ + uuid-dev \ + xvfb \ + lcov diff --git a/Doc/make.bat b/Doc/make.bat index dfc622f66615d..6f8f172e95eb8 100644 --- a/Doc/make.bat +++ b/Doc/make.bat @@ -54,9 +54,9 @@ if not exist "%HTMLHELP%" ( ) :skiphhcsearch -if "%DISTVERSION%" EQU "" for /f "usebackq" %%v in (`%PYTHON% tools/extensions/patchlevel.py`) do set DISTVERSION=%%v +if not defined DISTVERSION for /f "usebackq" %%v in (`%PYTHON% tools/extensions/patchlevel.py`) do set DISTVERSION=%%v -if "%BUILDDIR%" EQU "" set BUILDDIR=build +if not defined BUILDDIR set BUILDDIR=build rem Targets that don't require sphinx-build if "%1" EQU "" goto help @@ -131,7 +131,7 @@ if exist ..\Misc\NEWS ( ) ) -if NOT "%PAPER%" == "" ( +if defined PAPER ( set SPHINXOPTS=-D latex_elements.papersize=%PAPER% %SPHINXOPTS% ) if "%1" EQU "htmlhelp" ( diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py index d6677ab45ff50..d4a68c9320d04 100644 --- a/Lib/test/test_py_compile.py +++ b/Lib/test/test_py_compile.py @@ -51,7 +51,7 @@ def __new__(mcls, name, bases, dct, *, source_date_epoch): class PyCompileTestsBase: def setUp(self): - self.directory = tempfile.mkdtemp() + self.directory = tempfile.mkdtemp(dir=os.getcwd()) self.source_path = os.path.join(self.directory, '_test.py') self.pyc_path = self.source_path + 'c' self.cache_path = importlib.util.cache_from_source(self.source_path) From webhook-mailer at python.org Mon Dec 16 14:15:15 2019 From: webhook-mailer at python.org (Steve Dower) Date: Mon, 16 Dec 2019 19:15:15 -0000 Subject: [Python-checkins] bpo-39041: Add GitHub Actions badge to README.rst (GH-17628) Message-ID: https://github.com/python/cpython/commit/6a263cf1adfc18cdba65c788dd76d35997a89acf commit: 6a263cf1adfc18cdba65c788dd76d35997a89acf branch: master author: Steve Dower committer: GitHub date: 2019-12-16T11:15:08-08:00 summary: bpo-39041: Add GitHub Actions badge to README.rst (GH-17628) Also skip build for doc-only changes and enable on push files: M .github/workflows/build.yml M README.rst diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16d6f0db8c908..7f13cfbc1ff4e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,14 +1,16 @@ name: Tests on: - #push: - # branches: - # - master - # - 3.8 - # - 3.7 - # paths-ignore: - # - 'Doc/**' - # - 'Misc/**' + push: + branches: + - master + - 3.8 + - 3.7 + paths-ignore: + - 'Doc/**' + - 'Misc/**' + - '**/*.md' + - '**/*.rst' pull_request: branches: - master @@ -17,6 +19,8 @@ on: paths-ignore: - 'Doc/**' - 'Misc/**' + - '**/*.md' + - '**/*.rst' jobs: build_win32: diff --git a/README.rst b/README.rst index 62dd0fd4e9450..43f619792925c 100644 --- a/README.rst +++ b/README.rst @@ -5,6 +5,10 @@ This is Python version 3.9.0 alpha 1 :alt: CPython build status on Travis CI :target: https://travis-ci.org/python/cpython +.. image:: https://github.com/python/cpython/workflows/Tests/badge.svg + :alt: CPython build status on GitHub Actions + :target: https://github.com/python/cpython/actions + .. image:: https://dev.azure.com/python/cpython/_apis/build/status/Azure%20Pipelines%20CI?branchName=master :alt: CPython build status on Azure DevOps :target: https://dev.azure.com/python/cpython/_build/latest?definitionId=4&branchName=master From webhook-mailer at python.org Mon Dec 16 16:50:40 2019 From: webhook-mailer at python.org (Yury Selivanov) Date: Mon, 16 Dec 2019 21:50:40 -0000 Subject: [Python-checkins] Add whatsnew for removal of asyncio.loop.create_datagram_endpoint()'s *reuse_address* parameter (#17595) Message-ID: https://github.com/python/cpython/commit/f501db2b93a9d3d840b6fb38d6bdda8bcc400d4a commit: f501db2b93a9d3d840b6fb38d6bdda8bcc400d4a branch: master author: Kyle Stanley committer: Yury Selivanov date: 2019-12-16T16:50:34-05:00 summary: Add whatsnew for removal of asyncio.loop.create_datagram_endpoint()'s *reuse_address* parameter (#17595) files: M Doc/whatsnew/3.6.rst M Doc/whatsnew/3.7.rst M Doc/whatsnew/3.8.rst M Doc/whatsnew/3.9.rst diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst index 3f5f5200f122f..04c1f7e71db32 100644 --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -2433,3 +2433,13 @@ In 3.6.7 the :mod:`tokenize` module now implicitly emits a ``NEWLINE`` token when provided with input that does not have a trailing new line. This behavior now matches what the C tokenizer does internally. (Contributed by Ammar Askar in :issue:`33899`.) + +Notable changes in Python 3.6.10 +================================ + +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is +because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For more +details, see the documentation for ``loop.create_datagram_endpoint()``. +(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in +:issue:`37228`.) diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index 2197bd9739299..8a70fe22d52bd 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -2541,3 +2541,13 @@ This resolves a long standing issue where all virtual environments would have to be upgraded or recreated with each Python update. However, note that this release will still require recreation of virtual environments in order to get the new scripts. + +Notable changes in Python 3.7.6 +=============================== + +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is +because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For more +details, see the documentation for ``loop.create_datagram_endpoint()``. +(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in +:issue:`37228`.) diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst index c71c1ab6fd181..0927a965dd3de 100644 --- a/Doc/whatsnew/3.8.rst +++ b/Doc/whatsnew/3.8.rst @@ -2204,3 +2204,13 @@ Here's a summary of performance improvements since Python 3.3: loop_overhead 0.3 0.5 0.6 0.4 0.3 0.3 (Measured from the macOS 64-bit builds found at python.org) + +Notable changes in Python 3.8.1 +=============================== + +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is +because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For more +details, see the documentation for ``loop.create_datagram_endpoint()``. +(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in +:issue:`37228`.) diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index 7cf49bfbb93f9..64361bb17f8a4 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -129,6 +129,13 @@ that would produce an equivalent :class:`ast.AST` object when parsed. asyncio ------- +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is +because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For more +details, see the documentation for ``loop.create_datagram_endpoint()``. +(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in +:issue:`37228`.) + Added a new :term:`coroutine` :meth:`~asyncio.loop.shutdown_default_executor` that schedules a shutdown for the default executor that waits on the :class:`~concurrent.futures.ThreadPoolExecutor` to finish closing. Also, From webhook-mailer at python.org Mon Dec 16 18:19:44 2019 From: webhook-mailer at python.org (Ned Deily) Date: Mon, 16 Dec 2019 23:19:44 -0000 Subject: [Python-checkins] [3.6] Add whatsnew for removal of asyncio.loop.create_datagram_endpoint()'s *reuse_address* parameter (GH-17595). (GH-17632) Message-ID: https://github.com/python/cpython/commit/50fc84af385b713ef8566dd040227926acf39172 commit: 50fc84af385b713ef8566dd040227926acf39172 branch: 3.6 author: Kyle Stanley committer: Ned Deily date: 2019-12-16T18:19:36-05:00 summary: [3.6] Add whatsnew for removal of asyncio.loop.create_datagram_endpoint()'s *reuse_address* parameter (GH-17595). (GH-17632) (cherry picked from commit f501db2b93a9d3d840b6fb38d6bdda8bcc400d4a) Co-authored-by: Kyle Stanley files: M Doc/whatsnew/3.6.rst diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst index bd5c6340130ec..90250e46b687f 100644 --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -2449,3 +2449,13 @@ In 3.6.7 the :mod:`tokenize` module now implicitly emits a ``NEWLINE`` token when provided with input that does not have a trailing new line. This behavior now matches what the C tokenizer does internally. (Contributed by Ammar Askar in :issue:`33899`.) + +Notable changes in Python 3.6.10 +================================ + +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is +because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For more +details, see the documentation for ``loop.create_datagram_endpoint()``. +(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in +:issue:`37228`.) From webhook-mailer at python.org Mon Dec 16 18:20:48 2019 From: webhook-mailer at python.org (Ned Deily) Date: Mon, 16 Dec 2019 23:20:48 -0000 Subject: [Python-checkins] bpo-39035: travis: Update image to xenial (GH-17622) Message-ID: https://github.com/python/cpython/commit/7699281b72b862797a89fcad004da8f58e93c800 commit: 7699281b72b862797a89fcad004da8f58e93c800 branch: 3.6 author: Inada Naoki committer: Ned Deily date: 2019-12-16T18:20:44-05:00 summary: bpo-39035: travis: Update image to xenial (GH-17622) files: M .travis.yml diff --git a/.travis.yml b/.travis.yml index 8250fd91b3d9a..0c4c28e8295bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,5 @@ language: c -dist: trusty -sudo: false -group: beta +dist: xenial # To cache doc-building dependencies and C compiler output. cache: From webhook-mailer at python.org Mon Dec 16 19:40:04 2019 From: webhook-mailer at python.org (Benjamin Peterson) Date: Tue, 17 Dec 2019 00:40:04 -0000 Subject: [Python-checkins] bpo-38730: Replace strncpy in import.c with memcpy. (GH-17633) Message-ID: https://github.com/python/cpython/commit/052f47ef5cc363e842e0e839980cfa55ada123b5 commit: 052f47ef5cc363e842e0e839980cfa55ada123b5 branch: 2.7 author: Benjamin Peterson committer: GitHub date: 2019-12-16T16:39:57-08:00 summary: bpo-38730: Replace strncpy in import.c with memcpy. (GH-17633) In all these cases, we know the exact length we want copied, so memcpy is the right function to use. files: M Python/import.c diff --git a/Python/import.c b/Python/import.c index ccbd949e624f1..b79354b37a406 100644 --- a/Python/import.c +++ b/Python/import.c @@ -2456,7 +2456,7 @@ get_parent(PyObject *globals, char *buf, Py_ssize_t *p_buflen, int level) "Module name too long"); return NULL; } - strncpy(buf, start, len); + memcpy(buf, start, len); buf[len] = '\0'; pkgname = PyString_FromString(buf); if (pkgname == NULL) { @@ -2554,7 +2554,7 @@ load_next(PyObject *mod, PyObject *altmod, char **p_name, char *buf, "Module name too long"); return NULL; } - strncpy(p, name, len); + memcpy(p, name, len); p[len] = '\0'; *p_buflen = p+len-buf; @@ -2568,7 +2568,7 @@ load_next(PyObject *mod, PyObject *altmod, char **p_name, char *buf, Py_DECREF(result); return NULL; } - strncpy(buf, name, len); + memcpy(buf, name, len); buf[len] = '\0'; *p_buflen = len; } From webhook-mailer at python.org Mon Dec 16 23:01:27 2019 From: webhook-mailer at python.org (Ned Deily) Date: Tue, 17 Dec 2019 04:01:27 -0000 Subject: [Python-checkins] [3.8] Add whatsnew for removal of asyncio.loop.create_datagram_endpoint()'s *reuse_address* parameter (GH-17595). (#17630) Message-ID: https://github.com/python/cpython/commit/a96e938fc3e266a56d8cebc53687eb2fd56e7589 commit: a96e938fc3e266a56d8cebc53687eb2fd56e7589 branch: 3.8 author: Kyle Stanley committer: Ned Deily date: 2019-12-16T23:01:19-05:00 summary: [3.8] Add whatsnew for removal of asyncio.loop.create_datagram_endpoint()'s *reuse_address* parameter (GH-17595). (#17630) (cherry picked from commit f501db2b93a9d3d840b6fb38d6bdda8bcc400d4a) Co-authored-by: Kyle Stanley files: M Doc/whatsnew/3.6.rst M Doc/whatsnew/3.7.rst M Doc/whatsnew/3.8.rst diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst index 3f5f5200f122f..04c1f7e71db32 100644 --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -2433,3 +2433,13 @@ In 3.6.7 the :mod:`tokenize` module now implicitly emits a ``NEWLINE`` token when provided with input that does not have a trailing new line. This behavior now matches what the C tokenizer does internally. (Contributed by Ammar Askar in :issue:`33899`.) + +Notable changes in Python 3.6.10 +================================ + +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is +because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For more +details, see the documentation for ``loop.create_datagram_endpoint()``. +(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in +:issue:`37228`.) diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index 2197bd9739299..8a70fe22d52bd 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -2541,3 +2541,13 @@ This resolves a long standing issue where all virtual environments would have to be upgraded or recreated with each Python update. However, note that this release will still require recreation of virtual environments in order to get the new scripts. + +Notable changes in Python 3.7.6 +=============================== + +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is +because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For more +details, see the documentation for ``loop.create_datagram_endpoint()``. +(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in +:issue:`37228`.) diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst index d975fb7815474..546fa2d5f016e 100644 --- a/Doc/whatsnew/3.8.rst +++ b/Doc/whatsnew/3.8.rst @@ -2206,3 +2206,13 @@ Here's a summary of performance improvements since Python 3.3: loop_overhead 0.3 0.5 0.6 0.4 0.3 0.3 (Measured from the macOS 64-bit builds found at python.org) + +Notable changes in Python 3.8.1 +=============================== + +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is +because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For more +details, see the documentation for ``loop.create_datagram_endpoint()``. +(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in +:issue:`37228`.) From webhook-mailer at python.org Mon Dec 16 23:08:57 2019 From: webhook-mailer at python.org (Ned Deily) Date: Tue, 17 Dec 2019 04:08:57 -0000 Subject: [Python-checkins] [3.7] Add whatsnew for removal of asyncio.loop.create_datagram_endpoint()'s *reuse_address* parameter (GH-17595). (GH-17631) Message-ID: https://github.com/python/cpython/commit/8a06c9eac450117d22d7b8ee966157ad2a0626d1 commit: 8a06c9eac450117d22d7b8ee966157ad2a0626d1 branch: 3.7 author: Kyle Stanley committer: Ned Deily date: 2019-12-16T23:08:49-05:00 summary: [3.7] Add whatsnew for removal of asyncio.loop.create_datagram_endpoint()'s *reuse_address* parameter (GH-17595). (GH-17631) (cherry picked from commit f501db2b93a9d3d840b6fb38d6bdda8bcc400d4a) Co-authored-by: Kyle Stanley files: M Doc/whatsnew/3.6.rst M Doc/whatsnew/3.7.rst diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst index 3f5f5200f122f..04c1f7e71db32 100644 --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -2433,3 +2433,13 @@ In 3.6.7 the :mod:`tokenize` module now implicitly emits a ``NEWLINE`` token when provided with input that does not have a trailing new line. This behavior now matches what the C tokenizer does internally. (Contributed by Ammar Askar in :issue:`33899`.) + +Notable changes in Python 3.6.10 +================================ + +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is +because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For more +details, see the documentation for ``loop.create_datagram_endpoint()``. +(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in +:issue:`37228`.) diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index 12e1d9be2a1cf..c7e3230db29e6 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -2557,3 +2557,13 @@ This resolves a long standing issue where all virtual environments would have to be upgraded or recreated with each Python update. However, note that this release will still require recreation of virtual environments in order to get the new scripts. + +Notable changes in Python 3.7.6 +=============================== + +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is +because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For more +details, see the documentation for ``loop.create_datagram_endpoint()``. +(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in +:issue:`37228`.) From webhook-mailer at python.org Mon Dec 16 23:11:16 2019 From: webhook-mailer at python.org (Ned Deily) Date: Tue, 17 Dec 2019 04:11:16 -0000 Subject: [Python-checkins] Fix warnings in test_asyncio.test_base_events (GH-17577) (GH-17579) Message-ID: https://github.com/python/cpython/commit/d21ad67d5ec7a08e760231c967f4d8b0c148d18f commit: d21ad67d5ec7a08e760231c967f4d8b0c148d18f branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Ned Deily date: 2019-12-16T23:11:11-05:00 summary: Fix warnings in test_asyncio.test_base_events (GH-17577) (GH-17579) Co-authored-by: tirkarthi (cherry picked from commit 1988344a6bff253f017e053f69318ecf03587294) Co-authored-by: Kyle Stanley files: M Lib/test/test_asyncio/test_base_events.py diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py index 3a23059911211..0f9e3d04d78eb 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -1808,7 +1808,10 @@ def test_create_datagram_endpoint_reuse_address_warning(self): reuse_address=False) with self.assertWarns(DeprecationWarning): - self.loop.run_until_complete(coro) + transport, protocol = self.loop.run_until_complete(coro) + transport.close() + self.loop.run_until_complete(protocol.done) + self.assertEqual('CLOSED', protocol.state) @patch_socket def test_create_datagram_endpoint_nosoreuseport(self, m_socket): @@ -1818,7 +1821,6 @@ def test_create_datagram_endpoint_nosoreuseport(self, m_socket): coro = self.loop.create_datagram_endpoint( lambda: MyDatagramProto(loop=self.loop), local_addr=('127.0.0.1', 0), - reuse_address=False, reuse_port=True) self.assertRaises(ValueError, self.loop.run_until_complete, coro) @@ -1837,7 +1839,6 @@ def getaddrinfo(*args, **kw): coro = self.loop.create_datagram_endpoint( lambda: MyDatagramProto(loop=self.loop), local_addr=('1.2.3.4', 0), - reuse_address=False, reuse_port=reuseport_supported) t, p = self.loop.run_until_complete(coro) From webhook-mailer at python.org Mon Dec 16 23:12:35 2019 From: webhook-mailer at python.org (Ned Deily) Date: Tue, 17 Dec 2019 04:12:35 -0000 Subject: [Python-checkins] Fix warnings in test_asyncio.test_base_events (GH-17577) (GH-17580) Message-ID: https://github.com/python/cpython/commit/c70c8ca746b776fa9a2d6d3e1dda278c8f560200 commit: c70c8ca746b776fa9a2d6d3e1dda278c8f560200 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Ned Deily date: 2019-12-16T23:12:28-05:00 summary: Fix warnings in test_asyncio.test_base_events (GH-17577) (GH-17580) Co-authored-by: tirkarthi (cherry picked from commit 1988344a6bff253f017e053f69318ecf03587294) Co-authored-by: Kyle Stanley files: M Lib/test/test_asyncio/test_base_events.py diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py index 2a4723a3330a6..5025d260d4313 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -1784,7 +1784,10 @@ def test_create_datagram_endpoint_reuse_address_warning(self): reuse_address=False) with self.assertWarns(DeprecationWarning): - self.loop.run_until_complete(coro) + transport, protocol = self.loop.run_until_complete(coro) + transport.close() + self.loop.run_until_complete(protocol.done) + self.assertEqual('CLOSED', protocol.state) @patch_socket def test_create_datagram_endpoint_nosoreuseport(self, m_socket): @@ -1794,7 +1797,6 @@ def test_create_datagram_endpoint_nosoreuseport(self, m_socket): coro = self.loop.create_datagram_endpoint( lambda: MyDatagramProto(loop=self.loop), local_addr=('127.0.0.1', 0), - reuse_address=False, reuse_port=True) self.assertRaises(ValueError, self.loop.run_until_complete, coro) @@ -1813,7 +1815,6 @@ def getaddrinfo(*args, **kw): coro = self.loop.create_datagram_endpoint( lambda: MyDatagramProto(loop=self.loop), local_addr=('1.2.3.4', 0), - reuse_address=False, reuse_port=reuseport_supported) t, p = self.loop.run_until_complete(coro) From webhook-mailer at python.org Tue Dec 17 04:05:50 2019 From: webhook-mailer at python.org (Ned Deily) Date: Tue, 17 Dec 2019 09:05:50 -0000 Subject: [Python-checkins] bpo-38295: prevent test_relative_path of test_py_compile failure on macOS Catalina (GH-17636) Message-ID: https://github.com/python/cpython/commit/bf3aa1060a29a05813abbe877193af16e3e7131e commit: bf3aa1060a29a05813abbe877193af16e3e7131e branch: 3.8 author: Ned Deily committer: GitHub date: 2019-12-17T04:05:41-05:00 summary: bpo-38295: prevent test_relative_path of test_py_compile failure on macOS Catalina (GH-17636) files: A Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst M Lib/test/test_py_compile.py diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py index d6677ab45ff50..d4a68c9320d04 100644 --- a/Lib/test/test_py_compile.py +++ b/Lib/test/test_py_compile.py @@ -51,7 +51,7 @@ def __new__(mcls, name, bases, dct, *, source_date_epoch): class PyCompileTestsBase: def setUp(self): - self.directory = tempfile.mkdtemp() + self.directory = tempfile.mkdtemp(dir=os.getcwd()) self.source_path = os.path.join(self.directory, '_test.py') self.pyc_path = self.source_path + 'c' self.cache_path = importlib.util.cache_from_source(self.source_path) diff --git a/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst b/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst new file mode 100644 index 0000000000000..cc9ceb4cc50b3 --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst @@ -0,0 +1 @@ +Prevent failure of test_relative_path in test_py_compile on macOS Catalina. From webhook-mailer at python.org Tue Dec 17 04:16:49 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 17 Dec 2019 09:16:49 -0000 Subject: [Python-checkins] bpo-38295: prevent test_relative_path of test_py_compile failure on macOS Catalina (GH-17636) Message-ID: https://github.com/python/cpython/commit/5f2c1345a79f205c680ed6e0a6ed44199546d79e commit: 5f2c1345a79f205c680ed6e0a6ed44199546d79e branch: 2.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-17T01:16:33-08:00 summary: bpo-38295: prevent test_relative_path of test_py_compile failure on macOS Catalina (GH-17636) (cherry picked from commit bf3aa1060a29a05813abbe877193af16e3e7131e) Co-authored-by: Ned Deily files: A Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst M Lib/test/test_py_compile.py diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py index 5ec523abe2588..95863088b48cb 100644 --- a/Lib/test/test_py_compile.py +++ b/Lib/test/test_py_compile.py @@ -10,7 +10,7 @@ class PyCompileTests(unittest.TestCase): def setUp(self): - self.directory = tempfile.mkdtemp() + self.directory = tempfile.mkdtemp(dir=os.getcwd()) self.source_path = os.path.join(self.directory, '_test.py') self.pyc_path = self.source_path + 'c' self.cwd_drive = os.path.splitdrive(os.getcwd())[0] diff --git a/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst b/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst new file mode 100644 index 0000000000000..cc9ceb4cc50b3 --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst @@ -0,0 +1 @@ +Prevent failure of test_relative_path in test_py_compile on macOS Catalina. From webhook-mailer at python.org Tue Dec 17 04:24:03 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 17 Dec 2019 09:24:03 -0000 Subject: [Python-checkins] bpo-38295: prevent test_relative_path of test_py_compile failure on macOS Catalina (GH-17636) Message-ID: https://github.com/python/cpython/commit/3dbfe0ac93ce031a23342a62edd39506bcdaea0e commit: 3dbfe0ac93ce031a23342a62edd39506bcdaea0e branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-17T01:23:55-08:00 summary: bpo-38295: prevent test_relative_path of test_py_compile failure on macOS Catalina (GH-17636) (cherry picked from commit bf3aa1060a29a05813abbe877193af16e3e7131e) Co-authored-by: Ned Deily files: A Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst M Lib/test/test_py_compile.py diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py index f86abe26f97ae..df45764f04773 100644 --- a/Lib/test/test_py_compile.py +++ b/Lib/test/test_py_compile.py @@ -51,7 +51,7 @@ def __new__(mcls, name, bases, dct, *, source_date_epoch): class PyCompileTestsBase: def setUp(self): - self.directory = tempfile.mkdtemp() + self.directory = tempfile.mkdtemp(dir=os.getcwd()) self.source_path = os.path.join(self.directory, '_test.py') self.pyc_path = self.source_path + 'c' self.cache_path = importlib.util.cache_from_source(self.source_path) diff --git a/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst b/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst new file mode 100644 index 0000000000000..cc9ceb4cc50b3 --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst @@ -0,0 +1 @@ +Prevent failure of test_relative_path in test_py_compile on macOS Catalina. From webhook-mailer at python.org Tue Dec 17 04:26:16 2019 From: webhook-mailer at python.org (Ned Deily) Date: Tue, 17 Dec 2019 09:26:16 -0000 Subject: [Python-checkins] bpo-38295: prevent test_relative_path of test_py_compile failure on macOS Catalina (GH-17636) (GH-17638) Message-ID: https://github.com/python/cpython/commit/5a9b69732ec19b04de459af890bcc26b83d979c5 commit: 5a9b69732ec19b04de459af890bcc26b83d979c5 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Ned Deily date: 2019-12-17T04:26:11-05:00 summary: bpo-38295: prevent test_relative_path of test_py_compile failure on macOS Catalina (GH-17636) (GH-17638) (cherry picked from commit bf3aa1060a29a05813abbe877193af16e3e7131e) Co-authored-by: Ned Deily files: A Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst M Lib/test/test_py_compile.py diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py index 4a6caa571875d..5e35b8d8051f7 100644 --- a/Lib/test/test_py_compile.py +++ b/Lib/test/test_py_compile.py @@ -13,7 +13,7 @@ class PyCompileTests(unittest.TestCase): def setUp(self): - self.directory = tempfile.mkdtemp() + self.directory = tempfile.mkdtemp(dir=os.getcwd()) self.source_path = os.path.join(self.directory, '_test.py') self.pyc_path = self.source_path + 'c' self.cache_path = importlib.util.cache_from_source(self.source_path) diff --git a/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst b/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst new file mode 100644 index 0000000000000..cc9ceb4cc50b3 --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst @@ -0,0 +1 @@ +Prevent failure of test_relative_path in test_py_compile on macOS Catalina. From webhook-mailer at python.org Tue Dec 17 07:02:28 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 17 Dec 2019 12:02:28 -0000 Subject: [Python-checkins] bpo-38858: Small integer per interpreter (GH-17315) Message-ID: https://github.com/python/cpython/commit/630c8df5cf126594f8c1c4579c1888ca80a29d59 commit: 630c8df5cf126594f8c1c4579c1888ca80a29d59 branch: master author: Victor Stinner committer: GitHub date: 2019-12-17T13:02:18+01:00 summary: bpo-38858: Small integer per interpreter (GH-17315) Each Python subinterpreter now has its own "small integer singletons": numbers in [-5; 257] range. It is no longer possible to change the number of small integers at build time by overriding NSMALLNEGINTS and NSMALLPOSINTS macros: macros should now be modified manually in pycore_pystate.h header file. For now, continue to share _PyLong_Zero and _PyLong_One singletons between all subinterpreters. files: A Misc/NEWS.d/next/Core and Builtins/2019-11-21-09-02-49.bpo-38858.bDLH04.rst M Include/internal/pycore_pylifecycle.h M Include/internal/pycore_pystate.h M Objects/longobject.c M Python/pylifecycle.c diff --git a/Include/internal/pycore_pylifecycle.h b/Include/internal/pycore_pylifecycle.h index 4e4bbc2bed098..72923498decd0 100644 --- a/Include/internal/pycore_pylifecycle.h +++ b/Include/internal/pycore_pylifecycle.h @@ -33,7 +33,7 @@ PyAPI_FUNC(int) _Py_IsLocaleCoercionTarget(const char *ctype_loc); extern PyStatus _PyUnicode_Init(void); extern int _PyStructSequence_Init(void); -extern int _PyLong_Init(void); +extern int _PyLong_Init(PyThreadState *tstate); extern PyStatus _PyFaulthandler_Init(int enable); extern int _PyTraceMalloc_Init(int enable); extern PyObject * _PyBuiltin_Init(PyThreadState *tstate); @@ -76,7 +76,7 @@ extern void _PyGC_Fini(PyThreadState *tstate); extern void _PyType_Fini(void); extern void _Py_HashRandomization_Fini(void); extern void _PyUnicode_Fini(PyThreadState *tstate); -extern void _PyLong_Fini(void); +extern void _PyLong_Fini(PyThreadState *tstate); extern void _PyFaulthandler_Fini(void); extern void _PyHash_Fini(void); extern void _PyTraceMalloc_Fini(void); diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h index aa2103f07c795..b78ed69042527 100644 --- a/Include/internal/pycore_pystate.h +++ b/Include/internal/pycore_pystate.h @@ -56,6 +56,9 @@ struct _ceval_runtime_state { typedef PyObject* (*_PyFrameEvalFunction)(struct _frame *, int); +#define _PY_NSMALLPOSINTS 257 +#define _PY_NSMALLNEGINTS 5 + // The PyInterpreterState typedef is in Include/pystate.h. struct _is { @@ -139,6 +142,15 @@ struct _is { int atbol; } listnode; } parser; + +#if _PY_NSMALLNEGINTS + _PY_NSMALLPOSINTS > 0 + /* Small integers are preallocated in this array so that they + can be shared. + The integers that are preallocated are those in the range + -_PY_NSMALLNEGINTS (inclusive) to _PY_NSMALLPOSINTS (not inclusive). + */ + PyLongObject* small_ints[_PY_NSMALLNEGINTS + _PY_NSMALLPOSINTS]; +#endif }; PyAPI_FUNC(struct _is*) _PyInterpreterState_LookUpID(PY_INT64_T); diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-21-09-02-49.bpo-38858.bDLH04.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-21-09-02-49.bpo-38858.bDLH04.rst new file mode 100644 index 0000000000000..e489c947f97c5 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-11-21-09-02-49.bpo-38858.bDLH04.rst @@ -0,0 +1,5 @@ +Each Python subinterpreter now has its own "small integer singletons": +numbers in [-5; 257] range. It is no longer possible to change the number of +small integers at build time by overriding ``NSMALLNEGINTS`` and +``NSMALLPOSINTS`` macros: macros should now be modified manually in +``pycore_pystate.h`` header file. diff --git a/Objects/longobject.c b/Objects/longobject.c index bc87fb2bd65c3..be9301f85162c 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -3,6 +3,7 @@ /* XXX The functional organization of this file is terrible */ #include "Python.h" +#include "pycore_pystate.h" /* _Py_IsMainInterpreter() */ #include "longintrepr.h" #include @@ -15,12 +16,8 @@ class int "PyObject *" "&PyLong_Type" [clinic start generated code]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=ec0275e3422a36e3]*/ -#ifndef NSMALLPOSINTS -#define NSMALLPOSINTS 257 -#endif -#ifndef NSMALLNEGINTS -#define NSMALLNEGINTS 5 -#endif +#define NSMALLPOSINTS _PY_NSMALLPOSINTS +#define NSMALLNEGINTS _PY_NSMALLNEGINTS _Py_IDENTIFIER(little); _Py_IDENTIFIER(big); @@ -35,13 +32,6 @@ PyObject *_PyLong_Zero = NULL; PyObject *_PyLong_One = NULL; #if NSMALLNEGINTS + NSMALLPOSINTS > 0 -/* Small integers are preallocated in this array so that they - can be shared. - The integers that are preallocated are those in the range - -NSMALLNEGINTS (inclusive) to NSMALLPOSINTS (not inclusive). -*/ -static PyLongObject* small_ints[NSMALLNEGINTS + NSMALLPOSINTS] = {0}; - #define IS_SMALL_INT(ival) (-NSMALLNEGINTS <= (ival) && (ival) < NSMALLPOSINTS) #define IS_SMALL_UINT(ival) ((ival) < NSMALLPOSINTS) @@ -53,7 +43,8 @@ static PyObject * get_small_int(sdigit ival) { assert(IS_SMALL_INT(ival)); - PyObject *v = (PyObject*)small_ints[ival + NSMALLNEGINTS]; + PyThreadState *tstate = _PyThreadState_GET(); + PyObject *v = (PyObject*)tstate->interp->small_ints[ival + NSMALLNEGINTS]; Py_INCREF(v); #ifdef COUNT_ALLOCS if (ival >= 0) @@ -5782,7 +5773,7 @@ PyLong_GetInfo(void) } int -_PyLong_Init(void) +_PyLong_Init(PyThreadState *tstate) { #if NSMALLNEGINTS + NSMALLPOSINTS > 0 for (Py_ssize_t i=0; i < NSMALLNEGINTS + NSMALLPOSINTS; i++) { @@ -5797,37 +5788,43 @@ _PyLong_Init(void) Py_SIZE(v) = size; v->ob_digit[0] = (digit)abs(ival); - small_ints[i] = v; + tstate->interp->small_ints[i] = v; } #endif - _PyLong_Zero = PyLong_FromLong(0); - if (_PyLong_Zero == NULL) { - return 0; - } - _PyLong_One = PyLong_FromLong(1); - if (_PyLong_One == NULL) { - return 0; - } + if (_Py_IsMainInterpreter(tstate)) { + _PyLong_Zero = PyLong_FromLong(0); + if (_PyLong_Zero == NULL) { + return 0; + } - /* initialize int_info */ - if (Int_InfoType.tp_name == NULL) { - if (PyStructSequence_InitType2(&Int_InfoType, &int_info_desc) < 0) { + _PyLong_One = PyLong_FromLong(1); + if (_PyLong_One == NULL) { return 0; } + + /* initialize int_info */ + if (Int_InfoType.tp_name == NULL) { + if (PyStructSequence_InitType2(&Int_InfoType, &int_info_desc) < 0) { + return 0; + } + } } return 1; } void -_PyLong_Fini(void) +_PyLong_Fini(PyThreadState *tstate) { - Py_CLEAR(_PyLong_One); - Py_CLEAR(_PyLong_Zero); + if (_Py_IsMainInterpreter(tstate)) { + Py_CLEAR(_PyLong_One); + Py_CLEAR(_PyLong_Zero); + } + #if NSMALLNEGINTS + NSMALLPOSINTS > 0 for (Py_ssize_t i = 0; i < NSMALLNEGINTS + NSMALLPOSINTS; i++) { - Py_CLEAR(small_ints[i]); + Py_CLEAR(tstate->interp->small_ints[i]); } #endif } diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 823d96e86a438..4f05dfc349033 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -576,10 +576,11 @@ pycore_init_types(PyThreadState *tstate) if (_PyStatus_EXCEPTION(status)) { return status; } + } - if (!_PyLong_Init()) { - return _PyStatus_ERR("can't init longs"); - } + + if (!_PyLong_Init(tstate)) { + return _PyStatus_ERR("can't init longs"); } if (is_main_interp) { @@ -1251,7 +1252,11 @@ finalize_interp_types(PyThreadState *tstate, int is_main_interp) _PyList_Fini(); _PySet_Fini(); _PyBytes_Fini(); - _PyLong_Fini(); + } + + _PyLong_Fini(tstate); + + if (is_main_interp) { _PyFloat_Fini(); _PyDict_Fini(); _PySlice_Fini(); From webhook-mailer at python.org Tue Dec 17 12:37:47 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 17 Dec 2019 17:37:47 -0000 Subject: [Python-checkins] bpo-38546: multiprocessing tests stop the resource tracker (GH-17641) Message-ID: https://github.com/python/cpython/commit/9707e8e22d80ca97bf7a9812816701cecde6d226 commit: 9707e8e22d80ca97bf7a9812816701cecde6d226 branch: master author: Victor Stinner committer: GitHub date: 2019-12-17T18:37:26+01:00 summary: bpo-38546: multiprocessing tests stop the resource tracker (GH-17641) Multiprocessing and concurrent.futures tests now stop the resource tracker process when tests complete. Add ResourceTracker._stop() method to multiprocessing.resource_tracker. Add _cleanup_tests() helper function to multiprocessing.util: share code between multiprocessing and concurrent.futures tests. files: A Misc/NEWS.d/next/Tests/2019-12-17-15-27-07.bpo-38546.82JwN2.rst M Lib/multiprocessing/resource_tracker.py M Lib/multiprocessing/util.py M Lib/test/_test_multiprocessing.py M Lib/test/test_concurrent_futures.py diff --git a/Lib/multiprocessing/resource_tracker.py b/Lib/multiprocessing/resource_tracker.py index 61a6dd66e72e6..c9bfa9b82b6e6 100644 --- a/Lib/multiprocessing/resource_tracker.py +++ b/Lib/multiprocessing/resource_tracker.py @@ -50,6 +50,19 @@ def __init__(self): self._fd = None self._pid = None + def _stop(self): + with self._lock: + if self._fd is None: + # not running + return + + # closing the "alive" file descriptor stops main() + os.close(self._fd) + self._fd = None + + os.waitpid(self._pid, 0) + self._pid = None + def getfd(self): self.ensure_running() return self._fd diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py index 3e640b944e958..4bc7782c00c15 100644 --- a/Lib/multiprocessing/util.py +++ b/Lib/multiprocessing/util.py @@ -439,3 +439,28 @@ def close_fds(*fds): """Close each file descriptor given as an argument""" for fd in fds: os.close(fd) + + +def _cleanup_tests(): + """Cleanup multiprocessing resources when multiprocessing tests + completed.""" + + from test import support + + # cleanup multiprocessing + process._cleanup() + + # Stop the ForkServer process if it's running + from multiprocessing import forkserver + forkserver._forkserver._stop() + + # Stop the ResourceTracker process if it's running + from multiprocessing import resource_tracker + resource_tracker._resource_tracker._stop() + + # bpo-37421: Explicitly call _run_finalizers() to remove immediately + # temporary directories created by multiprocessing.util.get_temp_dir(). + _run_finalizers() + support.gc_collect() + + support.reap_children() diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index c0da7d8912e64..4e48cd45e14ca 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -5695,16 +5695,7 @@ def tearDownModule(): if need_sleep: time.sleep(0.5) - multiprocessing.process._cleanup() - - # Stop the ForkServer process if it's running - from multiprocessing import forkserver - forkserver._forkserver._stop() - - # bpo-37421: Explicitly call _run_finalizers() to remove immediately - # temporary directories created by multiprocessing.util.get_temp_dir(). - multiprocessing.util._run_finalizers() - test.support.gc_collect() + multiprocessing.util._cleanup_tests() remote_globs['setUpModule'] = setUpModule remote_globs['tearDownModule'] = tearDownModule diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index 8b7518530193d..7b10f81ff207c 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -1306,17 +1306,7 @@ def setUpModule(): def tearDownModule(): support.threading_cleanup(*_threads_key) - support.reap_children() - - # cleanup multiprocessing - multiprocessing.process._cleanup() - # Stop the ForkServer process if it's running - from multiprocessing import forkserver - forkserver._forkserver._stop() - # bpo-37421: Explicitly call _run_finalizers() to remove immediately - # temporary directories created by multiprocessing.util.get_temp_dir(). - multiprocessing.util._run_finalizers() - support.gc_collect() + multiprocessing.util._cleanup_tests() if __name__ == "__main__": diff --git a/Misc/NEWS.d/next/Tests/2019-12-17-15-27-07.bpo-38546.82JwN2.rst b/Misc/NEWS.d/next/Tests/2019-12-17-15-27-07.bpo-38546.82JwN2.rst new file mode 100644 index 0000000000000..78d9df3469182 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-12-17-15-27-07.bpo-38546.82JwN2.rst @@ -0,0 +1,2 @@ +Multiprocessing and concurrent.futures tests now stop the resource tracker +process when tests complete. From webhook-mailer at python.org Tue Dec 17 16:21:33 2019 From: webhook-mailer at python.org (Steve Dower) Date: Tue, 17 Dec 2019 21:21:33 -0000 Subject: [Python-checkins] bpo-36500: Add --regen option to PCbuild/build.bat so Windows users can regen grammar, opcodes, tokens and symbols (GH-12654) Message-ID: https://github.com/python/cpython/commit/9e36589d49c1d6b06c0239fa69e8274d7e89e375 commit: 9e36589d49c1d6b06c0239fa69e8274d7e89e375 branch: master author: Anthony Shaw committer: Steve Dower date: 2019-12-17T13:21:20-08:00 summary: bpo-36500: Add --regen option to PCbuild/build.bat so Windows users can regen grammar, opcodes, tokens and symbols (GH-12654) files: A Misc/NEWS.d/next/Build/2019-04-02-01-59-26.bpo-36500.fyG6_U.rst A PCbuild/regen.vcxproj M PCbuild/build.bat diff --git a/Misc/NEWS.d/next/Build/2019-04-02-01-59-26.bpo-36500.fyG6_U.rst b/Misc/NEWS.d/next/Build/2019-04-02-01-59-26.bpo-36500.fyG6_U.rst new file mode 100644 index 0000000000000..cd230e4069e67 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2019-04-02-01-59-26.bpo-36500.fyG6_U.rst @@ -0,0 +1,2 @@ +Added an optional "regen" project to the Visual Studio solution that will +regenerate all grammar, tokens, and opcodes. diff --git a/PCbuild/build.bat b/PCbuild/build.bat index 623409c24ec04..5bc5da9e1c9ea 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -32,6 +32,7 @@ echo. automatically by the pythoncore project) echo. --pgo Build with Profile-Guided Optimization. This flag echo. overrides -c and -d echo. --test-marker Enable the test marker within the build. +echo. --regen Regenerate all opcodes, grammar and tokens echo. echo.Available flags to avoid building certain modules. echo.These flags have no effect if '-e' is not given: @@ -76,7 +77,8 @@ if "%~1"=="-k" (set kill=true) & shift & goto CheckOpts if "%~1"=="--pgo" (set do_pgo=true) & shift & goto CheckOpts if "%~1"=="--pgo-job" (set do_pgo=true) & (set pgo_job=%~2) & shift & shift & goto CheckOpts if "%~1"=="--test-marker" (set UseTestMarker=true) & shift & goto CheckOpts -if "%~1"=="-V" shift & goto :Version +if "%~1"=="-V" shift & goto Version +if "%~1"=="--regen" (set Regen=true) & shift & goto CheckOpts rem These use the actual property names used by MSBuild. We could just let rem them in through the environment, but we specify them on the command line rem anyway for visibility so set defaults after this @@ -154,9 +156,22 @@ echo on /p:UseTestMarker=%UseTestMarker% %GITProperty%^ %1 %2 %3 %4 %5 %6 %7 %8 %9 +if "%Regen%"=="true" call :Regen @echo off exit /b %ERRORLEVEL% +:Regen +echo on +call "%dir%find_msbuild.bat" %MSBUILD% +if not ERRORLEVEL 1 %MSBUILD% "%dir%regen.vcxproj" /t:%target% %parallel% %verbose%^ + /p:IncludeExternals=%IncludeExternals%^ + /p:Configuration=%conf% /p:Platform=%platf%^ + /p:UseTestMarker=%UseTestMarker% %GITProperty%^ + %1 %2 %3 %4 %5 %6 %7 %8 %9 + + at echo off +goto :eof + :Version rem Display the current build version information call "%dir%find_msbuild.bat" %MSBUILD% diff --git a/PCbuild/regen.vcxproj b/PCbuild/regen.vcxproj new file mode 100644 index 0000000000000..876b12bae9cdf --- /dev/null +++ b/PCbuild/regen.vcxproj @@ -0,0 +1,225 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + ARM + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + ARM + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + {21CF2108-2CC9-4005-A6ED-B7965ADE3854} + Win32Proj + regen + false + 10.0 + + + + + Utility + Unicode + + + v142 + + + v142 + + + v142 + + + v142 + + + v142 + + + v142 + + + v142 + + + v142 + + + v142 + + + v142 + + + v142 + + + v142 + + + + + + + + + + + + _CONSOLE;%(PreprocessorDefinitions) + + + Console + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + true + true + false + true + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From webhook-mailer at python.org Tue Dec 17 17:14:20 2019 From: webhook-mailer at python.org (Steve Dower) Date: Tue, 17 Dec 2019 22:14:20 -0000 Subject: [Python-checkins] bpo-36500: Simplify PCbuild/build.bat and prevent path separator changing in comments (GH-17644) Message-ID: https://github.com/python/cpython/commit/a9d0a6a1b932752873e04714c5dda707729078e4 commit: a9d0a6a1b932752873e04714c5dda707729078e4 branch: master author: Steve Dower committer: GitHub date: 2019-12-17T14:14:13-08:00 summary: bpo-36500: Simplify PCbuild/build.bat and prevent path separator changing in comments (GH-17644) files: M PCbuild/build.bat M Parser/asdl_c.py diff --git a/PCbuild/build.bat b/PCbuild/build.bat index 5bc5da9e1c9ea..7c24e0b155578 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -156,21 +156,16 @@ echo on /p:UseTestMarker=%UseTestMarker% %GITProperty%^ %1 %2 %3 %4 %5 %6 %7 %8 %9 -if "%Regen%"=="true" call :Regen - at echo off -exit /b %ERRORLEVEL% - -:Regen -echo on -call "%dir%find_msbuild.bat" %MSBUILD% -if not ERRORLEVEL 1 %MSBUILD% "%dir%regen.vcxproj" /t:%target% %parallel% %verbose%^ - /p:IncludeExternals=%IncludeExternals%^ - /p:Configuration=%conf% /p:Platform=%platf%^ - /p:UseTestMarker=%UseTestMarker% %GITProperty%^ - %1 %2 %3 %4 %5 %6 %7 %8 %9 + at if not ERRORLEVEL 1 @if "%Regen%"=="true" ( + %MSBUILD% "%dir%regen.vcxproj" /t:%target% %parallel% %verbose%^ + /p:IncludeExternals=%IncludeExternals%^ + /p:Configuration=%conf% /p:Platform=%platf%^ + /p:UseTestMarker=%UseTestMarker% %GITProperty%^ + %1 %2 %3 %4 %5 %6 %7 %8 %9 +) @echo off -goto :eof +exit /b %ERRORLEVEL% :Version rem Display the current build version information diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index 52495e9b451c1..daac0966f564a 100755 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -1331,7 +1331,8 @@ def generate_module_def(f, mod): def main(srcfile, dump_module=False): argv0 = sys.argv[0] components = argv0.split(os.sep) - argv0 = os.sep.join(components[-2:]) + # Always join with '/' so different OS does not keep changing the file + argv0 = '/'.join(components[-2:]) auto_gen_msg = common_msg % argv0 mod = asdl.parse(srcfile) if dump_module: From webhook-mailer at python.org Tue Dec 17 19:21:10 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Wed, 18 Dec 2019 00:21:10 -0000 Subject: [Python-checkins] bpo-39080: Starred Expression's column offset fix when inside a CALL (GH-17645) Message-ID: https://github.com/python/cpython/commit/50d4f12958bf806a4e1a1021d70cfd5d448c5cba commit: 50d4f12958bf806a4e1a1021d70cfd5d448c5cba branch: master author: Lysandros Nikolaou committer: Pablo Galindo date: 2019-12-18T00:20:55Z summary: bpo-39080: Starred Expression's column offset fix when inside a CALL (GH-17645) Co-Authored-By: Pablo Galindo files: A Misc/NEWS.d/next/Core and Builtins/2019-12-17-21-45-36.bpo-39080.OrxEVS.rst M Lib/test/test_ast.py M Python/ast.c diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index cd35f96a14663..51a7c1af1ffe7 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -209,6 +209,8 @@ def to_tuple(t): "1 < 2 < 3", # Call "f(1,2,c=3,*d,**e)", + # Call with multi-character starred + "f(*[0, 1])", # Call with a generator argument "f(a for a in b)", # Num @@ -877,6 +879,12 @@ def test_elif_stmt_start_position_with_else(self): self.assertEqual(elif_stmt.lineno, 3) self.assertEqual(elif_stmt.col_offset, 0) + def test_starred_expr_end_position_within_call(self): + node = ast.parse('f(*[0, 1])') + starred_expr = node.body[0].value.args[0] + self.assertEqual(starred_expr.end_lineno, 1) + self.assertEqual(starred_expr.end_col_offset, 9) + def test_literal_eval(self): self.assertEqual(ast.literal_eval('[1, 2, 3]'), [1, 2, 3]) self.assertEqual(ast.literal_eval('{"foo": 42}'), {"foo": 42}) @@ -1930,6 +1938,7 @@ def main(): ('Expression', ('GeneratorExp', (1, 0), ('Tuple', (1, 1), [('Name', (1, 2), 'a', ('Load',)), ('Name', (1, 4), 'b', ('Load',))], ('Load',)), [('comprehension', ('List', (1, 11), [('Name', (1, 12), 'a', ('Store',)), ('Name', (1, 14), 'b', ('Store',))], ('Store',)), ('Name', (1, 20), 'c', ('Load',)), [], 0)])), ('Expression', ('Compare', (1, 0), ('Constant', (1, 0), 1, None), [('Lt',), ('Lt',)], [('Constant', (1, 4), 2, None), ('Constant', (1, 8), 3, None)])), ('Expression', ('Call', (1, 0), ('Name', (1, 0), 'f', ('Load',)), [('Constant', (1, 2), 1, None), ('Constant', (1, 4), 2, None), ('Starred', (1, 10), ('Name', (1, 11), 'd', ('Load',)), ('Load',))], [('keyword', 'c', ('Constant', (1, 8), 3, None)), ('keyword', None, ('Name', (1, 15), 'e', ('Load',)))])), +('Expression', ('Call', (1, 0), ('Name', (1, 0), 'f', ('Load',)), [('Starred', (1, 2), ('List', (1, 3), [('Constant', (1, 4), 0, None), ('Constant', (1, 7), 1, None)], ('Load',)), ('Load',))], [])), ('Expression', ('Call', (1, 0), ('Name', (1, 0), 'f', ('Load',)), [('GeneratorExp', (1, 1), ('Name', (1, 2), 'a', ('Load',)), [('comprehension', ('Name', (1, 8), 'a', ('Store',)), ('Name', (1, 13), 'b', ('Load',)), [], 0)])], [])), ('Expression', ('Constant', (1, 0), 10, None)), ('Expression', ('Constant', (1, 0), 'string', None)), diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-17-21-45-36.bpo-39080.OrxEVS.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-17-21-45-36.bpo-39080.OrxEVS.rst new file mode 100644 index 0000000000000..b120d496b81e0 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-17-21-45-36.bpo-39080.OrxEVS.rst @@ -0,0 +1 @@ +Fix the value of *end_col_offset* for Starred Expression AST nodes when they are among the elements in the *args* attribute of Call AST nodes. diff --git a/Python/ast.c b/Python/ast.c index c0d67a15a6d7d..e4e9b837d3409 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -3126,7 +3126,7 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func, return NULL; starred = Starred(e, Load, LINENO(chch), chch->n_col_offset, - chch->n_end_lineno, chch->n_end_col_offset, + e->end_lineno, e->end_col_offset, c->c_arena); if (!starred) return NULL; From webhook-mailer at python.org Tue Dec 17 20:42:04 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Wed, 18 Dec 2019 01:42:04 -0000 Subject: [Python-checkins] [3.8] bpo-39080: Starred Expression's column offset fix when inside a CALL (GH-17645) (GH-17649) Message-ID: https://github.com/python/cpython/commit/b1f204471092678dd89117e608fa041a9589d14c commit: b1f204471092678dd89117e608fa041a9589d14c branch: 3.8 author: Pablo Galindo committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-17T17:41:58-08:00 summary: [3.8] bpo-39080: Starred Expression's column offset fix when inside a CALL (GH-17645) (GH-17649) ? Co-Authored-By: Pablo Galindo (cherry picked from commit 50d4f12958bf806a4e1a1021d70cfd5d448c5cba) Co-authored-by: Lysandros Nikolaou https://bugs.python.org/issue39080 files: A Misc/NEWS.d/next/Core and Builtins/2019-12-17-21-45-36.bpo-39080.OrxEVS.rst M Lib/test/test_ast.py M Python/ast.c diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index caea84f80f6a4..69ed83cd8b68b 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -209,6 +209,8 @@ def to_tuple(t): "1 < 2 < 3", # Call "f(1,2,c=3,*d,**e)", + # Call with multi-character starred + "f(*[0, 1])", # Call with a generator argument "f(a for a in b)", # Num @@ -815,6 +817,12 @@ def test_elif_stmt_start_position_with_else(self): self.assertEqual(elif_stmt.lineno, 3) self.assertEqual(elif_stmt.col_offset, 0) + def test_starred_expr_end_position_within_call(self): + node = ast.parse('f(*[0, 1])') + starred_expr = node.body[0].value.args[0] + self.assertEqual(starred_expr.end_lineno, 1) + self.assertEqual(starred_expr.end_col_offset, 9) + def test_literal_eval(self): self.assertEqual(ast.literal_eval('[1, 2, 3]'), [1, 2, 3]) self.assertEqual(ast.literal_eval('{"foo": 42}'), {"foo": 42}) @@ -1868,6 +1876,7 @@ def main(): ('Expression', ('GeneratorExp', (1, 0), ('Tuple', (1, 1), [('Name', (1, 2), 'a', ('Load',)), ('Name', (1, 4), 'b', ('Load',))], ('Load',)), [('comprehension', ('List', (1, 11), [('Name', (1, 12), 'a', ('Store',)), ('Name', (1, 14), 'b', ('Store',))], ('Store',)), ('Name', (1, 20), 'c', ('Load',)), [], 0)])), ('Expression', ('Compare', (1, 0), ('Constant', (1, 0), 1, None), [('Lt',), ('Lt',)], [('Constant', (1, 4), 2, None), ('Constant', (1, 8), 3, None)])), ('Expression', ('Call', (1, 0), ('Name', (1, 0), 'f', ('Load',)), [('Constant', (1, 2), 1, None), ('Constant', (1, 4), 2, None), ('Starred', (1, 10), ('Name', (1, 11), 'd', ('Load',)), ('Load',))], [('keyword', 'c', ('Constant', (1, 8), 3, None)), ('keyword', None, ('Name', (1, 15), 'e', ('Load',)))])), +('Expression', ('Call', (1, 0), ('Name', (1, 0), 'f', ('Load',)), [('Starred', (1, 2), ('List', (1, 3), [('Constant', (1, 4), 0, None), ('Constant', (1, 7), 1, None)], ('Load',)), ('Load',))], [])), ('Expression', ('Call', (1, 0), ('Name', (1, 0), 'f', ('Load',)), [('GeneratorExp', (1, 1), ('Name', (1, 2), 'a', ('Load',)), [('comprehension', ('Name', (1, 8), 'a', ('Store',)), ('Name', (1, 13), 'b', ('Load',)), [], 0)])], [])), ('Expression', ('Constant', (1, 0), 10, None)), ('Expression', ('Constant', (1, 0), 'string', None)), diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-17-21-45-36.bpo-39080.OrxEVS.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-17-21-45-36.bpo-39080.OrxEVS.rst new file mode 100644 index 0000000000000..b120d496b81e0 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-17-21-45-36.bpo-39080.OrxEVS.rst @@ -0,0 +1 @@ +Fix the value of *end_col_offset* for Starred Expression AST nodes when they are among the elements in the *args* attribute of Call AST nodes. diff --git a/Python/ast.c b/Python/ast.c index 7081394e5844b..e70ab519e66e1 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -3126,7 +3126,7 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func, return NULL; starred = Starred(e, Load, LINENO(chch), chch->n_col_offset, - chch->n_end_lineno, chch->n_end_col_offset, + e->end_lineno, e->end_col_offset, c->c_arena); if (!starred) return NULL; From webhook-mailer at python.org Wed Dec 18 01:51:49 2019 From: webhook-mailer at python.org (Inada Naoki) Date: Wed, 18 Dec 2019 06:51:49 -0000 Subject: [Python-checkins] bpo-39028: Performance enhancement in keyword extraction (GH-17576) Message-ID: https://github.com/python/cpython/commit/75bb07e92baa7267a61056d03d7e6b475588e793 commit: 75bb07e92baa7267a61056d03d7e6b475588e793 branch: master author: Sebastian Berg committer: Inada Naoki date: 2019-12-18T15:51:22+09:00 summary: bpo-39028: Performance enhancement in keyword extraction (GH-17576) All keywords should first be checked for pointer identity. Only after that failed for all keywords (unlikely) should unicode equality be used. The original code would call unicode equality on any non-matching keyword argument. Meaning calling it often e.g. when a function has many kwargs but only the last one is provided. files: A Misc/NEWS.d/next/Core and Builtins/2019-12-17-23-20-51.bpo-39028.SND4TB.rst M Python/getargs.c diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-17-23-20-51.bpo-39028.SND4TB.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-17-23-20-51.bpo-39028.SND4TB.rst new file mode 100644 index 0000000000000..ee7639ead9dd9 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-17-23-20-51.bpo-39028.SND4TB.rst @@ -0,0 +1 @@ +Slightly improve the speed of keyword argument parsing with many kwargs by strengthening the assumption that kwargs are interned strings. \ No newline at end of file diff --git a/Python/getargs.c b/Python/getargs.c index 351889f8e5189..d5caf47a02838 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -2053,14 +2053,18 @@ find_keyword(PyObject *kwnames, PyObject *const *kwstack, PyObject *key) Py_ssize_t i, nkwargs; nkwargs = PyTuple_GET_SIZE(kwnames); - for (i=0; i < nkwargs; i++) { + for (i = 0; i < nkwargs; i++) { PyObject *kwname = PyTuple_GET_ITEM(kwnames, i); - /* ptr==ptr should match in most cases since keyword keys - should be interned strings */ + /* kwname == key will normally find a match in since keyword keys + should be interned strings; if not retry below in a new loop. */ if (kwname == key) { return kwstack[i]; } + } + + for (i = 0; i < nkwargs; i++) { + PyObject *kwname = PyTuple_GET_ITEM(kwnames, i); assert(PyUnicode_Check(kwname)); if (_PyUnicode_EQ(kwname, key)) { return kwstack[i]; From webhook-mailer at python.org Wed Dec 18 04:11:22 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 18 Dec 2019 09:11:22 -0000 Subject: [Python-checkins] bpo-38546: multiprocessing tests stop the resource tracker (GH-17641) (GH-17647) Message-ID: https://github.com/python/cpython/commit/35acb3597208e10a101140474adec86859d57f61 commit: 35acb3597208e10a101140474adec86859d57f61 branch: 3.8 author: Victor Stinner committer: GitHub date: 2019-12-18T10:11:05+01:00 summary: bpo-38546: multiprocessing tests stop the resource tracker (GH-17641) (GH-17647) Multiprocessing and concurrent.futures tests now stop the resource tracker process when tests complete. Add ResourceTracker._stop() method to multiprocessing.resource_tracker. Add _cleanup_tests() helper function to multiprocessing.util: share code between multiprocessing and concurrent.futures tests. (cherry picked from commit 9707e8e22d80ca97bf7a9812816701cecde6d226) files: A Misc/NEWS.d/next/Tests/2019-12-17-15-27-07.bpo-38546.82JwN2.rst M Lib/multiprocessing/resource_tracker.py M Lib/multiprocessing/util.py M Lib/test/_test_multiprocessing.py M Lib/test/test_concurrent_futures.py diff --git a/Lib/multiprocessing/resource_tracker.py b/Lib/multiprocessing/resource_tracker.py index 61a6dd66e72e6..c9bfa9b82b6e6 100644 --- a/Lib/multiprocessing/resource_tracker.py +++ b/Lib/multiprocessing/resource_tracker.py @@ -50,6 +50,19 @@ def __init__(self): self._fd = None self._pid = None + def _stop(self): + with self._lock: + if self._fd is None: + # not running + return + + # closing the "alive" file descriptor stops main() + os.close(self._fd) + self._fd = None + + os.waitpid(self._pid, 0) + self._pid = None + def getfd(self): self.ensure_running() return self._fd diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py index 32b51b04373f9..745f2b2651b11 100644 --- a/Lib/multiprocessing/util.py +++ b/Lib/multiprocessing/util.py @@ -439,3 +439,28 @@ def close_fds(*fds): """Close each file descriptor given as an argument""" for fd in fds: os.close(fd) + + +def _cleanup_tests(): + """Cleanup multiprocessing resources when multiprocessing tests + completed.""" + + from test import support + + # cleanup multiprocessing + process._cleanup() + + # Stop the ForkServer process if it's running + from multiprocessing import forkserver + forkserver._forkserver._stop() + + # Stop the ResourceTracker process if it's running + from multiprocessing import resource_tracker + resource_tracker._resource_tracker._stop() + + # bpo-37421: Explicitly call _run_finalizers() to remove immediately + # temporary directories created by multiprocessing.util.get_temp_dir(). + _run_finalizers() + support.gc_collect() + + support.reap_children() diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index b7f3d253c4d13..983770f35761d 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -5673,16 +5673,7 @@ def tearDownModule(): if need_sleep: time.sleep(0.5) - multiprocessing.process._cleanup() - - # Stop the ForkServer process if it's running - from multiprocessing import forkserver - forkserver._forkserver._stop() - - # bpo-37421: Explicitly call _run_finalizers() to remove immediately - # temporary directories created by multiprocessing.util.get_temp_dir(). - multiprocessing.util._run_finalizers() - test.support.gc_collect() + multiprocessing.util._cleanup_tests() remote_globs['setUpModule'] = setUpModule remote_globs['tearDownModule'] = tearDownModule diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index 98c9bc9b507a4..e01f2e4b78759 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -1306,17 +1306,7 @@ def setUpModule(): def tearDownModule(): test.support.threading_cleanup(*_threads_key) - test.support.reap_children() - - # cleanup multiprocessing - multiprocessing.process._cleanup() - # Stop the ForkServer process if it's running - from multiprocessing import forkserver - forkserver._forkserver._stop() - # bpo-37421: Explicitly call _run_finalizers() to remove immediately - # temporary directories created by multiprocessing.util.get_temp_dir(). - multiprocessing.util._run_finalizers() - test.support.gc_collect() + multiprocessing.util._cleanup_tests() if __name__ == "__main__": diff --git a/Misc/NEWS.d/next/Tests/2019-12-17-15-27-07.bpo-38546.82JwN2.rst b/Misc/NEWS.d/next/Tests/2019-12-17-15-27-07.bpo-38546.82JwN2.rst new file mode 100644 index 0000000000000..78d9df3469182 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-12-17-15-27-07.bpo-38546.82JwN2.rst @@ -0,0 +1,2 @@ +Multiprocessing and concurrent.futures tests now stop the resource tracker +process when tests complete. From webhook-mailer at python.org Wed Dec 18 09:50:13 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 18 Dec 2019 14:50:13 -0000 Subject: [Python-checkins] bpo-38546: Fix concurrent.futures test_ressources_gced_in_workers() (GH-17652) Message-ID: https://github.com/python/cpython/commit/673c39331f844a80c465efd7cff88ac55c432bfb commit: 673c39331f844a80c465efd7cff88ac55c432bfb branch: master author: Victor Stinner committer: GitHub date: 2019-12-18T15:50:04+01:00 summary: bpo-38546: Fix concurrent.futures test_ressources_gced_in_workers() (GH-17652) Fix test_ressources_gced_in_workers() of test_concurrent_futures: explicitly stop the manager to prevent leaking a child process running in the background after the test completes. files: A Misc/NEWS.d/next/Tests/2019-12-18-14-52-08.bpo-38546.2kxNuM.rst M Lib/test/test_concurrent_futures.py diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index 7b10f81ff207c..c97351636e869 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -87,8 +87,7 @@ def my_method(self): class EventfulGCObj(): - def __init__(self, ctx): - mgr = get_context(ctx).Manager() + def __init__(self, mgr): self.event = mgr.Event() def __del__(self): @@ -847,12 +846,21 @@ def test_traceback(self): def test_ressources_gced_in_workers(self): # Ensure that argument for a job are correctly gc-ed after the job # is finished - obj = EventfulGCObj(self.ctx) + mgr = get_context(self.ctx).Manager() + obj = EventfulGCObj(mgr) future = self.executor.submit(id, obj) future.result() self.assertTrue(obj.event.wait(timeout=1)) + # explicitly destroy the object to ensure that EventfulGCObj.__del__() + # is called while manager is still running. + obj = None + support.gc_collect() + + mgr.shutdown() + mgr.join() + create_executor_tests(ProcessPoolExecutorTest, executor_mixins=(ProcessPoolForkMixin, diff --git a/Misc/NEWS.d/next/Tests/2019-12-18-14-52-08.bpo-38546.2kxNuM.rst b/Misc/NEWS.d/next/Tests/2019-12-18-14-52-08.bpo-38546.2kxNuM.rst new file mode 100644 index 0000000000000..d8ec7cabbbab8 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-12-18-14-52-08.bpo-38546.2kxNuM.rst @@ -0,0 +1,3 @@ +Fix test_ressources_gced_in_workers() of test_concurrent_futures: explicitly +stop the manager to prevent leaking a child process running in the background +after the test completes. From webhook-mailer at python.org Wed Dec 18 15:31:02 2019 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 18 Dec 2019 20:31:02 -0000 Subject: [Python-checkins] bpo-38546: Fix concurrent.futures test_ressources_gced_in_workers() (GH-17652) (GH-17655) Message-ID: https://github.com/python/cpython/commit/b0eb046cbd0dbb7b17f16aad6de20fac5305f387 commit: b0eb046cbd0dbb7b17f16aad6de20fac5305f387 branch: 3.8 author: Victor Stinner committer: GitHub date: 2019-12-18T21:30:43+01:00 summary: bpo-38546: Fix concurrent.futures test_ressources_gced_in_workers() (GH-17652) (GH-17655) Fix test_ressources_gced_in_workers() of test_concurrent_futures: explicitly stop the manager to prevent leaking a child process running in the background after the test completes. (cherry picked from commit 673c39331f844a80c465efd7cff88ac55c432bfb) files: A Misc/NEWS.d/next/Tests/2019-12-18-14-52-08.bpo-38546.2kxNuM.rst M Lib/test/test_concurrent_futures.py diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index e01f2e4b78759..ac722981659d3 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -87,8 +87,7 @@ def my_method(self): class EventfulGCObj(): - def __init__(self, ctx): - mgr = get_context(ctx).Manager() + def __init__(self, mgr): self.event = mgr.Event() def __del__(self): @@ -848,12 +847,21 @@ def test_traceback(self): def test_ressources_gced_in_workers(self): # Ensure that argument for a job are correctly gc-ed after the job # is finished - obj = EventfulGCObj(self.ctx) + mgr = get_context(self.ctx).Manager() + obj = EventfulGCObj(mgr) future = self.executor.submit(id, obj) future.result() self.assertTrue(obj.event.wait(timeout=1)) + # explicitly destroy the object to ensure that EventfulGCObj.__del__() + # is called while manager is still running. + obj = None + test.support.gc_collect() + + mgr.shutdown() + mgr.join() + create_executor_tests(ProcessPoolExecutorTest, executor_mixins=(ProcessPoolForkMixin, diff --git a/Misc/NEWS.d/next/Tests/2019-12-18-14-52-08.bpo-38546.2kxNuM.rst b/Misc/NEWS.d/next/Tests/2019-12-18-14-52-08.bpo-38546.2kxNuM.rst new file mode 100644 index 0000000000000..d8ec7cabbbab8 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-12-18-14-52-08.bpo-38546.2kxNuM.rst @@ -0,0 +1,3 @@ +Fix test_ressources_gced_in_workers() of test_concurrent_futures: explicitly +stop the manager to prevent leaking a child process running in the background +after the test completes. From webhook-mailer at python.org Wed Dec 18 15:51:17 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Wed, 18 Dec 2019 20:51:17 -0000 Subject: [Python-checkins] bpo-38546: Fix concurrent.futures test_ressources_gced_in_workers() (GH-17652) (GH-17655) Message-ID: https://github.com/python/cpython/commit/b8bbdf049b0472b8edc4298bfa61e62e3a584e98 commit: b8bbdf049b0472b8edc4298bfa61e62e3a584e98 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-18T12:51:09-08:00 summary: bpo-38546: Fix concurrent.futures test_ressources_gced_in_workers() (GH-17652) (GH-17655) Fix test_ressources_gced_in_workers() of test_concurrent_futures: explicitly stop the manager to prevent leaking a child process running in the background after the test completes. (cherry picked from commit 673c39331f844a80c465efd7cff88ac55c432bfb) (cherry picked from commit b0eb046cbd0dbb7b17f16aad6de20fac5305f387) Co-authored-by: Victor Stinner files: A Misc/NEWS.d/next/Tests/2019-12-18-14-52-08.bpo-38546.2kxNuM.rst M Lib/test/test_concurrent_futures.py diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index ad68909161c73..b42670e16a6c9 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -84,8 +84,7 @@ def my_method(self): class EventfulGCObj(): - def __init__(self, ctx): - mgr = get_context(ctx).Manager() + def __init__(self, mgr): self.event = mgr.Event() def __del__(self): @@ -818,12 +817,21 @@ def test_traceback(self): def test_ressources_gced_in_workers(self): # Ensure that argument for a job are correctly gc-ed after the job # is finished - obj = EventfulGCObj(self.ctx) + mgr = get_context(self.ctx).Manager() + obj = EventfulGCObj(mgr) future = self.executor.submit(id, obj) future.result() self.assertTrue(obj.event.wait(timeout=1)) + # explicitly destroy the object to ensure that EventfulGCObj.__del__() + # is called while manager is still running. + obj = None + test.support.gc_collect() + + mgr.shutdown() + mgr.join() + create_executor_tests(ProcessPoolExecutorTest, executor_mixins=(ProcessPoolForkMixin, diff --git a/Misc/NEWS.d/next/Tests/2019-12-18-14-52-08.bpo-38546.2kxNuM.rst b/Misc/NEWS.d/next/Tests/2019-12-18-14-52-08.bpo-38546.2kxNuM.rst new file mode 100644 index 0000000000000..d8ec7cabbbab8 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-12-18-14-52-08.bpo-38546.2kxNuM.rst @@ -0,0 +1,3 @@ +Fix test_ressources_gced_in_workers() of test_concurrent_futures: explicitly +stop the manager to prevent leaking a child process running in the background +after the test completes. From webhook-mailer at python.org Wed Dec 18 19:53:12 2019 From: webhook-mailer at python.org (Ned Deily) Date: Thu, 19 Dec 2019 00:53:12 -0000 Subject: [Python-checkins] 3.6.10 Message-ID: https://github.com/python/cpython/commit/02dff8b01100e7cd6d4c93be27202ccb4ea05811 commit: 02dff8b01100e7cd6d4c93be27202ccb4ea05811 branch: 3.6 author: Ned Deily committer: Ned Deily date: 2019-12-18T14:26:36-05:00 summary: 3.6.10 files: A Misc/NEWS.d/3.6.10.rst D Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst M Include/patchlevel.h M README.rst diff --git a/Include/patchlevel.h b/Include/patchlevel.h index 59fb07d8b3a07..6b63ccbb84f60 100644 --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -19,11 +19,11 @@ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 6 #define PY_MICRO_VERSION 10 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.6.10rc1+" +#define PY_VERSION "3.6.10" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Misc/NEWS.d/3.6.10.rst b/Misc/NEWS.d/3.6.10.rst new file mode 100644 index 0000000000000..87d5f97cd4674 --- /dev/null +++ b/Misc/NEWS.d/3.6.10.rst @@ -0,0 +1,7 @@ +.. bpo: 38295 +.. date: 2019-12-17-03-43-04 +.. nonce: hgDvlB +.. release date: 2019-12-18 +.. section: macOS + +Prevent failure of test_relative_path in test_py_compile on macOS Catalina. diff --git a/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst b/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst deleted file mode 100644 index cc9ceb4cc50b3..0000000000000 --- a/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst +++ /dev/null @@ -1 +0,0 @@ -Prevent failure of test_relative_path in test_py_compile on macOS Catalina. diff --git a/README.rst b/README.rst index eaa9682f497ea..bcae070f26adc 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ -This is Python version 3.6.10 candidate 1+ -========================================== +This is Python version 3.6.10 +============================= .. image:: https://travis-ci.org/python/cpython.svg?branch=3.6 :alt: CPython build status on Travis CI From webhook-mailer at python.org Wed Dec 18 20:50:10 2019 From: webhook-mailer at python.org (Ned Deily) Date: Thu, 19 Dec 2019 01:50:10 -0000 Subject: [Python-checkins] Add PYTHONUTF8 to commandline usage. (GH-17587) (GH-17599) Message-ID: https://github.com/python/cpython/commit/b4f98f412ad9c203c3d60101cf6fdc04415c0032 commit: b4f98f412ad9c203c3d60101cf6fdc04415c0032 branch: 3.7 author: Inada Naoki committer: Ned Deily date: 2019-12-18T13:38:18-05:00 summary: Add PYTHONUTF8 to commandline usage. (GH-17587) (GH-17599) Co-Authored-By: Victor Stinner (cherry picked from commit 95826c773a9004fc5b3c89de55f800504685ab21) files: M Modules/main.c diff --git a/Modules/main.c b/Modules/main.c index acc59c6c40a99..4d13184f2d184 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -131,6 +131,7 @@ static const char usage_5[] = "PYTHONHOME : alternate directory (or %lc).\n" " The default module search path uses %s.\n" "PYTHONCASEOK : ignore case in 'import' statements (Windows).\n" +"PYTHONUTF8: if set to 1, enable the UTF-8 mode.\n" "PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.\n" "PYTHONFAULTHANDLER: dump the Python traceback on fatal errors.\n"; static const char usage_6[] = From webhook-mailer at python.org Thu Dec 19 09:41:54 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Thu, 19 Dec 2019 14:41:54 -0000 Subject: [Python-checkins] [3.7] bpo-38316: Fix co_stacksize documentation (GH-16983). (GH-17660) Message-ID: https://github.com/python/cpython/commit/917419f58b2869d71691c5ba54a9e02e5dcf73b2 commit: 917419f58b2869d71691c5ba54a9e02e5dcf73b2 branch: 3.7 author: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-19T06:41:49-08:00 summary: [3.7] bpo-38316: Fix co_stacksize documentation (GH-16983). (GH-17660) (cherry picked from commit d587272fe3b0fcad2f23a490e76f9f82ca7d64ef) Co-authored-by: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> https://bugs.python.org/issue38316 Automerge-Triggered-By: @vstinner files: M Doc/reference/datamodel.rst diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index b4f9ddc1194cb..c38dcdc4e512d 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -922,8 +922,8 @@ Internal types compiled; :attr:`co_firstlineno` is the first line number of the function; :attr:`co_lnotab` is a string encoding the mapping from bytecode offsets to line numbers (for details see the source code of the interpreter); - :attr:`co_stacksize` is the required stack size (including local variables); - :attr:`co_flags` is an integer encoding a number of flags for the interpreter. + :attr:`co_stacksize` is the required stack size; :attr:`co_flags` is an + integer encoding a number of flags for the interpreter. .. index:: object: generator From webhook-mailer at python.org Thu Dec 19 09:44:34 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Thu, 19 Dec 2019 14:44:34 -0000 Subject: [Python-checkins] [3.8] bpo-38316: Fix co_stacksize documentation (GH-16983) (GH-17661) Message-ID: https://github.com/python/cpython/commit/eba61f33d60cc63e35d5f5fcada837a66c89774a commit: eba61f33d60cc63e35d5f5fcada837a66c89774a branch: 3.8 author: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-19T06:44:27-08:00 summary: [3.8] bpo-38316: Fix co_stacksize documentation (GH-16983) (GH-17661) (cherry picked from commit d587272fe3b0fcad2f23a490e76f9f82ca7d64ef) Co-authored-by: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> https://bugs.python.org/issue38316 Automerge-Triggered-By: @vstinner files: M Doc/reference/datamodel.rst diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 46d50ad600ff5..c530e4117af97 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -925,8 +925,8 @@ Internal types the first line number of the function; :attr:`co_lnotab` is a string encoding the mapping from bytecode offsets to line numbers (for details see the source code of the interpreter); :attr:`co_stacksize` is the - required stack size (including local variables); :attr:`co_flags` is an - integer encoding a number of flags for the interpreter. + required stack size; :attr:`co_flags` is an integer encoding a number + of flags for the interpreter. .. index:: object: generator From webhook-mailer at python.org Fri Dec 20 14:18:42 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Fri, 20 Dec 2019 19:18:42 -0000 Subject: [Python-checkins] bpo-38918: Add __module__ entry for function & method type in inspect docs table (GH-17408) Message-ID: https://github.com/python/cpython/commit/f522a6ddb67a238bab5673608111f74ec4e22205 commit: f522a6ddb67a238bab5673608111f74ec4e22205 branch: master author: Parth Sharma committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-20T11:18:33-08:00 summary: bpo-38918: Add __module__ entry for function & method type in inspect docs table (GH-17408) Adds` __module__ ` entries for function & method types in inspect docs table. https://bugs.python.org/issue38918 files: A Misc/NEWS.d/next/Documentation/2019-12-15-22-04-41.bpo-38918.8JnDTS.rst M Doc/library/inspect.rst diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 10f347dd420f3..bab2c41e4e224 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -70,6 +70,9 @@ attributes: | | | method is bound, or | | | | ``None`` | +-----------+-------------------+---------------------------+ +| | __module__ | name of module in which | +| | | this method was defined | ++-----------+-------------------+---------------------------+ | function | __doc__ | documentation string | +-----------+-------------------+---------------------------+ | | __name__ | name with which this | @@ -98,6 +101,9 @@ attributes: | | | reserved for return | | | | annotations. | +-----------+-------------------+---------------------------+ +| | __module__ | name of module in which | +| | | this function was defined | ++-----------+-------------------+---------------------------+ | traceback | tb_frame | frame object at this | | | | level | +-----------+-------------------+---------------------------+ diff --git a/Misc/NEWS.d/next/Documentation/2019-12-15-22-04-41.bpo-38918.8JnDTS.rst b/Misc/NEWS.d/next/Documentation/2019-12-15-22-04-41.bpo-38918.8JnDTS.rst new file mode 100644 index 0000000000000..5747936dd64d5 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2019-12-15-22-04-41.bpo-38918.8JnDTS.rst @@ -0,0 +1,3 @@ +Add an entry for ``__module__`` in the "function" & "method" sections of the +`inspect docs types and members table +`_ From webhook-mailer at python.org Fri Dec 20 14:26:21 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Fri, 20 Dec 2019 19:26:21 -0000 Subject: [Python-checkins] bpo-38918: Add __module__ entry for function & method type in inspect docs table (GH-17408) Message-ID: https://github.com/python/cpython/commit/0ffc90031cadf5637cfc13a40899e71c259c49b1 commit: 0ffc90031cadf5637cfc13a40899e71c259c49b1 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-20T11:26:16-08:00 summary: bpo-38918: Add __module__ entry for function & method type in inspect docs table (GH-17408) Adds` __module__ ` entries for function & method types in inspect docs table. https://bugs.python.org/issue38918 (cherry picked from commit f522a6ddb67a238bab5673608111f74ec4e22205) Co-authored-by: Parth Sharma files: A Misc/NEWS.d/next/Documentation/2019-12-15-22-04-41.bpo-38918.8JnDTS.rst M Doc/library/inspect.rst diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index d52726d07a985..02b02cae9d86f 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -70,6 +70,9 @@ attributes: | | | method is bound, or | | | | ``None`` | +-----------+-------------------+---------------------------+ +| | __module__ | name of module in which | +| | | this method was defined | ++-----------+-------------------+---------------------------+ | function | __doc__ | documentation string | +-----------+-------------------+---------------------------+ | | __name__ | name with which this | @@ -98,6 +101,9 @@ attributes: | | | reserved for return | | | | annotations. | +-----------+-------------------+---------------------------+ +| | __module__ | name of module in which | +| | | this function was defined | ++-----------+-------------------+---------------------------+ | traceback | tb_frame | frame object at this | | | | level | +-----------+-------------------+---------------------------+ diff --git a/Misc/NEWS.d/next/Documentation/2019-12-15-22-04-41.bpo-38918.8JnDTS.rst b/Misc/NEWS.d/next/Documentation/2019-12-15-22-04-41.bpo-38918.8JnDTS.rst new file mode 100644 index 0000000000000..5747936dd64d5 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2019-12-15-22-04-41.bpo-38918.8JnDTS.rst @@ -0,0 +1,3 @@ +Add an entry for ``__module__`` in the "function" & "method" sections of the +`inspect docs types and members table +`_ From webhook-mailer at python.org Fri Dec 20 14:26:44 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Fri, 20 Dec 2019 19:26:44 -0000 Subject: [Python-checkins] bpo-38918: Add __module__ entry for function & method type in inspect docs table (GH-17408) Message-ID: https://github.com/python/cpython/commit/44683bbc634bd007df572dce0d8bb348a469a6bb commit: 44683bbc634bd007df572dce0d8bb348a469a6bb branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-20T11:26:39-08:00 summary: bpo-38918: Add __module__ entry for function & method type in inspect docs table (GH-17408) Adds` __module__ ` entries for function & method types in inspect docs table. https://bugs.python.org/issue38918 (cherry picked from commit f522a6ddb67a238bab5673608111f74ec4e22205) Co-authored-by: Parth Sharma files: A Misc/NEWS.d/next/Documentation/2019-12-15-22-04-41.bpo-38918.8JnDTS.rst M Doc/library/inspect.rst diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 10f347dd420f3..bab2c41e4e224 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -70,6 +70,9 @@ attributes: | | | method is bound, or | | | | ``None`` | +-----------+-------------------+---------------------------+ +| | __module__ | name of module in which | +| | | this method was defined | ++-----------+-------------------+---------------------------+ | function | __doc__ | documentation string | +-----------+-------------------+---------------------------+ | | __name__ | name with which this | @@ -98,6 +101,9 @@ attributes: | | | reserved for return | | | | annotations. | +-----------+-------------------+---------------------------+ +| | __module__ | name of module in which | +| | | this function was defined | ++-----------+-------------------+---------------------------+ | traceback | tb_frame | frame object at this | | | | level | +-----------+-------------------+---------------------------+ diff --git a/Misc/NEWS.d/next/Documentation/2019-12-15-22-04-41.bpo-38918.8JnDTS.rst b/Misc/NEWS.d/next/Documentation/2019-12-15-22-04-41.bpo-38918.8JnDTS.rst new file mode 100644 index 0000000000000..5747936dd64d5 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2019-12-15-22-04-41.bpo-38918.8JnDTS.rst @@ -0,0 +1,3 @@ +Add an entry for ``__module__`` in the "function" & "method" sections of the +`inspect docs types and members table +`_ From webhook-mailer at python.org Sun Dec 22 04:57:58 2019 From: webhook-mailer at python.org (Ivan Levkivskyi) Date: Sun, 22 Dec 2019 09:57:58 -0000 Subject: [Python-checkins] bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) Message-ID: https://github.com/python/cpython/commit/eae87e3e4e0cb9a0ce10c2e101acb6995d79e09c commit: eae87e3e4e0cb9a0ce10c2e101acb6995d79e09c branch: master author: Bar Harel committer: Ivan Levkivskyi date: 2019-12-22T09:57:27Z summary: bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) Quick subclasshook fix using the same method is being used in collections.abc (up to a certain degree). files: A Misc/NEWS.d/next/Library/2019-11-22-12-08-52.bpo-38878.EJ0cFf.rst M Lib/os.py M Lib/test/test_os.py diff --git a/Lib/os.py b/Lib/os.py index c901bd1b8ed9d..ca418edbc5736 100644 --- a/Lib/os.py +++ b/Lib/os.py @@ -26,6 +26,8 @@ import sys import stat as st +from _collections_abc import _check_methods + _names = sys.builtin_module_names # Note: more names are added to __all__ later. @@ -1070,7 +1072,9 @@ def __fspath__(self): @classmethod def __subclasshook__(cls, subclass): - return hasattr(subclass, '__fspath__') + if cls is PathLike: + return _check_methods(subclass, '__fspath__') + return NotImplemented def __class_getitem__(cls, type): return cls diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index f44ddbad7d641..82c441c204835 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -4048,6 +4048,14 @@ def test_bad_pathlike(self): self.assertRaises(ZeroDivisionError, self.fspath, FakePath(ZeroDivisionError())) + def test_pathlike_subclasshook(self): + # bpo-38878: subclasshook causes subclass checks + # true on abstract implementation. + class A(os.PathLike): + pass + self.assertFalse(issubclass(FakePath, A)) + self.assertTrue(issubclass(FakePath, os.PathLike)) + def test_pathlike_class_getitem(self): self.assertIs(os.PathLike[bytes], os.PathLike) diff --git a/Misc/NEWS.d/next/Library/2019-11-22-12-08-52.bpo-38878.EJ0cFf.rst b/Misc/NEWS.d/next/Library/2019-11-22-12-08-52.bpo-38878.EJ0cFf.rst new file mode 100644 index 0000000000000..9cbdf08dd53e3 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-11-22-12-08-52.bpo-38878.EJ0cFf.rst @@ -0,0 +1,2 @@ +Fixed __subclasshook__ of :class:`os.PathLike` to return a correct result +upon inheritence. Patch by Bar Harel. From webhook-mailer at python.org Sun Dec 22 12:47:05 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 22 Dec 2019 17:47:05 -0000 Subject: [Python-checkins] Add missing markup (GH-17680) Message-ID: https://github.com/python/cpython/commit/068768faf6b82478de239d7ab903dfb249ad96a4 commit: 068768faf6b82478de239d7ab903dfb249ad96a4 branch: master author: cocoatomo committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-22T09:46:45-08:00 summary: Add missing markup (GH-17680) "HH", "MM" and "ffffff" are enclosed with double back quotes, but "SS" is left being bare files: M Doc/library/datetime.rst diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 2bd25cc4362b2..401118f980acf 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -2514,7 +2514,7 @@ Notes: :meth:`utcoffset` is transformed into a string of the form ``?HHMM[SS[.ffffff]]``, where ``HH`` is a 2-digit string giving the number of UTC offset hours, ``MM`` is a 2-digit string giving the number of UTC - offset minutes, SS is a 2-digit string giving the number of UTC offset + offset minutes, ``SS`` is a 2-digit string giving the number of UTC offset seconds and ``ffffff`` is a 6-digit string giving the number of UTC offset microseconds. The ``ffffff`` part is omitted when the offset is a whole number of seconds and both the ``ffffff`` and the ``SS`` part is From webhook-mailer at python.org Sun Dec 22 12:54:37 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 22 Dec 2019 17:54:37 -0000 Subject: [Python-checkins] Add missing markup (GH-17680) Message-ID: https://github.com/python/cpython/commit/35590c5ee178ce101955e41a213febccb077684d commit: 35590c5ee178ce101955e41a213febccb077684d branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-22T09:54:33-08:00 summary: Add missing markup (GH-17680) "HH", "MM" and "ffffff" are enclosed with double back quotes, but "SS" is left being bare (cherry picked from commit 068768faf6b82478de239d7ab903dfb249ad96a4) Co-authored-by: cocoatomo files: M Doc/library/datetime.rst diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index b49eab44aef9e..2bc4652c26396 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -2514,7 +2514,7 @@ Notes: :meth:`utcoffset` is transformed into a string of the form ``?HHMM[SS[.ffffff]]``, where ``HH`` is a 2-digit string giving the number of UTC offset hours, ``MM`` is a 2-digit string giving the number of UTC - offset minutes, SS is a 2-digit string giving the number of UTC offset + offset minutes, ``SS`` is a 2-digit string giving the number of UTC offset seconds and ``ffffff`` is a 6-digit string giving the number of UTC offset microseconds. The ``ffffff`` part is omitted when the offset is a whole number of seconds and both the ``ffffff`` and the ``SS`` part is From webhook-mailer at python.org Mon Dec 23 09:37:54 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 23 Dec 2019 14:37:54 -0000 Subject: [Python-checkins] [typo] fix dupe in datetime.fromisoformat docs (GH-17295) Message-ID: https://github.com/python/cpython/commit/e7b406f4e20e248d24079f97d7c8b93e5a45249e commit: e7b406f4e20e248d24079f97d7c8b93e5a45249e branch: master author: Michael Morehouse <640167+yawpitch at users.noreply.github.com> committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-23T06:37:47-08:00 summary: [typo] fix dupe in datetime.fromisoformat docs (GH-17295) Fixes a nearly word for word duplication of a sentence that appears earlier in the caution section of datetime.datetime.fromisoformat in Doc/Library/datetime.rst. No issue created as it's a trivial change. Automerge-Triggered-By: @pganssle files: M Doc/library/datetime.rst diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 401118f980acf..22ecbb551d897 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -997,8 +997,6 @@ Other constructors, all class methods: as the inverse operation of :meth:`datetime.isoformat`. A more full-featured ISO 8601 parser, ``dateutil.parser.isoparse`` is available in the third-party package `dateutil `__. - This does not support parsing arbitrary ISO 8601 strings - it is only intended - as the inverse operation of :meth:`datetime.isoformat`. Examples:: From webhook-mailer at python.org Mon Dec 23 09:44:09 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 23 Dec 2019 14:44:09 -0000 Subject: [Python-checkins] [typo] fix dupe in datetime.fromisoformat docs (GH-17295) Message-ID: https://github.com/python/cpython/commit/a542aec092404c5cbb89f9e88bf2a9f4548ef179 commit: a542aec092404c5cbb89f9e88bf2a9f4548ef179 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-23T06:44:04-08:00 summary: [typo] fix dupe in datetime.fromisoformat docs (GH-17295) Fixes a nearly word for word duplication of a sentence that appears earlier in the caution section of datetime.datetime.fromisoformat in Doc/Library/datetime.rst. No issue created as it's a trivial change. Automerge-Triggered-By: @pganssle (cherry picked from commit e7b406f4e20e248d24079f97d7c8b93e5a45249e) Co-authored-by: Michael Morehouse <640167+yawpitch at users.noreply.github.com> files: M Doc/library/datetime.rst diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 2bc4652c26396..29c6b5a4736c0 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -997,8 +997,6 @@ Other constructors, all class methods: as the inverse operation of :meth:`datetime.isoformat`. A more full-featured ISO 8601 parser, ``dateutil.parser.isoparse`` is available in the third-party package `dateutil `__. - This does not support parsing arbitrary ISO 8601 strings - it is only intended - as the inverse operation of :meth:`datetime.isoformat`. Examples:: From webhook-mailer at python.org Mon Dec 23 09:53:22 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 23 Dec 2019 14:53:22 -0000 Subject: [Python-checkins] bpo-38914 Do not require email field in setup.py. (GH-17388) Message-ID: https://github.com/python/cpython/commit/9f9dac0a4e58d5c72aa3b644701cb155c009cb2c commit: 9f9dac0a4e58d5c72aa3b644701cb155c009cb2c branch: master author: J?rgen Gmach committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-23T06:53:18-08:00 summary: bpo-38914 Do not require email field in setup.py. (GH-17388) When checking `setup.py` and when the `author` field was provided, but the `author_email` field was missing, erroneously a warning message was displayed that the `author_email` field is required. The specs do not require the `author_email`field: https://packaging.python.org/specifications/core-metadata/#author The same is valid for `maintainer` and `maintainer_email`. The warning message has been adjusted. modified: Doc/distutils/examples.rst modified: Lib/distutils/command/check.py https://bugs.python.org/issue38914 files: A Misc/NEWS.d/next/Library/2019-11-26-23-21-56.bpo-38914.8l-g-T.rst M Doc/distutils/examples.rst M Lib/distutils/command/check.py diff --git a/Doc/distutils/examples.rst b/Doc/distutils/examples.rst index 44f70831d0bf8..e492b7f605759 100644 --- a/Doc/distutils/examples.rst +++ b/Doc/distutils/examples.rst @@ -255,7 +255,7 @@ Running the ``check`` command will display some warnings: running check warning: check: missing required meta-data: version, url warning: check: missing meta-data: either (author and author_email) or - (maintainer and maintainer_email) must be supplied + (maintainer and maintainer_email) should be supplied If you use the reStructuredText syntax in the ``long_description`` field and diff --git a/Lib/distutils/command/check.py b/Lib/distutils/command/check.py index 04c2f9642d733..7ceabd3adf22d 100644 --- a/Lib/distutils/command/check.py +++ b/Lib/distutils/command/check.py @@ -80,8 +80,11 @@ def run(self): def check_metadata(self): """Ensures that all required elements of meta-data are supplied. - name, version, URL, (author and author_email) or - (maintainer and maintainer_email)). + Required fields: + name, version, URL + + Recommended fields: + (author and author_email) or (maintainer and maintainer_email)) Warns if any are missing. """ @@ -97,15 +100,15 @@ def check_metadata(self): if metadata.author: if not metadata.author_email: self.warn("missing meta-data: if 'author' supplied, " + - "'author_email' must be supplied too") + "'author_email' should be supplied too") elif metadata.maintainer: if not metadata.maintainer_email: self.warn("missing meta-data: if 'maintainer' supplied, " + - "'maintainer_email' must be supplied too") + "'maintainer_email' should be supplied too") else: self.warn("missing meta-data: either (author and author_email) " + "or (maintainer and maintainer_email) " + - "must be supplied") + "should be supplied") def check_restructuredtext(self): """Checks if the long string fields are reST-compliant.""" diff --git a/Misc/NEWS.d/next/Library/2019-11-26-23-21-56.bpo-38914.8l-g-T.rst b/Misc/NEWS.d/next/Library/2019-11-26-23-21-56.bpo-38914.8l-g-T.rst new file mode 100644 index 0000000000000..2dfc1ea149b1b --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-11-26-23-21-56.bpo-38914.8l-g-T.rst @@ -0,0 +1,5 @@ +Adjusted the wording of the warning issued by distutils' ``check`` command when +the ``author`` and ``maintainer`` fields are supplied but no corresponding +e-mail field (``author_email`` or ``maintainer_email``) is found. The wording +now reflects the fact that these fields are suggested, but not required. Patch +by Juergen Gmach. From webhook-mailer at python.org Mon Dec 23 11:11:08 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Mon, 23 Dec 2019 16:11:08 -0000 Subject: [Python-checkins] bpo-38870: Refactor delimiting with context managers in ast.unparse (GH-17612) Message-ID: https://github.com/python/cpython/commit/4b3b1226e86df6cd45e921c8f2ad23c3639c43b2 commit: 4b3b1226e86df6cd45e921c8f2ad23c3639c43b2 branch: master author: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> committer: Pablo Galindo date: 2019-12-23T16:11:00Z summary: bpo-38870: Refactor delimiting with context managers in ast.unparse (GH-17612) Co-Authored-By: Victor Stinner Co-authored-by: Pablo Galindo files: M Lib/ast.py diff --git a/Lib/ast.py b/Lib/ast.py index ee3f74358ee12..76e0cac838b92 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -26,6 +26,7 @@ """ import sys from _ast import * +from contextlib import contextmanager, nullcontext def parse(source, filename='', mode='exec', *, @@ -613,6 +614,21 @@ def __exit__(self, exc_type, exc_value, traceback): def block(self): return self._Block(self) + @contextmanager + def delimit(self, start, end): + """A context manager for preparing the source for expressions. It adds + *start* to the buffer and enters, after exit it adds *end*.""" + + self.write(start) + yield + self.write(end) + + def delimit_if(self, start, end, condition): + if condition: + return self.delimit(start, end) + else: + return nullcontext() + def traverse(self, node): if isinstance(node, list): for item in node: @@ -636,11 +652,10 @@ def visit_Expr(self, node): self.traverse(node.value) def visit_NamedExpr(self, node): - self.write("(") - self.traverse(node.target) - self.write(" := ") - self.traverse(node.value) - self.write(")") + with self.delimit("(", ")"): + self.traverse(node.target) + self.write(" := ") + self.traverse(node.value) def visit_Import(self, node): self.fill("import ") @@ -669,11 +684,8 @@ def visit_AugAssign(self, node): def visit_AnnAssign(self, node): self.fill() - if not node.simple and isinstance(node.target, Name): - self.write("(") - self.traverse(node.target) - if not node.simple and isinstance(node.target, Name): - self.write(")") + with self.delimit_if("(", ")", not node.simple and isinstance(node.target, Name)): + self.traverse(node.target) self.write(": ") self.traverse(node.annotation) if node.value: @@ -715,28 +727,25 @@ def visit_Nonlocal(self, node): self.interleave(lambda: self.write(", "), self.write, node.names) def visit_Await(self, node): - self.write("(") - self.write("await") - if node.value: - self.write(" ") - self.traverse(node.value) - self.write(")") + with self.delimit("(", ")"): + self.write("await") + if node.value: + self.write(" ") + self.traverse(node.value) def visit_Yield(self, node): - self.write("(") - self.write("yield") - if node.value: - self.write(" ") - self.traverse(node.value) - self.write(")") + with self.delimit("(", ")"): + self.write("yield") + if node.value: + self.write(" ") + self.traverse(node.value) def visit_YieldFrom(self, node): - self.write("(") - self.write("yield from") - if node.value: - self.write(" ") - self.traverse(node.value) - self.write(")") + with self.delimit("(", ")"): + self.write("yield from") + if node.value: + self.write(" ") + self.traverse(node.value) def visit_Raise(self, node): self.fill("raise") @@ -782,21 +791,20 @@ def visit_ClassDef(self, node): self.fill("@") self.traverse(deco) self.fill("class " + node.name) - self.write("(") - comma = False - for e in node.bases: - if comma: - self.write(", ") - else: - comma = True - self.traverse(e) - for e in node.keywords: - if comma: - self.write(", ") - else: - comma = True - self.traverse(e) - self.write(")") + with self.delimit("(", ")"): + comma = False + for e in node.bases: + if comma: + self.write(", ") + else: + comma = True + self.traverse(e) + for e in node.keywords: + if comma: + self.write(", ") + else: + comma = True + self.traverse(e) with self.block(): self.traverse(node.body) @@ -812,10 +820,10 @@ def __FunctionDef_helper(self, node, fill_suffix): for deco in node.decorator_list: self.fill("@") self.traverse(deco) - def_str = fill_suffix + " " + node.name + "(" + def_str = fill_suffix + " " + node.name self.fill(def_str) - self.traverse(node.args) - self.write(")") + with self.delimit("(", ")"): + self.traverse(node.args) if node.returns: self.write(" -> ") self.traverse(node.returns) @@ -931,13 +939,12 @@ def _write_constant(self, value): def visit_Constant(self, node): value = node.value if isinstance(value, tuple): - self.write("(") - if len(value) == 1: - self._write_constant(value[0]) - self.write(",") - else: - self.interleave(lambda: self.write(", "), self._write_constant, value) - self.write(")") + with self.delimit("(", ")"): + if len(value) == 1: + self._write_constant(value[0]) + self.write(",") + else: + self.interleave(lambda: self.write(", "), self._write_constant, value) elif value is ...: self.write("...") else: @@ -946,39 +953,34 @@ def visit_Constant(self, node): self._write_constant(node.value) def visit_List(self, node): - self.write("[") - self.interleave(lambda: self.write(", "), self.traverse, node.elts) - self.write("]") + with self.delimit("[", "]"): + self.interleave(lambda: self.write(", "), self.traverse, node.elts) def visit_ListComp(self, node): - self.write("[") - self.traverse(node.elt) - for gen in node.generators: - self.traverse(gen) - self.write("]") + with self.delimit("[", "]"): + self.traverse(node.elt) + for gen in node.generators: + self.traverse(gen) def visit_GeneratorExp(self, node): - self.write("(") - self.traverse(node.elt) - for gen in node.generators: - self.traverse(gen) - self.write(")") + with self.delimit("(", ")"): + self.traverse(node.elt) + for gen in node.generators: + self.traverse(gen) def visit_SetComp(self, node): - self.write("{") - self.traverse(node.elt) - for gen in node.generators: - self.traverse(gen) - self.write("}") + with self.delimit("{", "}"): + self.traverse(node.elt) + for gen in node.generators: + self.traverse(gen) def visit_DictComp(self, node): - self.write("{") - self.traverse(node.key) - self.write(": ") - self.traverse(node.value) - for gen in node.generators: - self.traverse(gen) - self.write("}") + with self.delimit("{", "}"): + self.traverse(node.key) + self.write(": ") + self.traverse(node.value) + for gen in node.generators: + self.traverse(gen) def visit_comprehension(self, node): if node.is_async: @@ -993,24 +995,20 @@ def visit_comprehension(self, node): self.traverse(if_clause) def visit_IfExp(self, node): - self.write("(") - self.traverse(node.body) - self.write(" if ") - self.traverse(node.test) - self.write(" else ") - self.traverse(node.orelse) - self.write(")") + with self.delimit("(", ")"): + self.traverse(node.body) + self.write(" if ") + self.traverse(node.test) + self.write(" else ") + self.traverse(node.orelse) def visit_Set(self, node): if not node.elts: raise ValueError("Set node should has at least one item") - self.write("{") - self.interleave(lambda: self.write(", "), self.traverse, node.elts) - self.write("}") + with self.delimit("{", "}"): + self.interleave(lambda: self.write(", "), self.traverse, node.elts) def visit_Dict(self, node): - self.write("{") - def write_key_value_pair(k, v): self.traverse(k) self.write(": ") @@ -1026,29 +1024,27 @@ def write_item(item): else: write_key_value_pair(k, v) - self.interleave( - lambda: self.write(", "), write_item, zip(node.keys, node.values) - ) - self.write("}") + with self.delimit("{", "}"): + self.interleave( + lambda: self.write(", "), write_item, zip(node.keys, node.values) + ) def visit_Tuple(self, node): - self.write("(") - if len(node.elts) == 1: - elt = node.elts[0] - self.traverse(elt) - self.write(",") - else: - self.interleave(lambda: self.write(", "), self.traverse, node.elts) - self.write(")") + with self.delimit("(", ")"): + if len(node.elts) == 1: + elt = node.elts[0] + self.traverse(elt) + self.write(",") + else: + self.interleave(lambda: self.write(", "), self.traverse, node.elts) unop = {"Invert": "~", "Not": "not", "UAdd": "+", "USub": "-"} def visit_UnaryOp(self, node): - self.write("(") - self.write(self.unop[node.op.__class__.__name__]) - self.write(" ") - self.traverse(node.operand) - self.write(")") + with self.delimit("(", ")"): + self.write(self.unop[node.op.__class__.__name__]) + self.write(" ") + self.traverse(node.operand) binop = { "Add": "+", @@ -1067,11 +1063,10 @@ def visit_UnaryOp(self, node): } def visit_BinOp(self, node): - self.write("(") - self.traverse(node.left) - self.write(" " + self.binop[node.op.__class__.__name__] + " ") - self.traverse(node.right) - self.write(")") + with self.delimit("(", ")"): + self.traverse(node.left) + self.write(" " + self.binop[node.op.__class__.__name__] + " ") + self.traverse(node.right) cmpops = { "Eq": "==", @@ -1087,20 +1082,18 @@ def visit_BinOp(self, node): } def visit_Compare(self, node): - self.write("(") - self.traverse(node.left) - for o, e in zip(node.ops, node.comparators): - self.write(" " + self.cmpops[o.__class__.__name__] + " ") - self.traverse(e) - self.write(")") + with self.delimit("(", ")"): + self.traverse(node.left) + for o, e in zip(node.ops, node.comparators): + self.write(" " + self.cmpops[o.__class__.__name__] + " ") + self.traverse(e) - boolops = {And: "and", Or: "or"} + boolops = {"And": "and", "Or": "or"} def visit_BoolOp(self, node): - self.write("(") - s = " %s " % self.boolops[node.op.__class__] - self.interleave(lambda: self.write(s), self.traverse, node.values) - self.write(")") + with self.delimit("(", ")"): + s = " %s " % self.boolops[node.op.__class__.__name__] + self.interleave(lambda: self.write(s), self.traverse, node.values) def visit_Attribute(self, node): self.traverse(node.value) @@ -1114,27 +1107,25 @@ def visit_Attribute(self, node): def visit_Call(self, node): self.traverse(node.func) - self.write("(") - comma = False - for e in node.args: - if comma: - self.write(", ") - else: - comma = True - self.traverse(e) - for e in node.keywords: - if comma: - self.write(", ") - else: - comma = True - self.traverse(e) - self.write(")") + with self.delimit("(", ")"): + comma = False + for e in node.args: + if comma: + self.write(", ") + else: + comma = True + self.traverse(e) + for e in node.keywords: + if comma: + self.write(", ") + else: + comma = True + self.traverse(e) def visit_Subscript(self, node): self.traverse(node.value) - self.write("[") - self.traverse(node.slice) - self.write("]") + with self.delimit("[", "]"): + self.traverse(node.slice) def visit_Starred(self, node): self.write("*") @@ -1225,12 +1216,11 @@ def visit_keyword(self, node): self.traverse(node.value) def visit_Lambda(self, node): - self.write("(") - self.write("lambda ") - self.traverse(node.args) - self.write(": ") - self.traverse(node.body) - self.write(")") + with self.delimit("(", ")"): + self.write("lambda ") + self.traverse(node.args) + self.write(": ") + self.traverse(node.body) def visit_alias(self, node): self.write(node.name) From webhook-mailer at python.org Mon Dec 23 11:42:55 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Mon, 23 Dec 2019 16:42:55 -0000 Subject: [Python-checkins] Revert "bpo-38870: Remove dependency on contextlib to avoid performance regression on import (GH-17376)" (GH-17687) Message-ID: https://github.com/python/cpython/commit/d69cbeb99d5fd0d5464e937202cca6a2024d1bcf commit: d69cbeb99d5fd0d5464e937202cca6a2024d1bcf branch: master author: Pablo Galindo committer: GitHub date: 2019-12-23T16:42:48Z summary: Revert "bpo-38870: Remove dependency on contextlib to avoid performance regression on import (GH-17376)" (GH-17687) This reverts commit ded8888fbc33011dd39b7b1c86a5adfacc4943f3. files: M Lib/ast.py diff --git a/Lib/ast.py b/Lib/ast.py index 76e0cac838b92..62f6e075a09fd 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -597,22 +597,15 @@ def buffer(self): self._buffer.clear() return value - class _Block: + @contextmanager + def block(self): """A context manager for preparing the source for blocks. It adds the character':', increases the indentation on enter and decreases the indentation on exit.""" - def __init__(self, unparser): - self.unparser = unparser - - def __enter__(self): - self.unparser.write(":") - self.unparser._indent += 1 - - def __exit__(self, exc_type, exc_value, traceback): - self.unparser._indent -= 1 - - def block(self): - return self._Block(self) + self.write(":") + self._indent += 1 + yield + self._indent -= 1 @contextmanager def delimit(self, start, end): From webhook-mailer at python.org Mon Dec 23 13:31:07 2019 From: webhook-mailer at python.org (Ivan Levkivskyi) Date: Mon, 23 Dec 2019 18:31:07 -0000 Subject: [Python-checkins] [3.8] bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) (GH-17684) Message-ID: https://github.com/python/cpython/commit/0846e5d4603434c2bbf8a528677cf1ff3fe29b95 commit: 0846e5d4603434c2bbf8a528677cf1ff3fe29b95 branch: 3.8 author: Bar Harel committer: Ivan Levkivskyi date: 2019-12-23T18:31:00Z summary: [3.8] bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) (GH-17684) https://bugs.python.org/issue38878 files: A Misc/NEWS.d/next/Library/2019-11-22-12-08-52.bpo-38878.EJ0cFf.rst M Lib/os.py M Lib/test/test_os.py diff --git a/Lib/os.py b/Lib/os.py index 52d3f1d741585..253cad1a59f35 100644 --- a/Lib/os.py +++ b/Lib/os.py @@ -26,6 +26,8 @@ import sys import stat as st +from _collections_abc import _check_methods + _names = sys.builtin_module_names # Note: more names are added to __all__ later. @@ -1070,7 +1072,9 @@ def __fspath__(self): @classmethod def __subclasshook__(cls, subclass): - return hasattr(subclass, '__fspath__') + if cls is PathLike: + return _check_methods(subclass, '__fspath__') + return NotImplemented if name == 'nt': diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 4a076e3bbf542..11454b2e88ff6 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -4017,6 +4017,14 @@ def test_bad_pathlike(self): self.assertRaises(ZeroDivisionError, self.fspath, FakePath(ZeroDivisionError())) + def test_pathlike_subclasshook(self): + # bpo-38878: subclasshook causes subclass checks + # true on abstract implementation. + class A(os.PathLike): + pass + self.assertFalse(issubclass(FakePath, A)) + self.assertTrue(issubclass(FakePath, os.PathLike)) + class TimesTests(unittest.TestCase): def test_times(self): diff --git a/Misc/NEWS.d/next/Library/2019-11-22-12-08-52.bpo-38878.EJ0cFf.rst b/Misc/NEWS.d/next/Library/2019-11-22-12-08-52.bpo-38878.EJ0cFf.rst new file mode 100644 index 0000000000000..9cbdf08dd53e3 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-11-22-12-08-52.bpo-38878.EJ0cFf.rst @@ -0,0 +1,2 @@ +Fixed __subclasshook__ of :class:`os.PathLike` to return a correct result +upon inheritence. Patch by Bar Harel. From webhook-mailer at python.org Mon Dec 23 13:31:19 2019 From: webhook-mailer at python.org (Ivan Levkivskyi) Date: Mon, 23 Dec 2019 18:31:19 -0000 Subject: [Python-checkins] [3.7] bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) (GH-17685) Message-ID: https://github.com/python/cpython/commit/59d06b987db34cde8783e265709366d244c9e35b commit: 59d06b987db34cde8783e265709366d244c9e35b branch: 3.7 author: Bar Harel committer: Ivan Levkivskyi date: 2019-12-23T18:31:15Z summary: [3.7] bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) (GH-17685) https://bugs.python.org/issue38878 files: A Misc/NEWS.d/next/Library/2019-11-22-12-08-52.bpo-38878.EJ0cFf.rst M Lib/os.py M Lib/test/test_os.py diff --git a/Lib/os.py b/Lib/os.py index b93f95d98ede1..9853e37c61a20 100644 --- a/Lib/os.py +++ b/Lib/os.py @@ -26,6 +26,8 @@ import sys import stat as st +from _collections_abc import _check_methods + _names = sys.builtin_module_names # Note: more names are added to __all__ later. @@ -1076,4 +1078,6 @@ def __fspath__(self): @classmethod def __subclasshook__(cls, subclass): - return hasattr(subclass, '__fspath__') + if cls is PathLike: + return _check_methods(subclass, '__fspath__') + return NotImplemented diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index df4bad7a8cf7d..411e5aa507389 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -3745,6 +3745,14 @@ def test_bad_pathlike(self): self.assertRaises(ZeroDivisionError, self.fspath, FakePath(ZeroDivisionError())) + def test_pathlike_subclasshook(self): + # bpo-38878: subclasshook causes subclass checks + # true on abstract implementation. + class A(os.PathLike): + pass + self.assertFalse(issubclass(FakePath, A)) + self.assertTrue(issubclass(FakePath, os.PathLike)) + class TimesTests(unittest.TestCase): def test_times(self): diff --git a/Misc/NEWS.d/next/Library/2019-11-22-12-08-52.bpo-38878.EJ0cFf.rst b/Misc/NEWS.d/next/Library/2019-11-22-12-08-52.bpo-38878.EJ0cFf.rst new file mode 100644 index 0000000000000..9cbdf08dd53e3 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-11-22-12-08-52.bpo-38878.EJ0cFf.rst @@ -0,0 +1,2 @@ +Fixed __subclasshook__ of :class:`os.PathLike` to return a correct result +upon inheritence. Patch by Bar Harel. From webhook-mailer at python.org Tue Dec 24 05:46:46 2019 From: webhook-mailer at python.org (Andrew Svetlov) Date: Tue, 24 Dec 2019 10:46:46 -0000 Subject: [Python-checkins] Fix import path for asyncio.TimeoutError (#17691) Message-ID: https://github.com/python/cpython/commit/025eeaa19607b2a80c979668dad405f567444573 commit: 025eeaa19607b2a80c979668dad405f567444573 branch: master author: Andrew Svetlov committer: GitHub date: 2019-12-24T12:46:42+02:00 summary: Fix import path for asyncio.TimeoutError (#17691) files: A Misc/NEWS.d/next/Library/2019-12-24-10-43-13.bpo-39129.jVx5rW.rst M Lib/asyncio/staggered.py diff --git a/Lib/asyncio/staggered.py b/Lib/asyncio/staggered.py index 27c665a9910ab..451a53a16f383 100644 --- a/Lib/asyncio/staggered.py +++ b/Lib/asyncio/staggered.py @@ -6,7 +6,7 @@ import typing from . import events -from . import futures +from . import exceptions as exceptions_mod from . import locks from . import tasks @@ -83,7 +83,7 @@ previous_failed: typing.Optional[locks.Event]) -> None: # Wait for the previous task to finish, or for delay seconds if previous_failed is not None: - with contextlib.suppress(futures.TimeoutError): + with contextlib.suppress(exceptions_mod.TimeoutError): # Use asyncio.wait_for() instead of asyncio.wait() here, so # that if we get cancelled at this point, Event.wait() is also # cancelled, otherwise there will be a "Task destroyed but it is diff --git a/Misc/NEWS.d/next/Library/2019-12-24-10-43-13.bpo-39129.jVx5rW.rst b/Misc/NEWS.d/next/Library/2019-12-24-10-43-13.bpo-39129.jVx5rW.rst new file mode 100644 index 0000000000000..6667697671a28 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-24-10-43-13.bpo-39129.jVx5rW.rst @@ -0,0 +1 @@ +Fix import path for ``asyncio.TimeoutError`` From webhook-mailer at python.org Tue Dec 24 06:04:16 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 24 Dec 2019 11:04:16 -0000 Subject: [Python-checkins] Fix import path for asyncio.TimeoutError (GH-17691) Message-ID: https://github.com/python/cpython/commit/4ed79b78002d1c1bca8ea72aaadea07710aca4e9 commit: 4ed79b78002d1c1bca8ea72aaadea07710aca4e9 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-24T03:04:12-08:00 summary: Fix import path for asyncio.TimeoutError (GH-17691) (cherry picked from commit 025eeaa19607b2a80c979668dad405f567444573) Co-authored-by: Andrew Svetlov files: A Misc/NEWS.d/next/Library/2019-12-24-10-43-13.bpo-39129.jVx5rW.rst M Lib/asyncio/staggered.py diff --git a/Lib/asyncio/staggered.py b/Lib/asyncio/staggered.py index 27c665a9910ab..451a53a16f383 100644 --- a/Lib/asyncio/staggered.py +++ b/Lib/asyncio/staggered.py @@ -6,7 +6,7 @@ import typing from . import events -from . import futures +from . import exceptions as exceptions_mod from . import locks from . import tasks @@ -83,7 +83,7 @@ previous_failed: typing.Optional[locks.Event]) -> None: # Wait for the previous task to finish, or for delay seconds if previous_failed is not None: - with contextlib.suppress(futures.TimeoutError): + with contextlib.suppress(exceptions_mod.TimeoutError): # Use asyncio.wait_for() instead of asyncio.wait() here, so # that if we get cancelled at this point, Event.wait() is also # cancelled, otherwise there will be a "Task destroyed but it is diff --git a/Misc/NEWS.d/next/Library/2019-12-24-10-43-13.bpo-39129.jVx5rW.rst b/Misc/NEWS.d/next/Library/2019-12-24-10-43-13.bpo-39129.jVx5rW.rst new file mode 100644 index 0000000000000..6667697671a28 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-24-10-43-13.bpo-39129.jVx5rW.rst @@ -0,0 +1 @@ +Fix import path for ``asyncio.TimeoutError`` From webhook-mailer at python.org Tue Dec 24 23:26:00 2019 From: webhook-mailer at python.org (Benjamin Peterson) Date: Wed, 25 Dec 2019 04:26:00 -0000 Subject: [Python-checkins] Minor C API documentation improvements. (GH-17696) Message-ID: https://github.com/python/cpython/commit/5c7ed7550ec2da16d7679e538fcd7c1a5631811f commit: 5c7ed7550ec2da16d7679e538fcd7c1a5631811f branch: master author: William Ayd committer: Benjamin Peterson date: 2019-12-24T22:25:56-06:00 summary: Minor C API documentation improvements. (GH-17696) The added parentheses around the PyIter_Next assignment suppress the following warning which gcc throws without: ``` warning: using the result of an assignment as a condition without parentheses [-Wparentheses] ``` The other change is a typo fix files: M Doc/c-api/iter.rst M Doc/includes/custom.c diff --git a/Doc/c-api/iter.rst b/Doc/c-api/iter.rst index 0224d37f1a41a..a2992b3452f91 100644 --- a/Doc/c-api/iter.rst +++ b/Doc/c-api/iter.rst @@ -29,7 +29,7 @@ something like this:: /* propagate error */ } - while (item = PyIter_Next(iterator)) { + while ((item = PyIter_Next(iterator))) { /* do something with item */ ... /* release reference when done */ diff --git a/Doc/includes/custom.c b/Doc/includes/custom.c index bda32e2ad81d4..f361baf830dd1 100644 --- a/Doc/includes/custom.c +++ b/Doc/includes/custom.c @@ -37,7 +37,7 @@ PyInit_custom(void) Py_INCREF(&CustomType); if (PyModule_AddObject(m, "Custom", (PyObject *) &CustomType) < 0) { Py_DECREF(&CustomType); - PY_DECREF(m); + Py_DECREF(m); return NULL; } From webhook-mailer at python.org Tue Dec 24 23:34:42 2019 From: webhook-mailer at python.org (Benjamin Peterson) Date: Wed, 25 Dec 2019 04:34:42 -0000 Subject: [Python-checkins] [2.7] Minor C API documentation improvements. (GH-17699) Message-ID: https://github.com/python/cpython/commit/362ede2232107fc54d406bb9de7711ff7574e1d4 commit: 362ede2232107fc54d406bb9de7711ff7574e1d4 branch: 2.7 author: Benjamin Peterson committer: GitHub date: 2019-12-24T22:34:38-06:00 summary: [2.7] Minor C API documentation improvements. (GH-17699) (cherry picked from commit 5c7ed7550ec2da16d7679e538fcd7c1a5631811f) Co-authored-by: William Ayd files: M Doc/c-api/iter.rst diff --git a/Doc/c-api/iter.rst b/Doc/c-api/iter.rst index fb2a71cf1a825..4f708829a89e4 100644 --- a/Doc/c-api/iter.rst +++ b/Doc/c-api/iter.rst @@ -36,7 +36,7 @@ something like this:: /* propagate error */ } - while (item = PyIter_Next(iterator)) { + while ((item = PyIter_Next(iterator))) { /* do something with item */ ... /* release reference when done */ From webhook-mailer at python.org Tue Dec 24 23:35:05 2019 From: webhook-mailer at python.org (Benjamin Peterson) Date: Wed, 25 Dec 2019 04:35:05 -0000 Subject: [Python-checkins] Minor C API documentation improvements. (GH-17697) Message-ID: https://github.com/python/cpython/commit/e9039f32b3e8b827106cf74db80fbf9477035687 commit: e9039f32b3e8b827106cf74db80fbf9477035687 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Benjamin Peterson date: 2019-12-24T22:35:01-06:00 summary: Minor C API documentation improvements. (GH-17697) The added parentheses around the PyIter_Next assignment suppress the following warning which gcc throws without: ``` warning: using the result of an assignment as a condition without parentheses [-Wparentheses] ``` The other change is a typo fix (cherry picked from commit 5c7ed7550ec2da16d7679e538fcd7c1a5631811f) Co-authored-by: William Ayd files: M Doc/c-api/iter.rst M Doc/includes/custom.c diff --git a/Doc/c-api/iter.rst b/Doc/c-api/iter.rst index 0224d37f1a41a..a2992b3452f91 100644 --- a/Doc/c-api/iter.rst +++ b/Doc/c-api/iter.rst @@ -29,7 +29,7 @@ something like this:: /* propagate error */ } - while (item = PyIter_Next(iterator)) { + while ((item = PyIter_Next(iterator))) { /* do something with item */ ... /* release reference when done */ diff --git a/Doc/includes/custom.c b/Doc/includes/custom.c index bda32e2ad81d4..f361baf830dd1 100644 --- a/Doc/includes/custom.c +++ b/Doc/includes/custom.c @@ -37,7 +37,7 @@ PyInit_custom(void) Py_INCREF(&CustomType); if (PyModule_AddObject(m, "Custom", (PyObject *) &CustomType) < 0) { Py_DECREF(&CustomType); - PY_DECREF(m); + Py_DECREF(m); return NULL; } From webhook-mailer at python.org Tue Dec 24 23:35:24 2019 From: webhook-mailer at python.org (Benjamin Peterson) Date: Wed, 25 Dec 2019 04:35:24 -0000 Subject: [Python-checkins] Minor C API documentation improvements. (GH-17698) Message-ID: https://github.com/python/cpython/commit/090bc148834aa4c92c683c2c07be572c31dd1b68 commit: 090bc148834aa4c92c683c2c07be572c31dd1b68 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Benjamin Peterson date: 2019-12-24T22:35:20-06:00 summary: Minor C API documentation improvements. (GH-17698) The added parentheses around the PyIter_Next assignment suppress the following warning which gcc throws without: ``` warning: using the result of an assignment as a condition without parentheses [-Wparentheses] ``` The other change is a typo fix (cherry picked from commit 5c7ed7550ec2da16d7679e538fcd7c1a5631811f) Co-authored-by: William Ayd files: M Doc/c-api/iter.rst M Doc/includes/custom.c diff --git a/Doc/c-api/iter.rst b/Doc/c-api/iter.rst index 62ca082713b68..6507da9c7f0a5 100644 --- a/Doc/c-api/iter.rst +++ b/Doc/c-api/iter.rst @@ -29,7 +29,7 @@ something like this:: /* propagate error */ } - while (item = PyIter_Next(iterator)) { + while ((item = PyIter_Next(iterator))) { /* do something with item */ ... /* release reference when done */ diff --git a/Doc/includes/custom.c b/Doc/includes/custom.c index bda32e2ad81d4..f361baf830dd1 100644 --- a/Doc/includes/custom.c +++ b/Doc/includes/custom.c @@ -37,7 +37,7 @@ PyInit_custom(void) Py_INCREF(&CustomType); if (PyModule_AddObject(m, "Custom", (PyObject *) &CustomType) < 0) { Py_DECREF(&CustomType); - PY_DECREF(m); + Py_DECREF(m); return NULL; } From webhook-mailer at python.org Tue Dec 24 23:42:28 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Wed, 25 Dec 2019 04:42:28 -0000 Subject: [Python-checkins] bpo-38753: AsyncMock added in version 3.8 (GH-17102) Message-ID: https://github.com/python/cpython/commit/8c0f0016e2d39f86589187db75012238c4e760e9 commit: 8c0f0016e2d39f86589187db75012238c4e760e9 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-24T20:42:24-08:00 summary: bpo-38753: AsyncMock added in version 3.8 (GH-17102) (cherry picked from commit 279d8df5e5e8bbd4429420649359f7afcb4c8cce) Co-authored-by: John Belmonte files: M Doc/library/unittest.mock.rst diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst index ebfaf7d643956..e92f5545d3eb0 100644 --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -915,6 +915,7 @@ object:: >>> mock.async_foo + .. versionadded:: 3.8 .. method:: assert_awaited() From webhook-mailer at python.org Wed Dec 25 06:25:44 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Wed, 25 Dec 2019 11:25:44 -0000 Subject: [Python-checkins] Update 3.9.0a2.rst - correct small typos (GH-17665) Message-ID: https://github.com/python/cpython/commit/dd117c33a83ae0a7532848d3e0b8d96b098c9c46 commit: dd117c33a83ae0a7532848d3e0b8d96b098c9c46 branch: master author: toonarmycaptain committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-25T03:25:36-08:00 summary: Update 3.9.0a2.rst - correct small typos (GH-17665) Small typo/formatting corrections. `whethen` -> `whether` `exaustion' -> `exhaustion` Assorted appending periods `.` and slight reformattings to place `Path contributed by` on the same line as description, matching the majority of document. NB Some of these might need to be backported, as I saw the first error in the [changelog for 3.8.1](https://docs.python.org/3.8/whatsnew/changelog.html#python-3-8-1) files: M Misc/NEWS.d/3.9.0a2.rst diff --git a/Misc/NEWS.d/3.9.0a2.rst b/Misc/NEWS.d/3.9.0a2.rst index a418fe0ef80b2..074e80fbb1e3a 100644 --- a/Misc/NEWS.d/3.9.0a2.rst +++ b/Misc/NEWS.d/3.9.0a2.rst @@ -81,7 +81,7 @@ sys.argv to be unmodified. .. section: Core and Builtins :c:func:`PySys_Audit` now requires ``Py_ssize_t`` to be used for size -arguments in the format string, regardless of whethen ``PY_SSIZE_T_CLEAN`` +arguments in the format string, regardless of whether ``PY_SSIZE_T_CLEAN`` was defined at include time. .. @@ -112,7 +112,7 @@ event. .. section: Core and Builtins Add audit hooks for when :func:`sys.excepthook` and -:func:`sys.unraisablehook` are invoked +:func:`sys.unraisablehook` are invoked. .. @@ -215,9 +215,7 @@ Patch by hongweipeng. .. section: Core and Builtins Provide a platform tag for AIX that is sufficient for PEP425 binary -distribution identification. - -Patch by Michael Felt +distribution identification. Patch by Michael Felt. .. @@ -300,7 +298,7 @@ parsing the header. .. nonce: IJYhz_ .. section: Library -Implement ``__class_getitem__`` for ``os.PathLike``, ``pathlib.Path`` +Implement ``__class_getitem__`` for ``os.PathLike``, ``pathlib.Path``. .. @@ -402,7 +400,7 @@ locale encoding is not UTF-8. .. nonce: WZnAPQ .. section: Library -Prevent UnboundLocalError to pop up in parse_message_id +Prevent UnboundLocalError to pop up in parse_message_id. parse_message_id() was improperly using a token defined inside an exception handler, which was raising `UnboundLocalError` on parsing an invalid value. @@ -444,7 +442,7 @@ random.choices() now raises a ValueError when all the weights are zero. .. section: Library Raise pickle.UnpicklingError when loading an item from memo for invalid -input +input. The previous code was raising a `KeyError` for both the Python and C implementation. This was caused by the specified index of an invalid input @@ -506,7 +504,7 @@ by Pablo Galindo and Batuhan Taskaya. .. nonce: AZUzL8 .. section: Library -AsyncMock now returns StopAsyncIteration on the exaustion of a side_effects +AsyncMock now returns StopAsyncIteration on the exhaustion of a side_effects iterable. Since PEP-479 its Impossible to raise a StopIteration exception from a coroutine. From webhook-mailer at python.org Wed Dec 25 10:39:43 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Wed, 25 Dec 2019 15:39:43 -0000 Subject: [Python-checkins] Fix the miscellaneous typo (GH-17700) Message-ID: https://github.com/python/cpython/commit/527f9de6efdcf09983d0764be0b978ddc1fd1653 commit: 527f9de6efdcf09983d0764be0b978ddc1fd1653 branch: master author: cocoatomo committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-25T07:39:35-08:00 summary: Fix the miscellaneous typo (GH-17700) A character "i" is omitted. files: M Doc/c-api/code.rst diff --git a/Doc/c-api/code.rst b/Doc/c-api/code.rst index 45a6b4a753a72..6f8c41ccbf6e8 100644 --- a/Doc/c-api/code.rst +++ b/Doc/c-api/code.rst @@ -42,7 +42,7 @@ bound into a function. .. c:function:: PyCodeObject* PyCode_NewWithPosOnlyArgs(int argcount, int posonlyargcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab) - Similar to :c:func:`PyCode_New`, but with an extra "posonlyargcount" for positonal-only arguments. + Similar to :c:func:`PyCode_New`, but with an extra "posonlyargcount" for positional-only arguments. .. versionadded:: 3.8 From webhook-mailer at python.org Wed Dec 25 10:45:56 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Wed, 25 Dec 2019 15:45:56 -0000 Subject: [Python-checkins] Fix the miscellaneous typo (GH-17700) Message-ID: https://github.com/python/cpython/commit/ff67612fa3c947c1dcc0a4cb0b55ee472b7edc66 commit: ff67612fa3c947c1dcc0a4cb0b55ee472b7edc66 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-25T07:45:52-08:00 summary: Fix the miscellaneous typo (GH-17700) A character "i" is omitted. (cherry picked from commit 527f9de6efdcf09983d0764be0b978ddc1fd1653) Co-authored-by: cocoatomo files: M Doc/c-api/code.rst diff --git a/Doc/c-api/code.rst b/Doc/c-api/code.rst index 45a6b4a753a72..6f8c41ccbf6e8 100644 --- a/Doc/c-api/code.rst +++ b/Doc/c-api/code.rst @@ -42,7 +42,7 @@ bound into a function. .. c:function:: PyCodeObject* PyCode_NewWithPosOnlyArgs(int argcount, int posonlyargcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab) - Similar to :c:func:`PyCode_New`, but with an extra "posonlyargcount" for positonal-only arguments. + Similar to :c:func:`PyCode_New`, but with an extra "posonlyargcount" for positional-only arguments. .. versionadded:: 3.8 From webhook-mailer at python.org Wed Dec 25 17:45:43 2019 From: webhook-mailer at python.org (Eric V. Smith) Date: Wed, 25 Dec 2019 22:45:43 -0000 Subject: [Python-checkins] bpo-33961: Adjusted dataclasses docs to correct exceptions raised. (GH-7917) (GH-17677) Message-ID: https://github.com/python/cpython/commit/e28aff54d95236ea1b64b648d89a1516e446e621 commit: e28aff54d95236ea1b64b648d89a1516e446e621 branch: master author: Fabio Sangiovanni <4040184+sanjioh at users.noreply.github.com> committer: Eric V. Smith date: 2019-12-25T17:45:30-05:00 summary: bpo-33961: Adjusted dataclasses docs to correct exceptions raised. (GH-7917) (GH-17677) files: M Doc/library/dataclasses.rst diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index 71768abf80c47..c125a1130a960 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -60,8 +60,9 @@ Module-level decorators, classes, and functions The :func:`dataclass` decorator will add various "dunder" methods to the class, described below. If any of the added methods already - exist on the class, a :exc:`TypeError` will be raised. The decorator - returns the same class that is called on: no new class is created. + exist on the class, the behavior depends on the parameter, as documented + below. The decorator returns the same class that is called on; no new + class is created. If :func:`dataclass` is used just as a simple decorator with no parameters, it acts as if it has the default values documented in this @@ -115,7 +116,7 @@ Module-level decorators, classes, and functions If the class already defines any of :meth:`__lt__`, :meth:`__le__`, :meth:`__gt__`, or :meth:`__ge__`, then - :exc:`ValueError` is raised. + :exc:`TypeError` is raised. - ``unsafe_hash``: If ``False`` (the default), a :meth:`__hash__` method is generated according to how ``eq`` and ``frozen`` are set. From webhook-mailer at python.org Wed Dec 25 17:51:28 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Wed, 25 Dec 2019 22:51:28 -0000 Subject: [Python-checkins] bpo-33961: Adjusted dataclasses docs to correct exceptions raised. (GH-7917) (GH-17677) Message-ID: https://github.com/python/cpython/commit/a5deabd8e43a76bf2d7923342b6c4395c1a5efcd commit: a5deabd8e43a76bf2d7923342b6c4395c1a5efcd branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-25T14:51:22-08:00 summary: bpo-33961: Adjusted dataclasses docs to correct exceptions raised. (GH-7917) (GH-17677) (cherry picked from commit e28aff54d95236ea1b64b648d89a1516e446e621) Co-authored-by: Fabio Sangiovanni <4040184+sanjioh at users.noreply.github.com> files: M Doc/library/dataclasses.rst diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index 9aa4a19d57ac7..37258d4ebc738 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -60,8 +60,9 @@ Module-level decorators, classes, and functions The :func:`dataclass` decorator will add various "dunder" methods to the class, described below. If any of the added methods already - exist on the class, a :exc:`TypeError` will be raised. The decorator - returns the same class that is called on: no new class is created. + exist on the class, the behavior depends on the parameter, as documented + below. The decorator returns the same class that is called on; no new + class is created. If :func:`dataclass` is used just as a simple decorator with no parameters, it acts as if it has the default values documented in this @@ -115,7 +116,7 @@ Module-level decorators, classes, and functions If the class already defines any of :meth:`__lt__`, :meth:`__le__`, :meth:`__gt__`, or :meth:`__ge__`, then - :exc:`ValueError` is raised. + :exc:`TypeError` is raised. - ``unsafe_hash``: If ``False`` (the default), a :meth:`__hash__` method is generated according to how ``eq`` and ``frozen`` are set. From webhook-mailer at python.org Thu Dec 26 09:22:45 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Thu, 26 Dec 2019 14:22:45 -0000 Subject: [Python-checkins] Update 3.9.0a2.rst (GH-17703) Message-ID: https://github.com/python/cpython/commit/03c8e5d46673e4704c8dc955d52735966ffdc2a4 commit: 03c8e5d46673e4704c8dc955d52735966ffdc2a4 branch: master author: Aurora Lanes <58722611+opensource-assist at users.noreply.github.com> committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-26T06:22:13-08:00 summary: Update 3.9.0a2.rst (GH-17703) Fixed small grammatical issue Automerge-Triggered-By: @Mariatta files: M Misc/NEWS.d/3.9.0a2.rst diff --git a/Misc/NEWS.d/3.9.0a2.rst b/Misc/NEWS.d/3.9.0a2.rst index 074e80fbb1e3a..1919ccb560402 100644 --- a/Misc/NEWS.d/3.9.0a2.rst +++ b/Misc/NEWS.d/3.9.0a2.rst @@ -257,7 +257,7 @@ Fix :exc:`NameError` in :mod:`zipimport`. Patch by Karthikeyan Singaravelan. .. nonce: QDtIxI .. section: Library -Update importliib.metadata to include improvements from importlib_metadata +Update importlib.metadata to include improvements from importlib_metadata 1.3 including better serialization of EntryPoints and improved documentation for custom finders. From webhook-mailer at python.org Thu Dec 26 16:56:47 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Thu, 26 Dec 2019 21:56:47 -0000 Subject: [Python-checkins] Update what's new with the latest GC improvements (GH-17708) Message-ID: https://github.com/python/cpython/commit/f460eea5c5cd555dfdc29558cb990addc5bd35aa commit: f460eea5c5cd555dfdc29558cb990addc5bd35aa branch: master author: Pablo Galindo committer: GitHub date: 2019-12-26T21:56:40Z summary: Update what's new with the latest GC improvements (GH-17708) files: M Doc/whatsnew/3.9.rst diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index 64361bb17f8a4..b315604af5110 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -159,6 +159,14 @@ Added constants :data:`~fcntl.F_OFD_GETLK`, :data:`~fcntl.F_OFD_SETLK` and :data:`~fcntl.F_OFD_SETLKW`. (Contributed by Dong-hee Na in :issue:`38602`.) +gc +-- + +When the garbage collector makes a collection in which some objects resurrect +(they are reachable from outside the isolated cycles after the finalizers have +been executed), do not block the collection of all objects that are still +unreachable. (Contributed by Pablo Galindo and Tim Peters in :issue:`38379`.) + os -- From webhook-mailer at python.org Thu Dec 26 21:51:46 2019 From: webhook-mailer at python.org (Benjamin Peterson) Date: Fri, 27 Dec 2019 02:51:46 -0000 Subject: [Python-checkins] closes bpo-30364: Replace deprecated no_address_safety_analysis attribute. (GH-17702) Message-ID: https://github.com/python/cpython/commit/c0052f3fe3d19820b2d4f76e383035439affe32c commit: c0052f3fe3d19820b2d4f76e383035439affe32c branch: master author: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> committer: Benjamin Peterson date: 2019-12-26T20:51:34-06:00 summary: closes bpo-30364: Replace deprecated no_address_safety_analysis attribute. (GH-17702) files: M Objects/obmalloc.c diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index 722e91e3db440..3881ff17e0642 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -31,8 +31,8 @@ static void _PyMem_SetupDebugHooksDomain(PyMemAllocatorDomain domain); #if defined(__has_feature) /* Clang */ # if __has_feature(address_sanitizer) /* is ASAN enabled? */ -# define _Py_NO_ADDRESS_SAFETY_ANALYSIS \ - __attribute__((no_address_safety_analysis)) +# define _Py_NO_SANITIZE_ADDRESS \ + __attribute__((no_sanitize("address"))) # endif # if __has_feature(thread_sanitizer) /* is TSAN enabled? */ # define _Py_NO_SANITIZE_THREAD __attribute__((no_sanitize_thread)) @@ -42,8 +42,8 @@ static void _PyMem_SetupDebugHooksDomain(PyMemAllocatorDomain domain); # endif #elif defined(__GNUC__) # if defined(__SANITIZE_ADDRESS__) /* GCC 4.8+, is ASAN enabled? */ -# define _Py_NO_ADDRESS_SAFETY_ANALYSIS \ - __attribute__((no_address_safety_analysis)) +# define _Py_NO_SANITIZE_ADDRESS \ + __attribute__((no_sanitize_address)) # endif // TSAN is supported since GCC 5.1, but __SANITIZE_THREAD__ macro // is provided only since GCC 7. @@ -52,8 +52,8 @@ static void _PyMem_SetupDebugHooksDomain(PyMemAllocatorDomain domain); # endif #endif -#ifndef _Py_NO_ADDRESS_SAFETY_ANALYSIS -# define _Py_NO_ADDRESS_SAFETY_ANALYSIS +#ifndef _Py_NO_SANITIZE_ADDRESS +# define _Py_NO_SANITIZE_ADDRESS #endif #ifndef _Py_NO_SANITIZE_THREAD # define _Py_NO_SANITIZE_THREAD @@ -1407,7 +1407,7 @@ obmalloc controls. Since this test is needed at every entry point, it's extremely desirable that it be this fast. */ -static bool _Py_NO_ADDRESS_SAFETY_ANALYSIS +static bool _Py_NO_SANITIZE_ADDRESS _Py_NO_SANITIZE_THREAD _Py_NO_SANITIZE_MEMORY address_in_range(void *p, poolp pool) From webhook-mailer at python.org Thu Dec 26 22:01:16 2019 From: webhook-mailer at python.org (Benjamin Peterson) Date: Fri, 27 Dec 2019 03:01:16 -0000 Subject: [Python-checkins] closes bpo-39135: Remove 'time.clock()' mention in docs. (GH17709) Message-ID: https://github.com/python/cpython/commit/91874bb07161bb481b6f5ea18ffafe69cb8cac30 commit: 91874bb07161bb481b6f5ea18ffafe69cb8cac30 branch: master author: Michael Wayne Goodman committer: Benjamin Peterson date: 2019-12-26T21:01:08-06:00 summary: closes bpo-39135: Remove 'time.clock()' mention in docs. (GH17709) `time.clock()` was removed in Python 3.8, but it was still mentioned in the documentation for when `time.get_clock_info()` is given the argument `'clock'`. This commit removes that mention. files: M Doc/library/time.rst diff --git a/Doc/library/time.rst b/Doc/library/time.rst index e628ac44e8064..6842e9075e1a6 100644 --- a/Doc/library/time.rst +++ b/Doc/library/time.rst @@ -218,7 +218,6 @@ Functions Supported clock names and the corresponding functions to read their value are: - * ``'clock'``: :func:`time.clock` * ``'monotonic'``: :func:`time.monotonic` * ``'perf_counter'``: :func:`time.perf_counter` * ``'process_time'``: :func:`time.process_time` From webhook-mailer at python.org Thu Dec 26 22:07:28 2019 From: webhook-mailer at python.org (Benjamin Peterson) Date: Fri, 27 Dec 2019 03:07:28 -0000 Subject: [Python-checkins] [3.8] closes bpo-39135: Remove 'time.clock()' mention in docs. (GH-17713) Message-ID: https://github.com/python/cpython/commit/b9b92d34646d6a1fca120f98476912f5e4ca7f34 commit: b9b92d34646d6a1fca120f98476912f5e4ca7f34 branch: 3.8 author: Benjamin Peterson committer: GitHub date: 2019-12-26T21:07:21-06:00 summary: [3.8] closes bpo-39135: Remove 'time.clock()' mention in docs. (GH-17713) `time.clock()` was removed in Python 3.8, but it was still mentioned in the documentation for when `time.get_clock_info()` is given the argument `'clock'`. This commit removes that mention. (cherry picked from commit 91874bb07161bb481b6f5ea18ffafe69cb8cac30) Co-authored-by: Michael Wayne Goodman files: M Doc/library/time.rst diff --git a/Doc/library/time.rst b/Doc/library/time.rst index e628ac44e8064..6842e9075e1a6 100644 --- a/Doc/library/time.rst +++ b/Doc/library/time.rst @@ -218,7 +218,6 @@ Functions Supported clock names and the corresponding functions to read their value are: - * ``'clock'``: :func:`time.clock` * ``'monotonic'``: :func:`time.monotonic` * ``'perf_counter'``: :func:`time.perf_counter` * ``'process_time'``: :func:`time.process_time` From webhook-mailer at python.org Thu Dec 26 22:08:34 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Fri, 27 Dec 2019 03:08:34 -0000 Subject: [Python-checkins] closes bpo-30364: Replace deprecated no_address_safety_analysis attribute. (GH-17702) Message-ID: https://github.com/python/cpython/commit/5641b6d3115f1c2700d2f84216710d3778a23d02 commit: 5641b6d3115f1c2700d2f84216710d3778a23d02 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-26T19:08:30-08:00 summary: closes bpo-30364: Replace deprecated no_address_safety_analysis attribute. (GH-17702) (cherry picked from commit c0052f3fe3d19820b2d4f76e383035439affe32c) Co-authored-by: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> files: M Objects/obmalloc.c diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index 1248a3937e0d4..9408855383cac 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -30,8 +30,8 @@ static void _PyMem_SetupDebugHooksDomain(PyMemAllocatorDomain domain); #if defined(__has_feature) /* Clang */ # if __has_feature(address_sanitizer) /* is ASAN enabled? */ -# define _Py_NO_ADDRESS_SAFETY_ANALYSIS \ - __attribute__((no_address_safety_analysis)) +# define _Py_NO_SANITIZE_ADDRESS \ + __attribute__((no_sanitize("address"))) # endif # if __has_feature(thread_sanitizer) /* is TSAN enabled? */ # define _Py_NO_SANITIZE_THREAD __attribute__((no_sanitize_thread)) @@ -41,8 +41,8 @@ static void _PyMem_SetupDebugHooksDomain(PyMemAllocatorDomain domain); # endif #elif defined(__GNUC__) # if defined(__SANITIZE_ADDRESS__) /* GCC 4.8+, is ASAN enabled? */ -# define _Py_NO_ADDRESS_SAFETY_ANALYSIS \ - __attribute__((no_address_safety_analysis)) +# define _Py_NO_SANITIZE_ADDRESS \ + __attribute__((no_sanitize_address)) # endif // TSAN is supported since GCC 5.1, but __SANITIZE_THREAD__ macro // is provided only since GCC 7. @@ -51,8 +51,8 @@ static void _PyMem_SetupDebugHooksDomain(PyMemAllocatorDomain domain); # endif #endif -#ifndef _Py_NO_ADDRESS_SAFETY_ANALYSIS -# define _Py_NO_ADDRESS_SAFETY_ANALYSIS +#ifndef _Py_NO_SANITIZE_ADDRESS +# define _Py_NO_SANITIZE_ADDRESS #endif #ifndef _Py_NO_SANITIZE_THREAD # define _Py_NO_SANITIZE_THREAD @@ -1350,7 +1350,7 @@ obmalloc controls. Since this test is needed at every entry point, it's extremely desirable that it be this fast. */ -static bool _Py_NO_ADDRESS_SAFETY_ANALYSIS +static bool _Py_NO_SANITIZE_ADDRESS _Py_NO_SANITIZE_THREAD _Py_NO_SANITIZE_MEMORY address_in_range(void *p, poolp pool) From webhook-mailer at python.org Thu Dec 26 22:10:56 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Fri, 27 Dec 2019 03:10:56 -0000 Subject: [Python-checkins] closes bpo-30364: Replace deprecated no_address_safety_analysis attribute. (GH-17702) Message-ID: https://github.com/python/cpython/commit/5dd1909680a5be76397b19bc235a8205b79787c7 commit: 5dd1909680a5be76397b19bc235a8205b79787c7 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-26T19:10:52-08:00 summary: closes bpo-30364: Replace deprecated no_address_safety_analysis attribute. (GH-17702) (cherry picked from commit c0052f3fe3d19820b2d4f76e383035439affe32c) Co-authored-by: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> files: M Objects/obmalloc.c diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index bd6480a625e8a..c483ff3e3b701 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -31,8 +31,8 @@ static void _PyMem_SetupDebugHooksDomain(PyMemAllocatorDomain domain); #if defined(__has_feature) /* Clang */ # if __has_feature(address_sanitizer) /* is ASAN enabled? */ -# define _Py_NO_ADDRESS_SAFETY_ANALYSIS \ - __attribute__((no_address_safety_analysis)) +# define _Py_NO_SANITIZE_ADDRESS \ + __attribute__((no_sanitize("address"))) # endif # if __has_feature(thread_sanitizer) /* is TSAN enabled? */ # define _Py_NO_SANITIZE_THREAD __attribute__((no_sanitize_thread)) @@ -42,8 +42,8 @@ static void _PyMem_SetupDebugHooksDomain(PyMemAllocatorDomain domain); # endif #elif defined(__GNUC__) # if defined(__SANITIZE_ADDRESS__) /* GCC 4.8+, is ASAN enabled? */ -# define _Py_NO_ADDRESS_SAFETY_ANALYSIS \ - __attribute__((no_address_safety_analysis)) +# define _Py_NO_SANITIZE_ADDRESS \ + __attribute__((no_sanitize_address)) # endif // TSAN is supported since GCC 5.1, but __SANITIZE_THREAD__ macro // is provided only since GCC 7. @@ -52,8 +52,8 @@ static void _PyMem_SetupDebugHooksDomain(PyMemAllocatorDomain domain); # endif #endif -#ifndef _Py_NO_ADDRESS_SAFETY_ANALYSIS -# define _Py_NO_ADDRESS_SAFETY_ANALYSIS +#ifndef _Py_NO_SANITIZE_ADDRESS +# define _Py_NO_SANITIZE_ADDRESS #endif #ifndef _Py_NO_SANITIZE_THREAD # define _Py_NO_SANITIZE_THREAD @@ -1388,7 +1388,7 @@ obmalloc controls. Since this test is needed at every entry point, it's extremely desirable that it be this fast. */ -static bool _Py_NO_ADDRESS_SAFETY_ANALYSIS +static bool _Py_NO_SANITIZE_ADDRESS _Py_NO_SANITIZE_THREAD _Py_NO_SANITIZE_MEMORY address_in_range(void *p, poolp pool) From webhook-mailer at python.org Fri Dec 27 16:56:01 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Fri, 27 Dec 2019 21:56:01 -0000 Subject: [Python-checkins] Move comment about permanent generation to gcmodule.c (GH-17718) Message-ID: https://github.com/python/cpython/commit/90913985b62845a58f6b9e815121bcf614bd107f commit: 90913985b62845a58f6b9e815121bcf614bd107f branch: master author: Pablo Galindo committer: GitHub date: 2019-12-27T21:55:56Z summary: Move comment about permanent generation to gcmodule.c (GH-17718) The comment about the collection rules for the permanent generation was incorrectly referenced by a comment in gcmodule.c (the comment has been moved long ago into a header file). Moving the comment into the relevant code helps with readability and avoids broken references. files: M Include/internal/pycore_pymem.h M Modules/gcmodule.c diff --git a/Include/internal/pycore_pymem.h b/Include/internal/pycore_pymem.h index a4e972068348c..06d0d06c75c36 100644 --- a/Include/internal/pycore_pymem.h +++ b/Include/internal/pycore_pymem.h @@ -16,42 +16,6 @@ extern "C" { /* If we change this, we need to change the default value in the signature of gc.collect. */ #define NUM_GENERATIONS 3 - -/* - NOTE: about the counting of long-lived objects. - - To limit the cost of garbage collection, there are two strategies; - - make each collection faster, e.g. by scanning fewer objects - - do less collections - This heuristic is about the latter strategy. - - In addition to the various configurable thresholds, we only trigger a - full collection if the ratio - long_lived_pending / long_lived_total - is above a given value (hardwired to 25%). - - The reason is that, while "non-full" collections (i.e., collections of - the young and middle generations) will always examine roughly the same - number of objects -- determined by the aforementioned thresholds --, - the cost of a full collection is proportional to the total number of - long-lived objects, which is virtually unbounded. - - Indeed, it has been remarked that doing a full collection every - of object creations entails a dramatic performance - degradation in workloads which consist in creating and storing lots of - long-lived objects (e.g. building a large list of GC-tracked objects would - show quadratic performance, instead of linear as expected: see issue #4074). - - Using the above ratio, instead, yields amortized linear performance in - the total number of objects (the effect of which can be summarized - thusly: "each full garbage collection is more and more costly as the - number of objects grows, but we do fewer and fewer of them"). - - This heuristic was suggested by Martin von L?wis on python-dev in - June 2008. His original analysis and proposal can be found at: - http://mail.python.org/pipermail/python-dev/2008-June/080579.html -*/ - /* NOTE: about untracking of mutable objects. diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 64afe831c84c5..b11ae842e2295 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -1381,8 +1381,40 @@ collect_generations(PyThreadState *tstate) for (int i = NUM_GENERATIONS-1; i >= 0; i--) { if (gcstate->generations[i].count > gcstate->generations[i].threshold) { /* Avoid quadratic performance degradation in number - of tracked objects. See comments at the beginning - of this file, and issue #4074. + of tracked objects (see also issue #4074): + + To limit the cost of garbage collection, there are two strategies; + - make each collection faster, e.g. by scanning fewer objects + - do less collections + This heuristic is about the latter strategy. + + In addition to the various configurable thresholds, we only trigger a + full collection if the ratio + + long_lived_pending / long_lived_total + + is above a given value (hardwired to 25%). + + The reason is that, while "non-full" collections (i.e., collections of + the young and middle generations) will always examine roughly the same + number of objects -- determined by the aforementioned thresholds --, + the cost of a full collection is proportional to the total number of + long-lived objects, which is virtually unbounded. + + Indeed, it has been remarked that doing a full collection every + of object creations entails a dramatic performance + degradation in workloads which consist in creating and storing lots of + long-lived objects (e.g. building a large list of GC-tracked objects would + show quadratic performance, instead of linear as expected: see issue #4074). + + Using the above ratio, instead, yields amortized linear performance in + the total number of objects (the effect of which can be summarized + thusly: "each full garbage collection is more and more costly as the + number of objects grows, but we do fewer and fewer of them"). + + This heuristic was suggested by Martin von L?wis on python-dev in + June 2008. His original analysis and proposal can be found at: + http://mail.python.org/pipermail/python-dev/2008-June/080579.html */ if (i == NUM_GENERATIONS - 1 && gcstate->long_lived_pending < gcstate->long_lived_total / 4) From webhook-mailer at python.org Fri Dec 27 21:32:58 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Sat, 28 Dec 2019 02:32:58 -0000 Subject: [Python-checkins] bpo-39144 Align ctags and etags behaviours in the makefile and include Python stdlib files (GH-17721) Message-ID: https://github.com/python/cpython/commit/ef7eaafc9d2e370cf79b3674e56f643bbfe239e2 commit: ef7eaafc9d2e370cf79b3674e56f643bbfe239e2 branch: master author: Anthony Shaw committer: Pablo Galindo date: 2019-12-28T02:32:48Z summary: bpo-39144 Align ctags and etags behaviours in the makefile and include Python stdlib files (GH-17721) files: A Misc/NEWS.d/next/Build/2019-12-27-22-18-26.bpo-39144.dwHMlR.rst M Makefile.pre.in diff --git a/Makefile.pre.in b/Makefile.pre.in index d08c78df394b3..cfe42b4f21ecb 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1730,6 +1730,7 @@ tags:: ctags -w $(srcdir)/Include/*.h $(srcdir)/Include/cpython/*.h $(srcdir)/Include/internal/*.h for i in $(SRCDIRS); do ctags -f tags -w -a $(srcdir)/$$i/*.[ch]; done ctags -f tags -w -a $(srcdir)/Modules/_ctypes/*.[ch] + find $(srcdir)/Lib -type f -name "*.py" -not -name "test_*.py" -not -path "*/test/*" -not -path "*/tests/*" -not -path "*/*_test/*" | ctags -f tags -w -a -L - LC_ALL=C sort -o tags tags # Create a tags file for GNU Emacs @@ -1737,6 +1738,8 @@ TAGS:: cd $(srcdir); \ etags Include/*.h Include/cpython/*.h Include/internal/*.h; \ for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done + etags -a $(srcdir)/Modules/_ctypes/*.[ch] + find $(srcdir)/Lib -type f -name "*.py" -not -name "test_*.py" -not -path "*/test/*" -not -path "*/tests/*" -not -path "*/*_test/*" | etags - -a # Sanitation targets -- clean leaves libraries, executables and tags # files, which clobber removes as well diff --git a/Misc/NEWS.d/next/Build/2019-12-27-22-18-26.bpo-39144.dwHMlR.rst b/Misc/NEWS.d/next/Build/2019-12-27-22-18-26.bpo-39144.dwHMlR.rst new file mode 100644 index 0000000000000..8b90da19622e6 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2019-12-27-22-18-26.bpo-39144.dwHMlR.rst @@ -0,0 +1 @@ +The ctags and etags build targets both include Modules/_ctypes and Python standard library source files. \ No newline at end of file From webhook-mailer at python.org Fri Dec 27 21:50:39 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sat, 28 Dec 2019 02:50:39 -0000 Subject: [Python-checkins] bpo-39144 Align ctags and etags behaviours in the makefile and include Python stdlib files (GH-17721) Message-ID: https://github.com/python/cpython/commit/2786fdec79c35b4a68afea2bbbedbba3b6eb2269 commit: 2786fdec79c35b4a68afea2bbbedbba3b6eb2269 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-27T18:50:34-08:00 summary: bpo-39144 Align ctags and etags behaviours in the makefile and include Python stdlib files (GH-17721) (cherry picked from commit ef7eaafc9d2e370cf79b3674e56f643bbfe239e2) Co-authored-by: Anthony Shaw files: A Misc/NEWS.d/next/Build/2019-12-27-22-18-26.bpo-39144.dwHMlR.rst M Makefile.pre.in diff --git a/Makefile.pre.in b/Makefile.pre.in index 502317aa0c783..a914a9c70f679 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1725,6 +1725,7 @@ tags:: ctags -w $(srcdir)/Include/*.h $(srcdir)/Include/cpython/*.h $(srcdir)/Include/internal/*.h for i in $(SRCDIRS); do ctags -f tags -w -a $(srcdir)/$$i/*.[ch]; done ctags -f tags -w -a $(srcdir)/Modules/_ctypes/*.[ch] + find $(srcdir)/Lib -type f -name "*.py" -not -name "test_*.py" -not -path "*/test/*" -not -path "*/tests/*" -not -path "*/*_test/*" | ctags -f tags -w -a -L - LC_ALL=C sort -o tags tags # Create a tags file for GNU Emacs @@ -1732,6 +1733,8 @@ TAGS:: cd $(srcdir); \ etags Include/*.h Include/cpython/*.h Include/internal/*.h; \ for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done + etags -a $(srcdir)/Modules/_ctypes/*.[ch] + find $(srcdir)/Lib -type f -name "*.py" -not -name "test_*.py" -not -path "*/test/*" -not -path "*/tests/*" -not -path "*/*_test/*" | etags - -a # Sanitation targets -- clean leaves libraries, executables and tags # files, which clobber removes as well diff --git a/Misc/NEWS.d/next/Build/2019-12-27-22-18-26.bpo-39144.dwHMlR.rst b/Misc/NEWS.d/next/Build/2019-12-27-22-18-26.bpo-39144.dwHMlR.rst new file mode 100644 index 0000000000000..8b90da19622e6 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2019-12-27-22-18-26.bpo-39144.dwHMlR.rst @@ -0,0 +1 @@ +The ctags and etags build targets both include Modules/_ctypes and Python standard library source files. \ No newline at end of file From webhook-mailer at python.org Fri Dec 27 21:51:41 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sat, 28 Dec 2019 02:51:41 -0000 Subject: [Python-checkins] bpo-39144 Align ctags and etags behaviours in the makefile and include Python stdlib files (GH-17721) Message-ID: https://github.com/python/cpython/commit/d7aa3d26845be77ebca1b3954830aace6ef31e58 commit: d7aa3d26845be77ebca1b3954830aace6ef31e58 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-27T18:51:37-08:00 summary: bpo-39144 Align ctags and etags behaviours in the makefile and include Python stdlib files (GH-17721) (cherry picked from commit ef7eaafc9d2e370cf79b3674e56f643bbfe239e2) Co-authored-by: Anthony Shaw files: A Misc/NEWS.d/next/Build/2019-12-27-22-18-26.bpo-39144.dwHMlR.rst M Makefile.pre.in diff --git a/Makefile.pre.in b/Makefile.pre.in index beaccf5894880..35ca1a86846b8 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1669,6 +1669,7 @@ tags:: ctags -w $(srcdir)/Include/*.h $(srcdir)/Include/internal/*.h for i in $(SRCDIRS); do ctags -f tags -w -a $(srcdir)/$$i/*.[ch]; done ctags -f tags -w -a $(srcdir)/Modules/_ctypes/*.[ch] + find $(srcdir)/Lib -type f -name "*.py" -not -name "test_*.py" -not -path "*/test/*" -not -path "*/tests/*" -not -path "*/*_test/*" | ctags -f tags -w -a -L - LC_ALL=C sort -o tags tags # Create a tags file for GNU Emacs @@ -1676,6 +1677,8 @@ TAGS:: cd $(srcdir); \ etags Include/*.h Include/internal/*.h; \ for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done + etags -a $(srcdir)/Modules/_ctypes/*.[ch] + find $(srcdir)/Lib -type f -name "*.py" -not -name "test_*.py" -not -path "*/test/*" -not -path "*/tests/*" -not -path "*/*_test/*" | etags - -a # Sanitation targets -- clean leaves libraries, executables and tags # files, which clobber removes as well diff --git a/Misc/NEWS.d/next/Build/2019-12-27-22-18-26.bpo-39144.dwHMlR.rst b/Misc/NEWS.d/next/Build/2019-12-27-22-18-26.bpo-39144.dwHMlR.rst new file mode 100644 index 0000000000000..8b90da19622e6 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2019-12-27-22-18-26.bpo-39144.dwHMlR.rst @@ -0,0 +1 @@ +The ctags and etags build targets both include Modules/_ctypes and Python standard library source files. \ No newline at end of file From webhook-mailer at python.org Fri Dec 27 21:53:07 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Sat, 28 Dec 2019 02:53:07 -0000 Subject: [Python-checkins] bpo-38731: Fix function signature of quiet in docs (GH-17719) Message-ID: https://github.com/python/cpython/commit/98f0f04b5016e63561d313a3446b7b58f2c12611 commit: 98f0f04b5016e63561d313a3446b7b58f2c12611 branch: master author: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> committer: Pablo Galindo date: 2019-12-28T02:53:03Z summary: bpo-38731: Fix function signature of quiet in docs (GH-17719) files: M Doc/library/py_compile.rst diff --git a/Doc/library/py_compile.rst b/Doc/library/py_compile.rst index 3824353abda1f..a12a5bb0b1aa2 100644 --- a/Doc/library/py_compile.rst +++ b/Doc/library/py_compile.rst @@ -27,7 +27,7 @@ byte-code cache files in the directory containing the source code. Exception raised when an error occurs while attempting to compile the file. -.. function:: compile(file, cfile=None, dfile=None, doraise=False, optimize=-1, invalidation_mode=PycInvalidationMode.TIMESTAMP) +.. function:: compile(file, cfile=None, dfile=None, doraise=False, optimize=-1, invalidation_mode=PycInvalidationMode.TIMESTAMP, quiet=0) Compile a source file to byte-code and write out the byte-code cache file. The source code is loaded from the file named *file*. The byte-code is From webhook-mailer at python.org Fri Dec 27 21:58:53 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sat, 28 Dec 2019 02:58:53 -0000 Subject: [Python-checkins] bpo-38731: Fix function signature of quiet in docs (GH-17719) Message-ID: https://github.com/python/cpython/commit/04c1efe5acc89b6f3f2c208604a1c35641e8a380 commit: 04c1efe5acc89b6f3f2c208604a1c35641e8a380 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-27T18:58:47-08:00 summary: bpo-38731: Fix function signature of quiet in docs (GH-17719) (cherry picked from commit 98f0f04b5016e63561d313a3446b7b58f2c12611) Co-authored-by: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> files: M Doc/library/py_compile.rst diff --git a/Doc/library/py_compile.rst b/Doc/library/py_compile.rst index 3824353abda1f..a12a5bb0b1aa2 100644 --- a/Doc/library/py_compile.rst +++ b/Doc/library/py_compile.rst @@ -27,7 +27,7 @@ byte-code cache files in the directory containing the source code. Exception raised when an error occurs while attempting to compile the file. -.. function:: compile(file, cfile=None, dfile=None, doraise=False, optimize=-1, invalidation_mode=PycInvalidationMode.TIMESTAMP) +.. function:: compile(file, cfile=None, dfile=None, doraise=False, optimize=-1, invalidation_mode=PycInvalidationMode.TIMESTAMP, quiet=0) Compile a source file to byte-code and write out the byte-code cache file. The source code is loaded from the file named *file*. The byte-code is From webhook-mailer at python.org Sat Dec 28 17:16:09 2019 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Sat, 28 Dec 2019 22:16:09 -0000 Subject: [Python-checkins] bpo-39136: Fixed typos (GH-17720) Message-ID: https://github.com/python/cpython/commit/6c7bb38ff2799ac218e6df598b2b262f89e2bc1e commit: 6c7bb38ff2799ac218e6df598b2b262f89e2bc1e branch: master author: Gurupad Hegde committer: Terry Jan Reedy date: 2019-12-28T17:16:02-05:00 summary: bpo-39136: Fixed typos (GH-17720) funtion -> function; configuraton -> configuration; defintitions -> definitions; focusses -> focuses; necesarily -> necessarily; follwing -> following; Excape -> Escape, files: M Doc/c-api/init.rst M Doc/c-api/init_config.rst M Doc/c-api/structures.rst M Doc/faq/programming.rst M Doc/library/ast.rst M Doc/library/test.rst M Lib/idlelib/NEWS.txt M Lib/tkinter/tix.py M Misc/NEWS.d/3.9.0a2.rst diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index 86bf7f9eec65e..3887937382948 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -1189,7 +1189,7 @@ It is usually the only Python interpreter in a process. Unlike sub-interpreters the main interpreter has unique process-global responsibilities like signal handling. It is also responsible for execution during runtime initialization and is usually the active interpreter during runtime finalization. The -:c:func:`PyInterpreterState_Main` funtion returns a pointer to its state. +:c:func:`PyInterpreterState_Main` function returns a pointer to its state. You can switch between sub-interpreters using the :c:func:`PyThreadState_Swap` function. You can create and destroy them using the following functions: diff --git a/Doc/c-api/init_config.rst b/Doc/c-api/init_config.rst index 6b16b5bb72859..79a8815ed4199 100644 --- a/Doc/c-api/init_config.rst +++ b/Doc/c-api/init_config.rst @@ -757,7 +757,7 @@ configuration, and then override some parameters:: PyConfig config; PyConfig_InitPythonConfig(&config); - /* Set the program name before reading the configuraton + /* Set the program name before reading the configuration (decode byte string from the locale encoding). Implicitly preinitialize Python. */ diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index 1bd769f275b35..0c661389021ef 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -350,7 +350,7 @@ Accessing attributes of extension types .. _pymemberdef-offsets: Heap allocated types (created using :c:func:`PyType_FromSpec` or similar), - ``PyMemberDef`` may contain defintitions for the special members + ``PyMemberDef`` may contain definitions for the special members ``__dictoffset__`` and ``__weaklistoffset__``, corresponding to :c:member:`~PyTypeObject.tp_dictoffset` and :c:member:`~PyTypeObject.tp_weaklistoffset` in type objects. diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst index 9d45765abaacf..70b11d6e93056 100644 --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -1019,7 +1019,7 @@ That's a tough one, in general. First, here are a list of things to remember before diving further: * Performance characteristics vary across Python implementations. This FAQ - focusses on :term:`CPython`. + focuses on :term:`CPython`. * Behaviour can vary across operating systems, especially when talking about I/O or multi-threading. * You should always find the hot spots in your program *before* attempting to diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index baf563f5d7877..190d9286effb0 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -168,7 +168,7 @@ and classes for traversing abstract syntax trees: back with :func:`ast.parse`. .. warning:: - The produced code string will not necesarily be equal to the original + The produced code string will not necessarily be equal to the original code that generated the :class:`ast.AST` object. .. versionadded:: 3.9 diff --git a/Doc/library/test.rst b/Doc/library/test.rst index 73b3fe5cf06f8..54ad620d7dae9 100644 --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -1577,7 +1577,7 @@ script execution tests. The :mod:`test.support.bytecode_helper` module provides support for testing and inspecting bytecode generation. -The module defines the follwing class: +The module defines the following class: .. class:: BytecodeTestCase(unittest.TestCase) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 304cf6375f7dc..cbf55d9adef40 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -6,7 +6,7 @@ Released on 2020-10-05? bpo-38943: Fix autocomplete windows not always appearing on some systems. Patch by Johnny Najera. -bpo-38944: Excape key now closes IDLE completion windows. Patch by +bpo-38944: Escape key now closes IDLE completion windows. Patch by Johnny Najera. bpo-38862: 'Strip Trailing Whitespace' on the Format menu removes extra diff --git a/Lib/tkinter/tix.py b/Lib/tkinter/tix.py index d9c097a77cdd1..ac545502e45c3 100644 --- a/Lib/tkinter/tix.py +++ b/Lib/tkinter/tix.py @@ -1890,7 +1890,7 @@ def size_column(self, index, **kw): containing the current size setting of the given column. When option-value pairs are given, the corresponding options of the size setting of the given column are changed. Options may be one - of the follwing: + of the following: pad0 pixels Specifies the paddings to the left of a column. pad1 pixels @@ -1915,7 +1915,7 @@ def size_row(self, index, **kw): When no option-value pair is given, this command returns a list con- taining the current size setting of the given row . When option-value pairs are given, the corresponding options of the size setting of the - given row are changed. Options may be one of the follwing: + given row are changed. Options may be one of the following: pad0 pixels Specifies the paddings to the top of a row. pad1 pixels diff --git a/Misc/NEWS.d/3.9.0a2.rst b/Misc/NEWS.d/3.9.0a2.rst index 1919ccb560402..60d0ea5a99b16 100644 --- a/Misc/NEWS.d/3.9.0a2.rst +++ b/Misc/NEWS.d/3.9.0a2.rst @@ -69,7 +69,7 @@ the "elif" keyword and not to its condition, making it consistent with the .. nonce: 8OyT5P .. section: Core and Builtins -In Python 3.9.0a1, sys.argv[0] was made an asolute path if a filename was +In Python 3.9.0a1, sys.argv[0] was made an absolute path if a filename was specified on the command line. Revert this change, since most users expect sys.argv to be unmodified. @@ -516,7 +516,7 @@ from a coroutine. .. section: Library AsyncMock fix for return values that are awaitable types. This also covers -side_effect iterable values that happend to be awaitable, and wraps +side_effect iterable values that happened to be awaitable, and wraps callables that return an awaitable type. Before these awaitables were being awaited instead of being returned as is. @@ -893,7 +893,7 @@ previous `import posix`. Patch by Beno?t Hudson. .. nonce: _3xjKG .. section: IDLE -Excape key now closes IDLE completion windows. Patch by Johnny Najera. +Escape key now closes IDLE completion windows. Patch by Johnny Najera. .. From webhook-mailer at python.org Sat Dec 28 19:05:22 2019 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Sun, 29 Dec 2019 00:05:22 -0000 Subject: [Python-checkins] [3.8] bpo-39136: Fixed typos (GH-17720) Message-ID: https://github.com/python/cpython/commit/df647f3340d7a40628ba731f80425cb469e72653 commit: df647f3340d7a40628ba731f80425cb469e72653 branch: 3.8 author: Terry Jan Reedy committer: GitHub date: 2019-12-28T19:05:15-05:00 summary: [3.8] bpo-39136: Fixed typos (GH-17720) funtion -> function; configuraton -> configuration; defintitions -> definitions; focusses -> focuses; necesarily -> necessarily; follwing -> following; Excape -> Escape, (cherry picked from commit 6c7bb38ff2799ac218e6df598b2b262f89e2bc1e) files: M Doc/c-api/init.rst M Doc/c-api/init_config.rst M Doc/faq/programming.rst M Lib/idlelib/NEWS.txt M Lib/tkinter/tix.py diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index 155edba82f96d..81cb4f825fee7 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -1181,7 +1181,7 @@ It is usually the only Python interpreter in a process. Unlike sub-interpreters the main interpreter has unique process-global responsibilities like signal handling. It is also responsible for execution during runtime initialization and is usually the active interpreter during runtime finalization. The -:c:func:`PyInterpreterState_Main` funtion returns a pointer to its state. +:c:func:`PyInterpreterState_Main` function returns a pointer to its state. You can switch between sub-interpreters using the :c:func:`PyThreadState_Swap` function. You can create and destroy them using the following functions: diff --git a/Doc/c-api/init_config.rst b/Doc/c-api/init_config.rst index 6b16b5bb72859..79a8815ed4199 100644 --- a/Doc/c-api/init_config.rst +++ b/Doc/c-api/init_config.rst @@ -757,7 +757,7 @@ configuration, and then override some parameters:: PyConfig config; PyConfig_InitPythonConfig(&config); - /* Set the program name before reading the configuraton + /* Set the program name before reading the configuration (decode byte string from the locale encoding). Implicitly preinitialize Python. */ diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst index 9d45765abaacf..70b11d6e93056 100644 --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -1019,7 +1019,7 @@ That's a tough one, in general. First, here are a list of things to remember before diving further: * Performance characteristics vary across Python implementations. This FAQ - focusses on :term:`CPython`. + focuses on :term:`CPython`. * Behaviour can vary across operating systems, especially when talking about I/O or multi-threading. * You should always find the hot spots in your program *before* attempting to diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index e829bc910ea87..0baec813b044d 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -6,7 +6,7 @@ Released on 2019-12-16? bpo-38943: Fix autocomplete windows not always appearing on some systems. Patch by Johnny Najera. -bpo-38944: Excape key now closes IDLE completion windows. Patch by +bpo-38944: Escape key now closes IDLE completion windows. Patch by Johnny Najera. bpo-38862: 'Strip Trailing Whitespace' on the Format menu removes extra diff --git a/Lib/tkinter/tix.py b/Lib/tkinter/tix.py index d9c097a77cdd1..ac545502e45c3 100644 --- a/Lib/tkinter/tix.py +++ b/Lib/tkinter/tix.py @@ -1890,7 +1890,7 @@ def size_column(self, index, **kw): containing the current size setting of the given column. When option-value pairs are given, the corresponding options of the size setting of the given column are changed. Options may be one - of the follwing: + of the following: pad0 pixels Specifies the paddings to the left of a column. pad1 pixels @@ -1915,7 +1915,7 @@ def size_row(self, index, **kw): When no option-value pair is given, this command returns a list con- taining the current size setting of the given row . When option-value pairs are given, the corresponding options of the size setting of the - given row are changed. Options may be one of the follwing: + given row are changed. Options may be one of the following: pad0 pixels Specifies the paddings to the top of a row. pad1 pixels From webhook-mailer at python.org Sun Dec 29 01:41:14 2019 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Sun, 29 Dec 2019 06:41:14 -0000 Subject: [Python-checkins] [3.7] bpo-39136: Fixed typos (GH-17720) Message-ID: https://github.com/python/cpython/commit/d7947280a4ba9dc652c3fac22946466338ec6999 commit: d7947280a4ba9dc652c3fac22946466338ec6999 branch: 3.7 author: Terry Jan Reedy committer: GitHub date: 2019-12-29T01:40:49-05:00 summary: [3.7] bpo-39136: Fixed typos (GH-17720) focusses -> focuses; follwing -> following; Excape -> Escape. (cherry picked from commit 6c7bb38) files: M Doc/faq/programming.rst M Lib/idlelib/NEWS.txt M Lib/tkinter/tix.py diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst index a8aaebf7558ee..270f57d8b8093 100644 --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -1026,7 +1026,7 @@ That's a tough one, in general. First, here are a list of things to remember before diving further: * Performance characteristics vary across Python implementations. This FAQ - focusses on :term:`CPython`. + focuses on :term:`CPython`. * Behaviour can vary across operating systems, especially when talking about I/O or multi-threading. * You should always find the hot spots in your program *before* attempting to diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 5caa98e3fcc9b..ac8570701e3fa 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -6,7 +6,7 @@ Released on 2019-12-16? bpo-38943: Fix autocomplete windows not always appearing on some systems. Patch by Johnny Najera. -bpo-38944: Excape key now closes IDLE completion windows. Patch by +bpo-38944: Escape key now closes IDLE completion windows. Patch by Johnny Najera. bpo-38862: 'Strip Trailing Whitespace' on the Format menu removes extra diff --git a/Lib/tkinter/tix.py b/Lib/tkinter/tix.py index d9c097a77cdd1..ac545502e45c3 100644 --- a/Lib/tkinter/tix.py +++ b/Lib/tkinter/tix.py @@ -1890,7 +1890,7 @@ def size_column(self, index, **kw): containing the current size setting of the given column. When option-value pairs are given, the corresponding options of the size setting of the given column are changed. Options may be one - of the follwing: + of the following: pad0 pixels Specifies the paddings to the left of a column. pad1 pixels @@ -1915,7 +1915,7 @@ def size_row(self, index, **kw): When no option-value pair is given, this command returns a list con- taining the current size setting of the given row . When option-value pairs are given, the corresponding options of the size setting of the - given row are changed. Options may be one of the follwing: + given row are changed. Options may be one of the following: pad0 pixels Specifies the paddings to the top of a row. pad1 pixels From webhook-mailer at python.org Sun Dec 29 12:26:39 2019 From: webhook-mailer at python.org (Jason R. Coombs) Date: Sun, 29 Dec 2019 17:26:39 -0000 Subject: [Python-checkins] links in importlib.metadata.rst replaced with sphinx references (GH-17730) Message-ID: https://github.com/python/cpython/commit/cbd0408b54c8f9512bfeace2aaf9da064053e86d commit: cbd0408b54c8f9512bfeace2aaf9da064053e86d branch: master author: Oleg H?fling committer: Jason R. Coombs date: 2019-12-29T12:26:35-05:00 summary: links in importlib.metadata.rst replaced with sphinx references (GH-17730) The importlib.metadata documentation uses hardcoded links to internal pages. This results in minor rendering issues. This change replaces the hardcoded links with suitable Sphinx roles. Signed-off-by: Oleg H?fling files: M Doc/library/importlib.metadata.rst M Doc/reference/import.rst M Misc/ACKS diff --git a/Doc/library/importlib.metadata.rst b/Doc/library/importlib.metadata.rst index dc6b66ca384d0..15e58b860d97d 100644 --- a/Doc/library/importlib.metadata.rst +++ b/Doc/library/importlib.metadata.rst @@ -1,8 +1,8 @@ .. _using: -========================== - Using importlib.metadata -========================== +================================= + Using :mod:`!importlib.metadata` +================================= .. note:: This functionality is provisional and may deviate from the usual @@ -12,8 +12,8 @@ package metadata. Built in part on Python's import system, this library intends to replace similar functionality in the `entry point API`_ and `metadata API`_ of ``pkg_resources``. Along with -``importlib.resources`` in `Python 3.7 -and newer`_ (backported as `importlib_resources`_ for older versions of +:mod:`importlib.resources` in Python 3.7 +and newer (backported as `importlib_resources`_ for older versions of Python), this can eliminate the need to use the older and less efficient ``pkg_resources`` package. @@ -21,9 +21,9 @@ By "installed package" we generally mean a third-party package installed into Python's ``site-packages`` directory via tools such as `pip `_. Specifically, it means a package with either a discoverable ``dist-info`` or ``egg-info`` -directory, and metadata defined by `PEP 566`_ or its older specifications. +directory, and metadata defined by :pep:`566` or its older specifications. By default, package metadata can live on the file system or in zip archives on -``sys.path``. Through an extension mechanism, the metadata can live almost +:data:`sys.path`. Through an extension mechanism, the metadata can live almost anywhere. @@ -134,7 +134,7 @@ Distribution files You can also get the full set of files contained within a distribution. The ``files()`` function takes a distribution package name and returns all of the files installed by this distribution. Each file object returned is a -``PackagePath``, a `pathlib.Path`_ derived object with additional ``dist``, +``PackagePath``, a :class:`pathlib.Path` derived object with additional ``dist``, ``size``, and ``hash`` properties as indicated by the metadata. For example:: >>> util = [p for p in files('wheel') if 'util.py' in str(p)][0] # doctest: +SKIP @@ -203,18 +203,18 @@ instance:: >>> d.metadata['License'] # doctest: +SKIP 'MIT' -The full set of available metadata is not described here. See `PEP 566 -`_ for additional details. +The full set of available metadata is not described here. See :pep:`566` +for additional details. Extending the search algorithm ============================== -Because package metadata is not available through ``sys.path`` searches, or +Because package metadata is not available through :data:`sys.path` searches, or package loaders directly, the metadata for a package is found through import -system `finders`_. To find a distribution package's metadata, -``importlib.metadata`` queries the list of `meta path finders`_ on -`sys.meta_path`_. +system :ref:`finders `. To find a distribution package's metadata, +``importlib.metadata`` queries the list of :term:`meta path finders ` on +:data:`sys.meta_path`. The default ``PathFinder`` for Python includes a hook that calls into ``importlib.metadata.MetadataPathFinder`` for finding distributions @@ -224,7 +224,7 @@ The abstract class :py:class:`importlib.abc.MetaPathFinder` defines the interface expected of finders by Python's import system. ``importlib.metadata`` extends this protocol by looking for an optional ``find_distributions`` callable on the finders from -``sys.meta_path`` and presents this extended interface as the +:data:`sys.meta_path` and presents this extended interface as the ``DistributionFinder`` abstract base class, which defines this abstract method:: @@ -247,20 +247,13 @@ a custom finder, return instances of this derived ``Distribution`` in the .. _`entry point API`: https://setuptools.readthedocs.io/en/latest/pkg_resources.html#entry-points .. _`metadata API`: https://setuptools.readthedocs.io/en/latest/pkg_resources.html#metadata-api -.. _`Python 3.7 and newer`: https://docs.python.org/3/library/importlib.html#module-importlib.resources .. _`importlib_resources`: https://importlib-resources.readthedocs.io/en/latest/index.html -.. _`PEP 566`: https://www.python.org/dev/peps/pep-0566/ -.. _`finders`: https://docs.python.org/3/reference/import.html#finders-and-loaders -.. _`meta path finders`: https://docs.python.org/3/glossary.html#term-meta-path-finder -.. _`sys.meta_path`: https://docs.python.org/3/library/sys.html#sys.meta_path -.. _`pathlib.Path`: https://docs.python.org/3/library/pathlib.html#pathlib.Path .. rubric:: Footnotes .. [#f1] Technically, the returned distribution metadata object is an - `email.message.Message - `_ + :class:`email.message.EmailMessage` instance, but this is an implementation detail, and not part of the stable API. You should only use dictionary-like methods and syntax to access the metadata contents. diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst index c95826305b6a6..20a2ea69e2d27 100644 --- a/Doc/reference/import.rst +++ b/Doc/reference/import.rst @@ -202,6 +202,8 @@ named module, the two module objects will *not* be the same. By contrast, reinitialise the module contents by rerunning the module's code. +.. _finders-and-loaders: + Finders and loaders ------------------- diff --git a/Misc/ACKS b/Misc/ACKS index 8ab7a6cee5a3f..5ecbac13e0bb4 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -751,6 +751,7 @@ Ludwig H?hne Gerhard H?ring Fredrik H??rd Florian H?ch +Oleg H?fling Robert H?lzl Catalin Iacob Mihai Ibanescu From webhook-mailer at python.org Sun Dec 29 14:21:07 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Sun, 29 Dec 2019 19:21:07 -0000 Subject: [Python-checkins] bpo-38870: Run always tests that heavily use grammar features in test_unparse (GH-17738) Message-ID: https://github.com/python/cpython/commit/23a226bf3ae7b462084e899d007d12d9fe398ac5 commit: 23a226bf3ae7b462084e899d007d12d9fe398ac5 branch: master author: Pablo Galindo committer: GitHub date: 2019-12-29T19:20:55Z summary: bpo-38870: Run always tests that heavily use grammar features in test_unparse (GH-17738) files: M Lib/test/test_unparse.py diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py index 45d819f175bb9..3e796860cbcf2 100644 --- a/Lib/test/test_unparse.py +++ b/Lib/test/test_unparse.py @@ -285,6 +285,8 @@ class DirectoryTestCase(ASTTestCase): lib_dir = pathlib.Path(__file__).parent / ".." test_directories = (lib_dir, lib_dir / "test") skip_files = {"test_fstring.py"} + run_always_files = {"test_grammar.py", "test_syntax.py", "test_compile.py", + "test_ast.py", "test_asdl_parser.py"} _files_to_test = None @@ -301,9 +303,17 @@ def files_to_test(cls): if not item.name.startswith("bad") ] + tests_to_run_always = {item for item in items if + item.name in cls.run_always_files} + # Test limited subset of files unless the 'cpu' resource is specified. if not test.support.is_resource_enabled("cpu"): - items = random.sample(items, 10) + items = set(random.sample(items, 10)) + + # Make sure that at least tests that heavily use grammar features are + # considered to reduce the change of missing something. + + items = list(items | tests_to_run_always) # bpo-31174: Store the names sample to always test the same files. # It prevents false alarms when hunting reference leaks. From webhook-mailer at python.org Sun Dec 29 15:18:40 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Sun, 29 Dec 2019 20:18:40 -0000 Subject: [Python-checkins] Fix error when running with -uall in test_unparse (GH-17739) Message-ID: https://github.com/python/cpython/commit/be287c319124b7eb59ef32b69cf837ae3e99acab commit: be287c319124b7eb59ef32b69cf837ae3e99acab branch: master author: Pablo Galindo committer: GitHub date: 2019-12-29T20:18:36Z summary: Fix error when running with -uall in test_unparse (GH-17739) files: M Lib/test/test_unparse.py diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py index 3e796860cbcf2..49767dbac16d1 100644 --- a/Lib/test/test_unparse.py +++ b/Lib/test/test_unparse.py @@ -303,17 +303,17 @@ def files_to_test(cls): if not item.name.startswith("bad") ] - tests_to_run_always = {item for item in items if - item.name in cls.run_always_files} - # Test limited subset of files unless the 'cpu' resource is specified. if not test.support.is_resource_enabled("cpu"): - items = set(random.sample(items, 10)) - # Make sure that at least tests that heavily use grammar features are - # considered to reduce the change of missing something. + tests_to_run_always = {item for item in items if + item.name in cls.run_always_files} + + items = set(random.sample(items, 10)) - items = list(items | tests_to_run_always) + # Make sure that at least tests that heavily use grammar features are + # always considered in order to reduce the chance of missing something. + items = list(items | tests_to_run_always) # bpo-31174: Store the names sample to always test the same files. # It prevents false alarms when hunting reference leaks. From webhook-mailer at python.org Sun Dec 29 16:36:03 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Sun, 29 Dec 2019 21:36:03 -0000 Subject: [Python-checkins] bpo-39157: Skip test_pidfd_send_signal if the system does not have enough privileges to use pidfd (GH-17740) Message-ID: https://github.com/python/cpython/commit/8f0703ff92ed2d9ccd52d7e083c7bc26e732a428 commit: 8f0703ff92ed2d9ccd52d7e083c7bc26e732a428 branch: master author: Pablo Galindo committer: GitHub date: 2019-12-29T21:35:54Z summary: bpo-39157: Skip test_pidfd_send_signal if the system does not have enough privileges to use pidfd (GH-17740) files: M Lib/test/test_signal.py diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index 5c02c28a90e17..5b072b0c60ee3 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -1284,6 +1284,8 @@ def test_pidfd_send_signal(self): signal.pidfd_send_signal(0, signal.SIGINT) if cm.exception.errno == errno.ENOSYS: self.skipTest("kernel does not support pidfds") + elif cm.exception.errno == errno.EPERM: + self.skipTest("Not enough privileges to use pidfs") self.assertEqual(cm.exception.errno, errno.EBADF) my_pidfd = os.open(f'/proc/{os.getpid()}', os.O_DIRECTORY) self.addCleanup(os.close, my_pidfd) From webhook-mailer at python.org Sun Dec 29 17:14:29 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Sun, 29 Dec 2019 22:14:29 -0000 Subject: [Python-checkins] Fix typos and remove deprecated deprecation warning. (GH-17741) Message-ID: https://github.com/python/cpython/commit/32a12aed6da41f49a5ca05e6de34f5f93ea1dc33 commit: 32a12aed6da41f49a5ca05e6de34f5f93ea1dc33 branch: master author: Antoine <43954001+awecx at users.noreply.github.com> committer: Pablo Galindo date: 2019-12-29T22:14:22Z summary: Fix typos and remove deprecated deprecation warning. (GH-17741) files: M Doc/library/ctypes.rst diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index e0bc28f5e5058..2d6c6d0a1c3c5 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -161,13 +161,6 @@ as the ``NULL`` pointer):: 0x1d000000 >>> -.. note:: - - :mod:`ctypes` may raise a :exc:`ValueError` after calling the function, if - it detects that an invalid number of arguments were passed. This behavior - should not be relied upon. It is deprecated in 3.6.2, and will be removed - in 3.7. - :exc:`ValueError` is raised when you call an ``stdcall`` function with the ``cdecl`` calling convention, or vice versa:: @@ -624,7 +617,7 @@ Structure/union alignment and byte order ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ By default, Structure and Union fields are aligned in the same way the C -compiler does it. It is possible to override this behavior be specifying a +compiler does it. It is possible to override this behavior by specifying a :attr:`_pack_` class attribute in the subclass definition. This must be set to a positive integer and specifies the maximum alignment for the fields. This is what ``#pragma pack(n)`` also does in MSVC. @@ -922,7 +915,7 @@ attribute later, after the class statement:: ... ("next", POINTER(cell))] >>> -Lets try it. We create two instances of ``cell``, and let them point to each +Let's try it. We create two instances of ``cell``, and let them point to each other, and finally follow the pointer chain a few times:: >>> c1 = cell() @@ -1125,8 +1118,8 @@ hit the ``NULL`` entry:: >>> The fact that standard Python has a frozen module and a frozen package -(indicated by the negative size member) is not well known, it is only used for -testing. Try it out with ``import __hello__`` for example. +(indicated by the negative ``size`` member) is not well known, it is only used +for testing. Try it out with ``import __hello__`` for example. .. _ctypes-surprises: From webhook-mailer at python.org Sun Dec 29 17:19:59 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 29 Dec 2019 22:19:59 -0000 Subject: [Python-checkins] Fix typos and remove deprecated deprecation warning. (GH-17741) Message-ID: https://github.com/python/cpython/commit/177bda9d51455d238ab6ec11302dd68340a24f43 commit: 177bda9d51455d238ab6ec11302dd68340a24f43 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-29T14:19:54-08:00 summary: Fix typos and remove deprecated deprecation warning. (GH-17741) (cherry picked from commit 32a12aed6da41f49a5ca05e6de34f5f93ea1dc33) Co-authored-by: Antoine <43954001+awecx at users.noreply.github.com> files: M Doc/library/ctypes.rst diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index b4f989d95ad5b..715d595b2404f 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -161,13 +161,6 @@ as the ``NULL`` pointer):: 0x1d000000 >>> -.. note:: - - :mod:`ctypes` may raise a :exc:`ValueError` after calling the function, if - it detects that an invalid number of arguments were passed. This behavior - should not be relied upon. It is deprecated in 3.6.2, and will be removed - in 3.7. - :exc:`ValueError` is raised when you call an ``stdcall`` function with the ``cdecl`` calling convention, or vice versa:: @@ -624,7 +617,7 @@ Structure/union alignment and byte order ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ By default, Structure and Union fields are aligned in the same way the C -compiler does it. It is possible to override this behavior be specifying a +compiler does it. It is possible to override this behavior by specifying a :attr:`_pack_` class attribute in the subclass definition. This must be set to a positive integer and specifies the maximum alignment for the fields. This is what ``#pragma pack(n)`` also does in MSVC. @@ -922,7 +915,7 @@ attribute later, after the class statement:: ... ("next", POINTER(cell))] >>> -Lets try it. We create two instances of ``cell``, and let them point to each +Let's try it. We create two instances of ``cell``, and let them point to each other, and finally follow the pointer chain a few times:: >>> c1 = cell() @@ -1125,8 +1118,8 @@ hit the ``NULL`` entry:: >>> The fact that standard Python has a frozen module and a frozen package -(indicated by the negative size member) is not well known, it is only used for -testing. Try it out with ``import __hello__`` for example. +(indicated by the negative ``size`` member) is not well known, it is only used +for testing. Try it out with ``import __hello__`` for example. .. _ctypes-surprises: From webhook-mailer at python.org Sun Dec 29 17:20:56 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Sun, 29 Dec 2019 22:20:56 -0000 Subject: [Python-checkins] Fix typos and remove deprecated deprecation warning. (GH-17741) Message-ID: https://github.com/python/cpython/commit/e06be0820f3304b1ea940cd643214d332ed02ea8 commit: e06be0820f3304b1ea940cd643214d332ed02ea8 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-29T14:20:52-08:00 summary: Fix typos and remove deprecated deprecation warning. (GH-17741) (cherry picked from commit 32a12aed6da41f49a5ca05e6de34f5f93ea1dc33) Co-authored-by: Antoine <43954001+awecx at users.noreply.github.com> files: M Doc/library/ctypes.rst diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index e0bc28f5e5058..2d6c6d0a1c3c5 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -161,13 +161,6 @@ as the ``NULL`` pointer):: 0x1d000000 >>> -.. note:: - - :mod:`ctypes` may raise a :exc:`ValueError` after calling the function, if - it detects that an invalid number of arguments were passed. This behavior - should not be relied upon. It is deprecated in 3.6.2, and will be removed - in 3.7. - :exc:`ValueError` is raised when you call an ``stdcall`` function with the ``cdecl`` calling convention, or vice versa:: @@ -624,7 +617,7 @@ Structure/union alignment and byte order ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ By default, Structure and Union fields are aligned in the same way the C -compiler does it. It is possible to override this behavior be specifying a +compiler does it. It is possible to override this behavior by specifying a :attr:`_pack_` class attribute in the subclass definition. This must be set to a positive integer and specifies the maximum alignment for the fields. This is what ``#pragma pack(n)`` also does in MSVC. @@ -922,7 +915,7 @@ attribute later, after the class statement:: ... ("next", POINTER(cell))] >>> -Lets try it. We create two instances of ``cell``, and let them point to each +Let's try it. We create two instances of ``cell``, and let them point to each other, and finally follow the pointer chain a few times:: >>> c1 = cell() @@ -1125,8 +1118,8 @@ hit the ``NULL`` entry:: >>> The fact that standard Python has a frozen module and a frozen package -(indicated by the negative size member) is not well known, it is only used for -testing. Try it out with ``import __hello__`` for example. +(indicated by the negative ``size`` member) is not well known, it is only used +for testing. Try it out with ``import __hello__`` for example. .. _ctypes-surprises: From webhook-mailer at python.org Mon Dec 30 00:24:58 2019 From: webhook-mailer at python.org (Nick Coghlan) Date: Mon, 30 Dec 2019 05:24:58 -0000 Subject: [Python-checkins] bpo-39037: Fix lookup order of magic methods in with statement documentation (GH-17608) Message-ID: https://github.com/python/cpython/commit/226e6e7d4326cf91ef37e13528eb1f62de1bb832 commit: 226e6e7d4326cf91ef37e13528eb1f62de1bb832 branch: master author: G?ry Ogam committer: Nick Coghlan date: 2019-12-30T15:24:51+10:00 summary: bpo-39037: Fix lookup order of magic methods in with statement documentation (GH-17608) * __enter__ is now looked up before __exit__ to give a more intuitive error message * add pseudo-code equivalent for the with statement * fix pseudo-code for the async with statement to use a finally clause * use SUITE rather than BLOCK for consistency with the language grammar Patch by G?ry Ogam. files: M Doc/reference/compound_stmts.rst diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst index 988eec6d254e1..564d6cc42136d 100644 --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -399,6 +399,8 @@ The execution of the :keyword:`with` statement with one "item" proceeds as follo #. The context expression (the expression given in the :token:`with_item`) is evaluated to obtain a context manager. +#. The context manager's :meth:`__enter__` is loaded for later use. + #. The context manager's :meth:`__exit__` is loaded for later use. #. The context manager's :meth:`__enter__` method is invoked. @@ -430,17 +432,41 @@ The execution of the :keyword:`with` statement with one "item" proceeds as follo value from :meth:`__exit__` is ignored, and execution proceeds at the normal location for the kind of exit that was taken. +The following code:: + + with EXPRESSION as TARGET: + SUITE + +is semantically equivalent to:: + + manager = (EXPRESSION) + enter = type(manager).__enter__ + exit = type(manager).__exit__ + value = enter(manager) + hit_except = False + + try: + TARGET = value + SUITE + except: + hit_except = True + if not exit(manager, *sys.exc_info()): + raise + finally: + if not hit_except: + exit(manager, None, None, None) + With more than one item, the context managers are processed as if multiple :keyword:`with` statements were nested:: with A() as a, B() as b: - suite + SUITE -is equivalent to :: +is semantically equivalent to:: with A() as a: with B() as b: - suite + SUITE .. versionchanged:: 3.1 Support for multiple context expressions. @@ -772,24 +798,25 @@ iterators. The following code:: async for TARGET in ITER: - BLOCK + SUITE else: - BLOCK2 + SUITE2 Is semantically equivalent to:: iter = (ITER) iter = type(iter).__aiter__(iter) running = True + while running: try: TARGET = await type(iter).__anext__(iter) except StopAsyncIteration: running = False else: - BLOCK + SUITE else: - BLOCK2 + SUITE2 See also :meth:`__aiter__` and :meth:`__anext__` for details. @@ -811,23 +838,27 @@ able to suspend execution in its *enter* and *exit* methods. The following code:: - async with EXPR as VAR: - BLOCK + async with EXPRESSION as TARGET: + SUITE -Is semantically equivalent to:: +is semantically equivalent to:: - mgr = (EXPR) - aexit = type(mgr).__aexit__ - aenter = type(mgr).__aenter__(mgr) + manager = (EXPRESSION) + aexit = type(manager).__aexit__ + aenter = type(manager).__aenter__ + value = await aenter(manager) + hit_except = False - VAR = await aenter try: - BLOCK + TARGET = value + SUITE except: - if not await aexit(mgr, *sys.exc_info()): + hit_except = True + if not await aexit(manager, *sys.exc_info()): raise - else: - await aexit(mgr, None, None, None) + finally: + if not hit_except: + await aexit(manager, None, None, None) See also :meth:`__aenter__` and :meth:`__aexit__` for details. From webhook-mailer at python.org Mon Dec 30 00:31:23 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 30 Dec 2019 05:31:23 -0000 Subject: [Python-checkins] bpo-39037: Fix lookup order of magic methods in with statement documentation (GH-17608) Message-ID: https://github.com/python/cpython/commit/cbfafa3e3625dae96ce392c88c793f8af55167bf commit: cbfafa3e3625dae96ce392c88c793f8af55167bf branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-29T21:31:18-08:00 summary: bpo-39037: Fix lookup order of magic methods in with statement documentation (GH-17608) * __enter__ is now looked up before __exit__ to give a more intuitive error message * add pseudo-code equivalent for the with statement * fix pseudo-code for the async with statement to use a finally clause * use SUITE rather than BLOCK for consistency with the language grammar Patch by G?ry Ogam. (cherry picked from commit 226e6e7d4326cf91ef37e13528eb1f62de1bb832) Co-authored-by: G?ry Ogam files: M Doc/reference/compound_stmts.rst diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst index 988eec6d254e1..564d6cc42136d 100644 --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -399,6 +399,8 @@ The execution of the :keyword:`with` statement with one "item" proceeds as follo #. The context expression (the expression given in the :token:`with_item`) is evaluated to obtain a context manager. +#. The context manager's :meth:`__enter__` is loaded for later use. + #. The context manager's :meth:`__exit__` is loaded for later use. #. The context manager's :meth:`__enter__` method is invoked. @@ -430,17 +432,41 @@ The execution of the :keyword:`with` statement with one "item" proceeds as follo value from :meth:`__exit__` is ignored, and execution proceeds at the normal location for the kind of exit that was taken. +The following code:: + + with EXPRESSION as TARGET: + SUITE + +is semantically equivalent to:: + + manager = (EXPRESSION) + enter = type(manager).__enter__ + exit = type(manager).__exit__ + value = enter(manager) + hit_except = False + + try: + TARGET = value + SUITE + except: + hit_except = True + if not exit(manager, *sys.exc_info()): + raise + finally: + if not hit_except: + exit(manager, None, None, None) + With more than one item, the context managers are processed as if multiple :keyword:`with` statements were nested:: with A() as a, B() as b: - suite + SUITE -is equivalent to :: +is semantically equivalent to:: with A() as a: with B() as b: - suite + SUITE .. versionchanged:: 3.1 Support for multiple context expressions. @@ -772,24 +798,25 @@ iterators. The following code:: async for TARGET in ITER: - BLOCK + SUITE else: - BLOCK2 + SUITE2 Is semantically equivalent to:: iter = (ITER) iter = type(iter).__aiter__(iter) running = True + while running: try: TARGET = await type(iter).__anext__(iter) except StopAsyncIteration: running = False else: - BLOCK + SUITE else: - BLOCK2 + SUITE2 See also :meth:`__aiter__` and :meth:`__anext__` for details. @@ -811,23 +838,27 @@ able to suspend execution in its *enter* and *exit* methods. The following code:: - async with EXPR as VAR: - BLOCK + async with EXPRESSION as TARGET: + SUITE -Is semantically equivalent to:: +is semantically equivalent to:: - mgr = (EXPR) - aexit = type(mgr).__aexit__ - aenter = type(mgr).__aenter__(mgr) + manager = (EXPRESSION) + aexit = type(manager).__aexit__ + aenter = type(manager).__aenter__ + value = await aenter(manager) + hit_except = False - VAR = await aenter try: - BLOCK + TARGET = value + SUITE except: - if not await aexit(mgr, *sys.exc_info()): + hit_except = True + if not await aexit(manager, *sys.exc_info()): raise - else: - await aexit(mgr, None, None, None) + finally: + if not hit_except: + await aexit(manager, None, None, None) See also :meth:`__aenter__` and :meth:`__aexit__` for details. From webhook-mailer at python.org Mon Dec 30 04:53:45 2019 From: webhook-mailer at python.org (Mark Shannon) Date: Mon, 30 Dec 2019 09:53:45 -0000 Subject: [Python-checkins] Fix handling of line numbers around finally-blocks. (#17737) Message-ID: https://github.com/python/cpython/commit/88dce26da6bc4838092128d9a6f1c98bf48b7c90 commit: 88dce26da6bc4838092128d9a6f1c98bf48b7c90 branch: master author: Mark Shannon committer: GitHub date: 2019-12-30T09:53:36Z summary: Fix handling of line numbers around finally-blocks. (#17737) files: M Lib/test/test_dis.py M Python/compile.c M Python/importlib.h diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index 5c1595268c505..313eefd9b8859 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -333,6 +333,68 @@ def _fstring(a, b, c, d): 28 RETURN_VALUE """ % (_fstring.__code__.co_firstlineno + 1,) +def _tryfinally(a, b): + try: + return a + finally: + b() + +def _tryfinallyconst(b): + try: + return 1 + finally: + b() + +dis_tryfinally = """\ +%3d 0 SETUP_FINALLY 12 (to 14) + +%3d 2 LOAD_FAST 0 (a) + 4 POP_BLOCK + +%3d 6 LOAD_FAST 1 (b) + 8 CALL_FUNCTION 0 + 10 POP_TOP + +%3d 12 RETURN_VALUE + +%3d >> 14 LOAD_FAST 1 (b) + 16 CALL_FUNCTION 0 + 18 POP_TOP + 20 RERAISE + 22 LOAD_CONST 0 (None) + 24 RETURN_VALUE +""" % (_tryfinally.__code__.co_firstlineno + 1, + _tryfinally.__code__.co_firstlineno + 2, + _tryfinally.__code__.co_firstlineno + 4, + _tryfinally.__code__.co_firstlineno + 2, + _tryfinally.__code__.co_firstlineno + 4, + ) + +dis_tryfinallyconst = """\ +%3d 0 SETUP_FINALLY 12 (to 14) + +%3d 2 POP_BLOCK + +%3d 4 LOAD_FAST 0 (b) + 6 CALL_FUNCTION 0 + 8 POP_TOP + +%3d 10 LOAD_CONST 1 (1) + 12 RETURN_VALUE + +%3d >> 14 LOAD_FAST 0 (b) + 16 CALL_FUNCTION 0 + 18 POP_TOP + 20 RERAISE + 22 LOAD_CONST 0 (None) + 24 RETURN_VALUE +""" % (_tryfinallyconst.__code__.co_firstlineno + 1, + _tryfinallyconst.__code__.co_firstlineno + 2, + _tryfinallyconst.__code__.co_firstlineno + 4, + _tryfinallyconst.__code__.co_firstlineno + 2, + _tryfinallyconst.__code__.co_firstlineno + 4, + ) + def _g(x): yield x @@ -563,6 +625,10 @@ def test_disassemble_coroutine(self): def test_disassemble_fstring(self): self.do_disassembly_test(_fstring, dis_fstring) + def test_disassemble_try_finally(self): + self.do_disassembly_test(_tryfinally, dis_tryfinally) + self.do_disassembly_test(_tryfinallyconst, dis_tryfinallyconst) + def test_dis_none(self): try: del sys.last_traceback diff --git a/Python/compile.c b/Python/compile.c index 98a4afa168c47..ce6f18a1f571d 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1686,7 +1686,11 @@ compiler_unwind_fblock(struct compiler *c, struct fblockinfo *info, return 0; } } + /* Emit the finally block, restoring the line number when done */ + int saved_lineno = c->u->u_lineno; VISIT_SEQ(c, stmt, info->fb_datum); + c->u->u_lineno = saved_lineno; + c->u->u_lineno_set = 0; if (preserve_tos) { compiler_pop_fblock(c, POP_VALUE, NULL); } diff --git a/Python/importlib.h b/Python/importlib.h index d837bdd9d4c53..dea619e29d755 100644 --- a/Python/importlib.h +++ b/Python/importlib.h @@ -168,1637 +168,1637 @@ const unsigned char _Py_M__importlib_bootstrap[] = { 117,105,114,101,114,28,0,0,0,218,7,114,101,108,101,97, 115,101,169,2,114,30,0,0,0,114,35,0,0,0,114,10, 0,0,0,114,10,0,0,0,114,11,0,0,0,114,38,0, - 0,0,78,0,0,0,115,38,0,0,0,0,6,8,1,8, - 1,2,2,8,1,20,1,6,1,14,1,14,9,6,247,2, - 9,2,248,8,1,12,1,12,1,44,2,10,1,14,2,8, - 0,122,19,95,77,111,100,117,108,101,76,111,99,107,46,97, - 99,113,117,105,114,101,99,1,0,0,0,0,0,0,0,0, - 0,0,0,2,0,0,0,8,0,0,0,67,0,0,0,115, - 142,0,0,0,116,0,160,1,161,0,125,1,124,0,106,2, - 143,108,1,0,124,0,106,3,124,1,107,3,114,34,116,4, - 100,1,131,1,130,1,124,0,106,5,100,2,107,4,115,48, - 74,0,130,1,124,0,4,0,106,5,100,3,56,0,2,0, - 95,5,124,0,106,5,100,2,107,2,114,108,100,0,124,0, - 95,3,124,0,106,6,114,108,124,0,4,0,106,6,100,3, - 56,0,2,0,95,6,124,0,106,7,160,8,161,0,1,0, - 87,0,100,0,4,0,4,0,131,3,1,0,110,16,49,0, - 115,128,48,0,1,0,1,0,1,0,89,0,1,0,100,0, - 83,0,41,4,78,250,31,99,97,110,110,111,116,32,114,101, - 108,101,97,115,101,32,117,110,45,97,99,113,117,105,114,101, - 100,32,108,111,99,107,114,22,0,0,0,114,37,0,0,0, - 41,9,114,23,0,0,0,114,32,0,0,0,114,24,0,0, - 0,114,26,0,0,0,218,12,82,117,110,116,105,109,101,69, - 114,114,111,114,114,27,0,0,0,114,28,0,0,0,114,25, - 0,0,0,114,39,0,0,0,114,40,0,0,0,114,10,0, - 0,0,114,10,0,0,0,114,11,0,0,0,114,39,0,0, - 0,103,0,0,0,115,22,0,0,0,0,1,8,1,8,1, - 10,1,8,1,14,1,14,1,10,1,6,1,6,1,14,1, - 122,19,95,77,111,100,117,108,101,76,111,99,107,46,114,101, - 108,101,97,115,101,99,1,0,0,0,0,0,0,0,0,0, - 0,0,1,0,0,0,5,0,0,0,67,0,0,0,115,18, - 0,0,0,100,1,160,0,124,0,106,1,116,2,124,0,131, - 1,161,2,83,0,41,2,78,122,23,95,77,111,100,117,108, - 101,76,111,99,107,40,123,33,114,125,41,32,97,116,32,123, - 125,169,3,218,6,102,111,114,109,97,116,114,17,0,0,0, - 218,2,105,100,169,1,114,30,0,0,0,114,10,0,0,0, - 114,10,0,0,0,114,11,0,0,0,218,8,95,95,114,101, - 112,114,95,95,116,0,0,0,115,2,0,0,0,0,1,122, - 20,95,77,111,100,117,108,101,76,111,99,107,46,95,95,114, - 101,112,114,95,95,78,41,9,114,1,0,0,0,114,0,0, - 0,0,114,2,0,0,0,114,3,0,0,0,114,31,0,0, - 0,114,36,0,0,0,114,38,0,0,0,114,39,0,0,0, - 114,47,0,0,0,114,10,0,0,0,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,114,20,0,0,0,52,0, - 0,0,115,12,0,0,0,8,1,4,5,8,8,8,12,8, - 25,8,13,114,20,0,0,0,99,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,2,0,0,0,64,0,0, - 0,115,48,0,0,0,101,0,90,1,100,0,90,2,100,1, - 90,3,100,2,100,3,132,0,90,4,100,4,100,5,132,0, - 90,5,100,6,100,7,132,0,90,6,100,8,100,9,132,0, - 90,7,100,10,83,0,41,11,218,16,95,68,117,109,109,121, - 77,111,100,117,108,101,76,111,99,107,122,86,65,32,115,105, - 109,112,108,101,32,95,77,111,100,117,108,101,76,111,99,107, - 32,101,113,117,105,118,97,108,101,110,116,32,102,111,114,32, - 80,121,116,104,111,110,32,98,117,105,108,100,115,32,119,105, - 116,104,111,117,116,10,32,32,32,32,109,117,108,116,105,45, - 116,104,114,101,97,100,105,110,103,32,115,117,112,112,111,114, - 116,46,99,2,0,0,0,0,0,0,0,0,0,0,0,2, - 0,0,0,2,0,0,0,67,0,0,0,115,16,0,0,0, - 124,1,124,0,95,0,100,1,124,0,95,1,100,0,83,0, - 114,21,0,0,0,41,2,114,17,0,0,0,114,27,0,0, - 0,114,29,0,0,0,114,10,0,0,0,114,10,0,0,0, - 114,11,0,0,0,114,31,0,0,0,124,0,0,0,115,4, - 0,0,0,0,1,6,1,122,25,95,68,117,109,109,121,77, - 111,100,117,108,101,76,111,99,107,46,95,95,105,110,105,116, - 95,95,99,1,0,0,0,0,0,0,0,0,0,0,0,1, - 0,0,0,3,0,0,0,67,0,0,0,115,18,0,0,0, - 124,0,4,0,106,0,100,1,55,0,2,0,95,0,100,2, - 83,0,41,3,78,114,37,0,0,0,84,41,1,114,27,0, - 0,0,114,46,0,0,0,114,10,0,0,0,114,10,0,0, - 0,114,11,0,0,0,114,38,0,0,0,128,0,0,0,115, - 4,0,0,0,0,1,14,1,122,24,95,68,117,109,109,121, - 77,111,100,117,108,101,76,111,99,107,46,97,99,113,117,105, - 114,101,99,1,0,0,0,0,0,0,0,0,0,0,0,1, - 0,0,0,3,0,0,0,67,0,0,0,115,36,0,0,0, - 124,0,106,0,100,1,107,2,114,18,116,1,100,2,131,1, - 130,1,124,0,4,0,106,0,100,3,56,0,2,0,95,0, - 100,0,83,0,41,4,78,114,22,0,0,0,114,41,0,0, - 0,114,37,0,0,0,41,2,114,27,0,0,0,114,42,0, - 0,0,114,46,0,0,0,114,10,0,0,0,114,10,0,0, - 0,114,11,0,0,0,114,39,0,0,0,132,0,0,0,115, - 6,0,0,0,0,1,10,1,8,1,122,24,95,68,117,109, - 109,121,77,111,100,117,108,101,76,111,99,107,46,114,101,108, - 101,97,115,101,99,1,0,0,0,0,0,0,0,0,0,0, - 0,1,0,0,0,5,0,0,0,67,0,0,0,115,18,0, - 0,0,100,1,160,0,124,0,106,1,116,2,124,0,131,1, - 161,2,83,0,41,2,78,122,28,95,68,117,109,109,121,77, - 111,100,117,108,101,76,111,99,107,40,123,33,114,125,41,32, - 97,116,32,123,125,114,43,0,0,0,114,46,0,0,0,114, - 10,0,0,0,114,10,0,0,0,114,11,0,0,0,114,47, - 0,0,0,137,0,0,0,115,2,0,0,0,0,1,122,25, - 95,68,117,109,109,121,77,111,100,117,108,101,76,111,99,107, - 46,95,95,114,101,112,114,95,95,78,41,8,114,1,0,0, - 0,114,0,0,0,0,114,2,0,0,0,114,3,0,0,0, - 114,31,0,0,0,114,38,0,0,0,114,39,0,0,0,114, - 47,0,0,0,114,10,0,0,0,114,10,0,0,0,114,10, - 0,0,0,114,11,0,0,0,114,48,0,0,0,120,0,0, - 0,115,10,0,0,0,8,1,4,3,8,4,8,4,8,5, - 114,48,0,0,0,99,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,2,0,0,0,64,0,0,0,115,36, - 0,0,0,101,0,90,1,100,0,90,2,100,1,100,2,132, - 0,90,3,100,3,100,4,132,0,90,4,100,5,100,6,132, - 0,90,5,100,7,83,0,41,8,218,18,95,77,111,100,117, - 108,101,76,111,99,107,77,97,110,97,103,101,114,99,2,0, - 0,0,0,0,0,0,0,0,0,0,2,0,0,0,2,0, - 0,0,67,0,0,0,115,16,0,0,0,124,1,124,0,95, - 0,100,0,124,0,95,1,100,0,83,0,114,13,0,0,0, - 41,2,218,5,95,110,97,109,101,218,5,95,108,111,99,107, - 114,29,0,0,0,114,10,0,0,0,114,10,0,0,0,114, - 11,0,0,0,114,31,0,0,0,143,0,0,0,115,4,0, - 0,0,0,1,6,1,122,27,95,77,111,100,117,108,101,76, - 111,99,107,77,97,110,97,103,101,114,46,95,95,105,110,105, - 116,95,95,99,1,0,0,0,0,0,0,0,0,0,0,0, - 1,0,0,0,2,0,0,0,67,0,0,0,115,26,0,0, - 0,116,0,124,0,106,1,131,1,124,0,95,2,124,0,106, - 2,160,3,161,0,1,0,100,0,83,0,114,13,0,0,0, - 41,4,218,16,95,103,101,116,95,109,111,100,117,108,101,95, - 108,111,99,107,114,50,0,0,0,114,51,0,0,0,114,38, - 0,0,0,114,46,0,0,0,114,10,0,0,0,114,10,0, - 0,0,114,11,0,0,0,218,9,95,95,101,110,116,101,114, - 95,95,147,0,0,0,115,4,0,0,0,0,1,12,1,122, - 28,95,77,111,100,117,108,101,76,111,99,107,77,97,110,97, - 103,101,114,46,95,95,101,110,116,101,114,95,95,99,1,0, - 0,0,0,0,0,0,0,0,0,0,3,0,0,0,2,0, - 0,0,79,0,0,0,115,14,0,0,0,124,0,106,0,160, - 1,161,0,1,0,100,0,83,0,114,13,0,0,0,41,2, - 114,51,0,0,0,114,39,0,0,0,41,3,114,30,0,0, - 0,218,4,97,114,103,115,90,6,107,119,97,114,103,115,114, - 10,0,0,0,114,10,0,0,0,114,11,0,0,0,218,8, - 95,95,101,120,105,116,95,95,151,0,0,0,115,2,0,0, - 0,0,1,122,27,95,77,111,100,117,108,101,76,111,99,107, - 77,97,110,97,103,101,114,46,95,95,101,120,105,116,95,95, - 78,41,6,114,1,0,0,0,114,0,0,0,0,114,2,0, - 0,0,114,31,0,0,0,114,53,0,0,0,114,55,0,0, - 0,114,10,0,0,0,114,10,0,0,0,114,10,0,0,0, - 114,11,0,0,0,114,49,0,0,0,141,0,0,0,115,6, - 0,0,0,8,2,8,4,8,4,114,49,0,0,0,99,1, - 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,8, - 0,0,0,67,0,0,0,115,138,0,0,0,116,0,160,1, - 161,0,1,0,122,114,122,14,116,2,124,0,25,0,131,0, - 125,1,87,0,110,24,4,0,116,3,107,10,114,48,1,0, - 1,0,1,0,100,1,125,1,89,0,110,2,48,0,124,1, - 100,1,107,8,114,112,116,4,100,1,107,8,114,76,116,5, - 124,0,131,1,125,1,110,8,116,6,124,0,131,1,125,1, - 124,0,102,1,100,2,100,3,132,1,125,2,116,7,160,8, - 124,1,124,2,161,2,116,2,124,0,60,0,87,0,116,0, - 160,9,161,0,1,0,110,10,116,0,160,9,161,0,1,0, - 48,0,124,1,83,0,41,4,122,139,71,101,116,32,111,114, - 32,99,114,101,97,116,101,32,116,104,101,32,109,111,100,117, - 108,101,32,108,111,99,107,32,102,111,114,32,97,32,103,105, - 118,101,110,32,109,111,100,117,108,101,32,110,97,109,101,46, - 10,10,32,32,32,32,65,99,113,117,105,114,101,47,114,101, - 108,101,97,115,101,32,105,110,116,101,114,110,97,108,108,121, - 32,116,104,101,32,103,108,111,98,97,108,32,105,109,112,111, - 114,116,32,108,111,99,107,32,116,111,32,112,114,111,116,101, - 99,116,10,32,32,32,32,95,109,111,100,117,108,101,95,108, - 111,99,107,115,46,78,99,2,0,0,0,0,0,0,0,0, - 0,0,0,2,0,0,0,8,0,0,0,83,0,0,0,115, - 56,0,0,0,116,0,160,1,161,0,1,0,122,32,116,2, - 160,3,124,1,161,1,124,0,107,8,114,30,116,2,124,1, - 61,0,87,0,116,0,160,4,161,0,1,0,110,10,116,0, - 160,4,161,0,1,0,48,0,100,0,83,0,114,13,0,0, - 0,41,5,218,4,95,105,109,112,218,12,97,99,113,117,105, - 114,101,95,108,111,99,107,218,13,95,109,111,100,117,108,101, - 95,108,111,99,107,115,114,34,0,0,0,218,12,114,101,108, - 101,97,115,101,95,108,111,99,107,41,2,218,3,114,101,102, - 114,17,0,0,0,114,10,0,0,0,114,10,0,0,0,114, - 11,0,0,0,218,2,99,98,176,0,0,0,115,12,0,0, - 0,0,1,8,1,2,4,14,1,8,2,10,0,122,28,95, - 103,101,116,95,109,111,100,117,108,101,95,108,111,99,107,46, - 60,108,111,99,97,108,115,62,46,99,98,41,10,114,56,0, - 0,0,114,57,0,0,0,114,58,0,0,0,218,8,75,101, - 121,69,114,114,111,114,114,23,0,0,0,114,48,0,0,0, - 114,20,0,0,0,218,8,95,119,101,97,107,114,101,102,114, - 60,0,0,0,114,59,0,0,0,41,3,114,17,0,0,0, - 114,24,0,0,0,114,61,0,0,0,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,114,52,0,0,0,157,0, - 0,0,115,30,0,0,0,0,6,8,1,2,1,2,1,14, - 1,14,1,10,2,8,1,8,1,10,2,8,2,12,11,18, - 2,10,0,10,2,114,52,0,0,0,99,1,0,0,0,0, - 0,0,0,0,0,0,0,2,0,0,0,8,0,0,0,67, - 0,0,0,115,54,0,0,0,116,0,124,0,131,1,125,1, - 122,12,124,1,160,1,161,0,1,0,87,0,110,20,4,0, - 116,2,107,10,114,40,1,0,1,0,1,0,89,0,110,10, - 48,0,124,1,160,3,161,0,1,0,100,1,83,0,41,2, - 122,189,65,99,113,117,105,114,101,115,32,116,104,101,110,32, - 114,101,108,101,97,115,101,115,32,116,104,101,32,109,111,100, - 117,108,101,32,108,111,99,107,32,102,111,114,32,97,32,103, - 105,118,101,110,32,109,111,100,117,108,101,32,110,97,109,101, - 46,10,10,32,32,32,32,84,104,105,115,32,105,115,32,117, - 115,101,100,32,116,111,32,101,110,115,117,114,101,32,97,32, - 109,111,100,117,108,101,32,105,115,32,99,111,109,112,108,101, - 116,101,108,121,32,105,110,105,116,105,97,108,105,122,101,100, - 44,32,105,110,32,116,104,101,10,32,32,32,32,101,118,101, - 110,116,32,105,116,32,105,115,32,98,101,105,110,103,32,105, - 109,112,111,114,116,101,100,32,98,121,32,97,110,111,116,104, - 101,114,32,116,104,114,101,97,100,46,10,32,32,32,32,78, - 41,4,114,52,0,0,0,114,38,0,0,0,114,19,0,0, - 0,114,39,0,0,0,41,2,114,17,0,0,0,114,24,0, - 0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0, - 0,218,19,95,108,111,99,107,95,117,110,108,111,99,107,95, - 109,111,100,117,108,101,194,0,0,0,115,12,0,0,0,0, - 6,8,1,2,1,12,1,14,3,6,2,114,64,0,0,0, - 99,1,0,0,0,0,0,0,0,0,0,0,0,3,0,0, - 0,3,0,0,0,79,0,0,0,115,10,0,0,0,124,0, - 124,1,124,2,142,1,83,0,41,1,97,46,1,0,0,114, - 101,109,111,118,101,95,105,109,112,111,114,116,108,105,98,95, - 102,114,97,109,101,115,32,105,110,32,105,109,112,111,114,116, - 46,99,32,119,105,108,108,32,97,108,119,97,121,115,32,114, - 101,109,111,118,101,32,115,101,113,117,101,110,99,101,115,10, - 32,32,32,32,111,102,32,105,109,112,111,114,116,108,105,98, - 32,102,114,97,109,101,115,32,116,104,97,116,32,101,110,100, - 32,119,105,116,104,32,97,32,99,97,108,108,32,116,111,32, - 116,104,105,115,32,102,117,110,99,116,105,111,110,10,10,32, - 32,32,32,85,115,101,32,105,116,32,105,110,115,116,101,97, - 100,32,111,102,32,97,32,110,111,114,109,97,108,32,99,97, - 108,108,32,105,110,32,112,108,97,99,101,115,32,119,104,101, - 114,101,32,105,110,99,108,117,100,105,110,103,32,116,104,101, - 32,105,109,112,111,114,116,108,105,98,10,32,32,32,32,102, - 114,97,109,101,115,32,105,110,116,114,111,100,117,99,101,115, - 32,117,110,119,97,110,116,101,100,32,110,111,105,115,101,32, - 105,110,116,111,32,116,104,101,32,116,114,97,99,101,98,97, - 99,107,32,40,101,46,103,46,32,119,104,101,110,32,101,120, - 101,99,117,116,105,110,103,10,32,32,32,32,109,111,100,117, - 108,101,32,99,111,100,101,41,10,32,32,32,32,114,10,0, - 0,0,41,3,218,1,102,114,54,0,0,0,90,4,107,119, - 100,115,114,10,0,0,0,114,10,0,0,0,114,11,0,0, - 0,218,25,95,99,97,108,108,95,119,105,116,104,95,102,114, - 97,109,101,115,95,114,101,109,111,118,101,100,211,0,0,0, - 115,2,0,0,0,0,8,114,66,0,0,0,114,37,0,0, - 0,41,1,218,9,118,101,114,98,111,115,105,116,121,99,1, - 0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,4, - 0,0,0,71,0,0,0,115,54,0,0,0,116,0,106,1, - 106,2,124,1,107,5,114,50,124,0,160,3,100,1,161,1, - 115,30,100,2,124,0,23,0,125,0,116,4,124,0,106,5, - 124,2,142,0,116,0,106,6,100,3,141,2,1,0,100,4, - 83,0,41,5,122,61,80,114,105,110,116,32,116,104,101,32, - 109,101,115,115,97,103,101,32,116,111,32,115,116,100,101,114, - 114,32,105,102,32,45,118,47,80,89,84,72,79,78,86,69, - 82,66,79,83,69,32,105,115,32,116,117,114,110,101,100,32, - 111,110,46,41,2,250,1,35,122,7,105,109,112,111,114,116, - 32,122,2,35,32,41,1,90,4,102,105,108,101,78,41,7, - 114,15,0,0,0,218,5,102,108,97,103,115,218,7,118,101, - 114,98,111,115,101,218,10,115,116,97,114,116,115,119,105,116, - 104,218,5,112,114,105,110,116,114,44,0,0,0,218,6,115, - 116,100,101,114,114,41,3,218,7,109,101,115,115,97,103,101, - 114,67,0,0,0,114,54,0,0,0,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,218,16,95,118,101,114,98, - 111,115,101,95,109,101,115,115,97,103,101,222,0,0,0,115, - 8,0,0,0,0,2,12,1,10,1,8,1,114,75,0,0, - 0,99,1,0,0,0,0,0,0,0,0,0,0,0,2,0, - 0,0,3,0,0,0,3,0,0,0,115,26,0,0,0,135, - 0,102,1,100,1,100,2,132,8,125,1,116,0,124,1,136, - 0,131,2,1,0,124,1,83,0,41,3,122,49,68,101,99, - 111,114,97,116,111,114,32,116,111,32,118,101,114,105,102,121, - 32,116,104,101,32,110,97,109,101,100,32,109,111,100,117,108, - 101,32,105,115,32,98,117,105,108,116,45,105,110,46,99,2, - 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,4, - 0,0,0,19,0,0,0,115,38,0,0,0,124,1,116,0, - 106,1,107,7,114,28,116,2,100,1,160,3,124,1,161,1, - 124,1,100,2,141,2,130,1,136,0,124,0,124,1,131,2, - 83,0,41,3,78,250,29,123,33,114,125,32,105,115,32,110, - 111,116,32,97,32,98,117,105,108,116,45,105,110,32,109,111, - 100,117,108,101,114,16,0,0,0,41,4,114,15,0,0,0, - 218,20,98,117,105,108,116,105,110,95,109,111,100,117,108,101, - 95,110,97,109,101,115,218,11,73,109,112,111,114,116,69,114, - 114,111,114,114,44,0,0,0,169,2,114,30,0,0,0,218, - 8,102,117,108,108,110,97,109,101,169,1,218,3,102,120,110, - 114,10,0,0,0,114,11,0,0,0,218,25,95,114,101,113, - 117,105,114,101,115,95,98,117,105,108,116,105,110,95,119,114, - 97,112,112,101,114,232,0,0,0,115,10,0,0,0,0,1, - 10,1,10,1,2,255,6,2,122,52,95,114,101,113,117,105, - 114,101,115,95,98,117,105,108,116,105,110,46,60,108,111,99, - 97,108,115,62,46,95,114,101,113,117,105,114,101,115,95,98, - 117,105,108,116,105,110,95,119,114,97,112,112,101,114,169,1, - 114,12,0,0,0,41,2,114,82,0,0,0,114,83,0,0, - 0,114,10,0,0,0,114,81,0,0,0,114,11,0,0,0, - 218,17,95,114,101,113,117,105,114,101,115,95,98,117,105,108, - 116,105,110,230,0,0,0,115,6,0,0,0,0,2,12,5, - 10,1,114,85,0,0,0,99,1,0,0,0,0,0,0,0, - 0,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0, - 115,26,0,0,0,135,0,102,1,100,1,100,2,132,8,125, - 1,116,0,124,1,136,0,131,2,1,0,124,1,83,0,41, - 3,122,47,68,101,99,111,114,97,116,111,114,32,116,111,32, - 118,101,114,105,102,121,32,116,104,101,32,110,97,109,101,100, - 32,109,111,100,117,108,101,32,105,115,32,102,114,111,122,101, - 110,46,99,2,0,0,0,0,0,0,0,0,0,0,0,2, - 0,0,0,4,0,0,0,19,0,0,0,115,38,0,0,0, - 116,0,160,1,124,1,161,1,115,28,116,2,100,1,160,3, - 124,1,161,1,124,1,100,2,141,2,130,1,136,0,124,0, - 124,1,131,2,83,0,169,3,78,122,27,123,33,114,125,32, - 105,115,32,110,111,116,32,97,32,102,114,111,122,101,110,32, - 109,111,100,117,108,101,114,16,0,0,0,41,4,114,56,0, - 0,0,218,9,105,115,95,102,114,111,122,101,110,114,78,0, - 0,0,114,44,0,0,0,114,79,0,0,0,114,81,0,0, - 0,114,10,0,0,0,114,11,0,0,0,218,24,95,114,101, - 113,117,105,114,101,115,95,102,114,111,122,101,110,95,119,114, - 97,112,112,101,114,243,0,0,0,115,10,0,0,0,0,1, - 10,1,10,1,2,255,6,2,122,50,95,114,101,113,117,105, - 114,101,115,95,102,114,111,122,101,110,46,60,108,111,99,97, - 108,115,62,46,95,114,101,113,117,105,114,101,115,95,102,114, - 111,122,101,110,95,119,114,97,112,112,101,114,114,84,0,0, - 0,41,2,114,82,0,0,0,114,88,0,0,0,114,10,0, - 0,0,114,81,0,0,0,114,11,0,0,0,218,16,95,114, - 101,113,117,105,114,101,115,95,102,114,111,122,101,110,241,0, - 0,0,115,6,0,0,0,0,2,12,5,10,1,114,89,0, - 0,0,99,2,0,0,0,0,0,0,0,0,0,0,0,4, - 0,0,0,3,0,0,0,67,0,0,0,115,62,0,0,0, - 116,0,124,1,124,0,131,2,125,2,124,1,116,1,106,2, - 107,6,114,50,116,1,106,2,124,1,25,0,125,3,116,3, - 124,2,124,3,131,2,1,0,116,1,106,2,124,1,25,0, - 83,0,116,4,124,2,131,1,83,0,100,1,83,0,41,2, - 122,128,76,111,97,100,32,116,104,101,32,115,112,101,99,105, - 102,105,101,100,32,109,111,100,117,108,101,32,105,110,116,111, - 32,115,121,115,46,109,111,100,117,108,101,115,32,97,110,100, - 32,114,101,116,117,114,110,32,105,116,46,10,10,32,32,32, - 32,84,104,105,115,32,109,101,116,104,111,100,32,105,115,32, - 100,101,112,114,101,99,97,116,101,100,46,32,32,85,115,101, - 32,108,111,97,100,101,114,46,101,120,101,99,95,109,111,100, - 117,108,101,32,105,110,115,116,101,97,100,46,10,10,32,32, - 32,32,78,41,5,218,16,115,112,101,99,95,102,114,111,109, - 95,108,111,97,100,101,114,114,15,0,0,0,218,7,109,111, - 100,117,108,101,115,218,5,95,101,120,101,99,218,5,95,108, - 111,97,100,41,4,114,30,0,0,0,114,80,0,0,0,218, - 4,115,112,101,99,218,6,109,111,100,117,108,101,114,10,0, - 0,0,114,10,0,0,0,114,11,0,0,0,218,17,95,108, - 111,97,100,95,109,111,100,117,108,101,95,115,104,105,109,253, - 0,0,0,115,12,0,0,0,0,6,10,1,10,1,10,1, - 10,1,10,2,114,96,0,0,0,99,1,0,0,0,0,0, - 0,0,0,0,0,0,5,0,0,0,8,0,0,0,67,0, - 0,0,115,226,0,0,0,116,0,124,0,100,1,100,0,131, - 3,125,1,116,1,124,1,100,2,131,2,114,56,122,12,124, - 1,160,2,124,0,161,1,87,0,83,0,4,0,116,3,107, - 10,114,54,1,0,1,0,1,0,89,0,110,2,48,0,122, - 10,124,0,106,4,125,2,87,0,110,20,4,0,116,5,107, - 10,114,86,1,0,1,0,1,0,89,0,110,18,48,0,124, - 2,100,0,107,9,114,104,116,6,124,2,131,1,83,0,122, - 10,124,0,106,7,125,3,87,0,110,24,4,0,116,5,107, - 10,114,138,1,0,1,0,1,0,100,3,125,3,89,0,110, - 2,48,0,122,10,124,0,106,8,125,4,87,0,110,58,4, - 0,116,5,107,10,114,208,1,0,1,0,1,0,124,1,100, - 0,107,8,114,188,100,4,160,9,124,3,161,1,6,0,89, - 0,83,0,100,5,160,9,124,3,124,1,161,2,6,0,89, - 0,83,0,89,0,110,14,48,0,100,6,160,9,124,3,124, - 4,161,2,83,0,100,0,83,0,41,7,78,218,10,95,95, - 108,111,97,100,101,114,95,95,218,11,109,111,100,117,108,101, - 95,114,101,112,114,250,1,63,250,13,60,109,111,100,117,108, - 101,32,123,33,114,125,62,250,20,60,109,111,100,117,108,101, - 32,123,33,114,125,32,40,123,33,114,125,41,62,250,23,60, - 109,111,100,117,108,101,32,123,33,114,125,32,102,114,111,109, - 32,123,33,114,125,62,41,10,114,6,0,0,0,114,4,0, - 0,0,114,98,0,0,0,218,9,69,120,99,101,112,116,105, - 111,110,218,8,95,95,115,112,101,99,95,95,218,14,65,116, - 116,114,105,98,117,116,101,69,114,114,111,114,218,22,95,109, - 111,100,117,108,101,95,114,101,112,114,95,102,114,111,109,95, - 115,112,101,99,114,1,0,0,0,218,8,95,95,102,105,108, - 101,95,95,114,44,0,0,0,41,5,114,95,0,0,0,218, - 6,108,111,97,100,101,114,114,94,0,0,0,114,17,0,0, - 0,218,8,102,105,108,101,110,97,109,101,114,10,0,0,0, - 114,10,0,0,0,114,11,0,0,0,218,12,95,109,111,100, - 117,108,101,95,114,101,112,114,13,1,0,0,115,46,0,0, - 0,0,2,12,1,10,4,2,1,12,1,14,1,6,1,2, - 1,10,1,14,1,6,2,8,1,8,4,2,1,10,1,14, - 1,10,1,2,1,10,1,14,1,8,1,14,2,22,2,114, - 110,0,0,0,99,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,4,0,0,0,64,0,0,0,115,114,0, - 0,0,101,0,90,1,100,0,90,2,100,1,90,3,100,2, - 100,2,100,2,100,3,156,3,100,4,100,5,132,2,90,4, - 100,6,100,7,132,0,90,5,100,8,100,9,132,0,90,6, - 101,7,100,10,100,11,132,0,131,1,90,8,101,8,106,9, - 100,12,100,11,132,0,131,1,90,8,101,7,100,13,100,14, - 132,0,131,1,90,10,101,7,100,15,100,16,132,0,131,1, - 90,11,101,11,106,9,100,17,100,16,132,0,131,1,90,11, - 100,2,83,0,41,18,218,10,77,111,100,117,108,101,83,112, - 101,99,97,208,5,0,0,84,104,101,32,115,112,101,99,105, - 102,105,99,97,116,105,111,110,32,102,111,114,32,97,32,109, - 111,100,117,108,101,44,32,117,115,101,100,32,102,111,114,32, - 108,111,97,100,105,110,103,46,10,10,32,32,32,32,65,32, - 109,111,100,117,108,101,39,115,32,115,112,101,99,32,105,115, - 32,116,104,101,32,115,111,117,114,99,101,32,102,111,114,32, - 105,110,102,111,114,109,97,116,105,111,110,32,97,98,111,117, - 116,32,116,104,101,32,109,111,100,117,108,101,46,32,32,70, - 111,114,10,32,32,32,32,100,97,116,97,32,97,115,115,111, - 99,105,97,116,101,100,32,119,105,116,104,32,116,104,101,32, - 109,111,100,117,108,101,44,32,105,110,99,108,117,100,105,110, - 103,32,115,111,117,114,99,101,44,32,117,115,101,32,116,104, - 101,32,115,112,101,99,39,115,10,32,32,32,32,108,111,97, - 100,101,114,46,10,10,32,32,32,32,96,110,97,109,101,96, - 32,105,115,32,116,104,101,32,97,98,115,111,108,117,116,101, - 32,110,97,109,101,32,111,102,32,116,104,101,32,109,111,100, - 117,108,101,46,32,32,96,108,111,97,100,101,114,96,32,105, - 115,32,116,104,101,32,108,111,97,100,101,114,10,32,32,32, - 32,116,111,32,117,115,101,32,119,104,101,110,32,108,111,97, - 100,105,110,103,32,116,104,101,32,109,111,100,117,108,101,46, - 32,32,96,112,97,114,101,110,116,96,32,105,115,32,116,104, - 101,32,110,97,109,101,32,111,102,32,116,104,101,10,32,32, - 32,32,112,97,99,107,97,103,101,32,116,104,101,32,109,111, - 100,117,108,101,32,105,115,32,105,110,46,32,32,84,104,101, - 32,112,97,114,101,110,116,32,105,115,32,100,101,114,105,118, - 101,100,32,102,114,111,109,32,116,104,101,32,110,97,109,101, - 46,10,10,32,32,32,32,96,105,115,95,112,97,99,107,97, - 103,101,96,32,100,101,116,101,114,109,105,110,101,115,32,105, - 102,32,116,104,101,32,109,111,100,117,108,101,32,105,115,32, - 99,111,110,115,105,100,101,114,101,100,32,97,32,112,97,99, - 107,97,103,101,32,111,114,10,32,32,32,32,110,111,116,46, - 32,32,79,110,32,109,111,100,117,108,101,115,32,116,104,105, - 115,32,105,115,32,114,101,102,108,101,99,116,101,100,32,98, - 121,32,116,104,101,32,96,95,95,112,97,116,104,95,95,96, - 32,97,116,116,114,105,98,117,116,101,46,10,10,32,32,32, - 32,96,111,114,105,103,105,110,96,32,105,115,32,116,104,101, - 32,115,112,101,99,105,102,105,99,32,108,111,99,97,116,105, - 111,110,32,117,115,101,100,32,98,121,32,116,104,101,32,108, - 111,97,100,101,114,32,102,114,111,109,32,119,104,105,99,104, - 32,116,111,10,32,32,32,32,108,111,97,100,32,116,104,101, - 32,109,111,100,117,108,101,44,32,105,102,32,116,104,97,116, - 32,105,110,102,111,114,109,97,116,105,111,110,32,105,115,32, - 97,118,97,105,108,97,98,108,101,46,32,32,87,104,101,110, - 32,102,105,108,101,110,97,109,101,32,105,115,10,32,32,32, - 32,115,101,116,44,32,111,114,105,103,105,110,32,119,105,108, - 108,32,109,97,116,99,104,46,10,10,32,32,32,32,96,104, - 97,115,95,108,111,99,97,116,105,111,110,96,32,105,110,100, - 105,99,97,116,101,115,32,116,104,97,116,32,97,32,115,112, - 101,99,39,115,32,34,111,114,105,103,105,110,34,32,114,101, - 102,108,101,99,116,115,32,97,32,108,111,99,97,116,105,111, - 110,46,10,32,32,32,32,87,104,101,110,32,116,104,105,115, - 32,105,115,32,84,114,117,101,44,32,96,95,95,102,105,108, - 101,95,95,96,32,97,116,116,114,105,98,117,116,101,32,111, - 102,32,116,104,101,32,109,111,100,117,108,101,32,105,115,32, - 115,101,116,46,10,10,32,32,32,32,96,99,97,99,104,101, - 100,96,32,105,115,32,116,104,101,32,108,111,99,97,116,105, - 111,110,32,111,102,32,116,104,101,32,99,97,99,104,101,100, - 32,98,121,116,101,99,111,100,101,32,102,105,108,101,44,32, - 105,102,32,97,110,121,46,32,32,73,116,10,32,32,32,32, - 99,111,114,114,101,115,112,111,110,100,115,32,116,111,32,116, - 104,101,32,96,95,95,99,97,99,104,101,100,95,95,96,32, - 97,116,116,114,105,98,117,116,101,46,10,10,32,32,32,32, - 96,115,117,98,109,111,100,117,108,101,95,115,101,97,114,99, - 104,95,108,111,99,97,116,105,111,110,115,96,32,105,115,32, - 116,104,101,32,115,101,113,117,101,110,99,101,32,111,102,32, - 112,97,116,104,32,101,110,116,114,105,101,115,32,116,111,10, - 32,32,32,32,115,101,97,114,99,104,32,119,104,101,110,32, - 105,109,112,111,114,116,105,110,103,32,115,117,98,109,111,100, - 117,108,101,115,46,32,32,73,102,32,115,101,116,44,32,105, - 115,95,112,97,99,107,97,103,101,32,115,104,111,117,108,100, - 32,98,101,10,32,32,32,32,84,114,117,101,45,45,97,110, - 100,32,70,97,108,115,101,32,111,116,104,101,114,119,105,115, - 101,46,10,10,32,32,32,32,80,97,99,107,97,103,101,115, - 32,97,114,101,32,115,105,109,112,108,121,32,109,111,100,117, - 108,101,115,32,116,104,97,116,32,40,109,97,121,41,32,104, - 97,118,101,32,115,117,98,109,111,100,117,108,101,115,46,32, - 32,73,102,32,97,32,115,112,101,99,10,32,32,32,32,104, - 97,115,32,97,32,110,111,110,45,78,111,110,101,32,118,97, - 108,117,101,32,105,110,32,96,115,117,98,109,111,100,117,108, - 101,95,115,101,97,114,99,104,95,108,111,99,97,116,105,111, - 110,115,96,44,32,116,104,101,32,105,109,112,111,114,116,10, - 32,32,32,32,115,121,115,116,101,109,32,119,105,108,108,32, - 99,111,110,115,105,100,101,114,32,109,111,100,117,108,101,115, - 32,108,111,97,100,101,100,32,102,114,111,109,32,116,104,101, - 32,115,112,101,99,32,97,115,32,112,97,99,107,97,103,101, - 115,46,10,10,32,32,32,32,79,110,108,121,32,102,105,110, - 100,101,114,115,32,40,115,101,101,32,105,109,112,111,114,116, - 108,105,98,46,97,98,99,46,77,101,116,97,80,97,116,104, - 70,105,110,100,101,114,32,97,110,100,10,32,32,32,32,105, - 109,112,111,114,116,108,105,98,46,97,98,99,46,80,97,116, - 104,69,110,116,114,121,70,105,110,100,101,114,41,32,115,104, - 111,117,108,100,32,109,111,100,105,102,121,32,77,111,100,117, - 108,101,83,112,101,99,32,105,110,115,116,97,110,99,101,115, - 46,10,10,32,32,32,32,78,41,3,218,6,111,114,105,103, - 105,110,218,12,108,111,97,100,101,114,95,115,116,97,116,101, - 218,10,105,115,95,112,97,99,107,97,103,101,99,3,0,0, - 0,0,0,0,0,3,0,0,0,6,0,0,0,2,0,0, - 0,67,0,0,0,115,54,0,0,0,124,1,124,0,95,0, - 124,2,124,0,95,1,124,3,124,0,95,2,124,4,124,0, - 95,3,124,5,114,32,103,0,110,2,100,0,124,0,95,4, - 100,1,124,0,95,5,100,0,124,0,95,6,100,0,83,0, - 41,2,78,70,41,7,114,17,0,0,0,114,108,0,0,0, - 114,112,0,0,0,114,113,0,0,0,218,26,115,117,98,109, - 111,100,117,108,101,95,115,101,97,114,99,104,95,108,111,99, - 97,116,105,111,110,115,218,13,95,115,101,116,95,102,105,108, - 101,97,116,116,114,218,7,95,99,97,99,104,101,100,41,6, - 114,30,0,0,0,114,17,0,0,0,114,108,0,0,0,114, - 112,0,0,0,114,113,0,0,0,114,114,0,0,0,114,10, - 0,0,0,114,10,0,0,0,114,11,0,0,0,114,31,0, - 0,0,86,1,0,0,115,14,0,0,0,0,2,6,1,6, - 1,6,1,6,1,14,3,6,1,122,19,77,111,100,117,108, - 101,83,112,101,99,46,95,95,105,110,105,116,95,95,99,1, - 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,6, - 0,0,0,67,0,0,0,115,102,0,0,0,100,1,160,0, - 124,0,106,1,161,1,100,2,160,0,124,0,106,2,161,1, - 103,2,125,1,124,0,106,3,100,0,107,9,114,52,124,1, - 160,4,100,3,160,0,124,0,106,3,161,1,161,1,1,0, - 124,0,106,5,100,0,107,9,114,80,124,1,160,4,100,4, - 160,0,124,0,106,5,161,1,161,1,1,0,100,5,160,0, - 124,0,106,6,106,7,100,6,160,8,124,1,161,1,161,2, - 83,0,41,7,78,122,9,110,97,109,101,61,123,33,114,125, - 122,11,108,111,97,100,101,114,61,123,33,114,125,122,11,111, - 114,105,103,105,110,61,123,33,114,125,122,29,115,117,98,109, - 111,100,117,108,101,95,115,101,97,114,99,104,95,108,111,99, - 97,116,105,111,110,115,61,123,125,122,6,123,125,40,123,125, - 41,122,2,44,32,41,9,114,44,0,0,0,114,17,0,0, - 0,114,108,0,0,0,114,112,0,0,0,218,6,97,112,112, - 101,110,100,114,115,0,0,0,218,9,95,95,99,108,97,115, - 115,95,95,114,1,0,0,0,218,4,106,111,105,110,41,2, - 114,30,0,0,0,114,54,0,0,0,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,114,47,0,0,0,98,1, - 0,0,115,20,0,0,0,0,1,10,1,10,255,4,2,10, - 1,18,1,10,1,8,1,4,255,6,2,122,19,77,111,100, - 117,108,101,83,112,101,99,46,95,95,114,101,112,114,95,95, - 99,2,0,0,0,0,0,0,0,0,0,0,0,3,0,0, - 0,8,0,0,0,67,0,0,0,115,108,0,0,0,124,0, - 106,0,125,2,122,72,124,0,106,1,124,1,106,1,107,2, - 111,76,124,0,106,2,124,1,106,2,107,2,111,76,124,0, - 106,3,124,1,106,3,107,2,111,76,124,2,124,1,106,0, - 107,2,111,76,124,0,106,4,124,1,106,4,107,2,111,76, - 124,0,106,5,124,1,106,5,107,2,87,0,83,0,4,0, - 116,6,107,10,114,102,1,0,1,0,1,0,116,7,6,0, - 89,0,83,0,48,0,100,0,83,0,114,13,0,0,0,41, - 8,114,115,0,0,0,114,17,0,0,0,114,108,0,0,0, - 114,112,0,0,0,218,6,99,97,99,104,101,100,218,12,104, - 97,115,95,108,111,99,97,116,105,111,110,114,105,0,0,0, - 218,14,78,111,116,73,109,112,108,101,109,101,110,116,101,100, - 41,3,114,30,0,0,0,90,5,111,116,104,101,114,90,4, - 115,109,115,108,114,10,0,0,0,114,10,0,0,0,114,11, - 0,0,0,218,6,95,95,101,113,95,95,108,1,0,0,115, - 30,0,0,0,0,1,6,1,2,1,12,1,10,255,2,2, - 10,254,2,3,8,253,2,4,10,252,2,5,10,251,4,6, - 14,1,122,17,77,111,100,117,108,101,83,112,101,99,46,95, - 95,101,113,95,95,99,1,0,0,0,0,0,0,0,0,0, - 0,0,1,0,0,0,3,0,0,0,67,0,0,0,115,58, - 0,0,0,124,0,106,0,100,0,107,8,114,52,124,0,106, - 1,100,0,107,9,114,52,124,0,106,2,114,52,116,3,100, - 0,107,8,114,38,116,4,130,1,116,3,160,5,124,0,106, - 1,161,1,124,0,95,0,124,0,106,0,83,0,114,13,0, - 0,0,41,6,114,117,0,0,0,114,112,0,0,0,114,116, - 0,0,0,218,19,95,98,111,111,116,115,116,114,97,112,95, - 101,120,116,101,114,110,97,108,218,19,78,111,116,73,109,112, - 108,101,109,101,110,116,101,100,69,114,114,111,114,90,11,95, - 103,101,116,95,99,97,99,104,101,100,114,46,0,0,0,114, - 10,0,0,0,114,10,0,0,0,114,11,0,0,0,114,121, - 0,0,0,120,1,0,0,115,12,0,0,0,0,2,10,1, - 16,1,8,1,4,1,14,1,122,17,77,111,100,117,108,101, - 83,112,101,99,46,99,97,99,104,101,100,99,2,0,0,0, + 0,0,78,0,0,0,115,36,0,0,0,0,6,8,1,8, + 1,2,2,8,1,20,1,6,1,14,1,14,9,6,247,4, + 1,8,1,12,1,12,1,44,2,10,1,14,2,8,0,122, + 19,95,77,111,100,117,108,101,76,111,99,107,46,97,99,113, + 117,105,114,101,99,1,0,0,0,0,0,0,0,0,0,0, + 0,2,0,0,0,8,0,0,0,67,0,0,0,115,142,0, + 0,0,116,0,160,1,161,0,125,1,124,0,106,2,143,108, + 1,0,124,0,106,3,124,1,107,3,114,34,116,4,100,1, + 131,1,130,1,124,0,106,5,100,2,107,4,115,48,74,0, + 130,1,124,0,4,0,106,5,100,3,56,0,2,0,95,5, + 124,0,106,5,100,2,107,2,114,108,100,0,124,0,95,3, + 124,0,106,6,114,108,124,0,4,0,106,6,100,3,56,0, + 2,0,95,6,124,0,106,7,160,8,161,0,1,0,87,0, + 100,0,4,0,4,0,131,3,1,0,110,16,49,0,115,128, + 48,0,1,0,1,0,1,0,89,0,1,0,100,0,83,0, + 41,4,78,250,31,99,97,110,110,111,116,32,114,101,108,101, + 97,115,101,32,117,110,45,97,99,113,117,105,114,101,100,32, + 108,111,99,107,114,22,0,0,0,114,37,0,0,0,41,9, + 114,23,0,0,0,114,32,0,0,0,114,24,0,0,0,114, + 26,0,0,0,218,12,82,117,110,116,105,109,101,69,114,114, + 111,114,114,27,0,0,0,114,28,0,0,0,114,25,0,0, + 0,114,39,0,0,0,114,40,0,0,0,114,10,0,0,0, + 114,10,0,0,0,114,11,0,0,0,114,39,0,0,0,103, + 0,0,0,115,22,0,0,0,0,1,8,1,8,1,10,1, + 8,1,14,1,14,1,10,1,6,1,6,1,14,1,122,19, + 95,77,111,100,117,108,101,76,111,99,107,46,114,101,108,101, + 97,115,101,99,1,0,0,0,0,0,0,0,0,0,0,0, + 1,0,0,0,5,0,0,0,67,0,0,0,115,18,0,0, + 0,100,1,160,0,124,0,106,1,116,2,124,0,131,1,161, + 2,83,0,41,2,78,122,23,95,77,111,100,117,108,101,76, + 111,99,107,40,123,33,114,125,41,32,97,116,32,123,125,169, + 3,218,6,102,111,114,109,97,116,114,17,0,0,0,218,2, + 105,100,169,1,114,30,0,0,0,114,10,0,0,0,114,10, + 0,0,0,114,11,0,0,0,218,8,95,95,114,101,112,114, + 95,95,116,0,0,0,115,2,0,0,0,0,1,122,20,95, + 77,111,100,117,108,101,76,111,99,107,46,95,95,114,101,112, + 114,95,95,78,41,9,114,1,0,0,0,114,0,0,0,0, + 114,2,0,0,0,114,3,0,0,0,114,31,0,0,0,114, + 36,0,0,0,114,38,0,0,0,114,39,0,0,0,114,47, + 0,0,0,114,10,0,0,0,114,10,0,0,0,114,10,0, + 0,0,114,11,0,0,0,114,20,0,0,0,52,0,0,0, + 115,12,0,0,0,8,1,4,5,8,8,8,12,8,25,8, + 13,114,20,0,0,0,99,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,2,0,0,0,64,0,0,0,115, + 48,0,0,0,101,0,90,1,100,0,90,2,100,1,90,3, + 100,2,100,3,132,0,90,4,100,4,100,5,132,0,90,5, + 100,6,100,7,132,0,90,6,100,8,100,9,132,0,90,7, + 100,10,83,0,41,11,218,16,95,68,117,109,109,121,77,111, + 100,117,108,101,76,111,99,107,122,86,65,32,115,105,109,112, + 108,101,32,95,77,111,100,117,108,101,76,111,99,107,32,101, + 113,117,105,118,97,108,101,110,116,32,102,111,114,32,80,121, + 116,104,111,110,32,98,117,105,108,100,115,32,119,105,116,104, + 111,117,116,10,32,32,32,32,109,117,108,116,105,45,116,104, + 114,101,97,100,105,110,103,32,115,117,112,112,111,114,116,46, + 99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0, + 0,2,0,0,0,67,0,0,0,115,16,0,0,0,124,1, + 124,0,95,0,100,1,124,0,95,1,100,0,83,0,114,21, + 0,0,0,41,2,114,17,0,0,0,114,27,0,0,0,114, + 29,0,0,0,114,10,0,0,0,114,10,0,0,0,114,11, + 0,0,0,114,31,0,0,0,124,0,0,0,115,4,0,0, + 0,0,1,6,1,122,25,95,68,117,109,109,121,77,111,100, + 117,108,101,76,111,99,107,46,95,95,105,110,105,116,95,95, + 99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0, + 0,3,0,0,0,67,0,0,0,115,18,0,0,0,124,0, + 4,0,106,0,100,1,55,0,2,0,95,0,100,2,83,0, + 41,3,78,114,37,0,0,0,84,41,1,114,27,0,0,0, + 114,46,0,0,0,114,10,0,0,0,114,10,0,0,0,114, + 11,0,0,0,114,38,0,0,0,128,0,0,0,115,4,0, + 0,0,0,1,14,1,122,24,95,68,117,109,109,121,77,111, + 100,117,108,101,76,111,99,107,46,97,99,113,117,105,114,101, + 99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0, + 0,3,0,0,0,67,0,0,0,115,36,0,0,0,124,0, + 106,0,100,1,107,2,114,18,116,1,100,2,131,1,130,1, + 124,0,4,0,106,0,100,3,56,0,2,0,95,0,100,0, + 83,0,41,4,78,114,22,0,0,0,114,41,0,0,0,114, + 37,0,0,0,41,2,114,27,0,0,0,114,42,0,0,0, + 114,46,0,0,0,114,10,0,0,0,114,10,0,0,0,114, + 11,0,0,0,114,39,0,0,0,132,0,0,0,115,6,0, + 0,0,0,1,10,1,8,1,122,24,95,68,117,109,109,121, + 77,111,100,117,108,101,76,111,99,107,46,114,101,108,101,97, + 115,101,99,1,0,0,0,0,0,0,0,0,0,0,0,1, + 0,0,0,5,0,0,0,67,0,0,0,115,18,0,0,0, + 100,1,160,0,124,0,106,1,116,2,124,0,131,1,161,2, + 83,0,41,2,78,122,28,95,68,117,109,109,121,77,111,100, + 117,108,101,76,111,99,107,40,123,33,114,125,41,32,97,116, + 32,123,125,114,43,0,0,0,114,46,0,0,0,114,10,0, + 0,0,114,10,0,0,0,114,11,0,0,0,114,47,0,0, + 0,137,0,0,0,115,2,0,0,0,0,1,122,25,95,68, + 117,109,109,121,77,111,100,117,108,101,76,111,99,107,46,95, + 95,114,101,112,114,95,95,78,41,8,114,1,0,0,0,114, + 0,0,0,0,114,2,0,0,0,114,3,0,0,0,114,31, + 0,0,0,114,38,0,0,0,114,39,0,0,0,114,47,0, + 0,0,114,10,0,0,0,114,10,0,0,0,114,10,0,0, + 0,114,11,0,0,0,114,48,0,0,0,120,0,0,0,115, + 10,0,0,0,8,1,4,3,8,4,8,4,8,5,114,48, + 0,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,2,0,0,0,64,0,0,0,115,36,0,0, + 0,101,0,90,1,100,0,90,2,100,1,100,2,132,0,90, + 3,100,3,100,4,132,0,90,4,100,5,100,6,132,0,90, + 5,100,7,83,0,41,8,218,18,95,77,111,100,117,108,101, + 76,111,99,107,77,97,110,97,103,101,114,99,2,0,0,0, 0,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0, - 67,0,0,0,115,10,0,0,0,124,1,124,0,95,0,100, - 0,83,0,114,13,0,0,0,41,1,114,117,0,0,0,41, - 2,114,30,0,0,0,114,121,0,0,0,114,10,0,0,0, - 114,10,0,0,0,114,11,0,0,0,114,121,0,0,0,129, - 1,0,0,115,2,0,0,0,0,2,99,1,0,0,0,0, - 0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,67, - 0,0,0,115,36,0,0,0,124,0,106,0,100,1,107,8, - 114,26,124,0,106,1,160,2,100,2,161,1,100,3,25,0, - 83,0,124,0,106,1,83,0,100,1,83,0,41,4,122,32, - 84,104,101,32,110,97,109,101,32,111,102,32,116,104,101,32, - 109,111,100,117,108,101,39,115,32,112,97,114,101,110,116,46, - 78,218,1,46,114,22,0,0,0,41,3,114,115,0,0,0, - 114,17,0,0,0,218,10,114,112,97,114,116,105,116,105,111, - 110,114,46,0,0,0,114,10,0,0,0,114,10,0,0,0, - 114,11,0,0,0,218,6,112,97,114,101,110,116,133,1,0, - 0,115,6,0,0,0,0,3,10,1,16,2,122,17,77,111, - 100,117,108,101,83,112,101,99,46,112,97,114,101,110,116,99, - 1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, - 1,0,0,0,67,0,0,0,115,6,0,0,0,124,0,106, - 0,83,0,114,13,0,0,0,41,1,114,116,0,0,0,114, + 67,0,0,0,115,16,0,0,0,124,1,124,0,95,0,100, + 0,124,0,95,1,100,0,83,0,114,13,0,0,0,41,2, + 218,5,95,110,97,109,101,218,5,95,108,111,99,107,114,29, + 0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,0, + 0,0,114,31,0,0,0,143,0,0,0,115,4,0,0,0, + 0,1,6,1,122,27,95,77,111,100,117,108,101,76,111,99, + 107,77,97,110,97,103,101,114,46,95,95,105,110,105,116,95, + 95,99,1,0,0,0,0,0,0,0,0,0,0,0,1,0, + 0,0,2,0,0,0,67,0,0,0,115,26,0,0,0,116, + 0,124,0,106,1,131,1,124,0,95,2,124,0,106,2,160, + 3,161,0,1,0,100,0,83,0,114,13,0,0,0,41,4, + 218,16,95,103,101,116,95,109,111,100,117,108,101,95,108,111, + 99,107,114,50,0,0,0,114,51,0,0,0,114,38,0,0, + 0,114,46,0,0,0,114,10,0,0,0,114,10,0,0,0, + 114,11,0,0,0,218,9,95,95,101,110,116,101,114,95,95, + 147,0,0,0,115,4,0,0,0,0,1,12,1,122,28,95, + 77,111,100,117,108,101,76,111,99,107,77,97,110,97,103,101, + 114,46,95,95,101,110,116,101,114,95,95,99,1,0,0,0, + 0,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0, + 79,0,0,0,115,14,0,0,0,124,0,106,0,160,1,161, + 0,1,0,100,0,83,0,114,13,0,0,0,41,2,114,51, + 0,0,0,114,39,0,0,0,41,3,114,30,0,0,0,218, + 4,97,114,103,115,90,6,107,119,97,114,103,115,114,10,0, + 0,0,114,10,0,0,0,114,11,0,0,0,218,8,95,95, + 101,120,105,116,95,95,151,0,0,0,115,2,0,0,0,0, + 1,122,27,95,77,111,100,117,108,101,76,111,99,107,77,97, + 110,97,103,101,114,46,95,95,101,120,105,116,95,95,78,41, + 6,114,1,0,0,0,114,0,0,0,0,114,2,0,0,0, + 114,31,0,0,0,114,53,0,0,0,114,55,0,0,0,114, + 10,0,0,0,114,10,0,0,0,114,10,0,0,0,114,11, + 0,0,0,114,49,0,0,0,141,0,0,0,115,6,0,0, + 0,8,2,8,4,8,4,114,49,0,0,0,99,1,0,0, + 0,0,0,0,0,0,0,0,0,3,0,0,0,8,0,0, + 0,67,0,0,0,115,138,0,0,0,116,0,160,1,161,0, + 1,0,122,114,122,14,116,2,124,0,25,0,131,0,125,1, + 87,0,110,24,4,0,116,3,107,10,114,48,1,0,1,0, + 1,0,100,1,125,1,89,0,110,2,48,0,124,1,100,1, + 107,8,114,112,116,4,100,1,107,8,114,76,116,5,124,0, + 131,1,125,1,110,8,116,6,124,0,131,1,125,1,124,0, + 102,1,100,2,100,3,132,1,125,2,116,7,160,8,124,1, + 124,2,161,2,116,2,124,0,60,0,87,0,116,0,160,9, + 161,0,1,0,110,10,116,0,160,9,161,0,1,0,48,0, + 124,1,83,0,41,4,122,139,71,101,116,32,111,114,32,99, + 114,101,97,116,101,32,116,104,101,32,109,111,100,117,108,101, + 32,108,111,99,107,32,102,111,114,32,97,32,103,105,118,101, + 110,32,109,111,100,117,108,101,32,110,97,109,101,46,10,10, + 32,32,32,32,65,99,113,117,105,114,101,47,114,101,108,101, + 97,115,101,32,105,110,116,101,114,110,97,108,108,121,32,116, + 104,101,32,103,108,111,98,97,108,32,105,109,112,111,114,116, + 32,108,111,99,107,32,116,111,32,112,114,111,116,101,99,116, + 10,32,32,32,32,95,109,111,100,117,108,101,95,108,111,99, + 107,115,46,78,99,2,0,0,0,0,0,0,0,0,0,0, + 0,2,0,0,0,8,0,0,0,83,0,0,0,115,56,0, + 0,0,116,0,160,1,161,0,1,0,122,32,116,2,160,3, + 124,1,161,1,124,0,107,8,114,30,116,2,124,1,61,0, + 87,0,116,0,160,4,161,0,1,0,110,10,116,0,160,4, + 161,0,1,0,48,0,100,0,83,0,114,13,0,0,0,41, + 5,218,4,95,105,109,112,218,12,97,99,113,117,105,114,101, + 95,108,111,99,107,218,13,95,109,111,100,117,108,101,95,108, + 111,99,107,115,114,34,0,0,0,218,12,114,101,108,101,97, + 115,101,95,108,111,99,107,41,2,218,3,114,101,102,114,17, + 0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,0, + 0,0,218,2,99,98,176,0,0,0,115,12,0,0,0,0, + 1,8,1,2,4,14,1,8,2,10,0,122,28,95,103,101, + 116,95,109,111,100,117,108,101,95,108,111,99,107,46,60,108, + 111,99,97,108,115,62,46,99,98,41,10,114,56,0,0,0, + 114,57,0,0,0,114,58,0,0,0,218,8,75,101,121,69, + 114,114,111,114,114,23,0,0,0,114,48,0,0,0,114,20, + 0,0,0,218,8,95,119,101,97,107,114,101,102,114,60,0, + 0,0,114,59,0,0,0,41,3,114,17,0,0,0,114,24, + 0,0,0,114,61,0,0,0,114,10,0,0,0,114,10,0, + 0,0,114,11,0,0,0,114,52,0,0,0,157,0,0,0, + 115,30,0,0,0,0,6,8,1,2,1,2,1,14,1,14, + 1,10,2,8,1,8,1,10,2,8,2,12,11,18,2,10, + 0,10,2,114,52,0,0,0,99,1,0,0,0,0,0,0, + 0,0,0,0,0,2,0,0,0,8,0,0,0,67,0,0, + 0,115,54,0,0,0,116,0,124,0,131,1,125,1,122,12, + 124,1,160,1,161,0,1,0,87,0,110,20,4,0,116,2, + 107,10,114,40,1,0,1,0,1,0,89,0,110,10,48,0, + 124,1,160,3,161,0,1,0,100,1,83,0,41,2,122,189, + 65,99,113,117,105,114,101,115,32,116,104,101,110,32,114,101, + 108,101,97,115,101,115,32,116,104,101,32,109,111,100,117,108, + 101,32,108,111,99,107,32,102,111,114,32,97,32,103,105,118, + 101,110,32,109,111,100,117,108,101,32,110,97,109,101,46,10, + 10,32,32,32,32,84,104,105,115,32,105,115,32,117,115,101, + 100,32,116,111,32,101,110,115,117,114,101,32,97,32,109,111, + 100,117,108,101,32,105,115,32,99,111,109,112,108,101,116,101, + 108,121,32,105,110,105,116,105,97,108,105,122,101,100,44,32, + 105,110,32,116,104,101,10,32,32,32,32,101,118,101,110,116, + 32,105,116,32,105,115,32,98,101,105,110,103,32,105,109,112, + 111,114,116,101,100,32,98,121,32,97,110,111,116,104,101,114, + 32,116,104,114,101,97,100,46,10,32,32,32,32,78,41,4, + 114,52,0,0,0,114,38,0,0,0,114,19,0,0,0,114, + 39,0,0,0,41,2,114,17,0,0,0,114,24,0,0,0, + 114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,218, + 19,95,108,111,99,107,95,117,110,108,111,99,107,95,109,111, + 100,117,108,101,194,0,0,0,115,12,0,0,0,0,6,8, + 1,2,1,12,1,14,3,6,2,114,64,0,0,0,99,1, + 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,3, + 0,0,0,79,0,0,0,115,10,0,0,0,124,0,124,1, + 124,2,142,1,83,0,41,1,97,46,1,0,0,114,101,109, + 111,118,101,95,105,109,112,111,114,116,108,105,98,95,102,114, + 97,109,101,115,32,105,110,32,105,109,112,111,114,116,46,99, + 32,119,105,108,108,32,97,108,119,97,121,115,32,114,101,109, + 111,118,101,32,115,101,113,117,101,110,99,101,115,10,32,32, + 32,32,111,102,32,105,109,112,111,114,116,108,105,98,32,102, + 114,97,109,101,115,32,116,104,97,116,32,101,110,100,32,119, + 105,116,104,32,97,32,99,97,108,108,32,116,111,32,116,104, + 105,115,32,102,117,110,99,116,105,111,110,10,10,32,32,32, + 32,85,115,101,32,105,116,32,105,110,115,116,101,97,100,32, + 111,102,32,97,32,110,111,114,109,97,108,32,99,97,108,108, + 32,105,110,32,112,108,97,99,101,115,32,119,104,101,114,101, + 32,105,110,99,108,117,100,105,110,103,32,116,104,101,32,105, + 109,112,111,114,116,108,105,98,10,32,32,32,32,102,114,97, + 109,101,115,32,105,110,116,114,111,100,117,99,101,115,32,117, + 110,119,97,110,116,101,100,32,110,111,105,115,101,32,105,110, + 116,111,32,116,104,101,32,116,114,97,99,101,98,97,99,107, + 32,40,101,46,103,46,32,119,104,101,110,32,101,120,101,99, + 117,116,105,110,103,10,32,32,32,32,109,111,100,117,108,101, + 32,99,111,100,101,41,10,32,32,32,32,114,10,0,0,0, + 41,3,218,1,102,114,54,0,0,0,90,4,107,119,100,115, + 114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,218, + 25,95,99,97,108,108,95,119,105,116,104,95,102,114,97,109, + 101,115,95,114,101,109,111,118,101,100,211,0,0,0,115,2, + 0,0,0,0,8,114,66,0,0,0,114,37,0,0,0,41, + 1,218,9,118,101,114,98,111,115,105,116,121,99,1,0,0, + 0,0,0,0,0,1,0,0,0,3,0,0,0,4,0,0, + 0,71,0,0,0,115,54,0,0,0,116,0,106,1,106,2, + 124,1,107,5,114,50,124,0,160,3,100,1,161,1,115,30, + 100,2,124,0,23,0,125,0,116,4,124,0,106,5,124,2, + 142,0,116,0,106,6,100,3,141,2,1,0,100,4,83,0, + 41,5,122,61,80,114,105,110,116,32,116,104,101,32,109,101, + 115,115,97,103,101,32,116,111,32,115,116,100,101,114,114,32, + 105,102,32,45,118,47,80,89,84,72,79,78,86,69,82,66, + 79,83,69,32,105,115,32,116,117,114,110,101,100,32,111,110, + 46,41,2,250,1,35,122,7,105,109,112,111,114,116,32,122, + 2,35,32,41,1,90,4,102,105,108,101,78,41,7,114,15, + 0,0,0,218,5,102,108,97,103,115,218,7,118,101,114,98, + 111,115,101,218,10,115,116,97,114,116,115,119,105,116,104,218, + 5,112,114,105,110,116,114,44,0,0,0,218,6,115,116,100, + 101,114,114,41,3,218,7,109,101,115,115,97,103,101,114,67, + 0,0,0,114,54,0,0,0,114,10,0,0,0,114,10,0, + 0,0,114,11,0,0,0,218,16,95,118,101,114,98,111,115, + 101,95,109,101,115,115,97,103,101,222,0,0,0,115,8,0, + 0,0,0,2,12,1,10,1,8,1,114,75,0,0,0,99, + 1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, + 3,0,0,0,3,0,0,0,115,26,0,0,0,135,0,102, + 1,100,1,100,2,132,8,125,1,116,0,124,1,136,0,131, + 2,1,0,124,1,83,0,41,3,122,49,68,101,99,111,114, + 97,116,111,114,32,116,111,32,118,101,114,105,102,121,32,116, + 104,101,32,110,97,109,101,100,32,109,111,100,117,108,101,32, + 105,115,32,98,117,105,108,116,45,105,110,46,99,2,0,0, + 0,0,0,0,0,0,0,0,0,2,0,0,0,4,0,0, + 0,19,0,0,0,115,38,0,0,0,124,1,116,0,106,1, + 107,7,114,28,116,2,100,1,160,3,124,1,161,1,124,1, + 100,2,141,2,130,1,136,0,124,0,124,1,131,2,83,0, + 41,3,78,250,29,123,33,114,125,32,105,115,32,110,111,116, + 32,97,32,98,117,105,108,116,45,105,110,32,109,111,100,117, + 108,101,114,16,0,0,0,41,4,114,15,0,0,0,218,20, + 98,117,105,108,116,105,110,95,109,111,100,117,108,101,95,110, + 97,109,101,115,218,11,73,109,112,111,114,116,69,114,114,111, + 114,114,44,0,0,0,169,2,114,30,0,0,0,218,8,102, + 117,108,108,110,97,109,101,169,1,218,3,102,120,110,114,10, + 0,0,0,114,11,0,0,0,218,25,95,114,101,113,117,105, + 114,101,115,95,98,117,105,108,116,105,110,95,119,114,97,112, + 112,101,114,232,0,0,0,115,10,0,0,0,0,1,10,1, + 10,1,2,255,6,2,122,52,95,114,101,113,117,105,114,101, + 115,95,98,117,105,108,116,105,110,46,60,108,111,99,97,108, + 115,62,46,95,114,101,113,117,105,114,101,115,95,98,117,105, + 108,116,105,110,95,119,114,97,112,112,101,114,169,1,114,12, + 0,0,0,41,2,114,82,0,0,0,114,83,0,0,0,114, + 10,0,0,0,114,81,0,0,0,114,11,0,0,0,218,17, + 95,114,101,113,117,105,114,101,115,95,98,117,105,108,116,105, + 110,230,0,0,0,115,6,0,0,0,0,2,12,5,10,1, + 114,85,0,0,0,99,1,0,0,0,0,0,0,0,0,0, + 0,0,2,0,0,0,3,0,0,0,3,0,0,0,115,26, + 0,0,0,135,0,102,1,100,1,100,2,132,8,125,1,116, + 0,124,1,136,0,131,2,1,0,124,1,83,0,41,3,122, + 47,68,101,99,111,114,97,116,111,114,32,116,111,32,118,101, + 114,105,102,121,32,116,104,101,32,110,97,109,101,100,32,109, + 111,100,117,108,101,32,105,115,32,102,114,111,122,101,110,46, + 99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0, + 0,4,0,0,0,19,0,0,0,115,38,0,0,0,116,0, + 160,1,124,1,161,1,115,28,116,2,100,1,160,3,124,1, + 161,1,124,1,100,2,141,2,130,1,136,0,124,0,124,1, + 131,2,83,0,169,3,78,122,27,123,33,114,125,32,105,115, + 32,110,111,116,32,97,32,102,114,111,122,101,110,32,109,111, + 100,117,108,101,114,16,0,0,0,41,4,114,56,0,0,0, + 218,9,105,115,95,102,114,111,122,101,110,114,78,0,0,0, + 114,44,0,0,0,114,79,0,0,0,114,81,0,0,0,114, + 10,0,0,0,114,11,0,0,0,218,24,95,114,101,113,117, + 105,114,101,115,95,102,114,111,122,101,110,95,119,114,97,112, + 112,101,114,243,0,0,0,115,10,0,0,0,0,1,10,1, + 10,1,2,255,6,2,122,50,95,114,101,113,117,105,114,101, + 115,95,102,114,111,122,101,110,46,60,108,111,99,97,108,115, + 62,46,95,114,101,113,117,105,114,101,115,95,102,114,111,122, + 101,110,95,119,114,97,112,112,101,114,114,84,0,0,0,41, + 2,114,82,0,0,0,114,88,0,0,0,114,10,0,0,0, + 114,81,0,0,0,114,11,0,0,0,218,16,95,114,101,113, + 117,105,114,101,115,95,102,114,111,122,101,110,241,0,0,0, + 115,6,0,0,0,0,2,12,5,10,1,114,89,0,0,0, + 99,2,0,0,0,0,0,0,0,0,0,0,0,4,0,0, + 0,3,0,0,0,67,0,0,0,115,62,0,0,0,116,0, + 124,1,124,0,131,2,125,2,124,1,116,1,106,2,107,6, + 114,50,116,1,106,2,124,1,25,0,125,3,116,3,124,2, + 124,3,131,2,1,0,116,1,106,2,124,1,25,0,83,0, + 116,4,124,2,131,1,83,0,100,1,83,0,41,2,122,128, + 76,111,97,100,32,116,104,101,32,115,112,101,99,105,102,105, + 101,100,32,109,111,100,117,108,101,32,105,110,116,111,32,115, + 121,115,46,109,111,100,117,108,101,115,32,97,110,100,32,114, + 101,116,117,114,110,32,105,116,46,10,10,32,32,32,32,84, + 104,105,115,32,109,101,116,104,111,100,32,105,115,32,100,101, + 112,114,101,99,97,116,101,100,46,32,32,85,115,101,32,108, + 111,97,100,101,114,46,101,120,101,99,95,109,111,100,117,108, + 101,32,105,110,115,116,101,97,100,46,10,10,32,32,32,32, + 78,41,5,218,16,115,112,101,99,95,102,114,111,109,95,108, + 111,97,100,101,114,114,15,0,0,0,218,7,109,111,100,117, + 108,101,115,218,5,95,101,120,101,99,218,5,95,108,111,97, + 100,41,4,114,30,0,0,0,114,80,0,0,0,218,4,115, + 112,101,99,218,6,109,111,100,117,108,101,114,10,0,0,0, + 114,10,0,0,0,114,11,0,0,0,218,17,95,108,111,97, + 100,95,109,111,100,117,108,101,95,115,104,105,109,253,0,0, + 0,115,12,0,0,0,0,6,10,1,10,1,10,1,10,1, + 10,2,114,96,0,0,0,99,1,0,0,0,0,0,0,0, + 0,0,0,0,5,0,0,0,8,0,0,0,67,0,0,0, + 115,226,0,0,0,116,0,124,0,100,1,100,0,131,3,125, + 1,116,1,124,1,100,2,131,2,114,56,122,12,124,1,160, + 2,124,0,161,1,87,0,83,0,4,0,116,3,107,10,114, + 54,1,0,1,0,1,0,89,0,110,2,48,0,122,10,124, + 0,106,4,125,2,87,0,110,20,4,0,116,5,107,10,114, + 86,1,0,1,0,1,0,89,0,110,18,48,0,124,2,100, + 0,107,9,114,104,116,6,124,2,131,1,83,0,122,10,124, + 0,106,7,125,3,87,0,110,24,4,0,116,5,107,10,114, + 138,1,0,1,0,1,0,100,3,125,3,89,0,110,2,48, + 0,122,10,124,0,106,8,125,4,87,0,110,58,4,0,116, + 5,107,10,114,208,1,0,1,0,1,0,124,1,100,0,107, + 8,114,188,100,4,160,9,124,3,161,1,6,0,89,0,83, + 0,100,5,160,9,124,3,124,1,161,2,6,0,89,0,83, + 0,89,0,110,14,48,0,100,6,160,9,124,3,124,4,161, + 2,83,0,100,0,83,0,41,7,78,218,10,95,95,108,111, + 97,100,101,114,95,95,218,11,109,111,100,117,108,101,95,114, + 101,112,114,250,1,63,250,13,60,109,111,100,117,108,101,32, + 123,33,114,125,62,250,20,60,109,111,100,117,108,101,32,123, + 33,114,125,32,40,123,33,114,125,41,62,250,23,60,109,111, + 100,117,108,101,32,123,33,114,125,32,102,114,111,109,32,123, + 33,114,125,62,41,10,114,6,0,0,0,114,4,0,0,0, + 114,98,0,0,0,218,9,69,120,99,101,112,116,105,111,110, + 218,8,95,95,115,112,101,99,95,95,218,14,65,116,116,114, + 105,98,117,116,101,69,114,114,111,114,218,22,95,109,111,100, + 117,108,101,95,114,101,112,114,95,102,114,111,109,95,115,112, + 101,99,114,1,0,0,0,218,8,95,95,102,105,108,101,95, + 95,114,44,0,0,0,41,5,114,95,0,0,0,218,6,108, + 111,97,100,101,114,114,94,0,0,0,114,17,0,0,0,218, + 8,102,105,108,101,110,97,109,101,114,10,0,0,0,114,10, + 0,0,0,114,11,0,0,0,218,12,95,109,111,100,117,108, + 101,95,114,101,112,114,13,1,0,0,115,46,0,0,0,0, + 2,12,1,10,4,2,1,12,1,14,1,6,1,2,1,10, + 1,14,1,6,2,8,1,8,4,2,1,10,1,14,1,10, + 1,2,1,10,1,14,1,8,1,14,2,22,2,114,110,0, + 0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,4,0,0,0,64,0,0,0,115,114,0,0,0, + 101,0,90,1,100,0,90,2,100,1,90,3,100,2,100,2, + 100,2,100,3,156,3,100,4,100,5,132,2,90,4,100,6, + 100,7,132,0,90,5,100,8,100,9,132,0,90,6,101,7, + 100,10,100,11,132,0,131,1,90,8,101,8,106,9,100,12, + 100,11,132,0,131,1,90,8,101,7,100,13,100,14,132,0, + 131,1,90,10,101,7,100,15,100,16,132,0,131,1,90,11, + 101,11,106,9,100,17,100,16,132,0,131,1,90,11,100,2, + 83,0,41,18,218,10,77,111,100,117,108,101,83,112,101,99, + 97,208,5,0,0,84,104,101,32,115,112,101,99,105,102,105, + 99,97,116,105,111,110,32,102,111,114,32,97,32,109,111,100, + 117,108,101,44,32,117,115,101,100,32,102,111,114,32,108,111, + 97,100,105,110,103,46,10,10,32,32,32,32,65,32,109,111, + 100,117,108,101,39,115,32,115,112,101,99,32,105,115,32,116, + 104,101,32,115,111,117,114,99,101,32,102,111,114,32,105,110, + 102,111,114,109,97,116,105,111,110,32,97,98,111,117,116,32, + 116,104,101,32,109,111,100,117,108,101,46,32,32,70,111,114, + 10,32,32,32,32,100,97,116,97,32,97,115,115,111,99,105, + 97,116,101,100,32,119,105,116,104,32,116,104,101,32,109,111, + 100,117,108,101,44,32,105,110,99,108,117,100,105,110,103,32, + 115,111,117,114,99,101,44,32,117,115,101,32,116,104,101,32, + 115,112,101,99,39,115,10,32,32,32,32,108,111,97,100,101, + 114,46,10,10,32,32,32,32,96,110,97,109,101,96,32,105, + 115,32,116,104,101,32,97,98,115,111,108,117,116,101,32,110, + 97,109,101,32,111,102,32,116,104,101,32,109,111,100,117,108, + 101,46,32,32,96,108,111,97,100,101,114,96,32,105,115,32, + 116,104,101,32,108,111,97,100,101,114,10,32,32,32,32,116, + 111,32,117,115,101,32,119,104,101,110,32,108,111,97,100,105, + 110,103,32,116,104,101,32,109,111,100,117,108,101,46,32,32, + 96,112,97,114,101,110,116,96,32,105,115,32,116,104,101,32, + 110,97,109,101,32,111,102,32,116,104,101,10,32,32,32,32, + 112,97,99,107,97,103,101,32,116,104,101,32,109,111,100,117, + 108,101,32,105,115,32,105,110,46,32,32,84,104,101,32,112, + 97,114,101,110,116,32,105,115,32,100,101,114,105,118,101,100, + 32,102,114,111,109,32,116,104,101,32,110,97,109,101,46,10, + 10,32,32,32,32,96,105,115,95,112,97,99,107,97,103,101, + 96,32,100,101,116,101,114,109,105,110,101,115,32,105,102,32, + 116,104,101,32,109,111,100,117,108,101,32,105,115,32,99,111, + 110,115,105,100,101,114,101,100,32,97,32,112,97,99,107,97, + 103,101,32,111,114,10,32,32,32,32,110,111,116,46,32,32, + 79,110,32,109,111,100,117,108,101,115,32,116,104,105,115,32, + 105,115,32,114,101,102,108,101,99,116,101,100,32,98,121,32, + 116,104,101,32,96,95,95,112,97,116,104,95,95,96,32,97, + 116,116,114,105,98,117,116,101,46,10,10,32,32,32,32,96, + 111,114,105,103,105,110,96,32,105,115,32,116,104,101,32,115, + 112,101,99,105,102,105,99,32,108,111,99,97,116,105,111,110, + 32,117,115,101,100,32,98,121,32,116,104,101,32,108,111,97, + 100,101,114,32,102,114,111,109,32,119,104,105,99,104,32,116, + 111,10,32,32,32,32,108,111,97,100,32,116,104,101,32,109, + 111,100,117,108,101,44,32,105,102,32,116,104,97,116,32,105, + 110,102,111,114,109,97,116,105,111,110,32,105,115,32,97,118, + 97,105,108,97,98,108,101,46,32,32,87,104,101,110,32,102, + 105,108,101,110,97,109,101,32,105,115,10,32,32,32,32,115, + 101,116,44,32,111,114,105,103,105,110,32,119,105,108,108,32, + 109,97,116,99,104,46,10,10,32,32,32,32,96,104,97,115, + 95,108,111,99,97,116,105,111,110,96,32,105,110,100,105,99, + 97,116,101,115,32,116,104,97,116,32,97,32,115,112,101,99, + 39,115,32,34,111,114,105,103,105,110,34,32,114,101,102,108, + 101,99,116,115,32,97,32,108,111,99,97,116,105,111,110,46, + 10,32,32,32,32,87,104,101,110,32,116,104,105,115,32,105, + 115,32,84,114,117,101,44,32,96,95,95,102,105,108,101,95, + 95,96,32,97,116,116,114,105,98,117,116,101,32,111,102,32, + 116,104,101,32,109,111,100,117,108,101,32,105,115,32,115,101, + 116,46,10,10,32,32,32,32,96,99,97,99,104,101,100,96, + 32,105,115,32,116,104,101,32,108,111,99,97,116,105,111,110, + 32,111,102,32,116,104,101,32,99,97,99,104,101,100,32,98, + 121,116,101,99,111,100,101,32,102,105,108,101,44,32,105,102, + 32,97,110,121,46,32,32,73,116,10,32,32,32,32,99,111, + 114,114,101,115,112,111,110,100,115,32,116,111,32,116,104,101, + 32,96,95,95,99,97,99,104,101,100,95,95,96,32,97,116, + 116,114,105,98,117,116,101,46,10,10,32,32,32,32,96,115, + 117,98,109,111,100,117,108,101,95,115,101,97,114,99,104,95, + 108,111,99,97,116,105,111,110,115,96,32,105,115,32,116,104, + 101,32,115,101,113,117,101,110,99,101,32,111,102,32,112,97, + 116,104,32,101,110,116,114,105,101,115,32,116,111,10,32,32, + 32,32,115,101,97,114,99,104,32,119,104,101,110,32,105,109, + 112,111,114,116,105,110,103,32,115,117,98,109,111,100,117,108, + 101,115,46,32,32,73,102,32,115,101,116,44,32,105,115,95, + 112,97,99,107,97,103,101,32,115,104,111,117,108,100,32,98, + 101,10,32,32,32,32,84,114,117,101,45,45,97,110,100,32, + 70,97,108,115,101,32,111,116,104,101,114,119,105,115,101,46, + 10,10,32,32,32,32,80,97,99,107,97,103,101,115,32,97, + 114,101,32,115,105,109,112,108,121,32,109,111,100,117,108,101, + 115,32,116,104,97,116,32,40,109,97,121,41,32,104,97,118, + 101,32,115,117,98,109,111,100,117,108,101,115,46,32,32,73, + 102,32,97,32,115,112,101,99,10,32,32,32,32,104,97,115, + 32,97,32,110,111,110,45,78,111,110,101,32,118,97,108,117, + 101,32,105,110,32,96,115,117,98,109,111,100,117,108,101,95, + 115,101,97,114,99,104,95,108,111,99,97,116,105,111,110,115, + 96,44,32,116,104,101,32,105,109,112,111,114,116,10,32,32, + 32,32,115,121,115,116,101,109,32,119,105,108,108,32,99,111, + 110,115,105,100,101,114,32,109,111,100,117,108,101,115,32,108, + 111,97,100,101,100,32,102,114,111,109,32,116,104,101,32,115, + 112,101,99,32,97,115,32,112,97,99,107,97,103,101,115,46, + 10,10,32,32,32,32,79,110,108,121,32,102,105,110,100,101, + 114,115,32,40,115,101,101,32,105,109,112,111,114,116,108,105, + 98,46,97,98,99,46,77,101,116,97,80,97,116,104,70,105, + 110,100,101,114,32,97,110,100,10,32,32,32,32,105,109,112, + 111,114,116,108,105,98,46,97,98,99,46,80,97,116,104,69, + 110,116,114,121,70,105,110,100,101,114,41,32,115,104,111,117, + 108,100,32,109,111,100,105,102,121,32,77,111,100,117,108,101, + 83,112,101,99,32,105,110,115,116,97,110,99,101,115,46,10, + 10,32,32,32,32,78,41,3,218,6,111,114,105,103,105,110, + 218,12,108,111,97,100,101,114,95,115,116,97,116,101,218,10, + 105,115,95,112,97,99,107,97,103,101,99,3,0,0,0,0, + 0,0,0,3,0,0,0,6,0,0,0,2,0,0,0,67, + 0,0,0,115,54,0,0,0,124,1,124,0,95,0,124,2, + 124,0,95,1,124,3,124,0,95,2,124,4,124,0,95,3, + 124,5,114,32,103,0,110,2,100,0,124,0,95,4,100,1, + 124,0,95,5,100,0,124,0,95,6,100,0,83,0,41,2, + 78,70,41,7,114,17,0,0,0,114,108,0,0,0,114,112, + 0,0,0,114,113,0,0,0,218,26,115,117,98,109,111,100, + 117,108,101,95,115,101,97,114,99,104,95,108,111,99,97,116, + 105,111,110,115,218,13,95,115,101,116,95,102,105,108,101,97, + 116,116,114,218,7,95,99,97,99,104,101,100,41,6,114,30, + 0,0,0,114,17,0,0,0,114,108,0,0,0,114,112,0, + 0,0,114,113,0,0,0,114,114,0,0,0,114,10,0,0, + 0,114,10,0,0,0,114,11,0,0,0,114,31,0,0,0, + 86,1,0,0,115,14,0,0,0,0,2,6,1,6,1,6, + 1,6,1,14,3,6,1,122,19,77,111,100,117,108,101,83, + 112,101,99,46,95,95,105,110,105,116,95,95,99,1,0,0, + 0,0,0,0,0,0,0,0,0,2,0,0,0,6,0,0, + 0,67,0,0,0,115,102,0,0,0,100,1,160,0,124,0, + 106,1,161,1,100,2,160,0,124,0,106,2,161,1,103,2, + 125,1,124,0,106,3,100,0,107,9,114,52,124,1,160,4, + 100,3,160,0,124,0,106,3,161,1,161,1,1,0,124,0, + 106,5,100,0,107,9,114,80,124,1,160,4,100,4,160,0, + 124,0,106,5,161,1,161,1,1,0,100,5,160,0,124,0, + 106,6,106,7,100,6,160,8,124,1,161,1,161,2,83,0, + 41,7,78,122,9,110,97,109,101,61,123,33,114,125,122,11, + 108,111,97,100,101,114,61,123,33,114,125,122,11,111,114,105, + 103,105,110,61,123,33,114,125,122,29,115,117,98,109,111,100, + 117,108,101,95,115,101,97,114,99,104,95,108,111,99,97,116, + 105,111,110,115,61,123,125,122,6,123,125,40,123,125,41,122, + 2,44,32,41,9,114,44,0,0,0,114,17,0,0,0,114, + 108,0,0,0,114,112,0,0,0,218,6,97,112,112,101,110, + 100,114,115,0,0,0,218,9,95,95,99,108,97,115,115,95, + 95,114,1,0,0,0,218,4,106,111,105,110,41,2,114,30, + 0,0,0,114,54,0,0,0,114,10,0,0,0,114,10,0, + 0,0,114,11,0,0,0,114,47,0,0,0,98,1,0,0, + 115,20,0,0,0,0,1,10,1,10,255,4,2,10,1,18, + 1,10,1,8,1,4,255,6,2,122,19,77,111,100,117,108, + 101,83,112,101,99,46,95,95,114,101,112,114,95,95,99,2, + 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,8, + 0,0,0,67,0,0,0,115,108,0,0,0,124,0,106,0, + 125,2,122,72,124,0,106,1,124,1,106,1,107,2,111,76, + 124,0,106,2,124,1,106,2,107,2,111,76,124,0,106,3, + 124,1,106,3,107,2,111,76,124,2,124,1,106,0,107,2, + 111,76,124,0,106,4,124,1,106,4,107,2,111,76,124,0, + 106,5,124,1,106,5,107,2,87,0,83,0,4,0,116,6, + 107,10,114,102,1,0,1,0,1,0,116,7,6,0,89,0, + 83,0,48,0,100,0,83,0,114,13,0,0,0,41,8,114, + 115,0,0,0,114,17,0,0,0,114,108,0,0,0,114,112, + 0,0,0,218,6,99,97,99,104,101,100,218,12,104,97,115, + 95,108,111,99,97,116,105,111,110,114,105,0,0,0,218,14, + 78,111,116,73,109,112,108,101,109,101,110,116,101,100,41,3, + 114,30,0,0,0,90,5,111,116,104,101,114,90,4,115,109, + 115,108,114,10,0,0,0,114,10,0,0,0,114,11,0,0, + 0,218,6,95,95,101,113,95,95,108,1,0,0,115,30,0, + 0,0,0,1,6,1,2,1,12,1,10,255,2,2,10,254, + 2,3,8,253,2,4,10,252,2,5,10,251,4,6,14,1, + 122,17,77,111,100,117,108,101,83,112,101,99,46,95,95,101, + 113,95,95,99,1,0,0,0,0,0,0,0,0,0,0,0, + 1,0,0,0,3,0,0,0,67,0,0,0,115,58,0,0, + 0,124,0,106,0,100,0,107,8,114,52,124,0,106,1,100, + 0,107,9,114,52,124,0,106,2,114,52,116,3,100,0,107, + 8,114,38,116,4,130,1,116,3,160,5,124,0,106,1,161, + 1,124,0,95,0,124,0,106,0,83,0,114,13,0,0,0, + 41,6,114,117,0,0,0,114,112,0,0,0,114,116,0,0, + 0,218,19,95,98,111,111,116,115,116,114,97,112,95,101,120, + 116,101,114,110,97,108,218,19,78,111,116,73,109,112,108,101, + 109,101,110,116,101,100,69,114,114,111,114,90,11,95,103,101, + 116,95,99,97,99,104,101,100,114,46,0,0,0,114,10,0, + 0,0,114,10,0,0,0,114,11,0,0,0,114,121,0,0, + 0,120,1,0,0,115,12,0,0,0,0,2,10,1,16,1, + 8,1,4,1,14,1,122,17,77,111,100,117,108,101,83,112, + 101,99,46,99,97,99,104,101,100,99,2,0,0,0,0,0, + 0,0,0,0,0,0,2,0,0,0,2,0,0,0,67,0, + 0,0,115,10,0,0,0,124,1,124,0,95,0,100,0,83, + 0,114,13,0,0,0,41,1,114,117,0,0,0,41,2,114, + 30,0,0,0,114,121,0,0,0,114,10,0,0,0,114,10, + 0,0,0,114,11,0,0,0,114,121,0,0,0,129,1,0, + 0,115,2,0,0,0,0,2,99,1,0,0,0,0,0,0, + 0,0,0,0,0,1,0,0,0,3,0,0,0,67,0,0, + 0,115,36,0,0,0,124,0,106,0,100,1,107,8,114,26, + 124,0,106,1,160,2,100,2,161,1,100,3,25,0,83,0, + 124,0,106,1,83,0,100,1,83,0,41,4,122,32,84,104, + 101,32,110,97,109,101,32,111,102,32,116,104,101,32,109,111, + 100,117,108,101,39,115,32,112,97,114,101,110,116,46,78,218, + 1,46,114,22,0,0,0,41,3,114,115,0,0,0,114,17, + 0,0,0,218,10,114,112,97,114,116,105,116,105,111,110,114, 46,0,0,0,114,10,0,0,0,114,10,0,0,0,114,11, - 0,0,0,114,122,0,0,0,141,1,0,0,115,2,0,0, - 0,0,2,122,23,77,111,100,117,108,101,83,112,101,99,46, - 104,97,115,95,108,111,99,97,116,105,111,110,99,2,0,0, - 0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,0, - 0,67,0,0,0,115,14,0,0,0,116,0,124,1,131,1, - 124,0,95,1,100,0,83,0,114,13,0,0,0,41,2,218, - 4,98,111,111,108,114,116,0,0,0,41,2,114,30,0,0, - 0,218,5,118,97,108,117,101,114,10,0,0,0,114,10,0, - 0,0,114,11,0,0,0,114,122,0,0,0,145,1,0,0, - 115,2,0,0,0,0,2,41,12,114,1,0,0,0,114,0, - 0,0,0,114,2,0,0,0,114,3,0,0,0,114,31,0, - 0,0,114,47,0,0,0,114,124,0,0,0,218,8,112,114, - 111,112,101,114,116,121,114,121,0,0,0,218,6,115,101,116, - 116,101,114,114,129,0,0,0,114,122,0,0,0,114,10,0, + 0,0,0,218,6,112,97,114,101,110,116,133,1,0,0,115, + 6,0,0,0,0,3,10,1,16,2,122,17,77,111,100,117, + 108,101,83,112,101,99,46,112,97,114,101,110,116,99,1,0, + 0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0, + 0,0,67,0,0,0,115,6,0,0,0,124,0,106,0,83, + 0,114,13,0,0,0,41,1,114,116,0,0,0,114,46,0, 0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0, - 0,114,111,0,0,0,49,1,0,0,115,32,0,0,0,8, - 1,4,36,4,1,2,255,12,12,8,10,8,12,2,1,10, - 8,4,1,10,3,2,1,10,7,2,1,10,3,4,1,114, - 111,0,0,0,169,2,114,112,0,0,0,114,114,0,0,0, - 99,2,0,0,0,0,0,0,0,2,0,0,0,6,0,0, - 0,8,0,0,0,67,0,0,0,115,154,0,0,0,116,0, - 124,1,100,1,131,2,114,74,116,1,100,2,107,8,114,22, - 116,2,130,1,116,1,106,3,125,4,124,3,100,2,107,8, - 114,48,124,4,124,0,124,1,100,3,141,2,83,0,124,3, - 114,56,103,0,110,2,100,2,125,5,124,4,124,0,124,1, - 124,5,100,4,141,3,83,0,124,3,100,2,107,8,114,138, - 116,0,124,1,100,5,131,2,114,134,122,14,124,1,160,4, - 124,0,161,1,125,3,87,0,113,138,4,0,116,5,107,10, - 114,130,1,0,1,0,1,0,100,2,125,3,89,0,113,138, - 48,0,110,4,100,6,125,3,116,6,124,0,124,1,124,2, - 124,3,100,7,141,4,83,0,41,8,122,53,82,101,116,117, - 114,110,32,97,32,109,111,100,117,108,101,32,115,112,101,99, - 32,98,97,115,101,100,32,111,110,32,118,97,114,105,111,117, - 115,32,108,111,97,100,101,114,32,109,101,116,104,111,100,115, - 46,90,12,103,101,116,95,102,105,108,101,110,97,109,101,78, - 41,1,114,108,0,0,0,41,2,114,108,0,0,0,114,115, - 0,0,0,114,114,0,0,0,70,114,134,0,0,0,41,7, - 114,4,0,0,0,114,125,0,0,0,114,126,0,0,0,218, - 23,115,112,101,99,95,102,114,111,109,95,102,105,108,101,95, - 108,111,99,97,116,105,111,110,114,114,0,0,0,114,78,0, - 0,0,114,111,0,0,0,41,6,114,17,0,0,0,114,108, - 0,0,0,114,112,0,0,0,114,114,0,0,0,114,135,0, - 0,0,90,6,115,101,97,114,99,104,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,114,90,0,0,0,150,1, - 0,0,115,36,0,0,0,0,2,10,1,8,1,4,1,6, - 2,8,1,12,1,12,1,6,1,2,255,6,3,8,1,10, - 1,2,1,14,1,14,1,12,3,4,2,114,90,0,0,0, - 99,3,0,0,0,0,0,0,0,0,0,0,0,8,0,0, - 0,8,0,0,0,67,0,0,0,115,56,1,0,0,122,10, - 124,0,106,0,125,3,87,0,110,20,4,0,116,1,107,10, - 114,30,1,0,1,0,1,0,89,0,110,14,48,0,124,3, - 100,0,107,9,114,44,124,3,83,0,124,0,106,2,125,4, - 124,1,100,0,107,8,114,90,122,10,124,0,106,3,125,1, - 87,0,110,20,4,0,116,1,107,10,114,88,1,0,1,0, - 1,0,89,0,110,2,48,0,122,10,124,0,106,4,125,5, - 87,0,110,24,4,0,116,1,107,10,114,124,1,0,1,0, - 1,0,100,0,125,5,89,0,110,2,48,0,124,2,100,0, - 107,8,114,184,124,5,100,0,107,8,114,180,122,10,124,1, - 106,5,125,2,87,0,113,184,4,0,116,1,107,10,114,176, - 1,0,1,0,1,0,100,0,125,2,89,0,113,184,48,0, - 110,4,124,5,125,2,122,10,124,0,106,6,125,6,87,0, - 110,24,4,0,116,1,107,10,114,218,1,0,1,0,1,0, - 100,0,125,6,89,0,110,2,48,0,122,14,116,7,124,0, - 106,8,131,1,125,7,87,0,110,26,4,0,116,1,107,10, - 144,1,114,4,1,0,1,0,1,0,100,0,125,7,89,0, - 110,2,48,0,116,9,124,4,124,1,124,2,100,1,141,3, - 125,3,124,5,100,0,107,8,144,1,114,34,100,2,110,2, - 100,3,124,3,95,10,124,6,124,3,95,11,124,7,124,3, - 95,12,124,3,83,0,41,4,78,169,1,114,112,0,0,0, - 70,84,41,13,114,104,0,0,0,114,105,0,0,0,114,1, - 0,0,0,114,97,0,0,0,114,107,0,0,0,218,7,95, - 79,82,73,71,73,78,218,10,95,95,99,97,99,104,101,100, - 95,95,218,4,108,105,115,116,218,8,95,95,112,97,116,104, - 95,95,114,111,0,0,0,114,116,0,0,0,114,121,0,0, - 0,114,115,0,0,0,41,8,114,95,0,0,0,114,108,0, - 0,0,114,112,0,0,0,114,94,0,0,0,114,17,0,0, - 0,90,8,108,111,99,97,116,105,111,110,114,121,0,0,0, - 114,115,0,0,0,114,10,0,0,0,114,10,0,0,0,114, - 11,0,0,0,218,17,95,115,112,101,99,95,102,114,111,109, - 95,109,111,100,117,108,101,176,1,0,0,115,72,0,0,0, - 0,2,2,1,10,1,14,1,6,2,8,1,4,2,6,1, - 8,1,2,1,10,1,14,2,6,1,2,1,10,1,14,1, - 10,1,8,1,8,1,2,1,10,1,14,1,12,2,4,1, - 2,1,10,1,14,1,10,1,2,1,14,1,16,1,10,2, - 14,1,20,1,6,1,6,1,114,141,0,0,0,70,169,1, - 218,8,111,118,101,114,114,105,100,101,99,2,0,0,0,0, - 0,0,0,1,0,0,0,5,0,0,0,8,0,0,0,67, - 0,0,0,115,226,1,0,0,124,2,115,20,116,0,124,1, - 100,1,100,0,131,3,100,0,107,8,114,54,122,12,124,0, - 106,1,124,1,95,2,87,0,110,20,4,0,116,3,107,10, - 114,52,1,0,1,0,1,0,89,0,110,2,48,0,124,2, - 115,74,116,0,124,1,100,2,100,0,131,3,100,0,107,8, - 114,178,124,0,106,4,125,3,124,3,100,0,107,8,114,146, - 124,0,106,5,100,0,107,9,114,146,116,6,100,0,107,8, - 114,110,116,7,130,1,116,6,106,8,125,4,124,4,160,9, - 124,4,161,1,125,3,124,0,106,5,124,3,95,10,124,3, - 124,0,95,4,100,0,124,1,95,11,122,10,124,3,124,1, - 95,12,87,0,110,20,4,0,116,3,107,10,114,176,1,0, - 1,0,1,0,89,0,110,2,48,0,124,2,115,198,116,0, - 124,1,100,3,100,0,131,3,100,0,107,8,114,232,122,12, - 124,0,106,13,124,1,95,14,87,0,110,20,4,0,116,3, - 107,10,114,230,1,0,1,0,1,0,89,0,110,2,48,0, - 122,10,124,0,124,1,95,15,87,0,110,22,4,0,116,3, - 107,10,144,1,114,8,1,0,1,0,1,0,89,0,110,2, - 48,0,124,2,144,1,115,34,116,0,124,1,100,4,100,0, - 131,3,100,0,107,8,144,1,114,82,124,0,106,5,100,0, - 107,9,144,1,114,82,122,12,124,0,106,5,124,1,95,16, - 87,0,110,22,4,0,116,3,107,10,144,1,114,80,1,0, - 1,0,1,0,89,0,110,2,48,0,124,0,106,17,144,1, - 114,222,124,2,144,1,115,114,116,0,124,1,100,5,100,0, - 131,3,100,0,107,8,144,1,114,150,122,12,124,0,106,18, - 124,1,95,11,87,0,110,22,4,0,116,3,107,10,144,1, - 114,148,1,0,1,0,1,0,89,0,110,2,48,0,124,2, - 144,1,115,174,116,0,124,1,100,6,100,0,131,3,100,0, - 107,8,144,1,114,222,124,0,106,19,100,0,107,9,144,1, - 114,222,122,12,124,0,106,19,124,1,95,20,87,0,110,22, - 4,0,116,3,107,10,144,1,114,220,1,0,1,0,1,0, - 89,0,110,2,48,0,124,1,83,0,41,7,78,114,1,0, - 0,0,114,97,0,0,0,218,11,95,95,112,97,99,107,97, - 103,101,95,95,114,140,0,0,0,114,107,0,0,0,114,138, - 0,0,0,41,21,114,6,0,0,0,114,17,0,0,0,114, - 1,0,0,0,114,105,0,0,0,114,108,0,0,0,114,115, - 0,0,0,114,125,0,0,0,114,126,0,0,0,218,16,95, - 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,218, - 7,95,95,110,101,119,95,95,90,5,95,112,97,116,104,114, - 107,0,0,0,114,97,0,0,0,114,129,0,0,0,114,144, - 0,0,0,114,104,0,0,0,114,140,0,0,0,114,122,0, - 0,0,114,112,0,0,0,114,121,0,0,0,114,138,0,0, - 0,41,5,114,94,0,0,0,114,95,0,0,0,114,143,0, - 0,0,114,108,0,0,0,114,145,0,0,0,114,10,0,0, - 0,114,10,0,0,0,114,11,0,0,0,218,18,95,105,110, - 105,116,95,109,111,100,117,108,101,95,97,116,116,114,115,221, - 1,0,0,115,96,0,0,0,0,4,20,1,2,1,12,1, - 14,1,6,2,20,1,6,1,8,2,10,1,8,1,4,1, - 6,2,10,1,8,1,6,11,6,1,2,1,10,1,14,1, - 6,2,20,1,2,1,12,1,14,1,6,2,2,1,10,1, - 16,1,6,2,24,1,12,1,2,1,12,1,16,1,6,2, - 8,1,24,1,2,1,12,1,16,1,6,2,24,1,12,1, - 2,1,12,1,16,1,6,1,114,147,0,0,0,99,1,0, - 0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,0, - 0,0,67,0,0,0,115,82,0,0,0,100,1,125,1,116, - 0,124,0,106,1,100,2,131,2,114,30,124,0,106,1,160, - 2,124,0,161,1,125,1,110,20,116,0,124,0,106,1,100, - 3,131,2,114,50,116,3,100,4,131,1,130,1,124,1,100, - 1,107,8,114,68,116,4,124,0,106,5,131,1,125,1,116, - 6,124,0,124,1,131,2,1,0,124,1,83,0,41,5,122, - 43,67,114,101,97,116,101,32,97,32,109,111,100,117,108,101, - 32,98,97,115,101,100,32,111,110,32,116,104,101,32,112,114, - 111,118,105,100,101,100,32,115,112,101,99,46,78,218,13,99, - 114,101,97,116,101,95,109,111,100,117,108,101,218,11,101,120, - 101,99,95,109,111,100,117,108,101,122,66,108,111,97,100,101, - 114,115,32,116,104,97,116,32,100,101,102,105,110,101,32,101, - 120,101,99,95,109,111,100,117,108,101,40,41,32,109,117,115, - 116,32,97,108,115,111,32,100,101,102,105,110,101,32,99,114, - 101,97,116,101,95,109,111,100,117,108,101,40,41,41,7,114, - 4,0,0,0,114,108,0,0,0,114,148,0,0,0,114,78, - 0,0,0,114,18,0,0,0,114,17,0,0,0,114,147,0, - 0,0,169,2,114,94,0,0,0,114,95,0,0,0,114,10, - 0,0,0,114,10,0,0,0,114,11,0,0,0,218,16,109, - 111,100,117,108,101,95,102,114,111,109,95,115,112,101,99,37, - 2,0,0,115,18,0,0,0,0,3,4,1,12,3,14,1, - 12,1,8,2,8,1,10,1,10,1,114,151,0,0,0,99, - 1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, - 4,0,0,0,67,0,0,0,115,106,0,0,0,124,0,106, - 0,100,1,107,8,114,14,100,2,110,4,124,0,106,0,125, - 1,124,0,106,1,100,1,107,8,114,66,124,0,106,2,100, - 1,107,8,114,50,100,3,160,3,124,1,161,1,83,0,100, - 4,160,3,124,1,124,0,106,2,161,2,83,0,110,36,124, - 0,106,4,114,86,100,5,160,3,124,1,124,0,106,1,161, - 2,83,0,100,6,160,3,124,0,106,0,124,0,106,1,161, - 2,83,0,100,1,83,0,41,7,122,38,82,101,116,117,114, - 110,32,116,104,101,32,114,101,112,114,32,116,111,32,117,115, - 101,32,102,111,114,32,116,104,101,32,109,111,100,117,108,101, - 46,78,114,99,0,0,0,114,100,0,0,0,114,101,0,0, - 0,114,102,0,0,0,250,18,60,109,111,100,117,108,101,32, - 123,33,114,125,32,40,123,125,41,62,41,5,114,17,0,0, - 0,114,112,0,0,0,114,108,0,0,0,114,44,0,0,0, - 114,122,0,0,0,41,2,114,94,0,0,0,114,17,0,0, - 0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,0, - 114,106,0,0,0,54,2,0,0,115,16,0,0,0,0,3, - 20,1,10,1,10,1,10,2,16,2,6,1,14,2,114,106, - 0,0,0,99,2,0,0,0,0,0,0,0,0,0,0,0, - 4,0,0,0,10,0,0,0,67,0,0,0,115,250,0,0, - 0,124,0,106,0,125,2,116,1,124,2,131,1,143,216,1, - 0,116,2,106,3,160,4,124,2,161,1,124,1,107,9,114, - 54,100,1,160,5,124,2,161,1,125,3,116,6,124,3,124, - 2,100,2,141,2,130,1,122,132,124,0,106,7,100,3,107, - 8,114,106,124,0,106,8,100,3,107,8,114,90,116,6,100, - 4,124,0,106,0,100,2,141,2,130,1,116,9,124,0,124, - 1,100,5,100,6,141,3,1,0,110,52,116,9,124,0,124, - 1,100,5,100,6,141,3,1,0,116,10,124,0,106,7,100, - 7,131,2,115,146,124,0,106,7,160,11,124,2,161,1,1, - 0,110,12,124,0,106,7,160,12,124,1,161,1,1,0,87, - 0,116,2,106,3,160,13,124,0,106,0,161,1,125,1,124, - 1,116,2,106,3,124,0,106,0,60,0,110,28,116,2,106, - 3,160,13,124,0,106,0,161,1,125,1,124,1,116,2,106, - 3,124,0,106,0,60,0,48,0,87,0,100,3,4,0,4, - 0,131,3,1,0,110,16,49,0,115,236,48,0,1,0,1, - 0,1,0,89,0,1,0,124,1,83,0,41,8,122,70,69, - 120,101,99,117,116,101,32,116,104,101,32,115,112,101,99,39, - 115,32,115,112,101,99,105,102,105,101,100,32,109,111,100,117, - 108,101,32,105,110,32,97,110,32,101,120,105,115,116,105,110, - 103,32,109,111,100,117,108,101,39,115,32,110,97,109,101,115, - 112,97,99,101,46,122,30,109,111,100,117,108,101,32,123,33, - 114,125,32,110,111,116,32,105,110,32,115,121,115,46,109,111, - 100,117,108,101,115,114,16,0,0,0,78,250,14,109,105,115, - 115,105,110,103,32,108,111,97,100,101,114,84,114,142,0,0, - 0,114,149,0,0,0,41,14,114,17,0,0,0,114,49,0, - 0,0,114,15,0,0,0,114,91,0,0,0,114,34,0,0, - 0,114,44,0,0,0,114,78,0,0,0,114,108,0,0,0, - 114,115,0,0,0,114,147,0,0,0,114,4,0,0,0,218, - 11,108,111,97,100,95,109,111,100,117,108,101,114,149,0,0, - 0,218,3,112,111,112,41,4,114,94,0,0,0,114,95,0, - 0,0,114,17,0,0,0,218,3,109,115,103,114,10,0,0, - 0,114,10,0,0,0,114,11,0,0,0,114,92,0,0,0, - 71,2,0,0,115,38,0,0,0,0,2,6,1,10,1,16, - 1,10,1,12,1,2,1,10,1,10,1,14,2,16,2,14, - 1,12,4,14,2,14,4,14,1,14,255,14,1,44,1,114, - 92,0,0,0,99,1,0,0,0,0,0,0,0,0,0,0, - 0,2,0,0,0,8,0,0,0,67,0,0,0,115,26,1, - 0,0,122,18,124,0,106,0,160,1,124,0,106,2,161,1, - 1,0,87,0,110,52,1,0,1,0,1,0,124,0,106,2, - 116,3,106,4,107,6,114,64,116,3,106,4,160,5,124,0, + 0,114,122,0,0,0,141,1,0,0,115,2,0,0,0,0, + 2,122,23,77,111,100,117,108,101,83,112,101,99,46,104,97, + 115,95,108,111,99,97,116,105,111,110,99,2,0,0,0,0, + 0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,67, + 0,0,0,115,14,0,0,0,116,0,124,1,131,1,124,0, + 95,1,100,0,83,0,114,13,0,0,0,41,2,218,4,98, + 111,111,108,114,116,0,0,0,41,2,114,30,0,0,0,218, + 5,118,97,108,117,101,114,10,0,0,0,114,10,0,0,0, + 114,11,0,0,0,114,122,0,0,0,145,1,0,0,115,2, + 0,0,0,0,2,41,12,114,1,0,0,0,114,0,0,0, + 0,114,2,0,0,0,114,3,0,0,0,114,31,0,0,0, + 114,47,0,0,0,114,124,0,0,0,218,8,112,114,111,112, + 101,114,116,121,114,121,0,0,0,218,6,115,101,116,116,101, + 114,114,129,0,0,0,114,122,0,0,0,114,10,0,0,0, + 114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,114, + 111,0,0,0,49,1,0,0,115,32,0,0,0,8,1,4, + 36,4,1,2,255,12,12,8,10,8,12,2,1,10,8,4, + 1,10,3,2,1,10,7,2,1,10,3,4,1,114,111,0, + 0,0,169,2,114,112,0,0,0,114,114,0,0,0,99,2, + 0,0,0,0,0,0,0,2,0,0,0,6,0,0,0,8, + 0,0,0,67,0,0,0,115,154,0,0,0,116,0,124,1, + 100,1,131,2,114,74,116,1,100,2,107,8,114,22,116,2, + 130,1,116,1,106,3,125,4,124,3,100,2,107,8,114,48, + 124,4,124,0,124,1,100,3,141,2,83,0,124,3,114,56, + 103,0,110,2,100,2,125,5,124,4,124,0,124,1,124,5, + 100,4,141,3,83,0,124,3,100,2,107,8,114,138,116,0, + 124,1,100,5,131,2,114,134,122,14,124,1,160,4,124,0, + 161,1,125,3,87,0,113,138,4,0,116,5,107,10,114,130, + 1,0,1,0,1,0,100,2,125,3,89,0,113,138,48,0, + 110,4,100,6,125,3,116,6,124,0,124,1,124,2,124,3, + 100,7,141,4,83,0,41,8,122,53,82,101,116,117,114,110, + 32,97,32,109,111,100,117,108,101,32,115,112,101,99,32,98, + 97,115,101,100,32,111,110,32,118,97,114,105,111,117,115,32, + 108,111,97,100,101,114,32,109,101,116,104,111,100,115,46,90, + 12,103,101,116,95,102,105,108,101,110,97,109,101,78,41,1, + 114,108,0,0,0,41,2,114,108,0,0,0,114,115,0,0, + 0,114,114,0,0,0,70,114,134,0,0,0,41,7,114,4, + 0,0,0,114,125,0,0,0,114,126,0,0,0,218,23,115, + 112,101,99,95,102,114,111,109,95,102,105,108,101,95,108,111, + 99,97,116,105,111,110,114,114,0,0,0,114,78,0,0,0, + 114,111,0,0,0,41,6,114,17,0,0,0,114,108,0,0, + 0,114,112,0,0,0,114,114,0,0,0,114,135,0,0,0, + 90,6,115,101,97,114,99,104,114,10,0,0,0,114,10,0, + 0,0,114,11,0,0,0,114,90,0,0,0,150,1,0,0, + 115,36,0,0,0,0,2,10,1,8,1,4,1,6,2,8, + 1,12,1,12,1,6,1,2,255,6,3,8,1,10,1,2, + 1,14,1,14,1,12,3,4,2,114,90,0,0,0,99,3, + 0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,8, + 0,0,0,67,0,0,0,115,56,1,0,0,122,10,124,0, + 106,0,125,3,87,0,110,20,4,0,116,1,107,10,114,30, + 1,0,1,0,1,0,89,0,110,14,48,0,124,3,100,0, + 107,9,114,44,124,3,83,0,124,0,106,2,125,4,124,1, + 100,0,107,8,114,90,122,10,124,0,106,3,125,1,87,0, + 110,20,4,0,116,1,107,10,114,88,1,0,1,0,1,0, + 89,0,110,2,48,0,122,10,124,0,106,4,125,5,87,0, + 110,24,4,0,116,1,107,10,114,124,1,0,1,0,1,0, + 100,0,125,5,89,0,110,2,48,0,124,2,100,0,107,8, + 114,184,124,5,100,0,107,8,114,180,122,10,124,1,106,5, + 125,2,87,0,113,184,4,0,116,1,107,10,114,176,1,0, + 1,0,1,0,100,0,125,2,89,0,113,184,48,0,110,4, + 124,5,125,2,122,10,124,0,106,6,125,6,87,0,110,24, + 4,0,116,1,107,10,114,218,1,0,1,0,1,0,100,0, + 125,6,89,0,110,2,48,0,122,14,116,7,124,0,106,8, + 131,1,125,7,87,0,110,26,4,0,116,1,107,10,144,1, + 114,4,1,0,1,0,1,0,100,0,125,7,89,0,110,2, + 48,0,116,9,124,4,124,1,124,2,100,1,141,3,125,3, + 124,5,100,0,107,8,144,1,114,34,100,2,110,2,100,3, + 124,3,95,10,124,6,124,3,95,11,124,7,124,3,95,12, + 124,3,83,0,41,4,78,169,1,114,112,0,0,0,70,84, + 41,13,114,104,0,0,0,114,105,0,0,0,114,1,0,0, + 0,114,97,0,0,0,114,107,0,0,0,218,7,95,79,82, + 73,71,73,78,218,10,95,95,99,97,99,104,101,100,95,95, + 218,4,108,105,115,116,218,8,95,95,112,97,116,104,95,95, + 114,111,0,0,0,114,116,0,0,0,114,121,0,0,0,114, + 115,0,0,0,41,8,114,95,0,0,0,114,108,0,0,0, + 114,112,0,0,0,114,94,0,0,0,114,17,0,0,0,90, + 8,108,111,99,97,116,105,111,110,114,121,0,0,0,114,115, + 0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,0, + 0,0,218,17,95,115,112,101,99,95,102,114,111,109,95,109, + 111,100,117,108,101,176,1,0,0,115,72,0,0,0,0,2, + 2,1,10,1,14,1,6,2,8,1,4,2,6,1,8,1, + 2,1,10,1,14,2,6,1,2,1,10,1,14,1,10,1, + 8,1,8,1,2,1,10,1,14,1,12,2,4,1,2,1, + 10,1,14,1,10,1,2,1,14,1,16,1,10,2,14,1, + 20,1,6,1,6,1,114,141,0,0,0,70,169,1,218,8, + 111,118,101,114,114,105,100,101,99,2,0,0,0,0,0,0, + 0,1,0,0,0,5,0,0,0,8,0,0,0,67,0,0, + 0,115,226,1,0,0,124,2,115,20,116,0,124,1,100,1, + 100,0,131,3,100,0,107,8,114,54,122,12,124,0,106,1, + 124,1,95,2,87,0,110,20,4,0,116,3,107,10,114,52, + 1,0,1,0,1,0,89,0,110,2,48,0,124,2,115,74, + 116,0,124,1,100,2,100,0,131,3,100,0,107,8,114,178, + 124,0,106,4,125,3,124,3,100,0,107,8,114,146,124,0, + 106,5,100,0,107,9,114,146,116,6,100,0,107,8,114,110, + 116,7,130,1,116,6,106,8,125,4,124,4,160,9,124,4, + 161,1,125,3,124,0,106,5,124,3,95,10,124,3,124,0, + 95,4,100,0,124,1,95,11,122,10,124,3,124,1,95,12, + 87,0,110,20,4,0,116,3,107,10,114,176,1,0,1,0, + 1,0,89,0,110,2,48,0,124,2,115,198,116,0,124,1, + 100,3,100,0,131,3,100,0,107,8,114,232,122,12,124,0, + 106,13,124,1,95,14,87,0,110,20,4,0,116,3,107,10, + 114,230,1,0,1,0,1,0,89,0,110,2,48,0,122,10, + 124,0,124,1,95,15,87,0,110,22,4,0,116,3,107,10, + 144,1,114,8,1,0,1,0,1,0,89,0,110,2,48,0, + 124,2,144,1,115,34,116,0,124,1,100,4,100,0,131,3, + 100,0,107,8,144,1,114,82,124,0,106,5,100,0,107,9, + 144,1,114,82,122,12,124,0,106,5,124,1,95,16,87,0, + 110,22,4,0,116,3,107,10,144,1,114,80,1,0,1,0, + 1,0,89,0,110,2,48,0,124,0,106,17,144,1,114,222, + 124,2,144,1,115,114,116,0,124,1,100,5,100,0,131,3, + 100,0,107,8,144,1,114,150,122,12,124,0,106,18,124,1, + 95,11,87,0,110,22,4,0,116,3,107,10,144,1,114,148, + 1,0,1,0,1,0,89,0,110,2,48,0,124,2,144,1, + 115,174,116,0,124,1,100,6,100,0,131,3,100,0,107,8, + 144,1,114,222,124,0,106,19,100,0,107,9,144,1,114,222, + 122,12,124,0,106,19,124,1,95,20,87,0,110,22,4,0, + 116,3,107,10,144,1,114,220,1,0,1,0,1,0,89,0, + 110,2,48,0,124,1,83,0,41,7,78,114,1,0,0,0, + 114,97,0,0,0,218,11,95,95,112,97,99,107,97,103,101, + 95,95,114,140,0,0,0,114,107,0,0,0,114,138,0,0, + 0,41,21,114,6,0,0,0,114,17,0,0,0,114,1,0, + 0,0,114,105,0,0,0,114,108,0,0,0,114,115,0,0, + 0,114,125,0,0,0,114,126,0,0,0,218,16,95,78,97, + 109,101,115,112,97,99,101,76,111,97,100,101,114,218,7,95, + 95,110,101,119,95,95,90,5,95,112,97,116,104,114,107,0, + 0,0,114,97,0,0,0,114,129,0,0,0,114,144,0,0, + 0,114,104,0,0,0,114,140,0,0,0,114,122,0,0,0, + 114,112,0,0,0,114,121,0,0,0,114,138,0,0,0,41, + 5,114,94,0,0,0,114,95,0,0,0,114,143,0,0,0, + 114,108,0,0,0,114,145,0,0,0,114,10,0,0,0,114, + 10,0,0,0,114,11,0,0,0,218,18,95,105,110,105,116, + 95,109,111,100,117,108,101,95,97,116,116,114,115,221,1,0, + 0,115,96,0,0,0,0,4,20,1,2,1,12,1,14,1, + 6,2,20,1,6,1,8,2,10,1,8,1,4,1,6,2, + 10,1,8,1,6,11,6,1,2,1,10,1,14,1,6,2, + 20,1,2,1,12,1,14,1,6,2,2,1,10,1,16,1, + 6,2,24,1,12,1,2,1,12,1,16,1,6,2,8,1, + 24,1,2,1,12,1,16,1,6,2,24,1,12,1,2,1, + 12,1,16,1,6,1,114,147,0,0,0,99,1,0,0,0, + 0,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0, + 67,0,0,0,115,82,0,0,0,100,1,125,1,116,0,124, + 0,106,1,100,2,131,2,114,30,124,0,106,1,160,2,124, + 0,161,1,125,1,110,20,116,0,124,0,106,1,100,3,131, + 2,114,50,116,3,100,4,131,1,130,1,124,1,100,1,107, + 8,114,68,116,4,124,0,106,5,131,1,125,1,116,6,124, + 0,124,1,131,2,1,0,124,1,83,0,41,5,122,43,67, + 114,101,97,116,101,32,97,32,109,111,100,117,108,101,32,98, + 97,115,101,100,32,111,110,32,116,104,101,32,112,114,111,118, + 105,100,101,100,32,115,112,101,99,46,78,218,13,99,114,101, + 97,116,101,95,109,111,100,117,108,101,218,11,101,120,101,99, + 95,109,111,100,117,108,101,122,66,108,111,97,100,101,114,115, + 32,116,104,97,116,32,100,101,102,105,110,101,32,101,120,101, + 99,95,109,111,100,117,108,101,40,41,32,109,117,115,116,32, + 97,108,115,111,32,100,101,102,105,110,101,32,99,114,101,97, + 116,101,95,109,111,100,117,108,101,40,41,41,7,114,4,0, + 0,0,114,108,0,0,0,114,148,0,0,0,114,78,0,0, + 0,114,18,0,0,0,114,17,0,0,0,114,147,0,0,0, + 169,2,114,94,0,0,0,114,95,0,0,0,114,10,0,0, + 0,114,10,0,0,0,114,11,0,0,0,218,16,109,111,100, + 117,108,101,95,102,114,111,109,95,115,112,101,99,37,2,0, + 0,115,18,0,0,0,0,3,4,1,12,3,14,1,12,1, + 8,2,8,1,10,1,10,1,114,151,0,0,0,99,1,0, + 0,0,0,0,0,0,0,0,0,0,2,0,0,0,4,0, + 0,0,67,0,0,0,115,106,0,0,0,124,0,106,0,100, + 1,107,8,114,14,100,2,110,4,124,0,106,0,125,1,124, + 0,106,1,100,1,107,8,114,66,124,0,106,2,100,1,107, + 8,114,50,100,3,160,3,124,1,161,1,83,0,100,4,160, + 3,124,1,124,0,106,2,161,2,83,0,110,36,124,0,106, + 4,114,86,100,5,160,3,124,1,124,0,106,1,161,2,83, + 0,100,6,160,3,124,0,106,0,124,0,106,1,161,2,83, + 0,100,1,83,0,41,7,122,38,82,101,116,117,114,110,32, + 116,104,101,32,114,101,112,114,32,116,111,32,117,115,101,32, + 102,111,114,32,116,104,101,32,109,111,100,117,108,101,46,78, + 114,99,0,0,0,114,100,0,0,0,114,101,0,0,0,114, + 102,0,0,0,250,18,60,109,111,100,117,108,101,32,123,33, + 114,125,32,40,123,125,41,62,41,5,114,17,0,0,0,114, + 112,0,0,0,114,108,0,0,0,114,44,0,0,0,114,122, + 0,0,0,41,2,114,94,0,0,0,114,17,0,0,0,114, + 10,0,0,0,114,10,0,0,0,114,11,0,0,0,114,106, + 0,0,0,54,2,0,0,115,16,0,0,0,0,3,20,1, + 10,1,10,1,10,2,16,2,6,1,14,2,114,106,0,0, + 0,99,2,0,0,0,0,0,0,0,0,0,0,0,4,0, + 0,0,10,0,0,0,67,0,0,0,115,250,0,0,0,124, + 0,106,0,125,2,116,1,124,2,131,1,143,216,1,0,116, + 2,106,3,160,4,124,2,161,1,124,1,107,9,114,54,100, + 1,160,5,124,2,161,1,125,3,116,6,124,3,124,2,100, + 2,141,2,130,1,122,132,124,0,106,7,100,3,107,8,114, + 106,124,0,106,8,100,3,107,8,114,90,116,6,100,4,124, + 0,106,0,100,2,141,2,130,1,116,9,124,0,124,1,100, + 5,100,6,141,3,1,0,110,52,116,9,124,0,124,1,100, + 5,100,6,141,3,1,0,116,10,124,0,106,7,100,7,131, + 2,115,146,124,0,106,7,160,11,124,2,161,1,1,0,110, + 12,124,0,106,7,160,12,124,1,161,1,1,0,87,0,116, + 2,106,3,160,13,124,0,106,0,161,1,125,1,124,1,116, + 2,106,3,124,0,106,0,60,0,110,28,116,2,106,3,160, + 13,124,0,106,0,161,1,125,1,124,1,116,2,106,3,124, + 0,106,0,60,0,48,0,87,0,100,3,4,0,4,0,131, + 3,1,0,110,16,49,0,115,236,48,0,1,0,1,0,1, + 0,89,0,1,0,124,1,83,0,41,8,122,70,69,120,101, + 99,117,116,101,32,116,104,101,32,115,112,101,99,39,115,32, + 115,112,101,99,105,102,105,101,100,32,109,111,100,117,108,101, + 32,105,110,32,97,110,32,101,120,105,115,116,105,110,103,32, + 109,111,100,117,108,101,39,115,32,110,97,109,101,115,112,97, + 99,101,46,122,30,109,111,100,117,108,101,32,123,33,114,125, + 32,110,111,116,32,105,110,32,115,121,115,46,109,111,100,117, + 108,101,115,114,16,0,0,0,78,250,14,109,105,115,115,105, + 110,103,32,108,111,97,100,101,114,84,114,142,0,0,0,114, + 149,0,0,0,41,14,114,17,0,0,0,114,49,0,0,0, + 114,15,0,0,0,114,91,0,0,0,114,34,0,0,0,114, + 44,0,0,0,114,78,0,0,0,114,108,0,0,0,114,115, + 0,0,0,114,147,0,0,0,114,4,0,0,0,218,11,108, + 111,97,100,95,109,111,100,117,108,101,114,149,0,0,0,218, + 3,112,111,112,41,4,114,94,0,0,0,114,95,0,0,0, + 114,17,0,0,0,218,3,109,115,103,114,10,0,0,0,114, + 10,0,0,0,114,11,0,0,0,114,92,0,0,0,71,2, + 0,0,115,38,0,0,0,0,2,6,1,10,1,16,1,10, + 1,12,1,2,1,10,1,10,1,14,2,16,2,14,1,12, + 4,14,2,14,4,14,1,14,255,14,1,44,1,114,92,0, + 0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,2, + 0,0,0,8,0,0,0,67,0,0,0,115,26,1,0,0, + 122,18,124,0,106,0,160,1,124,0,106,2,161,1,1,0, + 87,0,110,52,1,0,1,0,1,0,124,0,106,2,116,3, + 106,4,107,6,114,64,116,3,106,4,160,5,124,0,106,2, + 161,1,125,1,124,1,116,3,106,4,124,0,106,2,60,0, + 130,0,89,0,110,2,48,0,116,3,106,4,160,5,124,0, 106,2,161,1,125,1,124,1,116,3,106,4,124,0,106,2, - 60,0,130,0,89,0,110,2,48,0,116,3,106,4,160,5, - 124,0,106,2,161,1,125,1,124,1,116,3,106,4,124,0, - 106,2,60,0,116,6,124,1,100,1,100,0,131,3,100,0, - 107,8,114,148,122,12,124,0,106,0,124,1,95,7,87,0, - 110,20,4,0,116,8,107,10,114,146,1,0,1,0,1,0, - 89,0,110,2,48,0,116,6,124,1,100,2,100,0,131,3, - 100,0,107,8,114,226,122,40,124,1,106,9,124,1,95,10, - 116,11,124,1,100,3,131,2,115,202,124,0,106,2,160,12, - 100,4,161,1,100,5,25,0,124,1,95,10,87,0,110,20, - 4,0,116,8,107,10,114,224,1,0,1,0,1,0,89,0, - 110,2,48,0,116,6,124,1,100,6,100,0,131,3,100,0, - 107,8,144,1,114,22,122,10,124,0,124,1,95,13,87,0, - 110,22,4,0,116,8,107,10,144,1,114,20,1,0,1,0, - 1,0,89,0,110,2,48,0,124,1,83,0,41,7,78,114, - 97,0,0,0,114,144,0,0,0,114,140,0,0,0,114,127, - 0,0,0,114,22,0,0,0,114,104,0,0,0,41,14,114, - 108,0,0,0,114,154,0,0,0,114,17,0,0,0,114,15, - 0,0,0,114,91,0,0,0,114,155,0,0,0,114,6,0, - 0,0,114,97,0,0,0,114,105,0,0,0,114,1,0,0, - 0,114,144,0,0,0,114,4,0,0,0,114,128,0,0,0, - 114,104,0,0,0,114,150,0,0,0,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,218,25,95,108,111,97,100, - 95,98,97,99,107,119,97,114,100,95,99,111,109,112,97,116, - 105,98,108,101,101,2,0,0,115,54,0,0,0,0,4,2, - 1,18,1,6,1,12,1,14,1,12,1,8,3,14,1,12, - 1,16,1,2,1,12,1,14,1,6,1,16,1,2,4,8, - 1,10,1,22,1,14,1,6,1,18,1,2,1,10,1,16, - 1,6,1,114,157,0,0,0,99,1,0,0,0,0,0,0, - 0,0,0,0,0,2,0,0,0,11,0,0,0,67,0,0, - 0,115,226,0,0,0,124,0,106,0,100,0,107,9,114,30, - 116,1,124,0,106,0,100,1,131,2,115,30,116,2,124,0, - 131,1,83,0,116,3,124,0,131,1,125,1,100,2,124,0, - 95,4,122,168,124,1,116,5,106,6,124,0,106,7,60,0, - 122,52,124,0,106,0,100,0,107,8,114,96,124,0,106,8, - 100,0,107,8,114,108,116,9,100,3,124,0,106,7,100,4, - 141,2,130,1,110,12,124,0,106,0,160,10,124,1,161,1, - 1,0,87,0,110,50,1,0,1,0,1,0,122,14,116,5, - 106,6,124,0,106,7,61,0,87,0,110,20,4,0,116,11, - 107,10,114,152,1,0,1,0,1,0,89,0,110,2,48,0, - 130,0,89,0,110,2,48,0,116,5,106,6,160,12,124,0, - 106,7,161,1,125,1,124,1,116,5,106,6,124,0,106,7, - 60,0,116,13,100,5,124,0,106,7,124,0,106,0,131,3, - 1,0,87,0,100,6,124,0,95,4,110,8,100,6,124,0, - 95,4,48,0,124,1,83,0,41,7,78,114,149,0,0,0, - 84,114,153,0,0,0,114,16,0,0,0,122,18,105,109,112, - 111,114,116,32,123,33,114,125,32,35,32,123,33,114,125,70, - 41,14,114,108,0,0,0,114,4,0,0,0,114,157,0,0, - 0,114,151,0,0,0,90,13,95,105,110,105,116,105,97,108, - 105,122,105,110,103,114,15,0,0,0,114,91,0,0,0,114, - 17,0,0,0,114,115,0,0,0,114,78,0,0,0,114,149, - 0,0,0,114,62,0,0,0,114,155,0,0,0,114,75,0, - 0,0,114,150,0,0,0,114,10,0,0,0,114,10,0,0, - 0,114,11,0,0,0,218,14,95,108,111,97,100,95,117,110, - 108,111,99,107,101,100,138,2,0,0,115,48,0,0,0,0, - 2,10,2,12,1,8,2,8,5,6,1,2,1,12,1,2, - 1,10,1,10,1,16,3,16,1,6,1,2,1,14,1,14, - 1,6,1,8,5,14,1,12,1,18,2,8,0,8,2,114, - 158,0,0,0,99,1,0,0,0,0,0,0,0,0,0,0, - 0,1,0,0,0,8,0,0,0,67,0,0,0,115,54,0, - 0,0,116,0,124,0,106,1,131,1,143,24,1,0,116,2, - 124,0,131,1,87,0,2,0,100,1,4,0,4,0,131,3, - 1,0,83,0,49,0,115,40,48,0,1,0,1,0,1,0, - 89,0,1,0,100,1,83,0,41,2,122,191,82,101,116,117, - 114,110,32,97,32,110,101,119,32,109,111,100,117,108,101,32, - 111,98,106,101,99,116,44,32,108,111,97,100,101,100,32,98, - 121,32,116,104,101,32,115,112,101,99,39,115,32,108,111,97, - 100,101,114,46,10,10,32,32,32,32,84,104,101,32,109,111, - 100,117,108,101,32,105,115,32,110,111,116,32,97,100,100,101, - 100,32,116,111,32,105,116,115,32,112,97,114,101,110,116,46, - 10,10,32,32,32,32,73,102,32,97,32,109,111,100,117,108, - 101,32,105,115,32,97,108,114,101,97,100,121,32,105,110,32, - 115,121,115,46,109,111,100,117,108,101,115,44,32,116,104,97, - 116,32,101,120,105,115,116,105,110,103,32,109,111,100,117,108, - 101,32,103,101,116,115,10,32,32,32,32,99,108,111,98,98, - 101,114,101,100,46,10,10,32,32,32,32,78,41,3,114,49, - 0,0,0,114,17,0,0,0,114,158,0,0,0,41,1,114, - 94,0,0,0,114,10,0,0,0,114,10,0,0,0,114,11, - 0,0,0,114,93,0,0,0,180,2,0,0,115,4,0,0, - 0,0,9,12,1,114,93,0,0,0,99,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,64, - 0,0,0,115,140,0,0,0,101,0,90,1,100,0,90,2, - 100,1,90,3,100,2,90,4,101,5,100,3,100,4,132,0, - 131,1,90,6,101,7,100,20,100,6,100,7,132,1,131,1, - 90,8,101,7,100,21,100,8,100,9,132,1,131,1,90,9, - 101,7,100,10,100,11,132,0,131,1,90,10,101,7,100,12, - 100,13,132,0,131,1,90,11,101,7,101,12,100,14,100,15, - 132,0,131,1,131,1,90,13,101,7,101,12,100,16,100,17, - 132,0,131,1,131,1,90,14,101,7,101,12,100,18,100,19, - 132,0,131,1,131,1,90,15,101,7,101,16,131,1,90,17, - 100,5,83,0,41,22,218,15,66,117,105,108,116,105,110,73, - 109,112,111,114,116,101,114,122,144,77,101,116,97,32,112,97, - 116,104,32,105,109,112,111,114,116,32,102,111,114,32,98,117, - 105,108,116,45,105,110,32,109,111,100,117,108,101,115,46,10, - 10,32,32,32,32,65,108,108,32,109,101,116,104,111,100,115, - 32,97,114,101,32,101,105,116,104,101,114,32,99,108,97,115, - 115,32,111,114,32,115,116,97,116,105,99,32,109,101,116,104, - 111,100,115,32,116,111,32,97,118,111,105,100,32,116,104,101, - 32,110,101,101,100,32,116,111,10,32,32,32,32,105,110,115, - 116,97,110,116,105,97,116,101,32,116,104,101,32,99,108,97, - 115,115,46,10,10,32,32,32,32,122,8,98,117,105,108,116, - 45,105,110,99,1,0,0,0,0,0,0,0,0,0,0,0, - 1,0,0,0,5,0,0,0,67,0,0,0,115,22,0,0, - 0,100,1,124,0,106,0,155,2,100,2,116,1,106,2,155, - 0,100,3,157,5,83,0,41,4,250,115,82,101,116,117,114, - 110,32,114,101,112,114,32,102,111,114,32,116,104,101,32,109, - 111,100,117,108,101,46,10,10,32,32,32,32,32,32,32,32, - 84,104,101,32,109,101,116,104,111,100,32,105,115,32,100,101, - 112,114,101,99,97,116,101,100,46,32,32,84,104,101,32,105, - 109,112,111,114,116,32,109,97,99,104,105,110,101,114,121,32, - 100,111,101,115,32,116,104,101,32,106,111,98,32,105,116,115, - 101,108,102,46,10,10,32,32,32,32,32,32,32,32,122,8, - 60,109,111,100,117,108,101,32,122,2,32,40,122,2,41,62, - 41,3,114,1,0,0,0,114,159,0,0,0,114,137,0,0, - 0,41,1,114,95,0,0,0,114,10,0,0,0,114,10,0, - 0,0,114,11,0,0,0,114,98,0,0,0,206,2,0,0, - 115,2,0,0,0,0,7,122,27,66,117,105,108,116,105,110, - 73,109,112,111,114,116,101,114,46,109,111,100,117,108,101,95, - 114,101,112,114,78,99,4,0,0,0,0,0,0,0,0,0, - 0,0,4,0,0,0,5,0,0,0,67,0,0,0,115,46, - 0,0,0,124,2,100,0,107,9,114,12,100,0,83,0,116, - 0,160,1,124,1,161,1,114,38,116,2,124,1,124,0,124, - 0,106,3,100,1,141,3,83,0,100,0,83,0,100,0,83, - 0,169,2,78,114,136,0,0,0,41,4,114,56,0,0,0, - 90,10,105,115,95,98,117,105,108,116,105,110,114,90,0,0, - 0,114,137,0,0,0,169,4,218,3,99,108,115,114,80,0, - 0,0,218,4,112,97,116,104,218,6,116,97,114,103,101,116, - 114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,218, - 9,102,105,110,100,95,115,112,101,99,215,2,0,0,115,10, - 0,0,0,0,2,8,1,4,1,10,1,16,2,122,25,66, - 117,105,108,116,105,110,73,109,112,111,114,116,101,114,46,102, - 105,110,100,95,115,112,101,99,99,3,0,0,0,0,0,0, - 0,0,0,0,0,4,0,0,0,4,0,0,0,67,0,0, - 0,115,30,0,0,0,124,0,160,0,124,1,124,2,161,2, - 125,3,124,3,100,1,107,9,114,26,124,3,106,1,83,0, - 100,1,83,0,41,2,122,175,70,105,110,100,32,116,104,101, - 32,98,117,105,108,116,45,105,110,32,109,111,100,117,108,101, - 46,10,10,32,32,32,32,32,32,32,32,73,102,32,39,112, - 97,116,104,39,32,105,115,32,101,118,101,114,32,115,112,101, - 99,105,102,105,101,100,32,116,104,101,110,32,116,104,101,32, - 115,101,97,114,99,104,32,105,115,32,99,111,110,115,105,100, - 101,114,101,100,32,97,32,102,97,105,108,117,114,101,46,10, - 10,32,32,32,32,32,32,32,32,84,104,105,115,32,109,101, - 116,104,111,100,32,105,115,32,100,101,112,114,101,99,97,116, - 101,100,46,32,32,85,115,101,32,102,105,110,100,95,115,112, - 101,99,40,41,32,105,110,115,116,101,97,100,46,10,10,32, - 32,32,32,32,32,32,32,78,41,2,114,166,0,0,0,114, - 108,0,0,0,41,4,114,163,0,0,0,114,80,0,0,0, - 114,164,0,0,0,114,94,0,0,0,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,218,11,102,105,110,100,95, - 109,111,100,117,108,101,224,2,0,0,115,4,0,0,0,0, - 9,12,1,122,27,66,117,105,108,116,105,110,73,109,112,111, - 114,116,101,114,46,102,105,110,100,95,109,111,100,117,108,101, - 99,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0, - 0,4,0,0,0,67,0,0,0,115,46,0,0,0,124,1, - 106,0,116,1,106,2,107,7,114,34,116,3,100,1,160,4, - 124,1,106,0,161,1,124,1,106,0,100,2,141,2,130,1, - 116,5,116,6,106,7,124,1,131,2,83,0,41,3,122,24, - 67,114,101,97,116,101,32,97,32,98,117,105,108,116,45,105, - 110,32,109,111,100,117,108,101,114,76,0,0,0,114,16,0, - 0,0,41,8,114,17,0,0,0,114,15,0,0,0,114,77, - 0,0,0,114,78,0,0,0,114,44,0,0,0,114,66,0, - 0,0,114,56,0,0,0,90,14,99,114,101,97,116,101,95, - 98,117,105,108,116,105,110,41,2,114,30,0,0,0,114,94, + 60,0,116,6,124,1,100,1,100,0,131,3,100,0,107,8, + 114,148,122,12,124,0,106,0,124,1,95,7,87,0,110,20, + 4,0,116,8,107,10,114,146,1,0,1,0,1,0,89,0, + 110,2,48,0,116,6,124,1,100,2,100,0,131,3,100,0, + 107,8,114,226,122,40,124,1,106,9,124,1,95,10,116,11, + 124,1,100,3,131,2,115,202,124,0,106,2,160,12,100,4, + 161,1,100,5,25,0,124,1,95,10,87,0,110,20,4,0, + 116,8,107,10,114,224,1,0,1,0,1,0,89,0,110,2, + 48,0,116,6,124,1,100,6,100,0,131,3,100,0,107,8, + 144,1,114,22,122,10,124,0,124,1,95,13,87,0,110,22, + 4,0,116,8,107,10,144,1,114,20,1,0,1,0,1,0, + 89,0,110,2,48,0,124,1,83,0,41,7,78,114,97,0, + 0,0,114,144,0,0,0,114,140,0,0,0,114,127,0,0, + 0,114,22,0,0,0,114,104,0,0,0,41,14,114,108,0, + 0,0,114,154,0,0,0,114,17,0,0,0,114,15,0,0, + 0,114,91,0,0,0,114,155,0,0,0,114,6,0,0,0, + 114,97,0,0,0,114,105,0,0,0,114,1,0,0,0,114, + 144,0,0,0,114,4,0,0,0,114,128,0,0,0,114,104, + 0,0,0,114,150,0,0,0,114,10,0,0,0,114,10,0, + 0,0,114,11,0,0,0,218,25,95,108,111,97,100,95,98, + 97,99,107,119,97,114,100,95,99,111,109,112,97,116,105,98, + 108,101,101,2,0,0,115,54,0,0,0,0,4,2,1,18, + 1,6,1,12,1,14,1,12,1,8,3,14,1,12,1,16, + 1,2,1,12,1,14,1,6,1,16,1,2,4,8,1,10, + 1,22,1,14,1,6,1,18,1,2,1,10,1,16,1,6, + 1,114,157,0,0,0,99,1,0,0,0,0,0,0,0,0, + 0,0,0,2,0,0,0,11,0,0,0,67,0,0,0,115, + 226,0,0,0,124,0,106,0,100,0,107,9,114,30,116,1, + 124,0,106,0,100,1,131,2,115,30,116,2,124,0,131,1, + 83,0,116,3,124,0,131,1,125,1,100,2,124,0,95,4, + 122,168,124,1,116,5,106,6,124,0,106,7,60,0,122,52, + 124,0,106,0,100,0,107,8,114,96,124,0,106,8,100,0, + 107,8,114,108,116,9,100,3,124,0,106,7,100,4,141,2, + 130,1,110,12,124,0,106,0,160,10,124,1,161,1,1,0, + 87,0,110,50,1,0,1,0,1,0,122,14,116,5,106,6, + 124,0,106,7,61,0,87,0,110,20,4,0,116,11,107,10, + 114,152,1,0,1,0,1,0,89,0,110,2,48,0,130,0, + 89,0,110,2,48,0,116,5,106,6,160,12,124,0,106,7, + 161,1,125,1,124,1,116,5,106,6,124,0,106,7,60,0, + 116,13,100,5,124,0,106,7,124,0,106,0,131,3,1,0, + 87,0,100,6,124,0,95,4,110,8,100,6,124,0,95,4, + 48,0,124,1,83,0,41,7,78,114,149,0,0,0,84,114, + 153,0,0,0,114,16,0,0,0,122,18,105,109,112,111,114, + 116,32,123,33,114,125,32,35,32,123,33,114,125,70,41,14, + 114,108,0,0,0,114,4,0,0,0,114,157,0,0,0,114, + 151,0,0,0,90,13,95,105,110,105,116,105,97,108,105,122, + 105,110,103,114,15,0,0,0,114,91,0,0,0,114,17,0, + 0,0,114,115,0,0,0,114,78,0,0,0,114,149,0,0, + 0,114,62,0,0,0,114,155,0,0,0,114,75,0,0,0, + 114,150,0,0,0,114,10,0,0,0,114,10,0,0,0,114, + 11,0,0,0,218,14,95,108,111,97,100,95,117,110,108,111, + 99,107,101,100,138,2,0,0,115,48,0,0,0,0,2,10, + 2,12,1,8,2,8,5,6,1,2,1,12,1,2,1,10, + 1,10,1,16,3,16,1,6,1,2,1,14,1,14,1,6, + 1,8,5,14,1,12,1,18,2,8,0,8,2,114,158,0, + 0,0,99,1,0,0,0,0,0,0,0,0,0,0,0,1, + 0,0,0,8,0,0,0,67,0,0,0,115,54,0,0,0, + 116,0,124,0,106,1,131,1,143,24,1,0,116,2,124,0, + 131,1,87,0,2,0,100,1,4,0,4,0,131,3,1,0, + 83,0,49,0,115,40,48,0,1,0,1,0,1,0,89,0, + 1,0,100,1,83,0,41,2,122,191,82,101,116,117,114,110, + 32,97,32,110,101,119,32,109,111,100,117,108,101,32,111,98, + 106,101,99,116,44,32,108,111,97,100,101,100,32,98,121,32, + 116,104,101,32,115,112,101,99,39,115,32,108,111,97,100,101, + 114,46,10,10,32,32,32,32,84,104,101,32,109,111,100,117, + 108,101,32,105,115,32,110,111,116,32,97,100,100,101,100,32, + 116,111,32,105,116,115,32,112,97,114,101,110,116,46,10,10, + 32,32,32,32,73,102,32,97,32,109,111,100,117,108,101,32, + 105,115,32,97,108,114,101,97,100,121,32,105,110,32,115,121, + 115,46,109,111,100,117,108,101,115,44,32,116,104,97,116,32, + 101,120,105,115,116,105,110,103,32,109,111,100,117,108,101,32, + 103,101,116,115,10,32,32,32,32,99,108,111,98,98,101,114, + 101,100,46,10,10,32,32,32,32,78,41,3,114,49,0,0, + 0,114,17,0,0,0,114,158,0,0,0,41,1,114,94,0, + 0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0, + 0,114,93,0,0,0,180,2,0,0,115,4,0,0,0,0, + 9,12,1,114,93,0,0,0,99,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,4,0,0,0,64,0,0, + 0,115,140,0,0,0,101,0,90,1,100,0,90,2,100,1, + 90,3,100,2,90,4,101,5,100,3,100,4,132,0,131,1, + 90,6,101,7,100,20,100,6,100,7,132,1,131,1,90,8, + 101,7,100,21,100,8,100,9,132,1,131,1,90,9,101,7, + 100,10,100,11,132,0,131,1,90,10,101,7,100,12,100,13, + 132,0,131,1,90,11,101,7,101,12,100,14,100,15,132,0, + 131,1,131,1,90,13,101,7,101,12,100,16,100,17,132,0, + 131,1,131,1,90,14,101,7,101,12,100,18,100,19,132,0, + 131,1,131,1,90,15,101,7,101,16,131,1,90,17,100,5, + 83,0,41,22,218,15,66,117,105,108,116,105,110,73,109,112, + 111,114,116,101,114,122,144,77,101,116,97,32,112,97,116,104, + 32,105,109,112,111,114,116,32,102,111,114,32,98,117,105,108, + 116,45,105,110,32,109,111,100,117,108,101,115,46,10,10,32, + 32,32,32,65,108,108,32,109,101,116,104,111,100,115,32,97, + 114,101,32,101,105,116,104,101,114,32,99,108,97,115,115,32, + 111,114,32,115,116,97,116,105,99,32,109,101,116,104,111,100, + 115,32,116,111,32,97,118,111,105,100,32,116,104,101,32,110, + 101,101,100,32,116,111,10,32,32,32,32,105,110,115,116,97, + 110,116,105,97,116,101,32,116,104,101,32,99,108,97,115,115, + 46,10,10,32,32,32,32,122,8,98,117,105,108,116,45,105, + 110,99,1,0,0,0,0,0,0,0,0,0,0,0,1,0, + 0,0,5,0,0,0,67,0,0,0,115,22,0,0,0,100, + 1,124,0,106,0,155,2,100,2,116,1,106,2,155,0,100, + 3,157,5,83,0,41,4,250,115,82,101,116,117,114,110,32, + 114,101,112,114,32,102,111,114,32,116,104,101,32,109,111,100, + 117,108,101,46,10,10,32,32,32,32,32,32,32,32,84,104, + 101,32,109,101,116,104,111,100,32,105,115,32,100,101,112,114, + 101,99,97,116,101,100,46,32,32,84,104,101,32,105,109,112, + 111,114,116,32,109,97,99,104,105,110,101,114,121,32,100,111, + 101,115,32,116,104,101,32,106,111,98,32,105,116,115,101,108, + 102,46,10,10,32,32,32,32,32,32,32,32,122,8,60,109, + 111,100,117,108,101,32,122,2,32,40,122,2,41,62,41,3, + 114,1,0,0,0,114,159,0,0,0,114,137,0,0,0,41, + 1,114,95,0,0,0,114,10,0,0,0,114,10,0,0,0, + 114,11,0,0,0,114,98,0,0,0,206,2,0,0,115,2, + 0,0,0,0,7,122,27,66,117,105,108,116,105,110,73,109, + 112,111,114,116,101,114,46,109,111,100,117,108,101,95,114,101, + 112,114,78,99,4,0,0,0,0,0,0,0,0,0,0,0, + 4,0,0,0,5,0,0,0,67,0,0,0,115,46,0,0, + 0,124,2,100,0,107,9,114,12,100,0,83,0,116,0,160, + 1,124,1,161,1,114,38,116,2,124,1,124,0,124,0,106, + 3,100,1,141,3,83,0,100,0,83,0,100,0,83,0,169, + 2,78,114,136,0,0,0,41,4,114,56,0,0,0,90,10, + 105,115,95,98,117,105,108,116,105,110,114,90,0,0,0,114, + 137,0,0,0,169,4,218,3,99,108,115,114,80,0,0,0, + 218,4,112,97,116,104,218,6,116,97,114,103,101,116,114,10, + 0,0,0,114,10,0,0,0,114,11,0,0,0,218,9,102, + 105,110,100,95,115,112,101,99,215,2,0,0,115,10,0,0, + 0,0,2,8,1,4,1,10,1,16,2,122,25,66,117,105, + 108,116,105,110,73,109,112,111,114,116,101,114,46,102,105,110, + 100,95,115,112,101,99,99,3,0,0,0,0,0,0,0,0, + 0,0,0,4,0,0,0,4,0,0,0,67,0,0,0,115, + 30,0,0,0,124,0,160,0,124,1,124,2,161,2,125,3, + 124,3,100,1,107,9,114,26,124,3,106,1,83,0,100,1, + 83,0,41,2,122,175,70,105,110,100,32,116,104,101,32,98, + 117,105,108,116,45,105,110,32,109,111,100,117,108,101,46,10, + 10,32,32,32,32,32,32,32,32,73,102,32,39,112,97,116, + 104,39,32,105,115,32,101,118,101,114,32,115,112,101,99,105, + 102,105,101,100,32,116,104,101,110,32,116,104,101,32,115,101, + 97,114,99,104,32,105,115,32,99,111,110,115,105,100,101,114, + 101,100,32,97,32,102,97,105,108,117,114,101,46,10,10,32, + 32,32,32,32,32,32,32,84,104,105,115,32,109,101,116,104, + 111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,100, + 46,32,32,85,115,101,32,102,105,110,100,95,115,112,101,99, + 40,41,32,105,110,115,116,101,97,100,46,10,10,32,32,32, + 32,32,32,32,32,78,41,2,114,166,0,0,0,114,108,0, + 0,0,41,4,114,163,0,0,0,114,80,0,0,0,114,164, + 0,0,0,114,94,0,0,0,114,10,0,0,0,114,10,0, + 0,0,114,11,0,0,0,218,11,102,105,110,100,95,109,111, + 100,117,108,101,224,2,0,0,115,4,0,0,0,0,9,12, + 1,122,27,66,117,105,108,116,105,110,73,109,112,111,114,116, + 101,114,46,102,105,110,100,95,109,111,100,117,108,101,99,2, + 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,4, + 0,0,0,67,0,0,0,115,46,0,0,0,124,1,106,0, + 116,1,106,2,107,7,114,34,116,3,100,1,160,4,124,1, + 106,0,161,1,124,1,106,0,100,2,141,2,130,1,116,5, + 116,6,106,7,124,1,131,2,83,0,41,3,122,24,67,114, + 101,97,116,101,32,97,32,98,117,105,108,116,45,105,110,32, + 109,111,100,117,108,101,114,76,0,0,0,114,16,0,0,0, + 41,8,114,17,0,0,0,114,15,0,0,0,114,77,0,0, + 0,114,78,0,0,0,114,44,0,0,0,114,66,0,0,0, + 114,56,0,0,0,90,14,99,114,101,97,116,101,95,98,117, + 105,108,116,105,110,41,2,114,30,0,0,0,114,94,0,0, + 0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,0, + 114,148,0,0,0,236,2,0,0,115,10,0,0,0,0,3, + 12,1,12,1,4,255,6,2,122,29,66,117,105,108,116,105, + 110,73,109,112,111,114,116,101,114,46,99,114,101,97,116,101, + 95,109,111,100,117,108,101,99,2,0,0,0,0,0,0,0, + 0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,0, + 115,16,0,0,0,116,0,116,1,106,2,124,1,131,2,1, + 0,100,1,83,0,41,2,122,22,69,120,101,99,32,97,32, + 98,117,105,108,116,45,105,110,32,109,111,100,117,108,101,78, + 41,3,114,66,0,0,0,114,56,0,0,0,90,12,101,120, + 101,99,95,98,117,105,108,116,105,110,41,2,114,30,0,0, + 0,114,95,0,0,0,114,10,0,0,0,114,10,0,0,0, + 114,11,0,0,0,114,149,0,0,0,244,2,0,0,115,2, + 0,0,0,0,3,122,27,66,117,105,108,116,105,110,73,109, + 112,111,114,116,101,114,46,101,120,101,99,95,109,111,100,117, + 108,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2, + 0,0,0,1,0,0,0,67,0,0,0,115,4,0,0,0, + 100,1,83,0,41,2,122,57,82,101,116,117,114,110,32,78, + 111,110,101,32,97,115,32,98,117,105,108,116,45,105,110,32, + 109,111,100,117,108,101,115,32,100,111,32,110,111,116,32,104, + 97,118,101,32,99,111,100,101,32,111,98,106,101,99,116,115, + 46,78,114,10,0,0,0,169,2,114,163,0,0,0,114,80, 0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,0, - 0,0,114,148,0,0,0,236,2,0,0,115,10,0,0,0, - 0,3,12,1,12,1,4,255,6,2,122,29,66,117,105,108, - 116,105,110,73,109,112,111,114,116,101,114,46,99,114,101,97, - 116,101,95,109,111,100,117,108,101,99,2,0,0,0,0,0, - 0,0,0,0,0,0,2,0,0,0,3,0,0,0,67,0, - 0,0,115,16,0,0,0,116,0,116,1,106,2,124,1,131, - 2,1,0,100,1,83,0,41,2,122,22,69,120,101,99,32, - 97,32,98,117,105,108,116,45,105,110,32,109,111,100,117,108, - 101,78,41,3,114,66,0,0,0,114,56,0,0,0,90,12, - 101,120,101,99,95,98,117,105,108,116,105,110,41,2,114,30, - 0,0,0,114,95,0,0,0,114,10,0,0,0,114,10,0, - 0,0,114,11,0,0,0,114,149,0,0,0,244,2,0,0, - 115,2,0,0,0,0,3,122,27,66,117,105,108,116,105,110, - 73,109,112,111,114,116,101,114,46,101,120,101,99,95,109,111, - 100,117,108,101,99,2,0,0,0,0,0,0,0,0,0,0, - 0,2,0,0,0,1,0,0,0,67,0,0,0,115,4,0, - 0,0,100,1,83,0,41,2,122,57,82,101,116,117,114,110, - 32,78,111,110,101,32,97,115,32,98,117,105,108,116,45,105, - 110,32,109,111,100,117,108,101,115,32,100,111,32,110,111,116, - 32,104,97,118,101,32,99,111,100,101,32,111,98,106,101,99, - 116,115,46,78,114,10,0,0,0,169,2,114,163,0,0,0, - 114,80,0,0,0,114,10,0,0,0,114,10,0,0,0,114, - 11,0,0,0,218,8,103,101,116,95,99,111,100,101,249,2, - 0,0,115,2,0,0,0,0,4,122,24,66,117,105,108,116, - 105,110,73,109,112,111,114,116,101,114,46,103,101,116,95,99, - 111,100,101,99,2,0,0,0,0,0,0,0,0,0,0,0, + 0,0,218,8,103,101,116,95,99,111,100,101,249,2,0,0, + 115,2,0,0,0,0,4,122,24,66,117,105,108,116,105,110, + 73,109,112,111,114,116,101,114,46,103,101,116,95,99,111,100, + 101,99,2,0,0,0,0,0,0,0,0,0,0,0,2,0, + 0,0,1,0,0,0,67,0,0,0,115,4,0,0,0,100, + 1,83,0,41,2,122,56,82,101,116,117,114,110,32,78,111, + 110,101,32,97,115,32,98,117,105,108,116,45,105,110,32,109, + 111,100,117,108,101,115,32,100,111,32,110,111,116,32,104,97, + 118,101,32,115,111,117,114,99,101,32,99,111,100,101,46,78, + 114,10,0,0,0,114,168,0,0,0,114,10,0,0,0,114, + 10,0,0,0,114,11,0,0,0,218,10,103,101,116,95,115, + 111,117,114,99,101,255,2,0,0,115,2,0,0,0,0,4, + 122,26,66,117,105,108,116,105,110,73,109,112,111,114,116,101, + 114,46,103,101,116,95,115,111,117,114,99,101,99,2,0,0, + 0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,0, + 0,67,0,0,0,115,4,0,0,0,100,1,83,0,41,2, + 122,52,82,101,116,117,114,110,32,70,97,108,115,101,32,97, + 115,32,98,117,105,108,116,45,105,110,32,109,111,100,117,108, + 101,115,32,97,114,101,32,110,101,118,101,114,32,112,97,99, + 107,97,103,101,115,46,70,114,10,0,0,0,114,168,0,0, + 0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,0, + 114,114,0,0,0,5,3,0,0,115,2,0,0,0,0,4, + 122,26,66,117,105,108,116,105,110,73,109,112,111,114,116,101, + 114,46,105,115,95,112,97,99,107,97,103,101,41,2,78,78, + 41,1,78,41,18,114,1,0,0,0,114,0,0,0,0,114, + 2,0,0,0,114,3,0,0,0,114,137,0,0,0,218,12, + 115,116,97,116,105,99,109,101,116,104,111,100,114,98,0,0, + 0,218,11,99,108,97,115,115,109,101,116,104,111,100,114,166, + 0,0,0,114,167,0,0,0,114,148,0,0,0,114,149,0, + 0,0,114,85,0,0,0,114,169,0,0,0,114,170,0,0, + 0,114,114,0,0,0,114,96,0,0,0,114,154,0,0,0, + 114,10,0,0,0,114,10,0,0,0,114,10,0,0,0,114, + 11,0,0,0,114,159,0,0,0,195,2,0,0,115,44,0, + 0,0,8,2,4,7,4,2,2,1,10,8,2,1,12,8, + 2,1,12,11,2,1,10,7,2,1,10,4,2,1,2,1, + 12,4,2,1,2,1,12,4,2,1,2,1,12,4,114,159, + 0,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,4,0,0,0,64,0,0,0,115,144,0,0, + 0,101,0,90,1,100,0,90,2,100,1,90,3,100,2,90, + 4,101,5,100,3,100,4,132,0,131,1,90,6,101,7,100, + 22,100,6,100,7,132,1,131,1,90,8,101,7,100,23,100, + 8,100,9,132,1,131,1,90,9,101,7,100,10,100,11,132, + 0,131,1,90,10,101,5,100,12,100,13,132,0,131,1,90, + 11,101,7,100,14,100,15,132,0,131,1,90,12,101,7,101, + 13,100,16,100,17,132,0,131,1,131,1,90,14,101,7,101, + 13,100,18,100,19,132,0,131,1,131,1,90,15,101,7,101, + 13,100,20,100,21,132,0,131,1,131,1,90,16,100,5,83, + 0,41,24,218,14,70,114,111,122,101,110,73,109,112,111,114, + 116,101,114,122,142,77,101,116,97,32,112,97,116,104,32,105, + 109,112,111,114,116,32,102,111,114,32,102,114,111,122,101,110, + 32,109,111,100,117,108,101,115,46,10,10,32,32,32,32,65, + 108,108,32,109,101,116,104,111,100,115,32,97,114,101,32,101, + 105,116,104,101,114,32,99,108,97,115,115,32,111,114,32,115, + 116,97,116,105,99,32,109,101,116,104,111,100,115,32,116,111, + 32,97,118,111,105,100,32,116,104,101,32,110,101,101,100,32, + 116,111,10,32,32,32,32,105,110,115,116,97,110,116,105,97, + 116,101,32,116,104,101,32,99,108,97,115,115,46,10,10,32, + 32,32,32,90,6,102,114,111,122,101,110,99,1,0,0,0, + 0,0,0,0,0,0,0,0,1,0,0,0,4,0,0,0, + 67,0,0,0,115,16,0,0,0,100,1,160,0,124,0,106, + 1,116,2,106,3,161,2,83,0,41,2,114,160,0,0,0, + 114,152,0,0,0,41,4,114,44,0,0,0,114,1,0,0, + 0,114,173,0,0,0,114,137,0,0,0,41,1,218,1,109, + 114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,114, + 98,0,0,0,25,3,0,0,115,2,0,0,0,0,7,122, + 26,70,114,111,122,101,110,73,109,112,111,114,116,101,114,46, + 109,111,100,117,108,101,95,114,101,112,114,78,99,4,0,0, + 0,0,0,0,0,0,0,0,0,4,0,0,0,5,0,0, + 0,67,0,0,0,115,34,0,0,0,116,0,160,1,124,1, + 161,1,114,26,116,2,124,1,124,0,124,0,106,3,100,1, + 141,3,83,0,100,0,83,0,100,0,83,0,114,161,0,0, + 0,41,4,114,56,0,0,0,114,87,0,0,0,114,90,0, + 0,0,114,137,0,0,0,114,162,0,0,0,114,10,0,0, + 0,114,10,0,0,0,114,11,0,0,0,114,166,0,0,0, + 34,3,0,0,115,6,0,0,0,0,2,10,1,16,2,122, + 24,70,114,111,122,101,110,73,109,112,111,114,116,101,114,46, + 102,105,110,100,95,115,112,101,99,99,3,0,0,0,0,0, + 0,0,0,0,0,0,3,0,0,0,3,0,0,0,67,0, + 0,0,115,18,0,0,0,116,0,160,1,124,1,161,1,114, + 14,124,0,83,0,100,1,83,0,41,2,122,93,70,105,110, + 100,32,97,32,102,114,111,122,101,110,32,109,111,100,117,108, + 101,46,10,10,32,32,32,32,32,32,32,32,84,104,105,115, + 32,109,101,116,104,111,100,32,105,115,32,100,101,112,114,101, + 99,97,116,101,100,46,32,32,85,115,101,32,102,105,110,100, + 95,115,112,101,99,40,41,32,105,110,115,116,101,97,100,46, + 10,10,32,32,32,32,32,32,32,32,78,41,2,114,56,0, + 0,0,114,87,0,0,0,41,3,114,163,0,0,0,114,80, + 0,0,0,114,164,0,0,0,114,10,0,0,0,114,10,0, + 0,0,114,11,0,0,0,114,167,0,0,0,41,3,0,0, + 115,2,0,0,0,0,7,122,26,70,114,111,122,101,110,73, + 109,112,111,114,116,101,114,46,102,105,110,100,95,109,111,100, + 117,108,101,99,2,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,1,0,0,0,67,0,0,0,115,4,0,0, - 0,100,1,83,0,41,2,122,56,82,101,116,117,114,110,32, - 78,111,110,101,32,97,115,32,98,117,105,108,116,45,105,110, + 0,100,1,83,0,41,2,122,42,85,115,101,32,100,101,102, + 97,117,108,116,32,115,101,109,97,110,116,105,99,115,32,102, + 111,114,32,109,111,100,117,108,101,32,99,114,101,97,116,105, + 111,110,46,78,114,10,0,0,0,41,2,114,163,0,0,0, + 114,94,0,0,0,114,10,0,0,0,114,10,0,0,0,114, + 11,0,0,0,114,148,0,0,0,50,3,0,0,115,2,0, + 0,0,0,2,122,28,70,114,111,122,101,110,73,109,112,111, + 114,116,101,114,46,99,114,101,97,116,101,95,109,111,100,117, + 108,101,99,1,0,0,0,0,0,0,0,0,0,0,0,3, + 0,0,0,4,0,0,0,67,0,0,0,115,64,0,0,0, + 124,0,106,0,106,1,125,1,116,2,160,3,124,1,161,1, + 115,36,116,4,100,1,160,5,124,1,161,1,124,1,100,2, + 141,2,130,1,116,6,116,2,106,7,124,1,131,2,125,2, + 116,8,124,2,124,0,106,9,131,2,1,0,100,0,83,0, + 114,86,0,0,0,41,10,114,104,0,0,0,114,17,0,0, + 0,114,56,0,0,0,114,87,0,0,0,114,78,0,0,0, + 114,44,0,0,0,114,66,0,0,0,218,17,103,101,116,95, + 102,114,111,122,101,110,95,111,98,106,101,99,116,218,4,101, + 120,101,99,114,7,0,0,0,41,3,114,95,0,0,0,114, + 17,0,0,0,218,4,99,111,100,101,114,10,0,0,0,114, + 10,0,0,0,114,11,0,0,0,114,149,0,0,0,54,3, + 0,0,115,14,0,0,0,0,2,8,1,10,1,10,1,2, + 255,6,2,12,1,122,26,70,114,111,122,101,110,73,109,112, + 111,114,116,101,114,46,101,120,101,99,95,109,111,100,117,108, + 101,99,2,0,0,0,0,0,0,0,0,0,0,0,2,0, + 0,0,3,0,0,0,67,0,0,0,115,10,0,0,0,116, + 0,124,0,124,1,131,2,83,0,41,1,122,95,76,111,97, + 100,32,97,32,102,114,111,122,101,110,32,109,111,100,117,108, + 101,46,10,10,32,32,32,32,32,32,32,32,84,104,105,115, + 32,109,101,116,104,111,100,32,105,115,32,100,101,112,114,101, + 99,97,116,101,100,46,32,32,85,115,101,32,101,120,101,99, + 95,109,111,100,117,108,101,40,41,32,105,110,115,116,101,97, + 100,46,10,10,32,32,32,32,32,32,32,32,41,1,114,96, + 0,0,0,114,168,0,0,0,114,10,0,0,0,114,10,0, + 0,0,114,11,0,0,0,114,154,0,0,0,63,3,0,0, + 115,2,0,0,0,0,7,122,26,70,114,111,122,101,110,73, + 109,112,111,114,116,101,114,46,108,111,97,100,95,109,111,100, + 117,108,101,99,2,0,0,0,0,0,0,0,0,0,0,0, + 2,0,0,0,3,0,0,0,67,0,0,0,115,10,0,0, + 0,116,0,160,1,124,1,161,1,83,0,41,1,122,45,82, + 101,116,117,114,110,32,116,104,101,32,99,111,100,101,32,111, + 98,106,101,99,116,32,102,111,114,32,116,104,101,32,102,114, + 111,122,101,110,32,109,111,100,117,108,101,46,41,2,114,56, + 0,0,0,114,175,0,0,0,114,168,0,0,0,114,10,0, + 0,0,114,10,0,0,0,114,11,0,0,0,114,169,0,0, + 0,72,3,0,0,115,2,0,0,0,0,4,122,23,70,114, + 111,122,101,110,73,109,112,111,114,116,101,114,46,103,101,116, + 95,99,111,100,101,99,2,0,0,0,0,0,0,0,0,0, + 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, + 0,0,0,100,1,83,0,41,2,122,54,82,101,116,117,114, + 110,32,78,111,110,101,32,97,115,32,102,114,111,122,101,110, 32,109,111,100,117,108,101,115,32,100,111,32,110,111,116,32, 104,97,118,101,32,115,111,117,114,99,101,32,99,111,100,101, 46,78,114,10,0,0,0,114,168,0,0,0,114,10,0,0, - 0,114,10,0,0,0,114,11,0,0,0,218,10,103,101,116, - 95,115,111,117,114,99,101,255,2,0,0,115,2,0,0,0, - 0,4,122,26,66,117,105,108,116,105,110,73,109,112,111,114, - 116,101,114,46,103,101,116,95,115,111,117,114,99,101,99,2, - 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,1, - 0,0,0,67,0,0,0,115,4,0,0,0,100,1,83,0, - 41,2,122,52,82,101,116,117,114,110,32,70,97,108,115,101, - 32,97,115,32,98,117,105,108,116,45,105,110,32,109,111,100, - 117,108,101,115,32,97,114,101,32,110,101,118,101,114,32,112, - 97,99,107,97,103,101,115,46,70,114,10,0,0,0,114,168, - 0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,0, - 0,0,114,114,0,0,0,5,3,0,0,115,2,0,0,0, - 0,4,122,26,66,117,105,108,116,105,110,73,109,112,111,114, - 116,101,114,46,105,115,95,112,97,99,107,97,103,101,41,2, - 78,78,41,1,78,41,18,114,1,0,0,0,114,0,0,0, - 0,114,2,0,0,0,114,3,0,0,0,114,137,0,0,0, - 218,12,115,116,97,116,105,99,109,101,116,104,111,100,114,98, - 0,0,0,218,11,99,108,97,115,115,109,101,116,104,111,100, - 114,166,0,0,0,114,167,0,0,0,114,148,0,0,0,114, - 149,0,0,0,114,85,0,0,0,114,169,0,0,0,114,170, - 0,0,0,114,114,0,0,0,114,96,0,0,0,114,154,0, - 0,0,114,10,0,0,0,114,10,0,0,0,114,10,0,0, - 0,114,11,0,0,0,114,159,0,0,0,195,2,0,0,115, - 44,0,0,0,8,2,4,7,4,2,2,1,10,8,2,1, - 12,8,2,1,12,11,2,1,10,7,2,1,10,4,2,1, - 2,1,12,4,2,1,2,1,12,4,2,1,2,1,12,4, - 114,159,0,0,0,99,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,4,0,0,0,64,0,0,0,115,144, - 0,0,0,101,0,90,1,100,0,90,2,100,1,90,3,100, - 2,90,4,101,5,100,3,100,4,132,0,131,1,90,6,101, - 7,100,22,100,6,100,7,132,1,131,1,90,8,101,7,100, - 23,100,8,100,9,132,1,131,1,90,9,101,7,100,10,100, - 11,132,0,131,1,90,10,101,5,100,12,100,13,132,0,131, - 1,90,11,101,7,100,14,100,15,132,0,131,1,90,12,101, - 7,101,13,100,16,100,17,132,0,131,1,131,1,90,14,101, - 7,101,13,100,18,100,19,132,0,131,1,131,1,90,15,101, - 7,101,13,100,20,100,21,132,0,131,1,131,1,90,16,100, - 5,83,0,41,24,218,14,70,114,111,122,101,110,73,109,112, - 111,114,116,101,114,122,142,77,101,116,97,32,112,97,116,104, - 32,105,109,112,111,114,116,32,102,111,114,32,102,114,111,122, - 101,110,32,109,111,100,117,108,101,115,46,10,10,32,32,32, - 32,65,108,108,32,109,101,116,104,111,100,115,32,97,114,101, - 32,101,105,116,104,101,114,32,99,108,97,115,115,32,111,114, - 32,115,116,97,116,105,99,32,109,101,116,104,111,100,115,32, - 116,111,32,97,118,111,105,100,32,116,104,101,32,110,101,101, - 100,32,116,111,10,32,32,32,32,105,110,115,116,97,110,116, - 105,97,116,101,32,116,104,101,32,99,108,97,115,115,46,10, - 10,32,32,32,32,90,6,102,114,111,122,101,110,99,1,0, - 0,0,0,0,0,0,0,0,0,0,1,0,0,0,4,0, - 0,0,67,0,0,0,115,16,0,0,0,100,1,160,0,124, - 0,106,1,116,2,106,3,161,2,83,0,41,2,114,160,0, - 0,0,114,152,0,0,0,41,4,114,44,0,0,0,114,1, - 0,0,0,114,173,0,0,0,114,137,0,0,0,41,1,218, - 1,109,114,10,0,0,0,114,10,0,0,0,114,11,0,0, - 0,114,98,0,0,0,25,3,0,0,115,2,0,0,0,0, - 7,122,26,70,114,111,122,101,110,73,109,112,111,114,116,101, - 114,46,109,111,100,117,108,101,95,114,101,112,114,78,99,4, - 0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,5, - 0,0,0,67,0,0,0,115,34,0,0,0,116,0,160,1, - 124,1,161,1,114,26,116,2,124,1,124,0,124,0,106,3, - 100,1,141,3,83,0,100,0,83,0,100,0,83,0,114,161, - 0,0,0,41,4,114,56,0,0,0,114,87,0,0,0,114, - 90,0,0,0,114,137,0,0,0,114,162,0,0,0,114,10, - 0,0,0,114,10,0,0,0,114,11,0,0,0,114,166,0, - 0,0,34,3,0,0,115,6,0,0,0,0,2,10,1,16, - 2,122,24,70,114,111,122,101,110,73,109,112,111,114,116,101, - 114,46,102,105,110,100,95,115,112,101,99,99,3,0,0,0, - 0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0, - 67,0,0,0,115,18,0,0,0,116,0,160,1,124,1,161, - 1,114,14,124,0,83,0,100,1,83,0,41,2,122,93,70, - 105,110,100,32,97,32,102,114,111,122,101,110,32,109,111,100, - 117,108,101,46,10,10,32,32,32,32,32,32,32,32,84,104, - 105,115,32,109,101,116,104,111,100,32,105,115,32,100,101,112, - 114,101,99,97,116,101,100,46,32,32,85,115,101,32,102,105, - 110,100,95,115,112,101,99,40,41,32,105,110,115,116,101,97, - 100,46,10,10,32,32,32,32,32,32,32,32,78,41,2,114, - 56,0,0,0,114,87,0,0,0,41,3,114,163,0,0,0, - 114,80,0,0,0,114,164,0,0,0,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,114,167,0,0,0,41,3, - 0,0,115,2,0,0,0,0,7,122,26,70,114,111,122,101, - 110,73,109,112,111,114,116,101,114,46,102,105,110,100,95,109, - 111,100,117,108,101,99,2,0,0,0,0,0,0,0,0,0, - 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, - 0,0,0,100,1,83,0,41,2,122,42,85,115,101,32,100, - 101,102,97,117,108,116,32,115,101,109,97,110,116,105,99,115, - 32,102,111,114,32,109,111,100,117,108,101,32,99,114,101,97, - 116,105,111,110,46,78,114,10,0,0,0,41,2,114,163,0, - 0,0,114,94,0,0,0,114,10,0,0,0,114,10,0,0, - 0,114,11,0,0,0,114,148,0,0,0,50,3,0,0,115, - 2,0,0,0,0,2,122,28,70,114,111,122,101,110,73,109, - 112,111,114,116,101,114,46,99,114,101,97,116,101,95,109,111, - 100,117,108,101,99,1,0,0,0,0,0,0,0,0,0,0, - 0,3,0,0,0,4,0,0,0,67,0,0,0,115,64,0, - 0,0,124,0,106,0,106,1,125,1,116,2,160,3,124,1, - 161,1,115,36,116,4,100,1,160,5,124,1,161,1,124,1, - 100,2,141,2,130,1,116,6,116,2,106,7,124,1,131,2, - 125,2,116,8,124,2,124,0,106,9,131,2,1,0,100,0, - 83,0,114,86,0,0,0,41,10,114,104,0,0,0,114,17, - 0,0,0,114,56,0,0,0,114,87,0,0,0,114,78,0, - 0,0,114,44,0,0,0,114,66,0,0,0,218,17,103,101, - 116,95,102,114,111,122,101,110,95,111,98,106,101,99,116,218, - 4,101,120,101,99,114,7,0,0,0,41,3,114,95,0,0, - 0,114,17,0,0,0,218,4,99,111,100,101,114,10,0,0, - 0,114,10,0,0,0,114,11,0,0,0,114,149,0,0,0, - 54,3,0,0,115,14,0,0,0,0,2,8,1,10,1,10, - 1,2,255,6,2,12,1,122,26,70,114,111,122,101,110,73, - 109,112,111,114,116,101,114,46,101,120,101,99,95,109,111,100, - 117,108,101,99,2,0,0,0,0,0,0,0,0,0,0,0, - 2,0,0,0,3,0,0,0,67,0,0,0,115,10,0,0, - 0,116,0,124,0,124,1,131,2,83,0,41,1,122,95,76, - 111,97,100,32,97,32,102,114,111,122,101,110,32,109,111,100, - 117,108,101,46,10,10,32,32,32,32,32,32,32,32,84,104, - 105,115,32,109,101,116,104,111,100,32,105,115,32,100,101,112, - 114,101,99,97,116,101,100,46,32,32,85,115,101,32,101,120, - 101,99,95,109,111,100,117,108,101,40,41,32,105,110,115,116, - 101,97,100,46,10,10,32,32,32,32,32,32,32,32,41,1, - 114,96,0,0,0,114,168,0,0,0,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,114,154,0,0,0,63,3, - 0,0,115,2,0,0,0,0,7,122,26,70,114,111,122,101, - 110,73,109,112,111,114,116,101,114,46,108,111,97,100,95,109, - 111,100,117,108,101,99,2,0,0,0,0,0,0,0,0,0, - 0,0,2,0,0,0,3,0,0,0,67,0,0,0,115,10, - 0,0,0,116,0,160,1,124,1,161,1,83,0,41,1,122, - 45,82,101,116,117,114,110,32,116,104,101,32,99,111,100,101, - 32,111,98,106,101,99,116,32,102,111,114,32,116,104,101,32, - 102,114,111,122,101,110,32,109,111,100,117,108,101,46,41,2, - 114,56,0,0,0,114,175,0,0,0,114,168,0,0,0,114, - 10,0,0,0,114,10,0,0,0,114,11,0,0,0,114,169, - 0,0,0,72,3,0,0,115,2,0,0,0,0,4,122,23, - 70,114,111,122,101,110,73,109,112,111,114,116,101,114,46,103, - 101,116,95,99,111,100,101,99,2,0,0,0,0,0,0,0, - 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0, - 115,4,0,0,0,100,1,83,0,41,2,122,54,82,101,116, - 117,114,110,32,78,111,110,101,32,97,115,32,102,114,111,122, - 101,110,32,109,111,100,117,108,101,115,32,100,111,32,110,111, - 116,32,104,97,118,101,32,115,111,117,114,99,101,32,99,111, - 100,101,46,78,114,10,0,0,0,114,168,0,0,0,114,10, - 0,0,0,114,10,0,0,0,114,11,0,0,0,114,170,0, - 0,0,78,3,0,0,115,2,0,0,0,0,4,122,25,70, - 114,111,122,101,110,73,109,112,111,114,116,101,114,46,103,101, - 116,95,115,111,117,114,99,101,99,2,0,0,0,0,0,0, - 0,0,0,0,0,2,0,0,0,3,0,0,0,67,0,0, - 0,115,10,0,0,0,116,0,160,1,124,1,161,1,83,0, - 41,1,122,46,82,101,116,117,114,110,32,84,114,117,101,32, - 105,102,32,116,104,101,32,102,114,111,122,101,110,32,109,111, - 100,117,108,101,32,105,115,32,97,32,112,97,99,107,97,103, - 101,46,41,2,114,56,0,0,0,90,17,105,115,95,102,114, - 111,122,101,110,95,112,97,99,107,97,103,101,114,168,0,0, - 0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,0, - 114,114,0,0,0,84,3,0,0,115,2,0,0,0,0,4, - 122,25,70,114,111,122,101,110,73,109,112,111,114,116,101,114, - 46,105,115,95,112,97,99,107,97,103,101,41,2,78,78,41, - 1,78,41,17,114,1,0,0,0,114,0,0,0,0,114,2, - 0,0,0,114,3,0,0,0,114,137,0,0,0,114,171,0, - 0,0,114,98,0,0,0,114,172,0,0,0,114,166,0,0, - 0,114,167,0,0,0,114,148,0,0,0,114,149,0,0,0, - 114,154,0,0,0,114,89,0,0,0,114,169,0,0,0,114, - 170,0,0,0,114,114,0,0,0,114,10,0,0,0,114,10, - 0,0,0,114,10,0,0,0,114,11,0,0,0,114,173,0, - 0,0,14,3,0,0,115,46,0,0,0,8,2,4,7,4, - 2,2,1,10,8,2,1,12,6,2,1,12,8,2,1,10, - 3,2,1,10,8,2,1,10,8,2,1,2,1,12,4,2, - 1,2,1,12,4,2,1,2,1,114,173,0,0,0,99,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2, - 0,0,0,64,0,0,0,115,32,0,0,0,101,0,90,1, - 100,0,90,2,100,1,90,3,100,2,100,3,132,0,90,4, - 100,4,100,5,132,0,90,5,100,6,83,0,41,7,218,18, - 95,73,109,112,111,114,116,76,111,99,107,67,111,110,116,101, - 120,116,122,36,67,111,110,116,101,120,116,32,109,97,110,97, - 103,101,114,32,102,111,114,32,116,104,101,32,105,109,112,111, - 114,116,32,108,111,99,107,46,99,1,0,0,0,0,0,0, - 0,0,0,0,0,1,0,0,0,2,0,0,0,67,0,0, - 0,115,12,0,0,0,116,0,160,1,161,0,1,0,100,1, - 83,0,41,2,122,24,65,99,113,117,105,114,101,32,116,104, - 101,32,105,109,112,111,114,116,32,108,111,99,107,46,78,41, - 2,114,56,0,0,0,114,57,0,0,0,114,46,0,0,0, - 114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,114, - 53,0,0,0,97,3,0,0,115,2,0,0,0,0,2,122, - 28,95,73,109,112,111,114,116,76,111,99,107,67,111,110,116, - 101,120,116,46,95,95,101,110,116,101,114,95,95,99,4,0, - 0,0,0,0,0,0,0,0,0,0,4,0,0,0,2,0, - 0,0,67,0,0,0,115,12,0,0,0,116,0,160,1,161, - 0,1,0,100,1,83,0,41,2,122,60,82,101,108,101,97, - 115,101,32,116,104,101,32,105,109,112,111,114,116,32,108,111, - 99,107,32,114,101,103,97,114,100,108,101,115,115,32,111,102, - 32,97,110,121,32,114,97,105,115,101,100,32,101,120,99,101, - 112,116,105,111,110,115,46,78,41,2,114,56,0,0,0,114, - 59,0,0,0,41,4,114,30,0,0,0,218,8,101,120,99, - 95,116,121,112,101,218,9,101,120,99,95,118,97,108,117,101, - 218,13,101,120,99,95,116,114,97,99,101,98,97,99,107,114, - 10,0,0,0,114,10,0,0,0,114,11,0,0,0,114,55, - 0,0,0,101,3,0,0,115,2,0,0,0,0,2,122,27, - 95,73,109,112,111,114,116,76,111,99,107,67,111,110,116,101, - 120,116,46,95,95,101,120,105,116,95,95,78,41,6,114,1, - 0,0,0,114,0,0,0,0,114,2,0,0,0,114,3,0, - 0,0,114,53,0,0,0,114,55,0,0,0,114,10,0,0, + 0,114,10,0,0,0,114,11,0,0,0,114,170,0,0,0, + 78,3,0,0,115,2,0,0,0,0,4,122,25,70,114,111, + 122,101,110,73,109,112,111,114,116,101,114,46,103,101,116,95, + 115,111,117,114,99,101,99,2,0,0,0,0,0,0,0,0, + 0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115, + 10,0,0,0,116,0,160,1,124,1,161,1,83,0,41,1, + 122,46,82,101,116,117,114,110,32,84,114,117,101,32,105,102, + 32,116,104,101,32,102,114,111,122,101,110,32,109,111,100,117, + 108,101,32,105,115,32,97,32,112,97,99,107,97,103,101,46, + 41,2,114,56,0,0,0,90,17,105,115,95,102,114,111,122, + 101,110,95,112,97,99,107,97,103,101,114,168,0,0,0,114, + 10,0,0,0,114,10,0,0,0,114,11,0,0,0,114,114, + 0,0,0,84,3,0,0,115,2,0,0,0,0,4,122,25, + 70,114,111,122,101,110,73,109,112,111,114,116,101,114,46,105, + 115,95,112,97,99,107,97,103,101,41,2,78,78,41,1,78, + 41,17,114,1,0,0,0,114,0,0,0,0,114,2,0,0, + 0,114,3,0,0,0,114,137,0,0,0,114,171,0,0,0, + 114,98,0,0,0,114,172,0,0,0,114,166,0,0,0,114, + 167,0,0,0,114,148,0,0,0,114,149,0,0,0,114,154, + 0,0,0,114,89,0,0,0,114,169,0,0,0,114,170,0, + 0,0,114,114,0,0,0,114,10,0,0,0,114,10,0,0, + 0,114,10,0,0,0,114,11,0,0,0,114,173,0,0,0, + 14,3,0,0,115,46,0,0,0,8,2,4,7,4,2,2, + 1,10,8,2,1,12,6,2,1,12,8,2,1,10,3,2, + 1,10,8,2,1,10,8,2,1,2,1,12,4,2,1,2, + 1,12,4,2,1,2,1,114,173,0,0,0,99,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0, + 0,64,0,0,0,115,32,0,0,0,101,0,90,1,100,0, + 90,2,100,1,90,3,100,2,100,3,132,0,90,4,100,4, + 100,5,132,0,90,5,100,6,83,0,41,7,218,18,95,73, + 109,112,111,114,116,76,111,99,107,67,111,110,116,101,120,116, + 122,36,67,111,110,116,101,120,116,32,109,97,110,97,103,101, + 114,32,102,111,114,32,116,104,101,32,105,109,112,111,114,116, + 32,108,111,99,107,46,99,1,0,0,0,0,0,0,0,0, + 0,0,0,1,0,0,0,2,0,0,0,67,0,0,0,115, + 12,0,0,0,116,0,160,1,161,0,1,0,100,1,83,0, + 41,2,122,24,65,99,113,117,105,114,101,32,116,104,101,32, + 105,109,112,111,114,116,32,108,111,99,107,46,78,41,2,114, + 56,0,0,0,114,57,0,0,0,114,46,0,0,0,114,10, + 0,0,0,114,10,0,0,0,114,11,0,0,0,114,53,0, + 0,0,97,3,0,0,115,2,0,0,0,0,2,122,28,95, + 73,109,112,111,114,116,76,111,99,107,67,111,110,116,101,120, + 116,46,95,95,101,110,116,101,114,95,95,99,4,0,0,0, + 0,0,0,0,0,0,0,0,4,0,0,0,2,0,0,0, + 67,0,0,0,115,12,0,0,0,116,0,160,1,161,0,1, + 0,100,1,83,0,41,2,122,60,82,101,108,101,97,115,101, + 32,116,104,101,32,105,109,112,111,114,116,32,108,111,99,107, + 32,114,101,103,97,114,100,108,101,115,115,32,111,102,32,97, + 110,121,32,114,97,105,115,101,100,32,101,120,99,101,112,116, + 105,111,110,115,46,78,41,2,114,56,0,0,0,114,59,0, + 0,0,41,4,114,30,0,0,0,218,8,101,120,99,95,116, + 121,112,101,218,9,101,120,99,95,118,97,108,117,101,218,13, + 101,120,99,95,116,114,97,99,101,98,97,99,107,114,10,0, + 0,0,114,10,0,0,0,114,11,0,0,0,114,55,0,0, + 0,101,3,0,0,115,2,0,0,0,0,2,122,27,95,73, + 109,112,111,114,116,76,111,99,107,67,111,110,116,101,120,116, + 46,95,95,101,120,105,116,95,95,78,41,6,114,1,0,0, + 0,114,0,0,0,0,114,2,0,0,0,114,3,0,0,0, + 114,53,0,0,0,114,55,0,0,0,114,10,0,0,0,114, + 10,0,0,0,114,10,0,0,0,114,11,0,0,0,114,178, + 0,0,0,93,3,0,0,115,6,0,0,0,8,2,4,2, + 8,4,114,178,0,0,0,99,3,0,0,0,0,0,0,0, + 0,0,0,0,5,0,0,0,5,0,0,0,67,0,0,0, + 115,64,0,0,0,124,1,160,0,100,1,124,2,100,2,24, + 0,161,2,125,3,116,1,124,3,131,1,124,2,107,0,114, + 36,116,2,100,3,131,1,130,1,124,3,100,4,25,0,125, + 4,124,0,114,60,100,5,160,3,124,4,124,0,161,2,83, + 0,124,4,83,0,41,6,122,50,82,101,115,111,108,118,101, + 32,97,32,114,101,108,97,116,105,118,101,32,109,111,100,117, + 108,101,32,110,97,109,101,32,116,111,32,97,110,32,97,98, + 115,111,108,117,116,101,32,111,110,101,46,114,127,0,0,0, + 114,37,0,0,0,122,50,97,116,116,101,109,112,116,101,100, + 32,114,101,108,97,116,105,118,101,32,105,109,112,111,114,116, + 32,98,101,121,111,110,100,32,116,111,112,45,108,101,118,101, + 108,32,112,97,99,107,97,103,101,114,22,0,0,0,250,5, + 123,125,46,123,125,41,4,218,6,114,115,112,108,105,116,218, + 3,108,101,110,114,78,0,0,0,114,44,0,0,0,41,5, + 114,17,0,0,0,218,7,112,97,99,107,97,103,101,218,5, + 108,101,118,101,108,90,4,98,105,116,115,90,4,98,97,115, + 101,114,10,0,0,0,114,10,0,0,0,114,11,0,0,0, + 218,13,95,114,101,115,111,108,118,101,95,110,97,109,101,106, + 3,0,0,115,10,0,0,0,0,2,16,1,12,1,8,1, + 8,1,114,187,0,0,0,99,3,0,0,0,0,0,0,0, + 0,0,0,0,4,0,0,0,4,0,0,0,67,0,0,0, + 115,34,0,0,0,124,0,160,0,124,1,124,2,161,2,125, + 3,124,3,100,0,107,8,114,24,100,0,83,0,116,1,124, + 1,124,3,131,2,83,0,114,13,0,0,0,41,2,114,167, + 0,0,0,114,90,0,0,0,41,4,218,6,102,105,110,100, + 101,114,114,17,0,0,0,114,164,0,0,0,114,108,0,0, 0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,0, - 114,178,0,0,0,93,3,0,0,115,6,0,0,0,8,2, - 4,2,8,4,114,178,0,0,0,99,3,0,0,0,0,0, - 0,0,0,0,0,0,5,0,0,0,5,0,0,0,67,0, - 0,0,115,64,0,0,0,124,1,160,0,100,1,124,2,100, - 2,24,0,161,2,125,3,116,1,124,3,131,1,124,2,107, - 0,114,36,116,2,100,3,131,1,130,1,124,3,100,4,25, - 0,125,4,124,0,114,60,100,5,160,3,124,4,124,0,161, - 2,83,0,124,4,83,0,41,6,122,50,82,101,115,111,108, - 118,101,32,97,32,114,101,108,97,116,105,118,101,32,109,111, - 100,117,108,101,32,110,97,109,101,32,116,111,32,97,110,32, - 97,98,115,111,108,117,116,101,32,111,110,101,46,114,127,0, - 0,0,114,37,0,0,0,122,50,97,116,116,101,109,112,116, - 101,100,32,114,101,108,97,116,105,118,101,32,105,109,112,111, - 114,116,32,98,101,121,111,110,100,32,116,111,112,45,108,101, - 118,101,108,32,112,97,99,107,97,103,101,114,22,0,0,0, - 250,5,123,125,46,123,125,41,4,218,6,114,115,112,108,105, - 116,218,3,108,101,110,114,78,0,0,0,114,44,0,0,0, - 41,5,114,17,0,0,0,218,7,112,97,99,107,97,103,101, - 218,5,108,101,118,101,108,90,4,98,105,116,115,90,4,98, - 97,115,101,114,10,0,0,0,114,10,0,0,0,114,11,0, - 0,0,218,13,95,114,101,115,111,108,118,101,95,110,97,109, - 101,106,3,0,0,115,10,0,0,0,0,2,16,1,12,1, - 8,1,8,1,114,187,0,0,0,99,3,0,0,0,0,0, - 0,0,0,0,0,0,4,0,0,0,4,0,0,0,67,0, - 0,0,115,34,0,0,0,124,0,160,0,124,1,124,2,161, - 2,125,3,124,3,100,0,107,8,114,24,100,0,83,0,116, - 1,124,1,124,3,131,2,83,0,114,13,0,0,0,41,2, - 114,167,0,0,0,114,90,0,0,0,41,4,218,6,102,105, - 110,100,101,114,114,17,0,0,0,114,164,0,0,0,114,108, + 218,17,95,102,105,110,100,95,115,112,101,99,95,108,101,103, + 97,99,121,115,3,0,0,115,8,0,0,0,0,3,12,1, + 8,1,4,1,114,189,0,0,0,99,3,0,0,0,0,0, + 0,0,0,0,0,0,10,0,0,0,10,0,0,0,67,0, + 0,0,115,36,1,0,0,116,0,106,1,125,3,124,3,100, + 1,107,8,114,22,116,2,100,2,131,1,130,1,124,3,115, + 38,116,3,160,4,100,3,116,5,161,2,1,0,124,0,116, + 0,106,6,107,6,125,4,124,3,68,0,93,234,125,5,116, + 7,131,0,143,96,1,0,122,10,124,5,106,8,125,6,87, + 0,110,56,4,0,116,9,107,10,114,130,1,0,1,0,1, + 0,116,10,124,5,124,0,124,1,131,3,125,7,124,7,100, + 1,107,8,114,126,89,0,87,0,100,1,4,0,4,0,131, + 3,1,0,113,52,89,0,110,14,48,0,124,6,124,0,124, + 1,124,2,131,3,125,7,87,0,100,1,4,0,4,0,131, + 3,1,0,110,16,49,0,115,164,48,0,1,0,1,0,1, + 0,89,0,1,0,124,7,100,1,107,9,114,52,124,4,144, + 1,115,22,124,0,116,0,106,6,107,6,144,1,114,22,116, + 0,106,6,124,0,25,0,125,8,122,10,124,8,106,11,125, + 9,87,0,110,28,4,0,116,9,107,10,114,248,1,0,1, + 0,1,0,124,7,6,0,89,0,2,0,1,0,83,0,48, + 0,124,9,100,1,107,8,144,1,114,12,124,7,2,0,1, + 0,83,0,124,9,2,0,1,0,83,0,113,52,124,7,2, + 0,1,0,83,0,113,52,100,1,83,0,41,4,122,21,70, + 105,110,100,32,97,32,109,111,100,117,108,101,39,115,32,115, + 112,101,99,46,78,122,53,115,121,115,46,109,101,116,97,95, + 112,97,116,104,32,105,115,32,78,111,110,101,44,32,80,121, + 116,104,111,110,32,105,115,32,108,105,107,101,108,121,32,115, + 104,117,116,116,105,110,103,32,100,111,119,110,122,22,115,121, + 115,46,109,101,116,97,95,112,97,116,104,32,105,115,32,101, + 109,112,116,121,41,12,114,15,0,0,0,218,9,109,101,116, + 97,95,112,97,116,104,114,78,0,0,0,218,9,95,119,97, + 114,110,105,110,103,115,218,4,119,97,114,110,218,13,73,109, + 112,111,114,116,87,97,114,110,105,110,103,114,91,0,0,0, + 114,178,0,0,0,114,166,0,0,0,114,105,0,0,0,114, + 189,0,0,0,114,104,0,0,0,41,10,114,17,0,0,0, + 114,164,0,0,0,114,165,0,0,0,114,190,0,0,0,90, + 9,105,115,95,114,101,108,111,97,100,114,188,0,0,0,114, + 166,0,0,0,114,94,0,0,0,114,95,0,0,0,114,104, 0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,0, - 0,0,218,17,95,102,105,110,100,95,115,112,101,99,95,108, - 101,103,97,99,121,115,3,0,0,115,8,0,0,0,0,3, - 12,1,8,1,4,1,114,189,0,0,0,99,3,0,0,0, - 0,0,0,0,0,0,0,0,10,0,0,0,10,0,0,0, - 67,0,0,0,115,36,1,0,0,116,0,106,1,125,3,124, - 3,100,1,107,8,114,22,116,2,100,2,131,1,130,1,124, - 3,115,38,116,3,160,4,100,3,116,5,161,2,1,0,124, - 0,116,0,106,6,107,6,125,4,124,3,68,0,93,234,125, - 5,116,7,131,0,143,96,1,0,122,10,124,5,106,8,125, - 6,87,0,110,56,4,0,116,9,107,10,114,130,1,0,1, - 0,1,0,116,10,124,5,124,0,124,1,131,3,125,7,124, - 7,100,1,107,8,114,126,89,0,87,0,100,1,4,0,4, - 0,131,3,1,0,113,52,89,0,110,14,48,0,124,6,124, - 0,124,1,124,2,131,3,125,7,87,0,100,1,4,0,4, - 0,131,3,1,0,110,16,49,0,115,164,48,0,1,0,1, - 0,1,0,89,0,1,0,124,7,100,1,107,9,114,52,124, - 4,144,1,115,22,124,0,116,0,106,6,107,6,144,1,114, - 22,116,0,106,6,124,0,25,0,125,8,122,10,124,8,106, - 11,125,9,87,0,110,28,4,0,116,9,107,10,114,248,1, - 0,1,0,1,0,124,7,6,0,89,0,2,0,1,0,83, - 0,48,0,124,9,100,1,107,8,144,1,114,12,124,7,2, - 0,1,0,83,0,124,9,2,0,1,0,83,0,113,52,124, - 7,2,0,1,0,83,0,113,52,100,1,83,0,41,4,122, - 21,70,105,110,100,32,97,32,109,111,100,117,108,101,39,115, - 32,115,112,101,99,46,78,122,53,115,121,115,46,109,101,116, - 97,95,112,97,116,104,32,105,115,32,78,111,110,101,44,32, - 80,121,116,104,111,110,32,105,115,32,108,105,107,101,108,121, - 32,115,104,117,116,116,105,110,103,32,100,111,119,110,122,22, - 115,121,115,46,109,101,116,97,95,112,97,116,104,32,105,115, - 32,101,109,112,116,121,41,12,114,15,0,0,0,218,9,109, - 101,116,97,95,112,97,116,104,114,78,0,0,0,218,9,95, - 119,97,114,110,105,110,103,115,218,4,119,97,114,110,218,13, - 73,109,112,111,114,116,87,97,114,110,105,110,103,114,91,0, - 0,0,114,178,0,0,0,114,166,0,0,0,114,105,0,0, - 0,114,189,0,0,0,114,104,0,0,0,41,10,114,17,0, - 0,0,114,164,0,0,0,114,165,0,0,0,114,190,0,0, - 0,90,9,105,115,95,114,101,108,111,97,100,114,188,0,0, - 0,114,166,0,0,0,114,94,0,0,0,114,95,0,0,0, - 114,104,0,0,0,114,10,0,0,0,114,10,0,0,0,114, - 11,0,0,0,218,10,95,102,105,110,100,95,115,112,101,99, - 124,3,0,0,115,54,0,0,0,0,2,6,1,8,2,8, - 3,4,1,12,5,10,1,8,1,8,1,2,1,10,1,14, - 1,12,1,8,1,22,2,42,1,8,2,18,1,10,1,2, - 1,10,1,14,4,14,2,10,1,8,2,10,2,10,2,114, - 194,0,0,0,99,3,0,0,0,0,0,0,0,0,0,0, - 0,3,0,0,0,5,0,0,0,67,0,0,0,115,108,0, - 0,0,116,0,124,0,116,1,131,2,115,28,116,2,100,1, - 160,3,116,4,124,0,131,1,161,1,131,1,130,1,124,2, - 100,2,107,0,114,44,116,5,100,3,131,1,130,1,124,2, - 100,2,107,4,114,84,116,0,124,1,116,1,131,2,115,72, - 116,2,100,4,131,1,130,1,110,12,124,1,115,84,116,6, - 100,5,131,1,130,1,124,0,115,104,124,2,100,2,107,2, - 114,104,116,5,100,6,131,1,130,1,100,7,83,0,41,8, - 122,28,86,101,114,105,102,121,32,97,114,103,117,109,101,110, - 116,115,32,97,114,101,32,34,115,97,110,101,34,46,122,31, - 109,111,100,117,108,101,32,110,97,109,101,32,109,117,115,116, - 32,98,101,32,115,116,114,44,32,110,111,116,32,123,125,114, - 22,0,0,0,122,18,108,101,118,101,108,32,109,117,115,116, - 32,98,101,32,62,61,32,48,122,31,95,95,112,97,99,107, - 97,103,101,95,95,32,110,111,116,32,115,101,116,32,116,111, - 32,97,32,115,116,114,105,110,103,122,54,97,116,116,101,109, - 112,116,101,100,32,114,101,108,97,116,105,118,101,32,105,109, - 112,111,114,116,32,119,105,116,104,32,110,111,32,107,110,111, - 119,110,32,112,97,114,101,110,116,32,112,97,99,107,97,103, - 101,122,17,69,109,112,116,121,32,109,111,100,117,108,101,32, - 110,97,109,101,78,41,7,218,10,105,115,105,110,115,116,97, - 110,99,101,218,3,115,116,114,218,9,84,121,112,101,69,114, - 114,111,114,114,44,0,0,0,114,14,0,0,0,218,10,86, - 97,108,117,101,69,114,114,111,114,114,78,0,0,0,169,3, - 114,17,0,0,0,114,185,0,0,0,114,186,0,0,0,114, - 10,0,0,0,114,10,0,0,0,114,11,0,0,0,218,13, - 95,115,97,110,105,116,121,95,99,104,101,99,107,171,3,0, - 0,115,22,0,0,0,0,2,10,1,18,1,8,1,8,1, - 8,1,10,1,10,1,4,1,8,2,12,1,114,200,0,0, - 0,122,16,78,111,32,109,111,100,117,108,101,32,110,97,109, - 101,100,32,122,4,123,33,114,125,99,2,0,0,0,0,0, - 0,0,0,0,0,0,8,0,0,0,8,0,0,0,67,0, - 0,0,115,220,0,0,0,100,0,125,2,124,0,160,0,100, - 1,161,1,100,2,25,0,125,3,124,3,114,134,124,3,116, - 1,106,2,107,7,114,42,116,3,124,1,124,3,131,2,1, - 0,124,0,116,1,106,2,107,6,114,62,116,1,106,2,124, - 0,25,0,83,0,116,1,106,2,124,3,25,0,125,4,122, - 10,124,4,106,4,125,2,87,0,110,50,4,0,116,5,107, - 10,114,132,1,0,1,0,1,0,116,6,100,3,23,0,160, - 7,124,0,124,3,161,2,125,5,116,8,124,5,124,0,100, - 4,141,2,100,0,130,2,89,0,110,2,48,0,116,9,124, - 0,124,2,131,2,125,6,124,6,100,0,107,8,114,172,116, - 8,116,6,160,7,124,0,161,1,124,0,100,4,141,2,130, - 1,110,8,116,10,124,6,131,1,125,7,124,3,114,216,116, - 1,106,2,124,3,25,0,125,4,116,11,124,4,124,0,160, - 0,100,1,161,1,100,5,25,0,124,7,131,3,1,0,124, - 7,83,0,41,6,78,114,127,0,0,0,114,22,0,0,0, - 122,23,59,32,123,33,114,125,32,105,115,32,110,111,116,32, - 97,32,112,97,99,107,97,103,101,114,16,0,0,0,233,2, - 0,0,0,41,12,114,128,0,0,0,114,15,0,0,0,114, - 91,0,0,0,114,66,0,0,0,114,140,0,0,0,114,105, - 0,0,0,218,8,95,69,82,82,95,77,83,71,114,44,0, - 0,0,218,19,77,111,100,117,108,101,78,111,116,70,111,117, - 110,100,69,114,114,111,114,114,194,0,0,0,114,158,0,0, - 0,114,5,0,0,0,41,8,114,17,0,0,0,218,7,105, - 109,112,111,114,116,95,114,164,0,0,0,114,129,0,0,0, - 90,13,112,97,114,101,110,116,95,109,111,100,117,108,101,114, - 156,0,0,0,114,94,0,0,0,114,95,0,0,0,114,10, - 0,0,0,114,10,0,0,0,114,11,0,0,0,218,23,95, - 102,105,110,100,95,97,110,100,95,108,111,97,100,95,117,110, - 108,111,99,107,101,100,190,3,0,0,115,42,0,0,0,0, - 1,4,1,14,1,4,1,10,1,10,2,10,1,10,1,10, - 1,2,1,10,1,14,1,16,1,20,1,10,1,8,1,20, - 2,8,1,4,2,10,1,22,1,114,205,0,0,0,99,2, - 0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,8, - 0,0,0,67,0,0,0,115,128,0,0,0,116,0,124,0, - 131,1,143,62,1,0,116,1,106,2,160,3,124,0,116,4, - 161,2,125,2,124,2,116,4,107,8,114,56,116,5,124,0, - 124,1,131,2,87,0,2,0,100,1,4,0,4,0,131,3, - 1,0,83,0,87,0,100,1,4,0,4,0,131,3,1,0, - 110,16,49,0,115,76,48,0,1,0,1,0,1,0,89,0, - 1,0,124,2,100,1,107,8,114,116,100,2,160,6,124,0, - 161,1,125,3,116,7,124,3,124,0,100,3,141,2,130,1, - 116,8,124,0,131,1,1,0,124,2,83,0,41,4,122,25, - 70,105,110,100,32,97,110,100,32,108,111,97,100,32,116,104, - 101,32,109,111,100,117,108,101,46,78,122,40,105,109,112,111, - 114,116,32,111,102,32,123,125,32,104,97,108,116,101,100,59, - 32,78,111,110,101,32,105,110,32,115,121,115,46,109,111,100, - 117,108,101,115,114,16,0,0,0,41,9,114,49,0,0,0, - 114,15,0,0,0,114,91,0,0,0,114,34,0,0,0,218, - 14,95,78,69,69,68,83,95,76,79,65,68,73,78,71,114, - 205,0,0,0,114,44,0,0,0,114,203,0,0,0,114,64, - 0,0,0,41,4,114,17,0,0,0,114,204,0,0,0,114, - 95,0,0,0,114,74,0,0,0,114,10,0,0,0,114,10, - 0,0,0,114,11,0,0,0,218,14,95,102,105,110,100,95, - 97,110,100,95,108,111,97,100,220,3,0,0,115,22,0,0, - 0,0,2,10,1,14,1,8,1,54,2,8,1,4,1,2, - 255,4,2,12,2,8,1,114,207,0,0,0,114,22,0,0, - 0,99,3,0,0,0,0,0,0,0,0,0,0,0,3,0, - 0,0,4,0,0,0,67,0,0,0,115,42,0,0,0,116, - 0,124,0,124,1,124,2,131,3,1,0,124,2,100,1,107, - 4,114,32,116,1,124,0,124,1,124,2,131,3,125,0,116, - 2,124,0,116,3,131,2,83,0,41,2,97,50,1,0,0, - 73,109,112,111,114,116,32,97,110,100,32,114,101,116,117,114, - 110,32,116,104,101,32,109,111,100,117,108,101,32,98,97,115, - 101,100,32,111,110,32,105,116,115,32,110,97,109,101,44,32, - 116,104,101,32,112,97,99,107,97,103,101,32,116,104,101,32, - 99,97,108,108,32,105,115,10,32,32,32,32,98,101,105,110, - 103,32,109,97,100,101,32,102,114,111,109,44,32,97,110,100, - 32,116,104,101,32,108,101,118,101,108,32,97,100,106,117,115, - 116,109,101,110,116,46,10,10,32,32,32,32,84,104,105,115, - 32,102,117,110,99,116,105,111,110,32,114,101,112,114,101,115, - 101,110,116,115,32,116,104,101,32,103,114,101,97,116,101,115, - 116,32,99,111,109,109,111,110,32,100,101,110,111,109,105,110, - 97,116,111,114,32,111,102,32,102,117,110,99,116,105,111,110, - 97,108,105,116,121,10,32,32,32,32,98,101,116,119,101,101, - 110,32,105,109,112,111,114,116,95,109,111,100,117,108,101,32, - 97,110,100,32,95,95,105,109,112,111,114,116,95,95,46,32, - 84,104,105,115,32,105,110,99,108,117,100,101,115,32,115,101, - 116,116,105,110,103,32,95,95,112,97,99,107,97,103,101,95, - 95,32,105,102,10,32,32,32,32,116,104,101,32,108,111,97, - 100,101,114,32,100,105,100,32,110,111,116,46,10,10,32,32, - 32,32,114,22,0,0,0,41,4,114,200,0,0,0,114,187, - 0,0,0,114,207,0,0,0,218,11,95,103,99,100,95,105, - 109,112,111,114,116,114,199,0,0,0,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,114,208,0,0,0,236,3, - 0,0,115,8,0,0,0,0,9,12,1,8,1,12,1,114, - 208,0,0,0,169,1,218,9,114,101,99,117,114,115,105,118, - 101,99,3,0,0,0,0,0,0,0,1,0,0,0,8,0, - 0,0,11,0,0,0,67,0,0,0,115,234,0,0,0,124, - 1,68,0,93,224,125,4,116,0,124,4,116,1,131,2,115, - 66,124,3,114,34,124,0,106,2,100,1,23,0,125,5,110, - 4,100,2,125,5,116,3,100,3,124,5,155,0,100,4,116, - 4,124,4,131,1,106,2,155,0,157,4,131,1,130,1,113, - 4,124,4,100,5,107,2,114,108,124,3,115,228,116,5,124, - 0,100,6,131,2,114,228,116,6,124,0,124,0,106,7,124, - 2,100,7,100,8,141,4,1,0,113,4,116,5,124,0,124, - 4,131,2,115,4,100,9,160,8,124,0,106,2,124,4,161, - 2,125,6,122,14,116,9,124,2,124,6,131,2,1,0,87, - 0,113,4,4,0,116,10,107,10,114,226,1,0,125,7,1, - 0,122,54,124,7,106,11,124,6,107,2,114,204,116,12,106, - 13,160,14,124,6,116,15,161,2,100,10,107,9,114,204,87, - 0,89,0,100,10,125,7,126,7,113,4,130,0,87,0,89, - 0,100,10,125,7,126,7,113,4,100,10,125,7,126,7,48, - 0,48,0,113,4,124,0,83,0,41,11,122,238,70,105,103, - 117,114,101,32,111,117,116,32,119,104,97,116,32,95,95,105, - 109,112,111,114,116,95,95,32,115,104,111,117,108,100,32,114, - 101,116,117,114,110,46,10,10,32,32,32,32,84,104,101,32, - 105,109,112,111,114,116,95,32,112,97,114,97,109,101,116,101, - 114,32,105,115,32,97,32,99,97,108,108,97,98,108,101,32, - 119,104,105,99,104,32,116,97,107,101,115,32,116,104,101,32, - 110,97,109,101,32,111,102,32,109,111,100,117,108,101,32,116, - 111,10,32,32,32,32,105,109,112,111,114,116,46,32,73,116, - 32,105,115,32,114,101,113,117,105,114,101,100,32,116,111,32, - 100,101,99,111,117,112,108,101,32,116,104,101,32,102,117,110, - 99,116,105,111,110,32,102,114,111,109,32,97,115,115,117,109, - 105,110,103,32,105,109,112,111,114,116,108,105,98,39,115,10, - 32,32,32,32,105,109,112,111,114,116,32,105,109,112,108,101, - 109,101,110,116,97,116,105,111,110,32,105,115,32,100,101,115, - 105,114,101,100,46,10,10,32,32,32,32,122,8,46,95,95, - 97,108,108,95,95,122,13,96,96,102,114,111,109,32,108,105, - 115,116,39,39,122,8,73,116,101,109,32,105,110,32,122,18, - 32,109,117,115,116,32,98,101,32,115,116,114,44,32,110,111, - 116,32,250,1,42,218,7,95,95,97,108,108,95,95,84,114, - 209,0,0,0,114,182,0,0,0,78,41,16,114,195,0,0, - 0,114,196,0,0,0,114,1,0,0,0,114,197,0,0,0, - 114,14,0,0,0,114,4,0,0,0,218,16,95,104,97,110, - 100,108,101,95,102,114,111,109,108,105,115,116,114,212,0,0, - 0,114,44,0,0,0,114,66,0,0,0,114,203,0,0,0, - 114,17,0,0,0,114,15,0,0,0,114,91,0,0,0,114, - 34,0,0,0,114,206,0,0,0,41,8,114,95,0,0,0, - 218,8,102,114,111,109,108,105,115,116,114,204,0,0,0,114, - 210,0,0,0,218,1,120,90,5,119,104,101,114,101,90,9, - 102,114,111,109,95,110,97,109,101,90,3,101,120,99,114,10, - 0,0,0,114,10,0,0,0,114,11,0,0,0,114,213,0, - 0,0,251,3,0,0,115,44,0,0,0,0,10,8,1,10, - 1,4,1,12,2,4,1,28,2,8,1,14,1,10,1,2, - 255,8,2,10,1,14,1,2,1,14,1,16,4,10,1,16, - 255,2,2,12,1,26,1,114,213,0,0,0,99,1,0,0, - 0,0,0,0,0,0,0,0,0,3,0,0,0,6,0,0, - 0,67,0,0,0,115,146,0,0,0,124,0,160,0,100,1, - 161,1,125,1,124,0,160,0,100,2,161,1,125,2,124,1, - 100,3,107,9,114,82,124,2,100,3,107,9,114,78,124,1, - 124,2,106,1,107,3,114,78,116,2,106,3,100,4,124,1, - 155,2,100,5,124,2,106,1,155,2,100,6,157,5,116,4, - 100,7,100,8,141,3,1,0,124,1,83,0,124,2,100,3, - 107,9,114,96,124,2,106,1,83,0,116,2,106,3,100,9, - 116,4,100,7,100,8,141,3,1,0,124,0,100,10,25,0, - 125,1,100,11,124,0,107,7,114,142,124,1,160,5,100,12, - 161,1,100,13,25,0,125,1,124,1,83,0,41,14,122,167, - 67,97,108,99,117,108,97,116,101,32,119,104,97,116,32,95, - 95,112,97,99,107,97,103,101,95,95,32,115,104,111,117,108, - 100,32,98,101,46,10,10,32,32,32,32,95,95,112,97,99, - 107,97,103,101,95,95,32,105,115,32,110,111,116,32,103,117, - 97,114,97,110,116,101,101,100,32,116,111,32,98,101,32,100, - 101,102,105,110,101,100,32,111,114,32,99,111,117,108,100,32, - 98,101,32,115,101,116,32,116,111,32,78,111,110,101,10,32, - 32,32,32,116,111,32,114,101,112,114,101,115,101,110,116,32, - 116,104,97,116,32,105,116,115,32,112,114,111,112,101,114,32, - 118,97,108,117,101,32,105,115,32,117,110,107,110,111,119,110, - 46,10,10,32,32,32,32,114,144,0,0,0,114,104,0,0, - 0,78,122,32,95,95,112,97,99,107,97,103,101,95,95,32, - 33,61,32,95,95,115,112,101,99,95,95,46,112,97,114,101, - 110,116,32,40,122,4,32,33,61,32,250,1,41,233,3,0, - 0,0,41,1,90,10,115,116,97,99,107,108,101,118,101,108, - 122,89,99,97,110,39,116,32,114,101,115,111,108,118,101,32, - 112,97,99,107,97,103,101,32,102,114,111,109,32,95,95,115, - 112,101,99,95,95,32,111,114,32,95,95,112,97,99,107,97, - 103,101,95,95,44,32,102,97,108,108,105,110,103,32,98,97, - 99,107,32,111,110,32,95,95,110,97,109,101,95,95,32,97, - 110,100,32,95,95,112,97,116,104,95,95,114,1,0,0,0, - 114,140,0,0,0,114,127,0,0,0,114,22,0,0,0,41, - 6,114,34,0,0,0,114,129,0,0,0,114,191,0,0,0, - 114,192,0,0,0,114,193,0,0,0,114,128,0,0,0,41, - 3,218,7,103,108,111,98,97,108,115,114,185,0,0,0,114, - 94,0,0,0,114,10,0,0,0,114,10,0,0,0,114,11, - 0,0,0,218,17,95,99,97,108,99,95,95,95,112,97,99, - 107,97,103,101,95,95,32,4,0,0,115,38,0,0,0,0, - 7,10,1,10,1,8,1,18,1,22,2,2,0,2,254,6, - 3,4,1,8,1,6,2,6,2,2,0,2,254,6,3,8, - 1,8,1,14,1,114,219,0,0,0,114,10,0,0,0,99, - 5,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0, - 5,0,0,0,67,0,0,0,115,180,0,0,0,124,4,100, - 1,107,2,114,18,116,0,124,0,131,1,125,5,110,36,124, - 1,100,2,107,9,114,30,124,1,110,2,105,0,125,6,116, - 1,124,6,131,1,125,7,116,0,124,0,124,7,124,4,131, - 3,125,5,124,3,115,150,124,4,100,1,107,2,114,84,116, - 0,124,0,160,2,100,3,161,1,100,1,25,0,131,1,83, - 0,124,0,115,92,124,5,83,0,116,3,124,0,131,1,116, - 3,124,0,160,2,100,3,161,1,100,1,25,0,131,1,24, - 0,125,8,116,4,106,5,124,5,106,6,100,2,116,3,124, - 5,106,6,131,1,124,8,24,0,133,2,25,0,25,0,83, - 0,110,26,116,7,124,5,100,4,131,2,114,172,116,8,124, - 5,124,3,116,0,131,3,83,0,124,5,83,0,100,2,83, - 0,41,5,97,215,1,0,0,73,109,112,111,114,116,32,97, - 32,109,111,100,117,108,101,46,10,10,32,32,32,32,84,104, - 101,32,39,103,108,111,98,97,108,115,39,32,97,114,103,117, - 109,101,110,116,32,105,115,32,117,115,101,100,32,116,111,32, - 105,110,102,101,114,32,119,104,101,114,101,32,116,104,101,32, - 105,109,112,111,114,116,32,105,115,32,111,99,99,117,114,114, - 105,110,103,32,102,114,111,109,10,32,32,32,32,116,111,32, - 104,97,110,100,108,101,32,114,101,108,97,116,105,118,101,32, - 105,109,112,111,114,116,115,46,32,84,104,101,32,39,108,111, - 99,97,108,115,39,32,97,114,103,117,109,101,110,116,32,105, - 115,32,105,103,110,111,114,101,100,46,32,84,104,101,10,32, - 32,32,32,39,102,114,111,109,108,105,115,116,39,32,97,114, - 103,117,109,101,110,116,32,115,112,101,99,105,102,105,101,115, - 32,119,104,97,116,32,115,104,111,117,108,100,32,101,120,105, - 115,116,32,97,115,32,97,116,116,114,105,98,117,116,101,115, - 32,111,110,32,116,104,101,32,109,111,100,117,108,101,10,32, - 32,32,32,98,101,105,110,103,32,105,109,112,111,114,116,101, - 100,32,40,101,46,103,46,32,96,96,102,114,111,109,32,109, - 111,100,117,108,101,32,105,109,112,111,114,116,32,60,102,114, - 111,109,108,105,115,116,62,96,96,41,46,32,32,84,104,101, - 32,39,108,101,118,101,108,39,10,32,32,32,32,97,114,103, - 117,109,101,110,116,32,114,101,112,114,101,115,101,110,116,115, - 32,116,104,101,32,112,97,99,107,97,103,101,32,108,111,99, - 97,116,105,111,110,32,116,111,32,105,109,112,111,114,116,32, - 102,114,111,109,32,105,110,32,97,32,114,101,108,97,116,105, - 118,101,10,32,32,32,32,105,109,112,111,114,116,32,40,101, - 46,103,46,32,96,96,102,114,111,109,32,46,46,112,107,103, - 32,105,109,112,111,114,116,32,109,111,100,96,96,32,119,111, - 117,108,100,32,104,97,118,101,32,97,32,39,108,101,118,101, - 108,39,32,111,102,32,50,41,46,10,10,32,32,32,32,114, - 22,0,0,0,78,114,127,0,0,0,114,140,0,0,0,41, - 9,114,208,0,0,0,114,219,0,0,0,218,9,112,97,114, - 116,105,116,105,111,110,114,184,0,0,0,114,15,0,0,0, - 114,91,0,0,0,114,1,0,0,0,114,4,0,0,0,114, - 213,0,0,0,41,9,114,17,0,0,0,114,218,0,0,0, - 218,6,108,111,99,97,108,115,114,214,0,0,0,114,186,0, - 0,0,114,95,0,0,0,90,8,103,108,111,98,97,108,115, - 95,114,185,0,0,0,90,7,99,117,116,95,111,102,102,114, - 10,0,0,0,114,10,0,0,0,114,11,0,0,0,218,10, - 95,95,105,109,112,111,114,116,95,95,59,4,0,0,115,30, - 0,0,0,0,11,8,1,10,2,16,1,8,1,12,1,4, - 3,8,1,18,1,4,1,4,4,26,3,32,1,10,1,12, - 2,114,222,0,0,0,99,1,0,0,0,0,0,0,0,0, - 0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115, - 38,0,0,0,116,0,160,1,124,0,161,1,125,1,124,1, - 100,0,107,8,114,30,116,2,100,1,124,0,23,0,131,1, - 130,1,116,3,124,1,131,1,83,0,41,2,78,122,25,110, - 111,32,98,117,105,108,116,45,105,110,32,109,111,100,117,108, - 101,32,110,97,109,101,100,32,41,4,114,159,0,0,0,114, - 166,0,0,0,114,78,0,0,0,114,158,0,0,0,41,2, - 114,17,0,0,0,114,94,0,0,0,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,218,18,95,98,117,105,108, - 116,105,110,95,102,114,111,109,95,110,97,109,101,96,4,0, - 0,115,8,0,0,0,0,1,10,1,8,1,12,1,114,223, - 0,0,0,99,2,0,0,0,0,0,0,0,0,0,0,0, - 10,0,0,0,5,0,0,0,67,0,0,0,115,166,0,0, - 0,124,1,97,0,124,0,97,1,116,2,116,1,131,1,125, - 2,116,1,106,3,160,4,161,0,68,0,93,72,92,2,125, - 3,125,4,116,5,124,4,124,2,131,2,114,26,124,3,116, - 1,106,6,107,6,114,60,116,7,125,5,110,18,116,0,160, - 8,124,3,161,1,114,26,116,9,125,5,110,2,113,26,116, - 10,124,4,124,5,131,2,125,6,116,11,124,6,124,4,131, - 2,1,0,113,26,116,1,106,3,116,12,25,0,125,7,100, - 1,68,0,93,46,125,8,124,8,116,1,106,3,107,7,114, - 138,116,13,124,8,131,1,125,9,110,10,116,1,106,3,124, - 8,25,0,125,9,116,14,124,7,124,8,124,9,131,3,1, - 0,113,114,100,2,83,0,41,3,122,250,83,101,116,117,112, - 32,105,109,112,111,114,116,108,105,98,32,98,121,32,105,109, - 112,111,114,116,105,110,103,32,110,101,101,100,101,100,32,98, - 117,105,108,116,45,105,110,32,109,111,100,117,108,101,115,32, - 97,110,100,32,105,110,106,101,99,116,105,110,103,32,116,104, - 101,109,10,32,32,32,32,105,110,116,111,32,116,104,101,32, - 103,108,111,98,97,108,32,110,97,109,101,115,112,97,99,101, - 46,10,10,32,32,32,32,65,115,32,115,121,115,32,105,115, - 32,110,101,101,100,101,100,32,102,111,114,32,115,121,115,46, - 109,111,100,117,108,101,115,32,97,99,99,101,115,115,32,97, - 110,100,32,95,105,109,112,32,105,115,32,110,101,101,100,101, - 100,32,116,111,32,108,111,97,100,32,98,117,105,108,116,45, - 105,110,10,32,32,32,32,109,111,100,117,108,101,115,44,32, - 116,104,111,115,101,32,116,119,111,32,109,111,100,117,108,101, - 115,32,109,117,115,116,32,98,101,32,101,120,112,108,105,99, - 105,116,108,121,32,112,97,115,115,101,100,32,105,110,46,10, - 10,32,32,32,32,41,3,114,23,0,0,0,114,191,0,0, - 0,114,63,0,0,0,78,41,15,114,56,0,0,0,114,15, - 0,0,0,114,14,0,0,0,114,91,0,0,0,218,5,105, - 116,101,109,115,114,195,0,0,0,114,77,0,0,0,114,159, - 0,0,0,114,87,0,0,0,114,173,0,0,0,114,141,0, - 0,0,114,147,0,0,0,114,1,0,0,0,114,223,0,0, - 0,114,5,0,0,0,41,10,218,10,115,121,115,95,109,111, - 100,117,108,101,218,11,95,105,109,112,95,109,111,100,117,108, - 101,90,11,109,111,100,117,108,101,95,116,121,112,101,114,17, - 0,0,0,114,95,0,0,0,114,108,0,0,0,114,94,0, - 0,0,90,11,115,101,108,102,95,109,111,100,117,108,101,90, - 12,98,117,105,108,116,105,110,95,110,97,109,101,90,14,98, - 117,105,108,116,105,110,95,109,111,100,117,108,101,114,10,0, - 0,0,114,10,0,0,0,114,11,0,0,0,218,6,95,115, - 101,116,117,112,103,4,0,0,115,36,0,0,0,0,9,4, - 1,4,3,8,1,18,1,10,1,10,1,6,1,10,1,6, - 2,2,1,10,1,12,3,10,1,8,1,10,1,10,2,10, - 1,114,227,0,0,0,99,2,0,0,0,0,0,0,0,0, - 0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115, - 38,0,0,0,116,0,124,0,124,1,131,2,1,0,116,1, - 106,2,160,3,116,4,161,1,1,0,116,1,106,2,160,3, - 116,5,161,1,1,0,100,1,83,0,41,2,122,48,73,110, - 115,116,97,108,108,32,105,109,112,111,114,116,101,114,115,32, - 102,111,114,32,98,117,105,108,116,105,110,32,97,110,100,32, - 102,114,111,122,101,110,32,109,111,100,117,108,101,115,78,41, - 6,114,227,0,0,0,114,15,0,0,0,114,190,0,0,0, - 114,118,0,0,0,114,159,0,0,0,114,173,0,0,0,41, - 2,114,225,0,0,0,114,226,0,0,0,114,10,0,0,0, - 114,10,0,0,0,114,11,0,0,0,218,8,95,105,110,115, - 116,97,108,108,138,4,0,0,115,6,0,0,0,0,2,10, - 2,12,1,114,228,0,0,0,99,0,0,0,0,0,0,0, - 0,0,0,0,0,1,0,0,0,4,0,0,0,67,0,0, - 0,115,32,0,0,0,100,1,100,2,108,0,125,0,124,0, - 97,1,124,0,160,2,116,3,106,4,116,5,25,0,161,1, - 1,0,100,2,83,0,41,3,122,57,73,110,115,116,97,108, - 108,32,105,109,112,111,114,116,101,114,115,32,116,104,97,116, - 32,114,101,113,117,105,114,101,32,101,120,116,101,114,110,97, - 108,32,102,105,108,101,115,121,115,116,101,109,32,97,99,99, - 101,115,115,114,22,0,0,0,78,41,6,218,26,95,102,114, - 111,122,101,110,95,105,109,112,111,114,116,108,105,98,95,101, - 120,116,101,114,110,97,108,114,125,0,0,0,114,228,0,0, - 0,114,15,0,0,0,114,91,0,0,0,114,1,0,0,0, - 41,1,114,229,0,0,0,114,10,0,0,0,114,10,0,0, - 0,114,11,0,0,0,218,27,95,105,110,115,116,97,108,108, - 95,101,120,116,101,114,110,97,108,95,105,109,112,111,114,116, - 101,114,115,146,4,0,0,115,6,0,0,0,0,3,8,1, - 4,1,114,230,0,0,0,41,2,78,78,41,1,78,41,2, - 78,114,22,0,0,0,41,4,78,78,114,10,0,0,0,114, - 22,0,0,0,41,50,114,3,0,0,0,114,125,0,0,0, - 114,12,0,0,0,114,18,0,0,0,114,58,0,0,0,114, - 33,0,0,0,114,42,0,0,0,114,19,0,0,0,114,20, - 0,0,0,114,48,0,0,0,114,49,0,0,0,114,52,0, - 0,0,114,64,0,0,0,114,66,0,0,0,114,75,0,0, - 0,114,85,0,0,0,114,89,0,0,0,114,96,0,0,0, - 114,110,0,0,0,114,111,0,0,0,114,90,0,0,0,114, - 141,0,0,0,114,147,0,0,0,114,151,0,0,0,114,106, - 0,0,0,114,92,0,0,0,114,157,0,0,0,114,158,0, - 0,0,114,93,0,0,0,114,159,0,0,0,114,173,0,0, - 0,114,178,0,0,0,114,187,0,0,0,114,189,0,0,0, - 114,194,0,0,0,114,200,0,0,0,90,15,95,69,82,82, - 95,77,83,71,95,80,82,69,70,73,88,114,202,0,0,0, - 114,205,0,0,0,218,6,111,98,106,101,99,116,114,206,0, - 0,0,114,207,0,0,0,114,208,0,0,0,114,213,0,0, - 0,114,219,0,0,0,114,222,0,0,0,114,223,0,0,0, - 114,227,0,0,0,114,228,0,0,0,114,230,0,0,0,114, - 10,0,0,0,114,10,0,0,0,114,10,0,0,0,114,11, - 0,0,0,218,8,60,109,111,100,117,108,101,62,1,0,0, - 0,115,94,0,0,0,4,24,4,2,8,8,8,8,4,2, - 4,3,16,4,14,68,14,21,14,16,8,37,8,17,8,11, - 14,8,8,11,8,12,8,16,8,36,14,101,16,26,10,45, - 14,72,8,17,8,17,8,30,8,37,8,42,8,15,14,75, - 14,79,14,13,8,9,8,9,10,47,8,16,4,1,8,2, - 8,27,6,3,8,16,10,15,14,37,8,27,10,37,8,7, - 8,35,8,8, + 0,0,218,10,95,102,105,110,100,95,115,112,101,99,124,3, + 0,0,115,54,0,0,0,0,2,6,1,8,2,8,3,4, + 1,12,5,10,1,8,1,8,1,2,1,10,1,14,1,12, + 1,8,1,22,2,42,1,8,2,18,1,10,1,2,1,10, + 1,14,4,14,2,10,1,8,2,10,2,10,2,114,194,0, + 0,0,99,3,0,0,0,0,0,0,0,0,0,0,0,3, + 0,0,0,5,0,0,0,67,0,0,0,115,108,0,0,0, + 116,0,124,0,116,1,131,2,115,28,116,2,100,1,160,3, + 116,4,124,0,131,1,161,1,131,1,130,1,124,2,100,2, + 107,0,114,44,116,5,100,3,131,1,130,1,124,2,100,2, + 107,4,114,84,116,0,124,1,116,1,131,2,115,72,116,2, + 100,4,131,1,130,1,110,12,124,1,115,84,116,6,100,5, + 131,1,130,1,124,0,115,104,124,2,100,2,107,2,114,104, + 116,5,100,6,131,1,130,1,100,7,83,0,41,8,122,28, + 86,101,114,105,102,121,32,97,114,103,117,109,101,110,116,115, + 32,97,114,101,32,34,115,97,110,101,34,46,122,31,109,111, + 100,117,108,101,32,110,97,109,101,32,109,117,115,116,32,98, + 101,32,115,116,114,44,32,110,111,116,32,123,125,114,22,0, + 0,0,122,18,108,101,118,101,108,32,109,117,115,116,32,98, + 101,32,62,61,32,48,122,31,95,95,112,97,99,107,97,103, + 101,95,95,32,110,111,116,32,115,101,116,32,116,111,32,97, + 32,115,116,114,105,110,103,122,54,97,116,116,101,109,112,116, + 101,100,32,114,101,108,97,116,105,118,101,32,105,109,112,111, + 114,116,32,119,105,116,104,32,110,111,32,107,110,111,119,110, + 32,112,97,114,101,110,116,32,112,97,99,107,97,103,101,122, + 17,69,109,112,116,121,32,109,111,100,117,108,101,32,110,97, + 109,101,78,41,7,218,10,105,115,105,110,115,116,97,110,99, + 101,218,3,115,116,114,218,9,84,121,112,101,69,114,114,111, + 114,114,44,0,0,0,114,14,0,0,0,218,10,86,97,108, + 117,101,69,114,114,111,114,114,78,0,0,0,169,3,114,17, + 0,0,0,114,185,0,0,0,114,186,0,0,0,114,10,0, + 0,0,114,10,0,0,0,114,11,0,0,0,218,13,95,115, + 97,110,105,116,121,95,99,104,101,99,107,171,3,0,0,115, + 22,0,0,0,0,2,10,1,18,1,8,1,8,1,8,1, + 10,1,10,1,4,1,8,2,12,1,114,200,0,0,0,122, + 16,78,111,32,109,111,100,117,108,101,32,110,97,109,101,100, + 32,122,4,123,33,114,125,99,2,0,0,0,0,0,0,0, + 0,0,0,0,8,0,0,0,8,0,0,0,67,0,0,0, + 115,220,0,0,0,100,0,125,2,124,0,160,0,100,1,161, + 1,100,2,25,0,125,3,124,3,114,134,124,3,116,1,106, + 2,107,7,114,42,116,3,124,1,124,3,131,2,1,0,124, + 0,116,1,106,2,107,6,114,62,116,1,106,2,124,0,25, + 0,83,0,116,1,106,2,124,3,25,0,125,4,122,10,124, + 4,106,4,125,2,87,0,110,50,4,0,116,5,107,10,114, + 132,1,0,1,0,1,0,116,6,100,3,23,0,160,7,124, + 0,124,3,161,2,125,5,116,8,124,5,124,0,100,4,141, + 2,100,0,130,2,89,0,110,2,48,0,116,9,124,0,124, + 2,131,2,125,6,124,6,100,0,107,8,114,172,116,8,116, + 6,160,7,124,0,161,1,124,0,100,4,141,2,130,1,110, + 8,116,10,124,6,131,1,125,7,124,3,114,216,116,1,106, + 2,124,3,25,0,125,4,116,11,124,4,124,0,160,0,100, + 1,161,1,100,5,25,0,124,7,131,3,1,0,124,7,83, + 0,41,6,78,114,127,0,0,0,114,22,0,0,0,122,23, + 59,32,123,33,114,125,32,105,115,32,110,111,116,32,97,32, + 112,97,99,107,97,103,101,114,16,0,0,0,233,2,0,0, + 0,41,12,114,128,0,0,0,114,15,0,0,0,114,91,0, + 0,0,114,66,0,0,0,114,140,0,0,0,114,105,0,0, + 0,218,8,95,69,82,82,95,77,83,71,114,44,0,0,0, + 218,19,77,111,100,117,108,101,78,111,116,70,111,117,110,100, + 69,114,114,111,114,114,194,0,0,0,114,158,0,0,0,114, + 5,0,0,0,41,8,114,17,0,0,0,218,7,105,109,112, + 111,114,116,95,114,164,0,0,0,114,129,0,0,0,90,13, + 112,97,114,101,110,116,95,109,111,100,117,108,101,114,156,0, + 0,0,114,94,0,0,0,114,95,0,0,0,114,10,0,0, + 0,114,10,0,0,0,114,11,0,0,0,218,23,95,102,105, + 110,100,95,97,110,100,95,108,111,97,100,95,117,110,108,111, + 99,107,101,100,190,3,0,0,115,42,0,0,0,0,1,4, + 1,14,1,4,1,10,1,10,2,10,1,10,1,10,1,2, + 1,10,1,14,1,16,1,20,1,10,1,8,1,20,2,8, + 1,4,2,10,1,22,1,114,205,0,0,0,99,2,0,0, + 0,0,0,0,0,0,0,0,0,4,0,0,0,8,0,0, + 0,67,0,0,0,115,128,0,0,0,116,0,124,0,131,1, + 143,62,1,0,116,1,106,2,160,3,124,0,116,4,161,2, + 125,2,124,2,116,4,107,8,114,56,116,5,124,0,124,1, + 131,2,87,0,2,0,100,1,4,0,4,0,131,3,1,0, + 83,0,87,0,100,1,4,0,4,0,131,3,1,0,110,16, + 49,0,115,76,48,0,1,0,1,0,1,0,89,0,1,0, + 124,2,100,1,107,8,114,116,100,2,160,6,124,0,161,1, + 125,3,116,7,124,3,124,0,100,3,141,2,130,1,116,8, + 124,0,131,1,1,0,124,2,83,0,41,4,122,25,70,105, + 110,100,32,97,110,100,32,108,111,97,100,32,116,104,101,32, + 109,111,100,117,108,101,46,78,122,40,105,109,112,111,114,116, + 32,111,102,32,123,125,32,104,97,108,116,101,100,59,32,78, + 111,110,101,32,105,110,32,115,121,115,46,109,111,100,117,108, + 101,115,114,16,0,0,0,41,9,114,49,0,0,0,114,15, + 0,0,0,114,91,0,0,0,114,34,0,0,0,218,14,95, + 78,69,69,68,83,95,76,79,65,68,73,78,71,114,205,0, + 0,0,114,44,0,0,0,114,203,0,0,0,114,64,0,0, + 0,41,4,114,17,0,0,0,114,204,0,0,0,114,95,0, + 0,0,114,74,0,0,0,114,10,0,0,0,114,10,0,0, + 0,114,11,0,0,0,218,14,95,102,105,110,100,95,97,110, + 100,95,108,111,97,100,220,3,0,0,115,22,0,0,0,0, + 2,10,1,14,1,8,1,54,2,8,1,4,1,2,255,4, + 2,12,2,8,1,114,207,0,0,0,114,22,0,0,0,99, + 3,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, + 4,0,0,0,67,0,0,0,115,42,0,0,0,116,0,124, + 0,124,1,124,2,131,3,1,0,124,2,100,1,107,4,114, + 32,116,1,124,0,124,1,124,2,131,3,125,0,116,2,124, + 0,116,3,131,2,83,0,41,2,97,50,1,0,0,73,109, + 112,111,114,116,32,97,110,100,32,114,101,116,117,114,110,32, + 116,104,101,32,109,111,100,117,108,101,32,98,97,115,101,100, + 32,111,110,32,105,116,115,32,110,97,109,101,44,32,116,104, + 101,32,112,97,99,107,97,103,101,32,116,104,101,32,99,97, + 108,108,32,105,115,10,32,32,32,32,98,101,105,110,103,32, + 109,97,100,101,32,102,114,111,109,44,32,97,110,100,32,116, + 104,101,32,108,101,118,101,108,32,97,100,106,117,115,116,109, + 101,110,116,46,10,10,32,32,32,32,84,104,105,115,32,102, + 117,110,99,116,105,111,110,32,114,101,112,114,101,115,101,110, + 116,115,32,116,104,101,32,103,114,101,97,116,101,115,116,32, + 99,111,109,109,111,110,32,100,101,110,111,109,105,110,97,116, + 111,114,32,111,102,32,102,117,110,99,116,105,111,110,97,108, + 105,116,121,10,32,32,32,32,98,101,116,119,101,101,110,32, + 105,109,112,111,114,116,95,109,111,100,117,108,101,32,97,110, + 100,32,95,95,105,109,112,111,114,116,95,95,46,32,84,104, + 105,115,32,105,110,99,108,117,100,101,115,32,115,101,116,116, + 105,110,103,32,95,95,112,97,99,107,97,103,101,95,95,32, + 105,102,10,32,32,32,32,116,104,101,32,108,111,97,100,101, + 114,32,100,105,100,32,110,111,116,46,10,10,32,32,32,32, + 114,22,0,0,0,41,4,114,200,0,0,0,114,187,0,0, + 0,114,207,0,0,0,218,11,95,103,99,100,95,105,109,112, + 111,114,116,114,199,0,0,0,114,10,0,0,0,114,10,0, + 0,0,114,11,0,0,0,114,208,0,0,0,236,3,0,0, + 115,8,0,0,0,0,9,12,1,8,1,12,1,114,208,0, + 0,0,169,1,218,9,114,101,99,117,114,115,105,118,101,99, + 3,0,0,0,0,0,0,0,1,0,0,0,8,0,0,0, + 11,0,0,0,67,0,0,0,115,234,0,0,0,124,1,68, + 0,93,224,125,4,116,0,124,4,116,1,131,2,115,66,124, + 3,114,34,124,0,106,2,100,1,23,0,125,5,110,4,100, + 2,125,5,116,3,100,3,124,5,155,0,100,4,116,4,124, + 4,131,1,106,2,155,0,157,4,131,1,130,1,113,4,124, + 4,100,5,107,2,114,108,124,3,115,228,116,5,124,0,100, + 6,131,2,114,228,116,6,124,0,124,0,106,7,124,2,100, + 7,100,8,141,4,1,0,113,4,116,5,124,0,124,4,131, + 2,115,4,100,9,160,8,124,0,106,2,124,4,161,2,125, + 6,122,14,116,9,124,2,124,6,131,2,1,0,87,0,113, + 4,4,0,116,10,107,10,114,226,1,0,125,7,1,0,122, + 54,124,7,106,11,124,6,107,2,114,204,116,12,106,13,160, + 14,124,6,116,15,161,2,100,10,107,9,114,204,87,0,89, + 0,100,10,125,7,126,7,113,4,130,0,87,0,89,0,100, + 10,125,7,126,7,113,4,100,10,125,7,126,7,48,0,48, + 0,113,4,124,0,83,0,41,11,122,238,70,105,103,117,114, + 101,32,111,117,116,32,119,104,97,116,32,95,95,105,109,112, + 111,114,116,95,95,32,115,104,111,117,108,100,32,114,101,116, + 117,114,110,46,10,10,32,32,32,32,84,104,101,32,105,109, + 112,111,114,116,95,32,112,97,114,97,109,101,116,101,114,32, + 105,115,32,97,32,99,97,108,108,97,98,108,101,32,119,104, + 105,99,104,32,116,97,107,101,115,32,116,104,101,32,110,97, + 109,101,32,111,102,32,109,111,100,117,108,101,32,116,111,10, + 32,32,32,32,105,109,112,111,114,116,46,32,73,116,32,105, + 115,32,114,101,113,117,105,114,101,100,32,116,111,32,100,101, + 99,111,117,112,108,101,32,116,104,101,32,102,117,110,99,116, + 105,111,110,32,102,114,111,109,32,97,115,115,117,109,105,110, + 103,32,105,109,112,111,114,116,108,105,98,39,115,10,32,32, + 32,32,105,109,112,111,114,116,32,105,109,112,108,101,109,101, + 110,116,97,116,105,111,110,32,105,115,32,100,101,115,105,114, + 101,100,46,10,10,32,32,32,32,122,8,46,95,95,97,108, + 108,95,95,122,13,96,96,102,114,111,109,32,108,105,115,116, + 39,39,122,8,73,116,101,109,32,105,110,32,122,18,32,109, + 117,115,116,32,98,101,32,115,116,114,44,32,110,111,116,32, + 250,1,42,218,7,95,95,97,108,108,95,95,84,114,209,0, + 0,0,114,182,0,0,0,78,41,16,114,195,0,0,0,114, + 196,0,0,0,114,1,0,0,0,114,197,0,0,0,114,14, + 0,0,0,114,4,0,0,0,218,16,95,104,97,110,100,108, + 101,95,102,114,111,109,108,105,115,116,114,212,0,0,0,114, + 44,0,0,0,114,66,0,0,0,114,203,0,0,0,114,17, + 0,0,0,114,15,0,0,0,114,91,0,0,0,114,34,0, + 0,0,114,206,0,0,0,41,8,114,95,0,0,0,218,8, + 102,114,111,109,108,105,115,116,114,204,0,0,0,114,210,0, + 0,0,218,1,120,90,5,119,104,101,114,101,90,9,102,114, + 111,109,95,110,97,109,101,90,3,101,120,99,114,10,0,0, + 0,114,10,0,0,0,114,11,0,0,0,114,213,0,0,0, + 251,3,0,0,115,44,0,0,0,0,10,8,1,10,1,4, + 1,12,2,4,1,28,2,8,1,14,1,10,1,2,255,8, + 2,10,1,14,1,2,1,14,1,16,4,10,1,16,255,2, + 2,12,1,26,1,114,213,0,0,0,99,1,0,0,0,0, + 0,0,0,0,0,0,0,3,0,0,0,6,0,0,0,67, + 0,0,0,115,146,0,0,0,124,0,160,0,100,1,161,1, + 125,1,124,0,160,0,100,2,161,1,125,2,124,1,100,3, + 107,9,114,82,124,2,100,3,107,9,114,78,124,1,124,2, + 106,1,107,3,114,78,116,2,106,3,100,4,124,1,155,2, + 100,5,124,2,106,1,155,2,100,6,157,5,116,4,100,7, + 100,8,141,3,1,0,124,1,83,0,124,2,100,3,107,9, + 114,96,124,2,106,1,83,0,116,2,106,3,100,9,116,4, + 100,7,100,8,141,3,1,0,124,0,100,10,25,0,125,1, + 100,11,124,0,107,7,114,142,124,1,160,5,100,12,161,1, + 100,13,25,0,125,1,124,1,83,0,41,14,122,167,67,97, + 108,99,117,108,97,116,101,32,119,104,97,116,32,95,95,112, + 97,99,107,97,103,101,95,95,32,115,104,111,117,108,100,32, + 98,101,46,10,10,32,32,32,32,95,95,112,97,99,107,97, + 103,101,95,95,32,105,115,32,110,111,116,32,103,117,97,114, + 97,110,116,101,101,100,32,116,111,32,98,101,32,100,101,102, + 105,110,101,100,32,111,114,32,99,111,117,108,100,32,98,101, + 32,115,101,116,32,116,111,32,78,111,110,101,10,32,32,32, + 32,116,111,32,114,101,112,114,101,115,101,110,116,32,116,104, + 97,116,32,105,116,115,32,112,114,111,112,101,114,32,118,97, + 108,117,101,32,105,115,32,117,110,107,110,111,119,110,46,10, + 10,32,32,32,32,114,144,0,0,0,114,104,0,0,0,78, + 122,32,95,95,112,97,99,107,97,103,101,95,95,32,33,61, + 32,95,95,115,112,101,99,95,95,46,112,97,114,101,110,116, + 32,40,122,4,32,33,61,32,250,1,41,233,3,0,0,0, + 41,1,90,10,115,116,97,99,107,108,101,118,101,108,122,89, + 99,97,110,39,116,32,114,101,115,111,108,118,101,32,112,97, + 99,107,97,103,101,32,102,114,111,109,32,95,95,115,112,101, + 99,95,95,32,111,114,32,95,95,112,97,99,107,97,103,101, + 95,95,44,32,102,97,108,108,105,110,103,32,98,97,99,107, + 32,111,110,32,95,95,110,97,109,101,95,95,32,97,110,100, + 32,95,95,112,97,116,104,95,95,114,1,0,0,0,114,140, + 0,0,0,114,127,0,0,0,114,22,0,0,0,41,6,114, + 34,0,0,0,114,129,0,0,0,114,191,0,0,0,114,192, + 0,0,0,114,193,0,0,0,114,128,0,0,0,41,3,218, + 7,103,108,111,98,97,108,115,114,185,0,0,0,114,94,0, + 0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0, + 0,218,17,95,99,97,108,99,95,95,95,112,97,99,107,97, + 103,101,95,95,32,4,0,0,115,38,0,0,0,0,7,10, + 1,10,1,8,1,18,1,22,2,2,0,2,254,6,3,4, + 1,8,1,6,2,6,2,2,0,2,254,6,3,8,1,8, + 1,14,1,114,219,0,0,0,114,10,0,0,0,99,5,0, + 0,0,0,0,0,0,0,0,0,0,9,0,0,0,5,0, + 0,0,67,0,0,0,115,180,0,0,0,124,4,100,1,107, + 2,114,18,116,0,124,0,131,1,125,5,110,36,124,1,100, + 2,107,9,114,30,124,1,110,2,105,0,125,6,116,1,124, + 6,131,1,125,7,116,0,124,0,124,7,124,4,131,3,125, + 5,124,3,115,150,124,4,100,1,107,2,114,84,116,0,124, + 0,160,2,100,3,161,1,100,1,25,0,131,1,83,0,124, + 0,115,92,124,5,83,0,116,3,124,0,131,1,116,3,124, + 0,160,2,100,3,161,1,100,1,25,0,131,1,24,0,125, + 8,116,4,106,5,124,5,106,6,100,2,116,3,124,5,106, + 6,131,1,124,8,24,0,133,2,25,0,25,0,83,0,110, + 26,116,7,124,5,100,4,131,2,114,172,116,8,124,5,124, + 3,116,0,131,3,83,0,124,5,83,0,100,2,83,0,41, + 5,97,215,1,0,0,73,109,112,111,114,116,32,97,32,109, + 111,100,117,108,101,46,10,10,32,32,32,32,84,104,101,32, + 39,103,108,111,98,97,108,115,39,32,97,114,103,117,109,101, + 110,116,32,105,115,32,117,115,101,100,32,116,111,32,105,110, + 102,101,114,32,119,104,101,114,101,32,116,104,101,32,105,109, + 112,111,114,116,32,105,115,32,111,99,99,117,114,114,105,110, + 103,32,102,114,111,109,10,32,32,32,32,116,111,32,104,97, + 110,100,108,101,32,114,101,108,97,116,105,118,101,32,105,109, + 112,111,114,116,115,46,32,84,104,101,32,39,108,111,99,97, + 108,115,39,32,97,114,103,117,109,101,110,116,32,105,115,32, + 105,103,110,111,114,101,100,46,32,84,104,101,10,32,32,32, + 32,39,102,114,111,109,108,105,115,116,39,32,97,114,103,117, + 109,101,110,116,32,115,112,101,99,105,102,105,101,115,32,119, + 104,97,116,32,115,104,111,117,108,100,32,101,120,105,115,116, + 32,97,115,32,97,116,116,114,105,98,117,116,101,115,32,111, + 110,32,116,104,101,32,109,111,100,117,108,101,10,32,32,32, + 32,98,101,105,110,103,32,105,109,112,111,114,116,101,100,32, + 40,101,46,103,46,32,96,96,102,114,111,109,32,109,111,100, + 117,108,101,32,105,109,112,111,114,116,32,60,102,114,111,109, + 108,105,115,116,62,96,96,41,46,32,32,84,104,101,32,39, + 108,101,118,101,108,39,10,32,32,32,32,97,114,103,117,109, + 101,110,116,32,114,101,112,114,101,115,101,110,116,115,32,116, + 104,101,32,112,97,99,107,97,103,101,32,108,111,99,97,116, + 105,111,110,32,116,111,32,105,109,112,111,114,116,32,102,114, + 111,109,32,105,110,32,97,32,114,101,108,97,116,105,118,101, + 10,32,32,32,32,105,109,112,111,114,116,32,40,101,46,103, + 46,32,96,96,102,114,111,109,32,46,46,112,107,103,32,105, + 109,112,111,114,116,32,109,111,100,96,96,32,119,111,117,108, + 100,32,104,97,118,101,32,97,32,39,108,101,118,101,108,39, + 32,111,102,32,50,41,46,10,10,32,32,32,32,114,22,0, + 0,0,78,114,127,0,0,0,114,140,0,0,0,41,9,114, + 208,0,0,0,114,219,0,0,0,218,9,112,97,114,116,105, + 116,105,111,110,114,184,0,0,0,114,15,0,0,0,114,91, + 0,0,0,114,1,0,0,0,114,4,0,0,0,114,213,0, + 0,0,41,9,114,17,0,0,0,114,218,0,0,0,218,6, + 108,111,99,97,108,115,114,214,0,0,0,114,186,0,0,0, + 114,95,0,0,0,90,8,103,108,111,98,97,108,115,95,114, + 185,0,0,0,90,7,99,117,116,95,111,102,102,114,10,0, + 0,0,114,10,0,0,0,114,11,0,0,0,218,10,95,95, + 105,109,112,111,114,116,95,95,59,4,0,0,115,30,0,0, + 0,0,11,8,1,10,2,16,1,8,1,12,1,4,3,8, + 1,18,1,4,1,4,4,26,3,32,1,10,1,12,2,114, + 222,0,0,0,99,1,0,0,0,0,0,0,0,0,0,0, + 0,2,0,0,0,3,0,0,0,67,0,0,0,115,38,0, + 0,0,116,0,160,1,124,0,161,1,125,1,124,1,100,0, + 107,8,114,30,116,2,100,1,124,0,23,0,131,1,130,1, + 116,3,124,1,131,1,83,0,41,2,78,122,25,110,111,32, + 98,117,105,108,116,45,105,110,32,109,111,100,117,108,101,32, + 110,97,109,101,100,32,41,4,114,159,0,0,0,114,166,0, + 0,0,114,78,0,0,0,114,158,0,0,0,41,2,114,17, + 0,0,0,114,94,0,0,0,114,10,0,0,0,114,10,0, + 0,0,114,11,0,0,0,218,18,95,98,117,105,108,116,105, + 110,95,102,114,111,109,95,110,97,109,101,96,4,0,0,115, + 8,0,0,0,0,1,10,1,8,1,12,1,114,223,0,0, + 0,99,2,0,0,0,0,0,0,0,0,0,0,0,10,0, + 0,0,5,0,0,0,67,0,0,0,115,166,0,0,0,124, + 1,97,0,124,0,97,1,116,2,116,1,131,1,125,2,116, + 1,106,3,160,4,161,0,68,0,93,72,92,2,125,3,125, + 4,116,5,124,4,124,2,131,2,114,26,124,3,116,1,106, + 6,107,6,114,60,116,7,125,5,110,18,116,0,160,8,124, + 3,161,1,114,26,116,9,125,5,110,2,113,26,116,10,124, + 4,124,5,131,2,125,6,116,11,124,6,124,4,131,2,1, + 0,113,26,116,1,106,3,116,12,25,0,125,7,100,1,68, + 0,93,46,125,8,124,8,116,1,106,3,107,7,114,138,116, + 13,124,8,131,1,125,9,110,10,116,1,106,3,124,8,25, + 0,125,9,116,14,124,7,124,8,124,9,131,3,1,0,113, + 114,100,2,83,0,41,3,122,250,83,101,116,117,112,32,105, + 109,112,111,114,116,108,105,98,32,98,121,32,105,109,112,111, + 114,116,105,110,103,32,110,101,101,100,101,100,32,98,117,105, + 108,116,45,105,110,32,109,111,100,117,108,101,115,32,97,110, + 100,32,105,110,106,101,99,116,105,110,103,32,116,104,101,109, + 10,32,32,32,32,105,110,116,111,32,116,104,101,32,103,108, + 111,98,97,108,32,110,97,109,101,115,112,97,99,101,46,10, + 10,32,32,32,32,65,115,32,115,121,115,32,105,115,32,110, + 101,101,100,101,100,32,102,111,114,32,115,121,115,46,109,111, + 100,117,108,101,115,32,97,99,99,101,115,115,32,97,110,100, + 32,95,105,109,112,32,105,115,32,110,101,101,100,101,100,32, + 116,111,32,108,111,97,100,32,98,117,105,108,116,45,105,110, + 10,32,32,32,32,109,111,100,117,108,101,115,44,32,116,104, + 111,115,101,32,116,119,111,32,109,111,100,117,108,101,115,32, + 109,117,115,116,32,98,101,32,101,120,112,108,105,99,105,116, + 108,121,32,112,97,115,115,101,100,32,105,110,46,10,10,32, + 32,32,32,41,3,114,23,0,0,0,114,191,0,0,0,114, + 63,0,0,0,78,41,15,114,56,0,0,0,114,15,0,0, + 0,114,14,0,0,0,114,91,0,0,0,218,5,105,116,101, + 109,115,114,195,0,0,0,114,77,0,0,0,114,159,0,0, + 0,114,87,0,0,0,114,173,0,0,0,114,141,0,0,0, + 114,147,0,0,0,114,1,0,0,0,114,223,0,0,0,114, + 5,0,0,0,41,10,218,10,115,121,115,95,109,111,100,117, + 108,101,218,11,95,105,109,112,95,109,111,100,117,108,101,90, + 11,109,111,100,117,108,101,95,116,121,112,101,114,17,0,0, + 0,114,95,0,0,0,114,108,0,0,0,114,94,0,0,0, + 90,11,115,101,108,102,95,109,111,100,117,108,101,90,12,98, + 117,105,108,116,105,110,95,110,97,109,101,90,14,98,117,105, + 108,116,105,110,95,109,111,100,117,108,101,114,10,0,0,0, + 114,10,0,0,0,114,11,0,0,0,218,6,95,115,101,116, + 117,112,103,4,0,0,115,36,0,0,0,0,9,4,1,4, + 3,8,1,18,1,10,1,10,1,6,1,10,1,6,2,2, + 1,10,1,12,3,10,1,8,1,10,1,10,2,10,1,114, + 227,0,0,0,99,2,0,0,0,0,0,0,0,0,0,0, + 0,2,0,0,0,3,0,0,0,67,0,0,0,115,38,0, + 0,0,116,0,124,0,124,1,131,2,1,0,116,1,106,2, + 160,3,116,4,161,1,1,0,116,1,106,2,160,3,116,5, + 161,1,1,0,100,1,83,0,41,2,122,48,73,110,115,116, + 97,108,108,32,105,109,112,111,114,116,101,114,115,32,102,111, + 114,32,98,117,105,108,116,105,110,32,97,110,100,32,102,114, + 111,122,101,110,32,109,111,100,117,108,101,115,78,41,6,114, + 227,0,0,0,114,15,0,0,0,114,190,0,0,0,114,118, + 0,0,0,114,159,0,0,0,114,173,0,0,0,41,2,114, + 225,0,0,0,114,226,0,0,0,114,10,0,0,0,114,10, + 0,0,0,114,11,0,0,0,218,8,95,105,110,115,116,97, + 108,108,138,4,0,0,115,6,0,0,0,0,2,10,2,12, + 1,114,228,0,0,0,99,0,0,0,0,0,0,0,0,0, + 0,0,0,1,0,0,0,4,0,0,0,67,0,0,0,115, + 32,0,0,0,100,1,100,2,108,0,125,0,124,0,97,1, + 124,0,160,2,116,3,106,4,116,5,25,0,161,1,1,0, + 100,2,83,0,41,3,122,57,73,110,115,116,97,108,108,32, + 105,109,112,111,114,116,101,114,115,32,116,104,97,116,32,114, + 101,113,117,105,114,101,32,101,120,116,101,114,110,97,108,32, + 102,105,108,101,115,121,115,116,101,109,32,97,99,99,101,115, + 115,114,22,0,0,0,78,41,6,218,26,95,102,114,111,122, + 101,110,95,105,109,112,111,114,116,108,105,98,95,101,120,116, + 101,114,110,97,108,114,125,0,0,0,114,228,0,0,0,114, + 15,0,0,0,114,91,0,0,0,114,1,0,0,0,41,1, + 114,229,0,0,0,114,10,0,0,0,114,10,0,0,0,114, + 11,0,0,0,218,27,95,105,110,115,116,97,108,108,95,101, + 120,116,101,114,110,97,108,95,105,109,112,111,114,116,101,114, + 115,146,4,0,0,115,6,0,0,0,0,3,8,1,4,1, + 114,230,0,0,0,41,2,78,78,41,1,78,41,2,78,114, + 22,0,0,0,41,4,78,78,114,10,0,0,0,114,22,0, + 0,0,41,50,114,3,0,0,0,114,125,0,0,0,114,12, + 0,0,0,114,18,0,0,0,114,58,0,0,0,114,33,0, + 0,0,114,42,0,0,0,114,19,0,0,0,114,20,0,0, + 0,114,48,0,0,0,114,49,0,0,0,114,52,0,0,0, + 114,64,0,0,0,114,66,0,0,0,114,75,0,0,0,114, + 85,0,0,0,114,89,0,0,0,114,96,0,0,0,114,110, + 0,0,0,114,111,0,0,0,114,90,0,0,0,114,141,0, + 0,0,114,147,0,0,0,114,151,0,0,0,114,106,0,0, + 0,114,92,0,0,0,114,157,0,0,0,114,158,0,0,0, + 114,93,0,0,0,114,159,0,0,0,114,173,0,0,0,114, + 178,0,0,0,114,187,0,0,0,114,189,0,0,0,114,194, + 0,0,0,114,200,0,0,0,90,15,95,69,82,82,95,77, + 83,71,95,80,82,69,70,73,88,114,202,0,0,0,114,205, + 0,0,0,218,6,111,98,106,101,99,116,114,206,0,0,0, + 114,207,0,0,0,114,208,0,0,0,114,213,0,0,0,114, + 219,0,0,0,114,222,0,0,0,114,223,0,0,0,114,227, + 0,0,0,114,228,0,0,0,114,230,0,0,0,114,10,0, + 0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0, + 0,218,8,60,109,111,100,117,108,101,62,1,0,0,0,115, + 94,0,0,0,4,24,4,2,8,8,8,8,4,2,4,3, + 16,4,14,68,14,21,14,16,8,37,8,17,8,11,14,8, + 8,11,8,12,8,16,8,36,14,101,16,26,10,45,14,72, + 8,17,8,17,8,30,8,37,8,42,8,15,14,75,14,79, + 14,13,8,9,8,9,10,47,8,16,4,1,8,2,8,27, + 6,3,8,16,10,15,14,37,8,27,10,37,8,7,8,35, + 8,8, }; From webhook-mailer at python.org Mon Dec 30 06:50:27 2019 From: webhook-mailer at python.org (Andrew Svetlov) Date: Mon, 30 Dec 2019 11:50:27 -0000 Subject: [Python-checkins] bpo-34790: Implement deprecation of passing coroutines to asyncio.wait() (GH-16977) Message-ID: https://github.com/python/cpython/commit/89aa7f0ede1a11c020e83f24394593c577a61509 commit: 89aa7f0ede1a11c020e83f24394593c577a61509 branch: master author: Kyle Stanley committer: Andrew Svetlov date: 2019-12-30T13:50:19+02:00 summary: bpo-34790: Implement deprecation of passing coroutines to asyncio.wait() (GH-16977) files: M Doc/whatsnew/3.9.rst M Lib/asyncio/tasks.py M Lib/test/test_asyncio/test_tasks.py diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index b315604af5110..ff0fc24f317d4 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -290,6 +290,9 @@ Deprecated predicable behavior. (Contributed by Serhiy Storchaka in :issue:`38371`.) +* The explicit passing of coroutine objects to :func:`asyncio.wait` has been + deprecated and will be removed in version 3.11. + (Contributed by Yury Selivanov and Kyle Stanley in :issue:`34790`.) Removed ======= diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index 894d28eb107ac..717837d856843 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -424,6 +424,12 @@ def create_task(coro, *, name=None): "and scheduled for removal in Python 3.10.", DeprecationWarning, stacklevel=2) + if any(coroutines.iscoroutine(f) for f in set(fs)): + warnings.warn("The explicit passing of coroutine objects to " + "asyncio.wait() is deprecated since Python 3.8, and " + "scheduled for removal in Python 3.11.", + DeprecationWarning, stacklevel=2) + fs = {ensure_future(f, loop=loop) for f in set(fs)} return await _wait(fs, timeout, return_when, loop) diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index dde84b84b103e..68f3b8cce9f65 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -979,12 +979,12 @@ def test_wait_duplicate_coroutines(self): def coro(s): return s c = coro('test') - - task =self.new_task( + task = self.new_task( self.loop, asyncio.wait([c, c, coro('spam')])) - done, pending = self.loop.run_until_complete(task) + with self.assertWarns(DeprecationWarning): + done, pending = self.loop.run_until_complete(task) self.assertFalse(pending) self.assertEqual(set(f.result() for f in done), {'test', 'spam'}) @@ -1346,7 +1346,9 @@ def gen(): futs = list(asyncio.as_completed(fs, loop=loop)) self.assertEqual(len(futs), 2) waiter = asyncio.wait(futs) - done, pending = loop.run_until_complete(waiter) + # Deprecation from passing coros in futs to asyncio.wait() + with self.assertWarns(DeprecationWarning): + done, pending = loop.run_until_complete(waiter) self.assertEqual(set(f.result() for f in done), {'a', 'b'}) def test_as_completed_duplicate_coroutines(self): @@ -1751,7 +1753,8 @@ def test_yield_wait_does_not_shield_cancel(self): async def outer(): nonlocal proof - d, p = await asyncio.wait([inner()]) + with self.assertWarns(DeprecationWarning): + d, p = await asyncio.wait([inner()]) proof += 100 f = asyncio.ensure_future(outer(), loop=self.loop) @@ -3307,6 +3310,17 @@ def test_loop_argument_is_deprecated_in_wait_for(self): self.loop.run_until_complete( asyncio.wait_for(coroutine_function(), 0.01, loop=self.loop)) + def test_coro_is_deprecated_in_wait(self): + # Remove test when passing coros to asyncio.wait() is removed in 3.11 + with self.assertWarns(DeprecationWarning): + self.loop.run_until_complete( + asyncio.wait([coroutine_function()])) + + task = self.loop.create_task(coroutine_function()) + with self.assertWarns(DeprecationWarning): + self.loop.run_until_complete( + asyncio.wait([task, coroutine_function()])) + class CompatibilityTests(test_utils.TestCase): # Tests for checking a bridge between old-styled coroutines From webhook-mailer at python.org Mon Dec 30 11:02:21 2019 From: webhook-mailer at python.org (Ivan Levkivskyi) Date: Mon, 30 Dec 2019 16:02:21 -0000 Subject: [Python-checkins] bpo-39019: Implement missing __class_getitem__ for subprocess classes (GH-17558) Message-ID: https://github.com/python/cpython/commit/4dc5a9df59837446ec1dc5b7a0e6ce95ae5b5cec commit: 4dc5a9df59837446ec1dc5b7a0e6ce95ae5b5cec branch: master author: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> committer: Ivan Levkivskyi date: 2019-12-30T16:02:04Z summary: bpo-39019: Implement missing __class_getitem__ for subprocess classes (GH-17558) files: A Misc/NEWS.d/next/Library/2019-12-10-21-03-34.bpo-39019.i8RpMZ.rst M Lib/subprocess.py M Lib/test/test_subprocess.py diff --git a/Lib/subprocess.py b/Lib/subprocess.py index ba6f1983a5a22..30f0d1be154c4 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -446,6 +446,19 @@ def __repr__(self): args.append('stderr={!r}'.format(self.stderr)) return "{}({})".format(type(self).__name__, ', '.join(args)) + def __class_getitem__(cls, type): + """Provide minimal support for using this class as generic + (for example in type annotations). + + See PEP 484 and PEP 560 for more details. For example, + `CompletedProcess[bytes]` is a valid expression at runtime + (type argument `bytes` indicates the type used for stdout). + Note, no type checking happens at runtime, but a static type + checker can be used. + """ + return cls + + def check_returncode(self): """Raise CalledProcessError if the exit code is non-zero.""" if self.returncode: @@ -987,6 +1000,17 @@ def __repr__(self): obj_repr = obj_repr[:76] + "...>" return obj_repr + def __class_getitem__(cls, type): + """Provide minimal support for using this class as generic + (for example in type annotations). + + See PEP 484 and PEP 560 for more details. For example, `Popen[bytes]` + is a valid expression at runtime (type argument `bytes` indicates the + type used for stdout). Note, no type checking happens at runtime, but + a static type checker can be used. + """ + return cls + @property def universal_newlines(self): # universal_newlines as retained as an alias of text_mode for API diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 87322c6406bd5..2073fd146177a 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -1435,6 +1435,9 @@ def test_file_not_found_with_bad_cwd(self): subprocess.Popen(['exit', '0'], cwd='/some/nonexistent/directory') self.assertEqual(c.exception.filename, '/some/nonexistent/directory') + def test_class_getitems(self): + self.assertIs(subprocess.Popen[bytes], subprocess.Popen) + self.assertIs(subprocess.CompletedProcess[str], subprocess.CompletedProcess) class RunFuncTestCase(BaseTestCase): def run_python(self, code, **kwargs): diff --git a/Misc/NEWS.d/next/Library/2019-12-10-21-03-34.bpo-39019.i8RpMZ.rst b/Misc/NEWS.d/next/Library/2019-12-10-21-03-34.bpo-39019.i8RpMZ.rst new file mode 100644 index 0000000000000..b64a56edc50c7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-10-21-03-34.bpo-39019.i8RpMZ.rst @@ -0,0 +1,2 @@ +Implement dummy ``__class_getitem__`` for ``subprocess.Popen``, +``subprocess.CompletedProcess`` From webhook-mailer at python.org Mon Dec 30 11:08:16 2019 From: webhook-mailer at python.org (Ivan Levkivskyi) Date: Mon, 30 Dec 2019 16:08:16 -0000 Subject: [Python-checkins] bpo-39019: Implement missing __class_getitem__ for SpooledTemporaryFile (GH-17560) Message-ID: https://github.com/python/cpython/commit/09c482fad11c769be38b2449f1056e264b701bb7 commit: 09c482fad11c769be38b2449f1056e264b701bb7 branch: master author: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> committer: Ivan Levkivskyi date: 2019-12-30T16:08:08Z summary: bpo-39019: Implement missing __class_getitem__ for SpooledTemporaryFile (GH-17560) files: A Misc/NEWS.d/next/Library/2019-12-10-21-11-05.bpo-39019.YIlgZ7.rst M Lib/tempfile.py M Lib/test/test_tempfile.py diff --git a/Lib/tempfile.py b/Lib/tempfile.py index 62875540f8b92..448163f04380d 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -643,6 +643,18 @@ def __init__(self, max_size=0, mode='w+b', buffering=-1, 'encoding': encoding, 'newline': newline, 'dir': dir, 'errors': errors} + def __class_getitem__(cls, type): + """Provide minimal support for using this class as generic + (for example in type annotations). + + See PEP 484 and PEP 560 for more details. For example, + `SpooledTemporaryFile[str]` is a valid expression at runtime (type + argument `str` indicates whether the file is open in bytes or text + mode). Note, no type checking happens at runtime, but a static type + checker can be used. + """ + return cls + def _check(self, file): if self._rolled: return max_size = self._max_size diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py index 232c5dae10fdf..5fe9506b0b7ba 100644 --- a/Lib/test/test_tempfile.py +++ b/Lib/test/test_tempfile.py @@ -1229,6 +1229,9 @@ def test_truncate_with_size_parameter(self): self.assertTrue(f._rolled) self.assertEqual(os.fstat(f.fileno()).st_size, 20) + def test_class_getitem(self): + self.assertIs(tempfile.SpooledTemporaryFile[bytes], + tempfile.SpooledTemporaryFile) if tempfile.NamedTemporaryFile is not tempfile.TemporaryFile: diff --git a/Misc/NEWS.d/next/Library/2019-12-10-21-11-05.bpo-39019.YIlgZ7.rst b/Misc/NEWS.d/next/Library/2019-12-10-21-11-05.bpo-39019.YIlgZ7.rst new file mode 100644 index 0000000000000..7bdf291950f82 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-10-21-11-05.bpo-39019.YIlgZ7.rst @@ -0,0 +1 @@ +Implement dummy ``__class_getitem__`` for :class:`tempfile.SpooledTemporaryFile`. From webhook-mailer at python.org Mon Dec 30 14:33:07 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Mon, 30 Dec 2019 19:33:07 -0000 Subject: [Python-checkins] bpo-38610: Fix possible crashes in several list methods (GH-17022) Message-ID: https://github.com/python/cpython/commit/d9e561d23d994e3ed15f4fcbd7ee5c8fe50f190b commit: d9e561d23d994e3ed15f4fcbd7ee5c8fe50f190b branch: master author: Zackery Spytz committer: Pablo Galindo date: 2019-12-30T19:32:58Z summary: bpo-38610: Fix possible crashes in several list methods (GH-17022) Hold strong references to list elements while calling PyObject_RichCompareBool(). files: A Misc/NEWS.d/next/Core and Builtins/2019-10-31-14-30-39.bpo-38610.fHdVMS.rst M Lib/test/test_list.py M Objects/listobject.c diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py index fe4b2cd365f08..b10a833033f15 100644 --- a/Lib/test/test_list.py +++ b/Lib/test/test_list.py @@ -171,5 +171,31 @@ def test_preallocation(self): self.assertEqual(iter_size, sys.getsizeof(list([0] * 10))) self.assertEqual(iter_size, sys.getsizeof(list(range(10)))) + def test_count_index_remove_crashes(self): + # bpo-38610: The count(), index(), and remove() methods were not + # holding strong references to list elements while calling + # PyObject_RichCompareBool(). + class X: + def __eq__(self, other): + lst.clear() + return NotImplemented + + lst = [X()] + with self.assertRaises(ValueError): + lst.index(lst) + + class L(list): + def __eq__(self, other): + str(other) + return NotImplemented + + lst = L([X()]) + lst.count(lst) + + lst = L([X()]) + with self.assertRaises(ValueError): + lst.remove(lst) + + if __name__ == "__main__": unittest.main() diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-10-31-14-30-39.bpo-38610.fHdVMS.rst b/Misc/NEWS.d/next/Core and Builtins/2019-10-31-14-30-39.bpo-38610.fHdVMS.rst new file mode 100644 index 0000000000000..0ee63bbb40dc6 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-10-31-14-30-39.bpo-38610.fHdVMS.rst @@ -0,0 +1,2 @@ +Fix possible crashes in several list methods by holding strong references to +list elements when calling :c:func:`PyObject_RichCompareBool`. diff --git a/Objects/listobject.c b/Objects/listobject.c index 645742b801fac..86690f764b7db 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2553,7 +2553,10 @@ list_index_impl(PyListObject *self, PyObject *value, Py_ssize_t start, stop = 0; } for (i = start; i < stop && i < Py_SIZE(self); i++) { - int cmp = PyObject_RichCompareBool(self->ob_item[i], value, Py_EQ); + PyObject *obj = self->ob_item[i]; + Py_INCREF(obj); + int cmp = PyObject_RichCompareBool(obj, value, Py_EQ); + Py_DECREF(obj); if (cmp > 0) return PyLong_FromSsize_t(i); else if (cmp < 0) @@ -2580,7 +2583,10 @@ list_count(PyListObject *self, PyObject *value) Py_ssize_t i; for (i = 0; i < Py_SIZE(self); i++) { - int cmp = PyObject_RichCompareBool(self->ob_item[i], value, Py_EQ); + PyObject *obj = self->ob_item[i]; + Py_INCREF(obj); + int cmp = PyObject_RichCompareBool(obj, value, Py_EQ); + Py_DECREF(obj); if (cmp > 0) count++; else if (cmp < 0) @@ -2607,7 +2613,10 @@ list_remove(PyListObject *self, PyObject *value) Py_ssize_t i; for (i = 0; i < Py_SIZE(self); i++) { - int cmp = PyObject_RichCompareBool(self->ob_item[i], value, Py_EQ); + PyObject *obj = self->ob_item[i]; + Py_INCREF(obj); + int cmp = PyObject_RichCompareBool(obj, value, Py_EQ); + Py_DECREF(obj); if (cmp > 0) { if (list_ass_slice(self, i, i+1, (PyObject *)NULL) == 0) From webhook-mailer at python.org Mon Dec 30 14:51:14 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 30 Dec 2019 19:51:14 -0000 Subject: [Python-checkins] bpo-38610: Fix possible crashes in several list methods (GH-17022) Message-ID: https://github.com/python/cpython/commit/fcaf14cd9179bb48850f8f81ce8d5cee28129745 commit: fcaf14cd9179bb48850f8f81ce8d5cee28129745 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-30T11:51:06-08:00 summary: bpo-38610: Fix possible crashes in several list methods (GH-17022) Hold strong references to list elements while calling PyObject_RichCompareBool(). (cherry picked from commit d9e561d23d994e3ed15f4fcbd7ee5c8fe50f190b) Co-authored-by: Zackery Spytz files: A Misc/NEWS.d/next/Core and Builtins/2019-10-31-14-30-39.bpo-38610.fHdVMS.rst M Lib/test/test_list.py M Objects/listobject.c diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py index c5002b12732c9..55c6eede527c2 100644 --- a/Lib/test/test_list.py +++ b/Lib/test/test_list.py @@ -166,5 +166,31 @@ def test_preallocation(self): self.assertEqual(iter_size, sys.getsizeof(list([0] * 10))) self.assertEqual(iter_size, sys.getsizeof(list(range(10)))) + def test_count_index_remove_crashes(self): + # bpo-38610: The count(), index(), and remove() methods were not + # holding strong references to list elements while calling + # PyObject_RichCompareBool(). + class X: + def __eq__(self, other): + lst.clear() + return NotImplemented + + lst = [X()] + with self.assertRaises(ValueError): + lst.index(lst) + + class L(list): + def __eq__(self, other): + str(other) + return NotImplemented + + lst = L([X()]) + lst.count(lst) + + lst = L([X()]) + with self.assertRaises(ValueError): + lst.remove(lst) + + if __name__ == "__main__": unittest.main() diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-10-31-14-30-39.bpo-38610.fHdVMS.rst b/Misc/NEWS.d/next/Core and Builtins/2019-10-31-14-30-39.bpo-38610.fHdVMS.rst new file mode 100644 index 0000000000000..0ee63bbb40dc6 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-10-31-14-30-39.bpo-38610.fHdVMS.rst @@ -0,0 +1,2 @@ +Fix possible crashes in several list methods by holding strong references to +list elements when calling :c:func:`PyObject_RichCompareBool`. diff --git a/Objects/listobject.c b/Objects/listobject.c index f8bf45e5f8cda..8b52fa5ef267a 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2555,7 +2555,10 @@ list_index_impl(PyListObject *self, PyObject *value, Py_ssize_t start, stop = 0; } for (i = start; i < stop && i < Py_SIZE(self); i++) { - int cmp = PyObject_RichCompareBool(self->ob_item[i], value, Py_EQ); + PyObject *obj = self->ob_item[i]; + Py_INCREF(obj); + int cmp = PyObject_RichCompareBool(obj, value, Py_EQ); + Py_DECREF(obj); if (cmp > 0) return PyLong_FromSsize_t(i); else if (cmp < 0) @@ -2582,7 +2585,10 @@ list_count(PyListObject *self, PyObject *value) Py_ssize_t i; for (i = 0; i < Py_SIZE(self); i++) { - int cmp = PyObject_RichCompareBool(self->ob_item[i], value, Py_EQ); + PyObject *obj = self->ob_item[i]; + Py_INCREF(obj); + int cmp = PyObject_RichCompareBool(obj, value, Py_EQ); + Py_DECREF(obj); if (cmp > 0) count++; else if (cmp < 0) @@ -2609,7 +2615,10 @@ list_remove(PyListObject *self, PyObject *value) Py_ssize_t i; for (i = 0; i < Py_SIZE(self); i++) { - int cmp = PyObject_RichCompareBool(self->ob_item[i], value, Py_EQ); + PyObject *obj = self->ob_item[i]; + Py_INCREF(obj); + int cmp = PyObject_RichCompareBool(obj, value, Py_EQ); + Py_DECREF(obj); if (cmp > 0) { if (list_ass_slice(self, i, i+1, (PyObject *)NULL) == 0) From webhook-mailer at python.org Mon Dec 30 14:58:35 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Mon, 30 Dec 2019 19:58:35 -0000 Subject: [Python-checkins] [3.7] bpo-38610: Fix possible crashes in several list methods (GH-17022) (GH-17759) Message-ID: https://github.com/python/cpython/commit/296d45ec10fb55532bc3fac2311a3f91299ecf59 commit: 296d45ec10fb55532bc3fac2311a3f91299ecf59 branch: 3.7 author: Pablo Galindo committer: GitHub date: 2019-12-30T19:58:31Z summary: [3.7] bpo-38610: Fix possible crashes in several list methods (GH-17022) (GH-17759) Hold strong references to list elements while calling PyObject_RichCompareBool().. (cherry picked from commit d9e561d23d994e3ed15f4fcbd7ee5c8fe50f190b) Co-authored-by: Zackery Spytz Co-authored-by: Zackery Spytz files: A Misc/NEWS.d/next/Core and Builtins/2019-10-31-14-30-39.bpo-38610.fHdVMS.rst M Lib/test/test_list.py M Objects/listobject.c diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py index 5078d4bc1ced5..ece4598e4eaf2 100644 --- a/Lib/test/test_list.py +++ b/Lib/test/test_list.py @@ -162,5 +162,31 @@ class L(list): pass with self.assertRaises(TypeError): (3,) + L([1,2]) + def test_count_index_remove_crashes(self): + # bpo-38610: The count(), index(), and remove() methods were not + # holding strong references to list elements while calling + # PyObject_RichCompareBool(). + class X: + def __eq__(self, other): + lst.clear() + return NotImplemented + + lst = [X()] + with self.assertRaises(ValueError): + lst.index(lst) + + class L(list): + def __eq__(self, other): + str(other) + return NotImplemented + + lst = L([X()]) + lst.count(lst) + + lst = L([X()]) + with self.assertRaises(ValueError): + lst.remove(lst) + + if __name__ == "__main__": unittest.main() diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-10-31-14-30-39.bpo-38610.fHdVMS.rst b/Misc/NEWS.d/next/Core and Builtins/2019-10-31-14-30-39.bpo-38610.fHdVMS.rst new file mode 100644 index 0000000000000..0ee63bbb40dc6 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-10-31-14-30-39.bpo-38610.fHdVMS.rst @@ -0,0 +1,2 @@ +Fix possible crashes in several list methods by holding strong references to +list elements when calling :c:func:`PyObject_RichCompareBool`. diff --git a/Objects/listobject.c b/Objects/listobject.c index c5e7553efcf90..724f25677a16e 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2506,7 +2506,10 @@ list_index_impl(PyListObject *self, PyObject *value, Py_ssize_t start, stop = 0; } for (i = start; i < stop && i < Py_SIZE(self); i++) { - int cmp = PyObject_RichCompareBool(self->ob_item[i], value, Py_EQ); + PyObject *obj = self->ob_item[i]; + Py_INCREF(obj); + int cmp = PyObject_RichCompareBool(obj, value, Py_EQ); + Py_DECREF(obj); if (cmp > 0) return PyLong_FromSsize_t(i); else if (cmp < 0) @@ -2533,7 +2536,10 @@ list_count(PyListObject *self, PyObject *value) Py_ssize_t i; for (i = 0; i < Py_SIZE(self); i++) { - int cmp = PyObject_RichCompareBool(self->ob_item[i], value, Py_EQ); + PyObject *obj = self->ob_item[i]; + Py_INCREF(obj); + int cmp = PyObject_RichCompareBool(obj, value, Py_EQ); + Py_DECREF(obj); if (cmp > 0) count++; else if (cmp < 0) @@ -2560,7 +2566,10 @@ list_remove(PyListObject *self, PyObject *value) Py_ssize_t i; for (i = 0; i < Py_SIZE(self); i++) { - int cmp = PyObject_RichCompareBool(self->ob_item[i], value, Py_EQ); + PyObject *obj = self->ob_item[i]; + Py_INCREF(obj); + int cmp = PyObject_RichCompareBool(obj, value, Py_EQ); + Py_DECREF(obj); if (cmp > 0) { if (list_ass_slice(self, i, i+1, (PyObject *)NULL) == 0) From webhook-mailer at python.org Mon Dec 30 17:16:52 2019 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Mon, 30 Dec 2019 22:16:52 -0000 Subject: [Python-checkins] bpo-34118: memoryview, range, and tuple are classes (GH-17761) Message-ID: https://github.com/python/cpython/commit/ee9ff05ec22ecd47dbffdd361967ccd55963dad2 commit: ee9ff05ec22ecd47dbffdd361967ccd55963dad2 branch: master author: Terry Jan Reedy committer: GitHub date: 2019-12-30T17:16:43-05:00 summary: bpo-34118: memoryview, range, and tuple are classes (GH-17761) Tag memoryview, range, and tuple as classes, the same as list, etcetera, in the library manual built-in functions list. files: A Misc/NEWS.d/next/IDLE/2019-12-30-16-44-07.bpo-34118.FaNW0a.rst M Doc/library/functions.rst diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 5abf978c88eec..dc3391ffe882d 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -952,7 +952,7 @@ are always available. They are listed here in alphabetical order. .. _func-memoryview: -.. function:: memoryview(obj) +.. class:: memoryview(obj) :noindex: Return a "memory view" object created from the given argument. See @@ -1408,7 +1408,7 @@ are always available. They are listed here in alphabetical order. .. _func-range: -.. function:: range(stop) +.. class:: range(stop) range(start, stop[, step]) :noindex: @@ -1655,7 +1655,7 @@ are always available. They are listed here in alphabetical order. .. _func-tuple: -.. function:: tuple([iterable]) +.. class:: tuple([iterable]) :noindex: Rather than being a function, :class:`tuple` is actually an immutable diff --git a/Misc/NEWS.d/next/IDLE/2019-12-30-16-44-07.bpo-34118.FaNW0a.rst b/Misc/NEWS.d/next/IDLE/2019-12-30-16-44-07.bpo-34118.FaNW0a.rst new file mode 100644 index 0000000000000..ce95eb5482f2b --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2019-12-30-16-44-07.bpo-34118.FaNW0a.rst @@ -0,0 +1,2 @@ +Tag memoryview, range, and tuple as classes, the same as list, etcetera, in +the library manual built-in functions list. From webhook-mailer at python.org Mon Dec 30 17:22:28 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 30 Dec 2019 22:22:28 -0000 Subject: [Python-checkins] bpo-34118: memoryview, range, and tuple are classes (GH-17761) Message-ID: https://github.com/python/cpython/commit/c9c17cc933dcffb9ed7f03e3f791d8cfd7acc54a commit: c9c17cc933dcffb9ed7f03e3f791d8cfd7acc54a branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-30T14:22:24-08:00 summary: bpo-34118: memoryview, range, and tuple are classes (GH-17761) Tag memoryview, range, and tuple as classes, the same as list, etcetera, in the library manual built-in functions list. (cherry picked from commit ee9ff05ec22ecd47dbffdd361967ccd55963dad2) Co-authored-by: Terry Jan Reedy files: A Misc/NEWS.d/next/IDLE/2019-12-30-16-44-07.bpo-34118.FaNW0a.rst M Doc/library/functions.rst diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 72d82ae87e6f9..d4553e045d603 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -886,7 +886,7 @@ are always available. They are listed here in alphabetical order. .. _func-memoryview: -.. function:: memoryview(obj) +.. class:: memoryview(obj) :noindex: Return a "memory view" object created from the given argument. See @@ -1319,7 +1319,7 @@ are always available. They are listed here in alphabetical order. .. _func-range: -.. function:: range(stop) +.. class:: range(stop) range(start, stop[, step]) :noindex: @@ -1556,7 +1556,7 @@ are always available. They are listed here in alphabetical order. .. _func-tuple: -.. function:: tuple([iterable]) +.. class:: tuple([iterable]) :noindex: Rather than being a function, :class:`tuple` is actually an immutable diff --git a/Misc/NEWS.d/next/IDLE/2019-12-30-16-44-07.bpo-34118.FaNW0a.rst b/Misc/NEWS.d/next/IDLE/2019-12-30-16-44-07.bpo-34118.FaNW0a.rst new file mode 100644 index 0000000000000..ce95eb5482f2b --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2019-12-30-16-44-07.bpo-34118.FaNW0a.rst @@ -0,0 +1,2 @@ +Tag memoryview, range, and tuple as classes, the same as list, etcetera, in +the library manual built-in functions list. From webhook-mailer at python.org Mon Dec 30 17:24:31 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Mon, 30 Dec 2019 22:24:31 -0000 Subject: [Python-checkins] bpo-34118: memoryview, range, and tuple are classes (GH-17761) Message-ID: https://github.com/python/cpython/commit/ec941568bdb25e164a87a23cf1b8870ac047b4e3 commit: ec941568bdb25e164a87a23cf1b8870ac047b4e3 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-30T14:24:27-08:00 summary: bpo-34118: memoryview, range, and tuple are classes (GH-17761) Tag memoryview, range, and tuple as classes, the same as list, etcetera, in the library manual built-in functions list. (cherry picked from commit ee9ff05ec22ecd47dbffdd361967ccd55963dad2) Co-authored-by: Terry Jan Reedy files: A Misc/NEWS.d/next/IDLE/2019-12-30-16-44-07.bpo-34118.FaNW0a.rst M Doc/library/functions.rst diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 7968eef4fb96b..6feb26c4f25a6 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -950,7 +950,7 @@ are always available. They are listed here in alphabetical order. .. _func-memoryview: -.. function:: memoryview(obj) +.. class:: memoryview(obj) :noindex: Return a "memory view" object created from the given argument. See @@ -1412,7 +1412,7 @@ are always available. They are listed here in alphabetical order. .. _func-range: -.. function:: range(stop) +.. class:: range(stop) range(start, stop[, step]) :noindex: @@ -1659,7 +1659,7 @@ are always available. They are listed here in alphabetical order. .. _func-tuple: -.. function:: tuple([iterable]) +.. class:: tuple([iterable]) :noindex: Rather than being a function, :class:`tuple` is actually an immutable diff --git a/Misc/NEWS.d/next/IDLE/2019-12-30-16-44-07.bpo-34118.FaNW0a.rst b/Misc/NEWS.d/next/IDLE/2019-12-30-16-44-07.bpo-34118.FaNW0a.rst new file mode 100644 index 0000000000000..ce95eb5482f2b --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2019-12-30-16-44-07.bpo-34118.FaNW0a.rst @@ -0,0 +1,2 @@ +Tag memoryview, range, and tuple as classes, the same as list, etcetera, in +the library manual built-in functions list. From webhook-mailer at python.org Mon Dec 30 20:04:30 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Tue, 31 Dec 2019 01:04:30 -0000 Subject: [Python-checkins] bpo-38588: Fix possible crashes in dict and list when calling PyObject_RichCompareBool (GH-17734) Message-ID: https://github.com/python/cpython/commit/2d5bf568eaa5059402ccce9ba5a366986ba27c8a commit: 2d5bf568eaa5059402ccce9ba5a366986ba27c8a branch: master author: Dong-hee Na committer: Pablo Galindo date: 2019-12-31T01:04:22Z summary: bpo-38588: Fix possible crashes in dict and list when calling PyObject_RichCompareBool (GH-17734) Take strong references before calling PyObject_RichCompareBool to protect against the case where the object dies during the call. files: A Misc/NEWS.d/next/Core and Builtins/2019-12-29-19-13-54.bpo-38588.pgXnNS.rst M Lib/test/test_dict.py M Lib/test/test_list.py M Objects/dictobject.c M Objects/listobject.c diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py index 5b513765f7b08..de483ab552155 100644 --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -1221,7 +1221,7 @@ def test_free_after_iterating(self): support.check_free_after_iterating(self, lambda d: iter(d.items()), dict) def test_equal_operator_modifying_operand(self): - # test fix for seg fault reported in issue 27945 part 3. + # test fix for seg fault reported in bpo-27945 part 3. class X(): def __del__(self): dict_b.clear() @@ -1237,6 +1237,16 @@ def __hash__(self): dict_b = {X(): X()} self.assertTrue(dict_a == dict_b) + # test fix for seg fault reported in bpo-38588 part 1. + class Y: + def __eq__(self, other): + dict_d.clear() + return True + + dict_c = {0: Y()} + dict_d = {0: set()} + self.assertTrue(dict_c == dict_d) + def test_fromkeys_operator_modifying_dict_operand(self): # test fix for seg fault reported in issue 27945 part 4a. class X(int): diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py index b10a833033f15..6e3c4c109300e 100644 --- a/Lib/test/test_list.py +++ b/Lib/test/test_list.py @@ -163,6 +163,31 @@ class L(list): pass with self.assertRaises(TypeError): (3,) + L([1,2]) + def test_equal_operator_modifying_operand(self): + # test fix for seg fault reported in bpo-38588 part 2. + class X: + def __eq__(self,other) : + list2.clear() + return NotImplemented + + class Y: + def __eq__(self, other): + list1.clear() + return NotImplemented + + class Z: + def __eq__(self, other): + list3.clear() + return NotImplemented + + list1 = [X()] + list2 = [Y()] + self.assertTrue(list1 == list2) + + list3 = [Z()] + list4 = [1] + self.assertFalse(list3 == list4) + @cpython_only def test_preallocation(self): iterable = [0] * 10 diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-29-19-13-54.bpo-38588.pgXnNS.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-29-19-13-54.bpo-38588.pgXnNS.rst new file mode 100644 index 0000000000000..0b81085a89d25 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-29-19-13-54.bpo-38588.pgXnNS.rst @@ -0,0 +1,2 @@ +Fix possible crashes in dict and list when calling +:c:func:`PyObject_RichCompareBool`. diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 4afa19c8a0a90..87f88abbe53bd 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2777,9 +2777,11 @@ dict_equal(PyDictObject *a, PyDictObject *b) return -1; return 0; } + Py_INCREF(bval); cmp = PyObject_RichCompareBool(aval, bval, Py_EQ); Py_DECREF(key); Py_DECREF(aval); + Py_DECREF(bval); if (cmp <= 0) /* error or not equal */ return cmp; } diff --git a/Objects/listobject.c b/Objects/listobject.c index 86690f764b7db..abe2604573f95 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2662,8 +2662,15 @@ list_richcompare(PyObject *v, PyObject *w, int op) /* Search for the first index where items are different */ for (i = 0; i < Py_SIZE(vl) && i < Py_SIZE(wl); i++) { + PyObject *vitem = vl->ob_item[i]; + PyObject *witem = wl->ob_item[i]; + + Py_INCREF(vitem); + Py_INCREF(witem); int k = PyObject_RichCompareBool(vl->ob_item[i], wl->ob_item[i], Py_EQ); + Py_DECREF(vitem); + Py_DECREF(witem); if (k < 0) return NULL; if (!k) From webhook-mailer at python.org Mon Dec 30 20:58:41 2019 From: webhook-mailer at python.org (Inada Naoki) Date: Tue, 31 Dec 2019 01:58:41 -0000 Subject: [Python-checkins] bpo-38588: Optimize list comparison. (GH-17766) Message-ID: https://github.com/python/cpython/commit/dfef986f12dd92bd6434117bba0db3cbb4e65243 commit: dfef986f12dd92bd6434117bba0db3cbb4e65243 branch: master author: Inada Naoki committer: GitHub date: 2019-12-31T10:58:37+09:00 summary: bpo-38588: Optimize list comparison. (GH-17766) Mitigate performance regression of the list comparison caused by 2d5bf56. files: M Objects/listobject.c diff --git a/Objects/listobject.c b/Objects/listobject.c index abe2604573f95..bc8425cae63e1 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2664,6 +2664,9 @@ list_richcompare(PyObject *v, PyObject *w, int op) for (i = 0; i < Py_SIZE(vl) && i < Py_SIZE(wl); i++) { PyObject *vitem = vl->ob_item[i]; PyObject *witem = wl->ob_item[i]; + if (vitem == witem) { + continue; + } Py_INCREF(vitem); Py_INCREF(witem); From webhook-mailer at python.org Mon Dec 30 21:31:59 2019 From: webhook-mailer at python.org (Benjamin Peterson) Date: Tue, 31 Dec 2019 02:31:59 -0000 Subject: [Python-checkins] closes bpo-37446: resolve undefined behavior in Python/hamt.c (GH-17727) Message-ID: https://github.com/python/cpython/commit/d0c92e81aa2171228a23cb2bed36f7dab975257d commit: d0c92e81aa2171228a23cb2bed36f7dab975257d branch: master author: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> committer: Benjamin Peterson date: 2019-12-30T18:31:52-08:00 summary: closes bpo-37446: resolve undefined behavior in Python/hamt.c (GH-17727) files: M Python/hamt.c diff --git a/Python/hamt.c b/Python/hamt.c index ea659c800fc46..f5586eec5b076 100644 --- a/Python/hamt.c +++ b/Python/hamt.c @@ -1864,7 +1864,7 @@ hamt_node_array_without(PyHamtNode_Array *self, continue; } - bitmap |= 1 << i; + bitmap |= 1U << i; if (IS_BITMAP_NODE(node)) { PyHamtNode_Bitmap *child = (PyHamtNode_Bitmap *)node; From webhook-mailer at python.org Mon Dec 30 21:51:26 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 31 Dec 2019 02:51:26 -0000 Subject: [Python-checkins] closes bpo-37446: resolve undefined behavior in Python/hamt.c (GH-17727) Message-ID: https://github.com/python/cpython/commit/a278ae19b4daa1deb11e2a8eed38838027e90ece commit: a278ae19b4daa1deb11e2a8eed38838027e90ece branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-30T18:51:18-08:00 summary: closes bpo-37446: resolve undefined behavior in Python/hamt.c (GH-17727) (cherry picked from commit d0c92e81aa2171228a23cb2bed36f7dab975257d) Co-authored-by: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com> files: M Python/hamt.c diff --git a/Python/hamt.c b/Python/hamt.c index 38412596a37b0..5efc8d7fabe8e 100644 --- a/Python/hamt.c +++ b/Python/hamt.c @@ -1864,7 +1864,7 @@ hamt_node_array_without(PyHamtNode_Array *self, continue; } - bitmap |= 1 << i; + bitmap |= 1U << i; if (IS_BITMAP_NODE(node)) { PyHamtNode_Bitmap *child = (PyHamtNode_Bitmap *)node; From webhook-mailer at python.org Mon Dec 30 23:15:14 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Tue, 31 Dec 2019 04:15:14 -0000 Subject: [Python-checkins] =?utf-8?q?=5B3=2E7=5D_bpo-38588=3A_Fix_possibl?= =?utf-8?q?e_crashes_in_dict_and_list_when_calling_P=E2=80=A6_=28GH-17765?= =?utf-8?q?=29?= Message-ID: https://github.com/python/cpython/commit/53f11ba7b1498133ce3ff8173d5ae2e0182a3603 commit: 53f11ba7b1498133ce3ff8173d5ae2e0182a3603 branch: 3.7 author: Dong-hee Na committer: Pablo Galindo date: 2019-12-31T04:15:10Z summary: [3.7] bpo-38588: Fix possible crashes in dict and list when calling P? (GH-17765) * [3.7] bpo-38588: Fix possible crashes in dict and list when calling PyObject_RichCompareBool (GH-17734) Take strong references before calling PyObject_RichCompareBool to protect against the case where the object dies during the call.. (cherry picked from commit 2d5bf568eaa5059402ccce9ba5a366986ba27c8a) Co-authored-by: Dong-hee Na * methane's suggestion methane's suggestion Co-Authored-By: Inada Naoki Co-authored-by: Inada Naoki files: A Misc/NEWS.d/next/Core and Builtins/2019-12-29-19-13-54.bpo-38588.pgXnNS.rst M Lib/test/test_dict.py M Lib/test/test_list.py M Objects/dictobject.c M Objects/listobject.c diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py index 90c0a3131a78e..ea9dcb6a81c6a 100644 --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -1138,7 +1138,7 @@ def test_free_after_iterating(self): support.check_free_after_iterating(self, lambda d: iter(d.items()), dict) def test_equal_operator_modifying_operand(self): - # test fix for seg fault reported in issue 27945 part 3. + # test fix for seg fault reported in bpo-27945 part 3. class X(): def __del__(self): dict_b.clear() @@ -1154,6 +1154,16 @@ def __hash__(self): dict_b = {X(): X()} self.assertTrue(dict_a == dict_b) + # test fix for seg fault reported in bpo-38588 part 1. + class Y: + def __eq__(self, other): + dict_d.clear() + return True + + dict_c = {0: Y()} + dict_d = {0: set()} + self.assertTrue(dict_c == dict_d) + def test_fromkeys_operator_modifying_dict_operand(self): # test fix for seg fault reported in issue 27945 part 4a. class X(int): diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py index ece4598e4eaf2..553ac8c1cef81 100644 --- a/Lib/test/test_list.py +++ b/Lib/test/test_list.py @@ -162,6 +162,31 @@ class L(list): pass with self.assertRaises(TypeError): (3,) + L([1,2]) + def test_equal_operator_modifying_operand(self): + # test fix for seg fault reported in bpo-38588 part 2. + class X: + def __eq__(self,other) : + list2.clear() + return NotImplemented + + class Y: + def __eq__(self, other): + list1.clear() + return NotImplemented + + class Z: + def __eq__(self, other): + list3.clear() + return NotImplemented + + list1 = [X()] + list2 = [Y()] + self.assertTrue(list1 == list2) + + list3 = [Z()] + list4 = [1] + self.assertFalse(list3 == list4) + def test_count_index_remove_crashes(self): # bpo-38610: The count(), index(), and remove() methods were not # holding strong references to list elements while calling diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-29-19-13-54.bpo-38588.pgXnNS.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-29-19-13-54.bpo-38588.pgXnNS.rst new file mode 100644 index 0000000000000..0b81085a89d25 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-29-19-13-54.bpo-38588.pgXnNS.rst @@ -0,0 +1,2 @@ +Fix possible crashes in dict and list when calling +:c:func:`PyObject_RichCompareBool`. diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 9437448849007..3f00002a8991a 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2677,9 +2677,11 @@ dict_equal(PyDictObject *a, PyDictObject *b) return -1; return 0; } + Py_INCREF(bval); cmp = PyObject_RichCompareBool(aval, bval, Py_EQ); Py_DECREF(key); Py_DECREF(aval); + Py_DECREF(bval); if (cmp <= 0) /* error or not equal */ return cmp; } diff --git a/Objects/listobject.c b/Objects/listobject.c index 724f25677a16e..d622da9e0dbf3 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2615,8 +2615,18 @@ list_richcompare(PyObject *v, PyObject *w, int op) /* Search for the first index where items are different */ for (i = 0; i < Py_SIZE(vl) && i < Py_SIZE(wl); i++) { + PyObject *vitem = vl->ob_item[i]; + PyObject *witem = wl->ob_item[i]; + if (vitem == witem) { + continue; + } + + Py_INCREF(vitem); + Py_INCREF(witem); int k = PyObject_RichCompareBool(vl->ob_item[i], wl->ob_item[i], Py_EQ); + Py_DECREF(vitem); + Py_DECREF(witem); if (k < 0) return NULL; if (!k) From webhook-mailer at python.org Mon Dec 30 23:15:41 2019 From: webhook-mailer at python.org (Pablo Galindo) Date: Tue, 31 Dec 2019 04:15:41 -0000 Subject: [Python-checkins] =?utf-8?q?=5B3=2E8=5D_bpo-38588=3A_Fix_possibl?= =?utf-8?q?e_crashes_in_dict_and_list_when_calling_P=E2=80=A6_=28GH-17764?= =?utf-8?q?=29?= Message-ID: https://github.com/python/cpython/commit/2ee87913dde038436a25f1db13ee3fddd2bcc983 commit: 2ee87913dde038436a25f1db13ee3fddd2bcc983 branch: 3.8 author: Dong-hee Na committer: Pablo Galindo date: 2019-12-31T04:15:36Z summary: [3.8] bpo-38588: Fix possible crashes in dict and list when calling P? (GH-17764) * [3.8] bpo-38588: Fix possible crashes in dict and list when calling PyObject_RichCompareBool (GH-17734) Take strong references before calling PyObject_RichCompareBool to protect against the case where the object dies during the call. (cherry picked from commit 2d5bf568eaa5059402ccce9ba5a366986ba27c8a) Co-authored-by: Dong-hee Na * Update Objects/listobject.c @methane's suggestion Co-Authored-By: Inada Naoki Co-authored-by: Inada Naoki files: A Misc/NEWS.d/next/Core and Builtins/2019-12-29-19-13-54.bpo-38588.pgXnNS.rst M Lib/test/test_dict.py M Lib/test/test_list.py M Objects/dictobject.c M Objects/listobject.c diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py index 5b513765f7b08..de483ab552155 100644 --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -1221,7 +1221,7 @@ def test_free_after_iterating(self): support.check_free_after_iterating(self, lambda d: iter(d.items()), dict) def test_equal_operator_modifying_operand(self): - # test fix for seg fault reported in issue 27945 part 3. + # test fix for seg fault reported in bpo-27945 part 3. class X(): def __del__(self): dict_b.clear() @@ -1237,6 +1237,16 @@ def __hash__(self): dict_b = {X(): X()} self.assertTrue(dict_a == dict_b) + # test fix for seg fault reported in bpo-38588 part 1. + class Y: + def __eq__(self, other): + dict_d.clear() + return True + + dict_c = {0: Y()} + dict_d = {0: set()} + self.assertTrue(dict_c == dict_d) + def test_fromkeys_operator_modifying_dict_operand(self): # test fix for seg fault reported in issue 27945 part 4a. class X(int): diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py index 55c6eede527c2..f4dcced9c167f 100644 --- a/Lib/test/test_list.py +++ b/Lib/test/test_list.py @@ -158,6 +158,31 @@ class L(list): pass with self.assertRaises(TypeError): (3,) + L([1,2]) + def test_equal_operator_modifying_operand(self): + # test fix for seg fault reported in bpo-38588 part 2. + class X: + def __eq__(self,other) : + list2.clear() + return NotImplemented + + class Y: + def __eq__(self, other): + list1.clear() + return NotImplemented + + class Z: + def __eq__(self, other): + list3.clear() + return NotImplemented + + list1 = [X()] + list2 = [Y()] + self.assertTrue(list1 == list2) + + list3 = [Z()] + list4 = [1] + self.assertFalse(list3 == list4) + @cpython_only def test_preallocation(self): iterable = [0] * 10 diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-29-19-13-54.bpo-38588.pgXnNS.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-29-19-13-54.bpo-38588.pgXnNS.rst new file mode 100644 index 0000000000000..0b81085a89d25 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-29-19-13-54.bpo-38588.pgXnNS.rst @@ -0,0 +1,2 @@ +Fix possible crashes in dict and list when calling +:c:func:`PyObject_RichCompareBool`. diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 76f4fefe0979f..3c56f4a515e8a 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2773,9 +2773,11 @@ dict_equal(PyDictObject *a, PyDictObject *b) return -1; return 0; } + Py_INCREF(bval); cmp = PyObject_RichCompareBool(aval, bval, Py_EQ); Py_DECREF(key); Py_DECREF(aval); + Py_DECREF(bval); if (cmp <= 0) /* error or not equal */ return cmp; } diff --git a/Objects/listobject.c b/Objects/listobject.c index 8b52fa5ef267a..d506c0817336b 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2664,8 +2664,18 @@ list_richcompare(PyObject *v, PyObject *w, int op) /* Search for the first index where items are different */ for (i = 0; i < Py_SIZE(vl) && i < Py_SIZE(wl); i++) { + PyObject *vitem = vl->ob_item[i]; + PyObject *witem = wl->ob_item[i]; + if (vitem == witem) { + continue; + } + + Py_INCREF(vitem); + Py_INCREF(witem); int k = PyObject_RichCompareBool(vl->ob_item[i], wl->ob_item[i], Py_EQ); + Py_DECREF(vitem); + Py_DECREF(witem); if (k < 0) return NULL; if (!k) From webhook-mailer at python.org Tue Dec 31 00:15:01 2019 From: webhook-mailer at python.org (Senthil Kumaran) Date: Tue, 31 Dec 2019 05:15:01 -0000 Subject: [Python-checkins] [2.7] bpo-27973 - Fix for urllib.urlretrieve() failing on second ftp transfer (#1040) Message-ID: https://github.com/python/cpython/commit/f82e59ac4020a64c262a925230a8eb190b652e87 commit: f82e59ac4020a64c262a925230a8eb190b652e87 branch: 2.7 author: Senthil Kumaran committer: GitHub date: 2019-12-30T21:14:56-08:00 summary: [2.7] bpo-27973 - Fix for urllib.urlretrieve() failing on second ftp transfer (#1040) * bpo-27973: Fix urllib.urlretrieve failing on subsequent ftp transfers from the same host. * bpo-35411: Skip test_urllibnet FTP tests on Travis CI. files: A Misc/NEWS.d/next/Library/2019-12-30-07-59-34.bpo-27973.mgWXH1.rst M Lib/test/test_urllibnet.py M Lib/urllib.py diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py index 3f2d8dcd43b0c..df118dc75d1b3 100644 --- a/Lib/test/test_urllibnet.py +++ b/Lib/test/test_urllibnet.py @@ -1,5 +1,7 @@ +import tempfile import unittest from test import test_support +from test.test_urllib2net import skip_ftp_test_on_travis import socket import urllib @@ -213,6 +215,40 @@ def test_context_argument(self): self.assertIn("Python", response.read()) +class urlopen_FTPTest(unittest.TestCase): + FTP_TEST_FILE = 'ftp://www.pythontest.net/README' + NUM_FTP_RETRIEVES = 3 + + @skip_ftp_test_on_travis + def test_multiple_ftp_retrieves(self): + + with test_support.transient_internet(self.FTP_TEST_FILE): + try: + for _ in range(self.NUM_FTP_RETRIEVES): + with tempfile.NamedTemporaryFile() as fp: + urllib.FancyURLopener().retrieve(self.FTP_TEST_FILE, fp.name) + except IOError as e: + self.fail("Failed FTP retrieve while accessing ftp url " + "multiple times.\n Error message was : %s" % e) + + @skip_ftp_test_on_travis + def test_multiple_ftp_urlopen_same_host(self): + with test_support.transient_internet(self.FTP_TEST_FILE): + ftp_fds_to_close = [] + try: + for _ in range(self.NUM_FTP_RETRIEVES): + fd = urllib.urlopen(self.FTP_TEST_FILE) + # test ftp open without closing fd as a supported scenario. + ftp_fds_to_close.append(fd) + except IOError as e: + self.fail("Failed FTP binary file open. " + "Error message was: %s" % e) + finally: + # close the open fds + for fd in ftp_fds_to_close: + fd.close() + + def test_main(): test_support.requires('network') with test_support.check_py3k_warnings( @@ -220,7 +256,8 @@ def test_main(): test_support.run_unittest(URLTimeoutTest, urlopenNetworkTests, urlretrieveNetworkTests, - urlopen_HttpsTests) + urlopen_HttpsTests, + urlopen_FTPTest) if __name__ == "__main__": test_main() diff --git a/Lib/urllib.py b/Lib/urllib.py index 156879dd0a140..87bcd94db5f05 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -934,7 +934,13 @@ def retrfile(self, file, type): return (ftpobj, retrlen) def endtransfer(self): + if not self.busy: + return self.busy = 0 + try: + self.ftp.voidresp() + except ftperrors(): + pass def close(self): self.keepalive = False diff --git a/Misc/NEWS.d/next/Library/2019-12-30-07-59-34.bpo-27973.mgWXH1.rst b/Misc/NEWS.d/next/Library/2019-12-30-07-59-34.bpo-27973.mgWXH1.rst new file mode 100644 index 0000000000000..d50f483889b3d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-12-30-07-59-34.bpo-27973.mgWXH1.rst @@ -0,0 +1,2 @@ +Fix urllib.urlretrieve failing on subsequent ftp transfers from the same +host. From webhook-mailer at python.org Tue Dec 31 07:28:26 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 31 Dec 2019 12:28:26 -0000 Subject: [Python-checkins] Minor doc fixes in urllib.parse (GH-17745) Message-ID: https://github.com/python/cpython/commit/8e1f26e4f06c43cf52afa26ce30f27d2c1129c4a commit: 8e1f26e4f06c43cf52afa26ce30f27d2c1129c4a branch: master author: ????? ?????????? committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> date: 2019-12-31T04:28:18-08:00 summary: Minor doc fixes in urllib.parse (GH-17745) files: M Doc/library/urllib.parse.rst diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst index 2d4d5a9e60969..02f0c01e224dd 100644 --- a/Doc/library/urllib.parse.rst +++ b/Doc/library/urllib.parse.rst @@ -42,8 +42,8 @@ or on combining URL components into a URL string. Parse a URL into six components, returning a 6-item :term:`named tuple`. This corresponds to the general structure of a URL: ``scheme://netloc/path;parameters?query#fragment``. - Each tuple item is a string, possibly empty. The components are not broken up in - smaller parts (for example, the network location is a single string), and % + Each tuple item is a string, possibly empty. The components are not broken up + into smaller parts (for example, the network location is a single string), and % escapes are not expanded. The delimiters as shown above are not part of the result, except for a leading slash in the *path* component, which is retained if present. For example: @@ -328,22 +328,22 @@ or on combining URL components into a URL string. .. note:: - If *url* is an absolute URL (that is, starting with ``//`` or ``scheme://``), - the *url*'s host name and/or scheme will be present in the result. For example: + If *url* is an absolute URL (that is, it starts with ``//`` or ``scheme://``), + the *url*'s hostname and/or scheme will be present in the result. For example: - .. doctest:: + .. doctest:: - >>> urljoin('http://www.cwi.nl/%7Eguido/Python.html', - ... '//www.python.org/%7Eguido') - 'http://www.python.org/%7Eguido' + >>> urljoin('http://www.cwi.nl/%7Eguido/Python.html', + ... '//www.python.org/%7Eguido') + 'http://www.python.org/%7Eguido' - If you do not want that behavior, preprocess the *url* with :func:`urlsplit` and - :func:`urlunsplit`, removing possible *scheme* and *netloc* parts. + If you do not want that behavior, preprocess the *url* with :func:`urlsplit` and + :func:`urlunsplit`, removing possible *scheme* and *netloc* parts. .. versionchanged:: 3.5 - Behaviour updated to match the semantics defined in :rfc:`3986`. + Behavior updated to match the semantics defined in :rfc:`3986`. .. function:: urldefrag(url) @@ -521,11 +521,11 @@ task isn't already covered by the URL parsing functions above. Replace special characters in *string* using the ``%xx`` escape. Letters, digits, and the characters ``'_.-~'`` are never quoted. By default, this - function is intended for quoting the path section of URL. The optional *safe* - parameter specifies additional ASCII characters that should not be quoted - --- its default value is ``'/'``. + function is intended for quoting the path section of a URL. The optional + *safe* parameter specifies additional ASCII characters that should not be + quoted --- its default value is ``'/'``. - *string* may be either a :class:`str` or a :class:`bytes`. + *string* may be either a :class:`str` or a :class:`bytes` object. .. versionchanged:: 3.7 Moved from :rfc:`2396` to :rfc:`3986` for quoting URL strings. "~" is now @@ -547,7 +547,7 @@ task isn't already covered by the URL parsing functions above. .. function:: quote_plus(string, safe='', encoding=None, errors=None) - Like :func:`quote`, but also replace spaces by plus signs, as required for + Like :func:`quote`, but also replace spaces with plus signs, as required for quoting HTML form values when building up a query string to go into a URL. Plus signs in the original string are escaped unless they are included in *safe*. It also does not have *safe* default to ``'/'``. @@ -566,12 +566,12 @@ task isn't already covered by the URL parsing functions above. .. function:: unquote(string, encoding='utf-8', errors='replace') - Replace ``%xx`` escapes by their single-character equivalent. + Replace ``%xx`` escapes with their single-character equivalent. The optional *encoding* and *errors* parameters specify how to decode percent-encoded sequences into Unicode characters, as accepted by the :meth:`bytes.decode` method. - *string* may be either a :class:`str` or a :class:`bytes`. + *string* may be either a :class:`str` or a :class:`bytes` object. *encoding* defaults to ``'utf-8'``. *errors* defaults to ``'replace'``, meaning invalid sequences are replaced @@ -587,8 +587,8 @@ task isn't already covered by the URL parsing functions above. .. function:: unquote_plus(string, encoding='utf-8', errors='replace') - Like :func:`unquote`, but also replace plus signs by spaces, as required for - unquoting HTML form values. + Like :func:`unquote`, but also replace plus signs with spaces, as required + for unquoting HTML form values. *string* must be a :class:`str`. @@ -597,10 +597,10 @@ task isn't already covered by the URL parsing functions above. .. function:: unquote_to_bytes(string) - Replace ``%xx`` escapes by their single-octet equivalent, and return a + Replace ``%xx`` escapes with their single-octet equivalent, and return a :class:`bytes` object. - *string* may be either a :class:`str` or a :class:`bytes`. + *string* may be either a :class:`str` or a :class:`bytes` object. If it is a :class:`str`, unescaped non-ASCII characters in *string* are encoded into UTF-8 bytes. @@ -631,7 +631,7 @@ task isn't already covered by the URL parsing functions above. When a sequence of two-element tuples is used as the *query* argument, the first element of each tuple is a key and the second is a value. The value element in itself can be a sequence and in that case, if - the optional parameter *doseq* is evaluates to ``True``, individual + the optional parameter *doseq* evaluates to ``True``, individual ``key=value`` pairs separated by ``'&'`` are generated for each element of the value sequence for the key. The order of parameters in the encoded string will match the order of parameter tuples in the sequence. @@ -643,11 +643,12 @@ task isn't already covered by the URL parsing functions above. To reverse this encoding process, :func:`parse_qs` and :func:`parse_qsl` are provided in this module to parse query strings into Python data structures. - Refer to :ref:`urllib examples ` to find out how urlencode - method can be used for generating query string for a URL or data for POST. + Refer to :ref:`urllib examples ` to find out how the + :func:`urllib.parse.urlencode` method can be used for generating the query + string of a URL or data for a POST request. .. versionchanged:: 3.2 - Query parameter supports bytes and string objects. + *query* supports bytes and string objects. .. versionadded:: 3.5 *quote_via* parameter. From webhook-mailer at python.org Tue Dec 31 13:34:29 2019 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Tue, 31 Dec 2019 18:34:29 -0000 Subject: [Python-checkins] Fix idlelib README typo. (GH-17770) Message-ID: https://github.com/python/cpython/commit/ba82ee894cf0f6ec9e9f6a313c870ffd2db377e6 commit: ba82ee894cf0f6ec9e9f6a313c870ffd2db377e6 branch: master author: Terry Jan Reedy committer: GitHub date: 2019-12-31T13:34:22-05:00 summary: Fix idlelib README typo. (GH-17770) files: M Lib/idlelib/README.txt diff --git a/Lib/idlelib/README.txt b/Lib/idlelib/README.txt index 48a1f4a425c9e..bc3d978f43f1a 100644 --- a/Lib/idlelib/README.txt +++ b/Lib/idlelib/README.txt @@ -90,7 +90,7 @@ Configuration config-extensions.def # Defaults for extensions config-highlight.def # Defaults for colorizing config-keys.def # Defaults for key bindings -config-main.def # Defai;ts fpr font and geneal +config-main.def # Defaults for font and general tabs Text ---- From webhook-mailer at python.org Tue Dec 31 13:51:28 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 31 Dec 2019 18:51:28 -0000 Subject: [Python-checkins] Fix idlelib README typo. (GH-17770) Message-ID: https://github.com/python/cpython/commit/88938e415f4160dbccc3a6826394cf0d460e273c commit: 88938e415f4160dbccc3a6826394cf0d460e273c branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-31T10:51:23-08:00 summary: Fix idlelib README typo. (GH-17770) (cherry picked from commit ba82ee894cf0f6ec9e9f6a313c870ffd2db377e6) Co-authored-by: Terry Jan Reedy files: M Lib/idlelib/README.txt diff --git a/Lib/idlelib/README.txt b/Lib/idlelib/README.txt index 48a1f4a425c9e..bc3d978f43f1a 100644 --- a/Lib/idlelib/README.txt +++ b/Lib/idlelib/README.txt @@ -90,7 +90,7 @@ Configuration config-extensions.def # Defaults for extensions config-highlight.def # Defaults for colorizing config-keys.def # Defaults for key bindings -config-main.def # Defai;ts fpr font and geneal +config-main.def # Defaults for font and general tabs Text ---- From webhook-mailer at python.org Tue Dec 31 13:52:44 2019 From: webhook-mailer at python.org (Miss Islington (bot)) Date: Tue, 31 Dec 2019 18:52:44 -0000 Subject: [Python-checkins] Fix idlelib README typo. (GH-17770) Message-ID: https://github.com/python/cpython/commit/302b35f82bdaac817966638e2630b452f4123958 commit: 302b35f82bdaac817966638e2630b452f4123958 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: GitHub date: 2019-12-31T10:52:38-08:00 summary: Fix idlelib README typo. (GH-17770) (cherry picked from commit ba82ee894cf0f6ec9e9f6a313c870ffd2db377e6) Co-authored-by: Terry Jan Reedy files: M Lib/idlelib/README.txt diff --git a/Lib/idlelib/README.txt b/Lib/idlelib/README.txt index 48a1f4a425c9e..bc3d978f43f1a 100644 --- a/Lib/idlelib/README.txt +++ b/Lib/idlelib/README.txt @@ -90,7 +90,7 @@ Configuration config-extensions.def # Defaults for extensions config-highlight.def # Defaults for colorizing config-keys.def # Defaults for key bindings -config-main.def # Defai;ts fpr font and geneal +config-main.def # Defaults for font and general tabs Text ---- From webhook-mailer at python.org Tue Dec 31 21:41:07 2019 From: webhook-mailer at python.org (Raymond Hettinger) Date: Wed, 01 Jan 2020 02:41:07 -0000 Subject: [Python-checkins] bpo-39176: Improve error message for 'named assignment' (GH-17777) Message-ID: https://github.com/python/cpython/commit/37143a8e3b2e9245d52f4ddebbdd1c6121c96884 commit: 37143a8e3b2e9245d52f4ddebbdd1c6121c96884 branch: master author: Ned Batchelder committer: Raymond Hettinger date: 2019-12-31T20:40:58-06:00 summary: bpo-39176: Improve error message for 'named assignment' (GH-17777) files: M Lib/test/test_named_expressions.py M Lib/test/test_syntax.py M Python/ast.c diff --git a/Lib/test/test_named_expressions.py b/Lib/test/test_named_expressions.py index 01e26c8dfaf25..3ae557f78d273 100644 --- a/Lib/test/test_named_expressions.py +++ b/Lib/test/test_named_expressions.py @@ -32,7 +32,7 @@ def test_named_expression_invalid_04(self): def test_named_expression_invalid_06(self): code = """((a, b) := (1, 2))""" - with self.assertRaisesRegex(SyntaxError, "cannot use named assignment with tuple"): + with self.assertRaisesRegex(SyntaxError, "cannot use assignment expressions with tuple"): exec(code, {}, {}) def test_named_expression_invalid_07(self): @@ -90,7 +90,7 @@ def test_named_expression_invalid_15(self): code = """(lambda: x := 1)""" with self.assertRaisesRegex(SyntaxError, - "cannot use named assignment with lambda"): + "cannot use assignment expressions with lambda"): exec(code, {}, {}) def test_named_expression_invalid_16(self): diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index 3829746f1799a..128c4da143841 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -45,7 +45,7 @@ >>> (True := 1) Traceback (most recent call last): -SyntaxError: cannot use named assignment with True +SyntaxError: cannot use assignment expressions with True >>> obj.__debug__ = 1 Traceback (most recent call last): diff --git a/Python/ast.c b/Python/ast.c index e4e9b837d3409..d5113f8e413f4 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -1955,7 +1955,7 @@ ast_for_namedexpr(struct compiling *c, const node *n) if (target->kind != Name_kind) { const char *expr_name = get_expr_name(target); if (expr_name != NULL) { - ast_error(c, n, "cannot use named assignment with %s", expr_name); + ast_error(c, n, "cannot use assignment expressions with %s", expr_name); } return NULL; } From webhook-mailer at python.org Tue Dec 31 22:28:12 2019 From: webhook-mailer at python.org (Raymond Hettinger) Date: Wed, 01 Jan 2020 03:28:12 -0000 Subject: [Python-checkins] bpo-39176: Improve error message for 'named assignment' (GH-17777) (GH-17778) Message-ID: https://github.com/python/cpython/commit/6c004955aceb8a0cd8e14afbc608ebfdf7c8aa4a commit: 6c004955aceb8a0cd8e14afbc608ebfdf7c8aa4a branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Raymond Hettinger date: 2019-12-31T21:28:08-06:00 summary: bpo-39176: Improve error message for 'named assignment' (GH-17777) (GH-17778) (cherry picked from commit 37143a8e3b2e9245d52f4ddebbdd1c6121c96884) Co-authored-by: Ned Batchelder Co-authored-by: Ned Batchelder files: M Lib/test/test_named_expressions.py M Lib/test/test_syntax.py M Python/ast.c diff --git a/Lib/test/test_named_expressions.py b/Lib/test/test_named_expressions.py index 01e26c8dfaf25..3ae557f78d273 100644 --- a/Lib/test/test_named_expressions.py +++ b/Lib/test/test_named_expressions.py @@ -32,7 +32,7 @@ def test_named_expression_invalid_04(self): def test_named_expression_invalid_06(self): code = """((a, b) := (1, 2))""" - with self.assertRaisesRegex(SyntaxError, "cannot use named assignment with tuple"): + with self.assertRaisesRegex(SyntaxError, "cannot use assignment expressions with tuple"): exec(code, {}, {}) def test_named_expression_invalid_07(self): @@ -90,7 +90,7 @@ def test_named_expression_invalid_15(self): code = """(lambda: x := 1)""" with self.assertRaisesRegex(SyntaxError, - "cannot use named assignment with lambda"): + "cannot use assignment expressions with lambda"): exec(code, {}, {}) def test_named_expression_invalid_16(self): diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index 3829746f1799a..128c4da143841 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -45,7 +45,7 @@ >>> (True := 1) Traceback (most recent call last): -SyntaxError: cannot use named assignment with True +SyntaxError: cannot use assignment expressions with True >>> obj.__debug__ = 1 Traceback (most recent call last): diff --git a/Python/ast.c b/Python/ast.c index e70ab519e66e1..6cf71ce7bb810 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -1955,7 +1955,7 @@ ast_for_namedexpr(struct compiling *c, const node *n) if (target->kind != Name_kind) { const char *expr_name = get_expr_name(target); if (expr_name != NULL) { - ast_error(c, n, "cannot use named assignment with %s", expr_name); + ast_error(c, n, "cannot use assignment expressions with %s", expr_name); } return NULL; } From webhook-mailer at python.org Mon Dec 9 09:21:15 2019 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Mon, 09 Dec 2019 14:21:15 -0000 Subject: [Python-checkins] (no subject) Message-ID: To: python-checkins at python.org Subject: bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR (#17311) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 https://github.com/python/cpython/commit/ab513a38c98695f271e448fe2cb7c5e39eea= aaaf commit: ab513a38c98695f271e448fe2cb7c5e39eeaaaaf branch: master author: Kyle Stanley committer: =C5=81ukasz Langa date: 2019-12-09T15:21:10+01:00 summary: bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR (#1731= 1) files: A Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst M Doc/library/asyncio-eventloop.rst M Lib/asyncio/base_events.py M Lib/test/test_asyncio/test_base_events.py diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloo= p.rst index 240d814f13dea..d9b1cf7a8d835 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -473,6 +473,21 @@ Opening network connections reuse_address=3DNone, reuse_port=3DNone, \ allow_broadcast=3DNone, sock=3DNone) =20 + .. note:: + The parameter *reuse_address* is no longer supported, as using + :py:data:`~sockets.SO_REUSEADDR` poses a significant security concern = for + UDP. Explicitly passing ``reuse_address=3DTrue`` will raise an excepti= on. + + When multiple processes with differing UIDs assign sockets to an + indentical UDP socket address with ``SO_REUSEADDR``, incoming packets = can + become randomly distributed among the sockets. + + For supported platforms, *reuse_port* can be used as a replacement for + similar functionality. With *reuse_port*, + :py:data:`~sockets.SO_REUSEPORT` is used instead, which specifically + prevents processes with differing UIDs from assigning sockets to the s= ame + socket address. + Create a datagram connection. =20 The socket family can be either :py:data:`~socket.AF_INET`, @@ -501,11 +516,6 @@ Opening network connections resolution. If given, these should all be integers from the corresponding :mod:`socket` module constants. =20 - * *reuse_address* tells the kernel to reuse a local socket in - ``TIME_WAIT`` state, without waiting for its natural timeout to - expire. If not specified will automatically be set to ``True`` on - Unix. - * *reuse_port* tells the kernel to allow this endpoint to be bound to the same port as other existing endpoints are bound to, so long as they all set this flag when being created. This option is not supported on Windo= ws @@ -527,6 +537,10 @@ Opening network connections The *family*, *proto*, *flags*, *reuse_address*, *reuse_port, *allow_broadcast*, and *sock* parameters were added. =20 + .. versionchanged:: 3.8.1 + The *reuse_address* parameter is no longer supported due to security + concerns. + .. versionchanged:: 3.8 Added support for Windows. =20 diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 031071281b38f..adcdec171b07a 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -66,6 +66,10 @@ # Maximum timeout passed to select to avoid OS limitations MAXIMUM_SELECT_TIMEOUT =3D 24 * 3600 =20 +# Used for deprecation and removal of `loop.create_datagram_endpoint()`'s +# *reuse_address* parameter +_unset =3D object() + =20 def _format_handle(handle): cb =3D handle._callback @@ -1230,7 +1234,7 @@ def _check_sendfile_params(self, sock, file, offset, co= unt): async def create_datagram_endpoint(self, protocol_factory, local_addr=3DNone, remote_addr=3DNone= , *, family=3D0, proto=3D0, flags=3D0, - reuse_address=3DNone, reuse_port=3DNo= ne, + reuse_address=3D_unset, reuse_port=3D= None, allow_broadcast=3DNone, sock=3DNone): """Create datagram connection.""" if sock is not None: @@ -1239,7 +1243,7 @@ def _check_sendfile_params(self, sock, file, offset, co= unt): f'A UDP Socket was expected, got {sock!r}') if (local_addr or remote_addr or family or proto or flags or - reuse_address or reuse_port or allow_broadcast): + reuse_port or allow_broadcast): # show the problematic kwargs in exception msg opts =3D dict(local_addr=3Dlocal_addr, remote_addr=3Dremote_= addr, family=3Dfamily, proto=3Dproto, flags=3Dflags, @@ -1306,8 +1310,18 @@ def _check_sendfile_params(self, sock, file, offset, c= ount): =20 exceptions =3D [] =20 - if reuse_address is None: - reuse_address =3D os.name =3D=3D 'posix' and sys.platform != =3D 'cygwin' + # bpo-37228 + if reuse_address is not _unset: + if reuse_address: + raise ValueError("Passing `reuse_address=3DTrue` is no " + "longer supported, as the usage of " + "SO_REUSEPORT in UDP poses a significan= t " + "security concern.") + else: + warnings.warn("The *reuse_address* parameter has been " + "deprecated as of 3.5.10 and is scheduled " + "for removal in 3.11.", DeprecationWarning, + stacklevel=3D2) =20 for ((family, proto), (local_address, remote_address)) in addr_pairs_info: @@ -1316,9 +1330,6 @@ def _check_sendfile_params(self, sock, file, offset, co= unt): try: sock =3D socket.socket( family=3Dfamily, type=3Dsocket.SOCK_DGRAM, proto=3Dp= roto) - if reuse_address: - sock.setsockopt( - socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) if reuse_port: _set_reuseport(sock) if allow_broadcast: diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asynci= o/test_base_events.py index ca99d5c6c0ac8..6c0f00dc93647 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -1738,10 +1738,6 @@ class FakeSock: MyDatagramProto, flags=3D1, sock=3DFakeSock()) self.assertRaises(ValueError, self.loop.run_until_complete, fut) =20 - fut =3D self.loop.create_datagram_endpoint( - MyDatagramProto, reuse_address=3DTrue, sock=3DFakeSock()) - self.assertRaises(ValueError, self.loop.run_until_complete, fut) - fut =3D self.loop.create_datagram_endpoint( MyDatagramProto, reuse_port=3DTrue, sock=3DFakeSock()) self.assertRaises(ValueError, self.loop.run_until_complete, fut) @@ -1752,7 +1748,6 @@ class FakeSock: =20 def test_create_datagram_endpoint_sockopts(self): # Socket options should not be applied unless asked for. - # SO_REUSEADDR defaults to on for UNIX. # SO_REUSEPORT is not available on all platforms. =20 coro =3D self.loop.create_datagram_endpoint( @@ -1761,18 +1756,8 @@ def test_create_datagram_endpoint_sockopts(self): transport, protocol =3D self.loop.run_until_complete(coro) sock =3D transport.get_extra_info('socket') =20 - reuse_address_default_on =3D ( - os.name =3D=3D 'posix' and sys.platform !=3D 'cygwin') reuseport_supported =3D hasattr(socket, 'SO_REUSEPORT') =20 - if reuse_address_default_on: - self.assertTrue( - sock.getsockopt( - socket.SOL_SOCKET, socket.SO_REUSEADDR)) - else: - self.assertFalse( - sock.getsockopt( - socket.SOL_SOCKET, socket.SO_REUSEADDR)) if reuseport_supported: self.assertFalse( sock.getsockopt( @@ -1788,13 +1773,12 @@ def test_create_datagram_endpoint_sockopts(self): coro =3D self.loop.create_datagram_endpoint( lambda: MyDatagramProto(create_future=3DTrue, loop=3Dself.loop), local_addr=3D('127.0.0.1', 0), - reuse_address=3DTrue, reuse_port=3Dreuseport_supported, allow_broadcast=3DTrue) transport, protocol =3D self.loop.run_until_complete(coro) sock =3D transport.get_extra_info('socket') =20 - self.assertTrue( + self.assertFalse( sock.getsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR)) if reuseport_supported: @@ -1809,6 +1793,29 @@ def test_create_datagram_endpoint_sockopts(self): self.loop.run_until_complete(protocol.done) self.assertEqual('CLOSED', protocol.state) =20 + def test_create_datagram_endpoint_reuse_address_error(self): + # bpo-37228: Ensure that explicit passing of `reuse_address=3DTrue` + # raises an error, as it is not safe to use SO_REUSEADDR when using = UDP + + coro =3D self.loop.create_datagram_endpoint( + lambda: MyDatagramProto(create_future=3DTrue, loop=3Dself.loop), + local_addr=3D('127.0.0.1', 0), + reuse_address=3DTrue) + + with self.assertRaises(ValueError): + self.loop.run_until_complete(coro) + + def test_create_datagram_endpoint_reuse_address_warning(self): + # bpo-37228: Deprecate *reuse_address* parameter + + coro =3D self.loop.create_datagram_endpoint( + lambda: MyDatagramProto(create_future=3DTrue, loop=3Dself.loop), + local_addr=3D('127.0.0.1', 0), + reuse_address=3DFalse) + + with self.assertWarns(DeprecationWarning): + self.loop.run_until_complete(coro) + @patch_socket def test_create_datagram_endpoint_nosoreuseport(self, m_socket): del m_socket.SO_REUSEPORT diff --git a/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.r= st b/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst new file mode 100644 index 0000000000000..0fafb63402e46 --- /dev/null +++ b/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst @@ -0,0 +1,6 @@ +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is +because of the behavior of ``SO_REUSEADDR`` in UDP. For more details, see the +documentation for ``loop.create_datagram_endpoint()``. +(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in +:issue:`37228`.) From webhook-mailer at python.org Mon Dec 9 09:39:59 2019 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Mon, 09 Dec 2019 14:39:59 -0000 Subject: [Python-checkins] (no subject) Message-ID: To: python-checkins at python.org Subject: bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR (GH-17311) (#17529) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 https://github.com/python/cpython/commit/79c29742a8ba96fc933efe34e55e90537b3e= b780 commit: 79c29742a8ba96fc933efe34e55e90537b3eb780 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.co= m> committer: =C5=81ukasz Langa date: 2019-12-09T15:39:54+01:00 summary: bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR (GH-17= 311) (#17529) (cherry picked from commit ab513a38c98695f271e448fe2cb7c5e39eeaaaaf) Co-authored-by: Kyle Stanley files: A Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst M Doc/library/asyncio-eventloop.rst M Lib/asyncio/base_events.py M Lib/test/test_asyncio/test_base_events.py diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloo= p.rst index 1f4f0b6e75b9e..ecd69fd669f1a 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -461,6 +461,21 @@ Opening network connections reuse_address=3DNone, reuse_port=3DNone, \ allow_broadcast=3DNone, sock=3DNone) =20 + .. note:: + The parameter *reuse_address* is no longer supported, as using + :py:data:`~sockets.SO_REUSEADDR` poses a significant security concern = for + UDP. Explicitly passing ``reuse_address=3DTrue`` will raise an excepti= on. + + When multiple processes with differing UIDs assign sockets to an + indentical UDP socket address with ``SO_REUSEADDR``, incoming packets = can + become randomly distributed among the sockets. + + For supported platforms, *reuse_port* can be used as a replacement for + similar functionality. With *reuse_port*, + :py:data:`~sockets.SO_REUSEPORT` is used instead, which specifically + prevents processes with differing UIDs from assigning sockets to the s= ame + socket address. + Create a datagram connection. =20 The socket family can be either :py:data:`~socket.AF_INET`, @@ -489,11 +504,6 @@ Opening network connections resolution. If given, these should all be integers from the corresponding :mod:`socket` module constants. =20 - * *reuse_address* tells the kernel to reuse a local socket in - ``TIME_WAIT`` state, without waiting for its natural timeout to - expire. If not specified will automatically be set to ``True`` on - Unix. - * *reuse_port* tells the kernel to allow this endpoint to be bound to the same port as other existing endpoints are bound to, so long as they all set this flag when being created. This option is not supported on Windo= ws @@ -515,6 +525,10 @@ Opening network connections The *family*, *proto*, *flags*, *reuse_address*, *reuse_port, *allow_broadcast*, and *sock* parameters were added. =20 + .. versionchanged:: 3.8.1 + The *reuse_address* parameter is no longer supported due to security + concerns. + .. versionchanged:: 3.8 Added support for Windows. =20 diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 14b80bdda9c03..bfd40115bed38 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -66,6 +66,10 @@ # Maximum timeout passed to select to avoid OS limitations MAXIMUM_SELECT_TIMEOUT =3D 24 * 3600 =20 +# Used for deprecation and removal of `loop.create_datagram_endpoint()`'s +# *reuse_address* parameter +_unset =3D object() + =20 def _format_handle(handle): cb =3D handle._callback @@ -1201,7 +1205,7 @@ def _check_sendfile_params(self, sock, file, offset, co= unt): async def create_datagram_endpoint(self, protocol_factory, local_addr=3DNone, remote_addr=3DNone= , *, family=3D0, proto=3D0, flags=3D0, - reuse_address=3DNone, reuse_port=3DNo= ne, + reuse_address=3D_unset, reuse_port=3D= None, allow_broadcast=3DNone, sock=3DNone): """Create datagram connection.""" if sock is not None: @@ -1210,7 +1214,7 @@ def _check_sendfile_params(self, sock, file, offset, co= unt): f'A UDP Socket was expected, got {sock!r}') if (local_addr or remote_addr or family or proto or flags or - reuse_address or reuse_port or allow_broadcast): + reuse_port or allow_broadcast): # show the problematic kwargs in exception msg opts =3D dict(local_addr=3Dlocal_addr, remote_addr=3Dremote_= addr, family=3Dfamily, proto=3Dproto, flags=3Dflags, @@ -1277,8 +1281,18 @@ def _check_sendfile_params(self, sock, file, offset, c= ount): =20 exceptions =3D [] =20 - if reuse_address is None: - reuse_address =3D os.name =3D=3D 'posix' and sys.platform != =3D 'cygwin' + # bpo-37228 + if reuse_address is not _unset: + if reuse_address: + raise ValueError("Passing `reuse_address=3DTrue` is no " + "longer supported, as the usage of " + "SO_REUSEPORT in UDP poses a significan= t " + "security concern.") + else: + warnings.warn("The *reuse_address* parameter has been " + "deprecated as of 3.5.10 and is scheduled " + "for removal in 3.11.", DeprecationWarning, + stacklevel=3D2) =20 for ((family, proto), (local_address, remote_address)) in addr_pairs_info: @@ -1287,9 +1301,6 @@ def _check_sendfile_params(self, sock, file, offset, co= unt): try: sock =3D socket.socket( family=3Dfamily, type=3Dsocket.SOCK_DGRAM, proto=3Dp= roto) - if reuse_address: - sock.setsockopt( - socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) if reuse_port: _set_reuseport(sock) if allow_broadcast: diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asynci= o/test_base_events.py index 92fdaf17e2011..3a23059911211 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -1732,10 +1732,6 @@ class FakeSock: MyDatagramProto, flags=3D1, sock=3DFakeSock()) self.assertRaises(ValueError, self.loop.run_until_complete, fut) =20 - fut =3D self.loop.create_datagram_endpoint( - MyDatagramProto, reuse_address=3DTrue, sock=3DFakeSock()) - self.assertRaises(ValueError, self.loop.run_until_complete, fut) - fut =3D self.loop.create_datagram_endpoint( MyDatagramProto, reuse_port=3DTrue, sock=3DFakeSock()) self.assertRaises(ValueError, self.loop.run_until_complete, fut) @@ -1746,7 +1742,6 @@ class FakeSock: =20 def test_create_datagram_endpoint_sockopts(self): # Socket options should not be applied unless asked for. - # SO_REUSEADDR defaults to on for UNIX. # SO_REUSEPORT is not available on all platforms. =20 coro =3D self.loop.create_datagram_endpoint( @@ -1755,18 +1750,8 @@ def test_create_datagram_endpoint_sockopts(self): transport, protocol =3D self.loop.run_until_complete(coro) sock =3D transport.get_extra_info('socket') =20 - reuse_address_default_on =3D ( - os.name =3D=3D 'posix' and sys.platform !=3D 'cygwin') reuseport_supported =3D hasattr(socket, 'SO_REUSEPORT') =20 - if reuse_address_default_on: - self.assertTrue( - sock.getsockopt( - socket.SOL_SOCKET, socket.SO_REUSEADDR)) - else: - self.assertFalse( - sock.getsockopt( - socket.SOL_SOCKET, socket.SO_REUSEADDR)) if reuseport_supported: self.assertFalse( sock.getsockopt( @@ -1782,13 +1767,12 @@ def test_create_datagram_endpoint_sockopts(self): coro =3D self.loop.create_datagram_endpoint( lambda: MyDatagramProto(create_future=3DTrue, loop=3Dself.loop), local_addr=3D('127.0.0.1', 0), - reuse_address=3DTrue, reuse_port=3Dreuseport_supported, allow_broadcast=3DTrue) transport, protocol =3D self.loop.run_until_complete(coro) sock =3D transport.get_extra_info('socket') =20 - self.assertTrue( + self.assertFalse( sock.getsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR)) if reuseport_supported: @@ -1803,6 +1787,29 @@ def test_create_datagram_endpoint_sockopts(self): self.loop.run_until_complete(protocol.done) self.assertEqual('CLOSED', protocol.state) =20 + def test_create_datagram_endpoint_reuse_address_error(self): + # bpo-37228: Ensure that explicit passing of `reuse_address=3DTrue` + # raises an error, as it is not safe to use SO_REUSEADDR when using = UDP + + coro =3D self.loop.create_datagram_endpoint( + lambda: MyDatagramProto(create_future=3DTrue, loop=3Dself.loop), + local_addr=3D('127.0.0.1', 0), + reuse_address=3DTrue) + + with self.assertRaises(ValueError): + self.loop.run_until_complete(coro) + + def test_create_datagram_endpoint_reuse_address_warning(self): + # bpo-37228: Deprecate *reuse_address* parameter + + coro =3D self.loop.create_datagram_endpoint( + lambda: MyDatagramProto(create_future=3DTrue, loop=3Dself.loop), + local_addr=3D('127.0.0.1', 0), + reuse_address=3DFalse) + + with self.assertWarns(DeprecationWarning): + self.loop.run_until_complete(coro) + @patch_socket def test_create_datagram_endpoint_nosoreuseport(self, m_socket): del m_socket.SO_REUSEPORT diff --git a/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.r= st b/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst new file mode 100644 index 0000000000000..0fafb63402e46 --- /dev/null +++ b/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst @@ -0,0 +1,6 @@ +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is +because of the behavior of ``SO_REUSEADDR`` in UDP. For more details, see the +documentation for ``loop.create_datagram_endpoint()``. +(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in +:issue:`37228`.) From webhook-mailer at python.org Mon Dec 9 09:54:28 2019 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Mon, 09 Dec 2019 14:54:28 -0000 Subject: [Python-checkins] (no subject) Message-ID: To: python-checkins at python.org Subject: bpo-34776: Fix dataclasses to support __future__ "annotations" mode (#9518) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 https://github.com/python/cpython/commit/d219cc4180e7589807ebbef7421879f095e7= 2a98 commit: d219cc4180e7589807ebbef7421879f095e72a98 branch: master author: Yury Selivanov committer: =C5=81ukasz Langa date: 2019-12-09T15:54:20+01:00 summary: bpo-34776: Fix dataclasses to support __future__ "annotations" mode (#9518) files: A Lib/test/dataclass_textanno.py A Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst M Lib/dataclasses.py M Lib/test/test_dataclasses.py diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py index 91c1f6f80fc68..00851c648a13b 100644 --- a/Lib/dataclasses.py +++ b/Lib/dataclasses.py @@ -378,23 +378,24 @@ def _create_fn(name, args, body, *, globals=3DNone, loc= als=3DNone, # worries about external callers. if locals is None: locals =3D {} - # __builtins__ may be the "builtins" module or - # the value of its "__dict__", - # so make sure "__builtins__" is the module. - if globals is not None and '__builtins__' not in globals: - globals['__builtins__'] =3D builtins + if 'BUILTINS' not in locals: + locals['BUILTINS'] =3D builtins return_annotation =3D '' if return_type is not MISSING: locals['_return_type'] =3D return_type return_annotation =3D '->_return_type' args =3D ','.join(args) - body =3D '\n'.join(f' {b}' for b in body) + body =3D '\n'.join(f' {b}' for b in body) =20 # Compute the text of the entire function. - txt =3D f'def {name}({args}){return_annotation}:\n{body}' + txt =3D f' def {name}({args}){return_annotation}:\n{body}' =20 - exec(txt, globals, locals) - return locals[name] + local_vars =3D ', '.join(locals.keys()) + txt =3D f"def __create_fn__({local_vars}):\n{txt}\n return {name}" + + ns =3D {} + exec(txt, globals, ns) + return ns['__create_fn__'](**locals) =20 =20 def _field_assign(frozen, name, value, self_name): @@ -405,7 +406,7 @@ def _field_assign(frozen, name, value, self_name): # self_name is what "self" is called in this function: don't # hard-code "self", since that might be a field name. if frozen: - return f'__builtins__.object.__setattr__({self_name},{name!r},{value= })' + return f'BUILTINS.object.__setattr__({self_name},{name!r},{value})' return f'{self_name}.{name}=3D{value}' =20 =20 @@ -482,7 +483,7 @@ def _init_param(f): return f'{f.name}:_type_{f.name}{default}' =20 =20 -def _init_fn(fields, frozen, has_post_init, self_name): +def _init_fn(fields, frozen, has_post_init, self_name, globals): # fields contains both real fields and InitVar pseudo-fields. =20 # Make sure we don't have fields without defaults following fields @@ -500,12 +501,15 @@ def _init_fn(fields, frozen, has_post_init, self_name): raise TypeError(f'non-default argument {f.name!r} ' 'follows default argument') =20 - globals =3D {'MISSING': MISSING, - '_HAS_DEFAULT_FACTORY': _HAS_DEFAULT_FACTORY} + locals =3D {f'_type_{f.name}': f.type for f in fields} + locals.update({ + 'MISSING': MISSING, + '_HAS_DEFAULT_FACTORY': _HAS_DEFAULT_FACTORY, + }) =20 body_lines =3D [] for f in fields: - line =3D _field_init(f, frozen, globals, self_name) + line =3D _field_init(f, frozen, locals, self_name) # line is None means that this field doesn't require # initialization (it's a pseudo-field). Just skip it. if line: @@ -521,7 +525,6 @@ def _init_fn(fields, frozen, has_post_init, self_name): if not body_lines: body_lines =3D ['pass'] =20 - locals =3D {f'_type_{f.name}': f.type for f in fields} return _create_fn('__init__', [self_name] + [_init_param(f) for f in fields if f.ini= t], body_lines, @@ -530,20 +533,19 @@ def _init_fn(fields, frozen, has_post_init, self_name): return_type=3DNone) =20 =20 -def _repr_fn(fields): +def _repr_fn(fields, globals): fn =3D _create_fn('__repr__', ('self',), ['return self.__class__.__qualname__ + f"(' + ', '.join([f"{f.name}=3D{{self.{f.name}!r}}" for f in fields]) + - ')"']) + ')"'], + globals=3Dglobals) return _recursive_repr(fn) =20 =20 -def _frozen_get_del_attr(cls, fields): - # XXX: globals is modified on the first call to _create_fn, then - # the modified version is used in the second call. Is this okay? - globals =3D {'cls': cls, +def _frozen_get_del_attr(cls, fields, globals): + locals =3D {'cls': cls, 'FrozenInstanceError': FrozenInstanceError} if fields: fields_str =3D '(' + ','.join(repr(f.name) for f in fields) + ',)' @@ -555,17 +557,19 @@ def _frozen_get_del_attr(cls, fields): (f'if type(self) is cls or name in {fields_str}:', ' raise FrozenInstanceError(f"cannot assign to field= {name!r}")', f'super(cls, self).__setattr__(name, value)'), + locals=3Dlocals, globals=3Dglobals), _create_fn('__delattr__', ('self', 'name'), (f'if type(self) is cls or name in {fields_str}:', ' raise FrozenInstanceError(f"cannot delete field {n= ame!r}")', f'super(cls, self).__delattr__(name)'), + locals=3Dlocals, globals=3Dglobals), ) =20 =20 -def _cmp_fn(name, op, self_tuple, other_tuple): +def _cmp_fn(name, op, self_tuple, other_tuple, globals): # Create a comparison function. If the fields in the object are # named 'x' and 'y', then self_tuple is the string # '(self.x,self.y)' and other_tuple is the string @@ -575,14 +579,16 @@ def _cmp_fn(name, op, self_tuple, other_tuple): ('self', 'other'), [ 'if other.__class__ is self.__class__:', f' return {self_tuple}{op}{other_tuple}', - 'return NotImplemented']) + 'return NotImplemented'], + globals=3Dglobals) =20 =20 -def _hash_fn(fields): +def _hash_fn(fields, globals): self_tuple =3D _tuple_str('self', fields) return _create_fn('__hash__', ('self',), - [f'return hash({self_tuple})']) + [f'return hash({self_tuple})'], + globals=3Dglobals) =20 =20 def _is_classvar(a_type, typing): @@ -755,14 +761,14 @@ def _set_new_attribute(cls, name, value): # take. The common case is to do nothing, so instead of providing a # function that is a no-op, use None to signify that. =20 -def _hash_set_none(cls, fields): +def _hash_set_none(cls, fields, globals): return None =20 -def _hash_add(cls, fields): +def _hash_add(cls, fields, globals): flds =3D [f for f in fields if (f.compare if f.hash is None else f.hash)] - return _hash_fn(flds) + return _hash_fn(flds, globals) =20 -def _hash_exception(cls, fields): +def _hash_exception(cls, fields, globals): # Raise an exception. raise TypeError(f'Cannot overwrite attribute __hash__ ' f'in class {cls.__name__}') @@ -804,6 +810,16 @@ def _process_class(cls, init, repr, eq, order, unsafe_ha= sh, frozen): # is defined by the base class, which is found first. fields =3D {} =20 + if cls.__module__ in sys.modules: + globals =3D sys.modules[cls.__module__].__dict__ + else: + # Theoretically this can happen if someone writes + # a custom string to cls.__module__. In which case + # such dataclass won't be fully introspectable + # (w.r.t. typing.get_type_hints) but will still function + # correctly. + globals =3D {} + setattr(cls, _PARAMS, _DataclassParams(init, repr, eq, order, unsafe_hash, frozen)) =20 @@ -913,6 +929,7 @@ def _process_class(cls, init, repr, eq, order, unsafe_has= h, frozen): # if possible. '__dataclass_self__' if 'self' in fields else 'self', + globals, )) =20 # Get the fields as a list, and include only real fields. This is @@ -921,7 +938,7 @@ def _process_class(cls, init, repr, eq, order, unsafe_has= h, frozen): =20 if repr: flds =3D [f for f in field_list if f.repr] - _set_new_attribute(cls, '__repr__', _repr_fn(flds)) + _set_new_attribute(cls, '__repr__', _repr_fn(flds, globals)) =20 if eq: # Create _eq__ method. There's no need for a __ne__ method, @@ -931,7 +948,8 @@ def _process_class(cls, init, repr, eq, order, unsafe_has= h, frozen): other_tuple =3D _tuple_str('other', flds) _set_new_attribute(cls, '__eq__', _cmp_fn('__eq__', '=3D=3D', - self_tuple, other_tuple)) + self_tuple, other_tuple, + globals=3Dglobals)) =20 if order: # Create and set the ordering methods. @@ -944,13 +962,14 @@ def _process_class(cls, init, repr, eq, order, unsafe_h= ash, frozen): ('__ge__', '>=3D'), ]: if _set_new_attribute(cls, name, - _cmp_fn(name, op, self_tuple, other_tuple)= ): + _cmp_fn(name, op, self_tuple, other_tuple, + globals=3Dglobals)): raise TypeError(f'Cannot overwrite attribute {name} ' f'in class {cls.__name__}. Consider using ' 'functools.total_ordering') =20 if frozen: - for fn in _frozen_get_del_attr(cls, field_list): + for fn in _frozen_get_del_attr(cls, field_list, globals): if _set_new_attribute(cls, fn.__name__, fn): raise TypeError(f'Cannot overwrite attribute {fn.__name__} ' f'in class {cls.__name__}') @@ -963,7 +982,7 @@ def _process_class(cls, init, repr, eq, order, unsafe_has= h, frozen): if hash_action: # No need to call _set_new_attribute here, since by the time # we're here the overwriting is unconditional. - cls.__hash__ =3D hash_action(cls, field_list) + cls.__hash__ =3D hash_action(cls, field_list, globals) =20 if not getattr(cls, '__doc__'): # Create a class doc-string. diff --git a/Lib/test/dataclass_textanno.py b/Lib/test/dataclass_textanno.py new file mode 100644 index 0000000000000..3eb6c943d4c43 --- /dev/null +++ b/Lib/test/dataclass_textanno.py @@ -0,0 +1,12 @@ +from __future__ import annotations + +import dataclasses + + +class Foo: + pass + + + at dataclasses.dataclass +class Bar: + foo: Foo diff --git a/Lib/test/test_dataclasses.py b/Lib/test/test_dataclasses.py index 238335e7d9eda..8f9fb2ce8c169 100644 --- a/Lib/test/test_dataclasses.py +++ b/Lib/test/test_dataclasses.py @@ -10,6 +10,7 @@ import unittest from unittest.mock import Mock from typing import ClassVar, Any, List, Union, Tuple, Dict, Generic, TypeVar= , Optional +from typing import get_type_hints from collections import deque, OrderedDict, namedtuple from functools import total_ordering =20 @@ -2926,6 +2927,17 @@ def test_classvar_module_level_import(self): # won't exist on the instance. self.assertNotIn('not_iv4', c.__dict__) =20 + def test_text_annotations(self): + from test import dataclass_textanno + + self.assertEqual( + get_type_hints(dataclass_textanno.Bar), + {'foo': dataclass_textanno.Foo}) + self.assertEqual( + get_type_hints(dataclass_textanno.Bar.__init__), + {'foo': dataclass_textanno.Foo, + 'return': type(None)}) + =20 class TestMakeDataclass(unittest.TestCase): def test_simple(self): diff --git a/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rs= t b/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst new file mode 100644 index 0000000000000..815a4876e0b4a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst @@ -0,0 +1 @@ +Fix dataclasses to support forward references in type annotations From webhook-mailer at python.org Mon Dec 9 11:07:55 2019 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Mon, 09 Dec 2019 16:07:55 -0000 Subject: [Python-checkins] (no subject) Message-ID: To: python-checkins at python.org Subject: bpo-34776: Fix dataclasses to support __future__ "annotations" mode (GH-9518) (#17531) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 https://github.com/python/cpython/commit/0d57db27f2c563b6433a220b646b50bdeff8= a1f2 commit: 0d57db27f2c563b6433a220b646b50bdeff8a1f2 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.co= m> committer: =C5=81ukasz Langa date: 2019-12-09T17:07:51+01:00 summary: bpo-34776: Fix dataclasses to support __future__ "annotations" mode (GH-9518)= (#17531) (cherry picked from commit d219cc4180e7589807ebbef7421879f095e72a98) Co-authored-by: Yury Selivanov files: A Lib/test/dataclass_textanno.py A Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst M Lib/dataclasses.py M Lib/test/test_dataclasses.py diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py index 391f32e11d52a..74f79294e81bd 100644 --- a/Lib/dataclasses.py +++ b/Lib/dataclasses.py @@ -379,23 +379,24 @@ def _create_fn(name, args, body, *, globals=3DNone, loc= als=3DNone, # worries about external callers. if locals is None: locals =3D {} - # __builtins__ may be the "builtins" module or - # the value of its "__dict__", - # so make sure "__builtins__" is the module. - if globals is not None and '__builtins__' not in globals: - globals['__builtins__'] =3D builtins + if 'BUILTINS' not in locals: + locals['BUILTINS'] =3D builtins return_annotation =3D '' if return_type is not MISSING: locals['_return_type'] =3D return_type return_annotation =3D '->_return_type' args =3D ','.join(args) - body =3D '\n'.join(f' {b}' for b in body) + body =3D '\n'.join(f' {b}' for b in body) =20 # Compute the text of the entire function. - txt =3D f'def {name}({args}){return_annotation}:\n{body}' + txt =3D f' def {name}({args}){return_annotation}:\n{body}' =20 - exec(txt, globals, locals) - return locals[name] + local_vars =3D ', '.join(locals.keys()) + txt =3D f"def __create_fn__({local_vars}):\n{txt}\n return {name}" + + ns =3D {} + exec(txt, globals, ns) + return ns['__create_fn__'](**locals) =20 =20 def _field_assign(frozen, name, value, self_name): @@ -406,7 +407,7 @@ def _field_assign(frozen, name, value, self_name): # self_name is what "self" is called in this function: don't # hard-code "self", since that might be a field name. if frozen: - return f'__builtins__.object.__setattr__({self_name},{name!r},{value= })' + return f'BUILTINS.object.__setattr__({self_name},{name!r},{value})' return f'{self_name}.{name}=3D{value}' =20 =20 @@ -483,7 +484,7 @@ def _init_param(f): return f'{f.name}:_type_{f.name}{default}' =20 =20 -def _init_fn(fields, frozen, has_post_init, self_name): +def _init_fn(fields, frozen, has_post_init, self_name, globals): # fields contains both real fields and InitVar pseudo-fields. =20 # Make sure we don't have fields without defaults following fields @@ -501,12 +502,15 @@ def _init_fn(fields, frozen, has_post_init, self_name): raise TypeError(f'non-default argument {f.name!r} ' 'follows default argument') =20 - globals =3D {'MISSING': MISSING, - '_HAS_DEFAULT_FACTORY': _HAS_DEFAULT_FACTORY} + locals =3D {f'_type_{f.name}': f.type for f in fields} + locals.update({ + 'MISSING': MISSING, + '_HAS_DEFAULT_FACTORY': _HAS_DEFAULT_FACTORY, + }) =20 body_lines =3D [] for f in fields: - line =3D _field_init(f, frozen, globals, self_name) + line =3D _field_init(f, frozen, locals, self_name) # line is None means that this field doesn't require # initialization (it's a pseudo-field). Just skip it. if line: @@ -522,7 +526,6 @@ def _init_fn(fields, frozen, has_post_init, self_name): if not body_lines: body_lines =3D ['pass'] =20 - locals =3D {f'_type_{f.name}': f.type for f in fields} return _create_fn('__init__', [self_name] + [_init_param(f) for f in fields if f.ini= t], body_lines, @@ -531,20 +534,19 @@ def _init_fn(fields, frozen, has_post_init, self_name): return_type=3DNone) =20 =20 -def _repr_fn(fields): +def _repr_fn(fields, globals): fn =3D _create_fn('__repr__', ('self',), ['return self.__class__.__qualname__ + f"(' + ', '.join([f"{f.name}=3D{{self.{f.name}!r}}" for f in fields]) + - ')"']) + ')"'], + globals=3Dglobals) return _recursive_repr(fn) =20 =20 -def _frozen_get_del_attr(cls, fields): - # XXX: globals is modified on the first call to _create_fn, then - # the modified version is used in the second call. Is this okay? - globals =3D {'cls': cls, +def _frozen_get_del_attr(cls, fields, globals): + locals =3D {'cls': cls, 'FrozenInstanceError': FrozenInstanceError} if fields: fields_str =3D '(' + ','.join(repr(f.name) for f in fields) + ',)' @@ -556,17 +558,19 @@ def _frozen_get_del_attr(cls, fields): (f'if type(self) is cls or name in {fields_str}:', ' raise FrozenInstanceError(f"cannot assign to field= {name!r}")', f'super(cls, self).__setattr__(name, value)'), + locals=3Dlocals, globals=3Dglobals), _create_fn('__delattr__', ('self', 'name'), (f'if type(self) is cls or name in {fields_str}:', ' raise FrozenInstanceError(f"cannot delete field {n= ame!r}")', f'super(cls, self).__delattr__(name)'), + locals=3Dlocals, globals=3Dglobals), ) =20 =20 -def _cmp_fn(name, op, self_tuple, other_tuple): +def _cmp_fn(name, op, self_tuple, other_tuple, globals): # Create a comparison function. If the fields in the object are # named 'x' and 'y', then self_tuple is the string # '(self.x,self.y)' and other_tuple is the string @@ -576,14 +580,16 @@ def _cmp_fn(name, op, self_tuple, other_tuple): ('self', 'other'), [ 'if other.__class__ is self.__class__:', f' return {self_tuple}{op}{other_tuple}', - 'return NotImplemented']) + 'return NotImplemented'], + globals=3Dglobals) =20 =20 -def _hash_fn(fields): +def _hash_fn(fields, globals): self_tuple =3D _tuple_str('self', fields) return _create_fn('__hash__', ('self',), - [f'return hash({self_tuple})']) + [f'return hash({self_tuple})'], + globals=3Dglobals) =20 =20 def _is_classvar(a_type, typing): @@ -756,14 +762,14 @@ def _set_new_attribute(cls, name, value): # take. The common case is to do nothing, so instead of providing a # function that is a no-op, use None to signify that. =20 -def _hash_set_none(cls, fields): +def _hash_set_none(cls, fields, globals): return None =20 -def _hash_add(cls, fields): +def _hash_add(cls, fields, globals): flds =3D [f for f in fields if (f.compare if f.hash is None else f.hash)] - return _hash_fn(flds) + return _hash_fn(flds, globals) =20 -def _hash_exception(cls, fields): +def _hash_exception(cls, fields, globals): # Raise an exception. raise TypeError(f'Cannot overwrite attribute __hash__ ' f'in class {cls.__name__}') @@ -805,6 +811,16 @@ def _process_class(cls, init, repr, eq, order, unsafe_ha= sh, frozen): # is defined by the base class, which is found first. fields =3D {} =20 + if cls.__module__ in sys.modules: + globals =3D sys.modules[cls.__module__].__dict__ + else: + # Theoretically this can happen if someone writes + # a custom string to cls.__module__. In which case + # such dataclass won't be fully introspectable + # (w.r.t. typing.get_type_hints) but will still function + # correctly. + globals =3D {} + setattr(cls, _PARAMS, _DataclassParams(init, repr, eq, order, unsafe_hash, frozen)) =20 @@ -914,6 +930,7 @@ def _process_class(cls, init, repr, eq, order, unsafe_has= h, frozen): # if possible. '__dataclass_self__' if 'self' in fields else 'self', + globals, )) =20 # Get the fields as a list, and include only real fields. This is @@ -922,7 +939,7 @@ def _process_class(cls, init, repr, eq, order, unsafe_has= h, frozen): =20 if repr: flds =3D [f for f in field_list if f.repr] - _set_new_attribute(cls, '__repr__', _repr_fn(flds)) + _set_new_attribute(cls, '__repr__', _repr_fn(flds, globals)) =20 if eq: # Create _eq__ method. There's no need for a __ne__ method, @@ -932,7 +949,8 @@ def _process_class(cls, init, repr, eq, order, unsafe_has= h, frozen): other_tuple =3D _tuple_str('other', flds) _set_new_attribute(cls, '__eq__', _cmp_fn('__eq__', '=3D=3D', - self_tuple, other_tuple)) + self_tuple, other_tuple, + globals=3Dglobals)) =20 if order: # Create and set the ordering methods. @@ -945,13 +963,14 @@ def _process_class(cls, init, repr, eq, order, unsafe_h= ash, frozen): ('__ge__', '>=3D'), ]: if _set_new_attribute(cls, name, - _cmp_fn(name, op, self_tuple, other_tuple)= ): + _cmp_fn(name, op, self_tuple, other_tuple, + globals=3Dglobals)): raise TypeError(f'Cannot overwrite attribute {name} ' f'in class {cls.__name__}. Consider using ' 'functools.total_ordering') =20 if frozen: - for fn in _frozen_get_del_attr(cls, field_list): + for fn in _frozen_get_del_attr(cls, field_list, globals): if _set_new_attribute(cls, fn.__name__, fn): raise TypeError(f'Cannot overwrite attribute {fn.__name__} ' f'in class {cls.__name__}') @@ -964,7 +983,7 @@ def _process_class(cls, init, repr, eq, order, unsafe_has= h, frozen): if hash_action: # No need to call _set_new_attribute here, since by the time # we're here the overwriting is unconditional. - cls.__hash__ =3D hash_action(cls, field_list) + cls.__hash__ =3D hash_action(cls, field_list, globals) =20 if not getattr(cls, '__doc__'): # Create a class doc-string. diff --git a/Lib/test/dataclass_textanno.py b/Lib/test/dataclass_textanno.py new file mode 100644 index 0000000000000..3eb6c943d4c43 --- /dev/null +++ b/Lib/test/dataclass_textanno.py @@ -0,0 +1,12 @@ +from __future__ import annotations + +import dataclasses + + +class Foo: + pass + + + at dataclasses.dataclass +class Bar: + foo: Foo diff --git a/Lib/test/test_dataclasses.py b/Lib/test/test_dataclasses.py index b018133cf2302..2f3c531fc208a 100755 --- a/Lib/test/test_dataclasses.py +++ b/Lib/test/test_dataclasses.py @@ -10,6 +10,7 @@ import unittest from unittest.mock import Mock from typing import ClassVar, Any, List, Union, Tuple, Dict, Generic, TypeVar= , Optional +from typing import get_type_hints from collections import deque, OrderedDict, namedtuple from functools import total_ordering =20 @@ -2926,6 +2927,17 @@ def test_classvar_module_level_import(self): # won't exist on the instance. self.assertNotIn('not_iv4', c.__dict__) =20 + def test_text_annotations(self): + from test import dataclass_textanno + + self.assertEqual( + get_type_hints(dataclass_textanno.Bar), + {'foo': dataclass_textanno.Foo}) + self.assertEqual( + get_type_hints(dataclass_textanno.Bar.__init__), + {'foo': dataclass_textanno.Foo, + 'return': type(None)}) + =20 class TestMakeDataclass(unittest.TestCase): def test_simple(self): diff --git a/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rs= t b/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst new file mode 100644 index 0000000000000..815a4876e0b4a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst @@ -0,0 +1 @@ +Fix dataclasses to support forward references in type annotations From webhook-mailer at python.org Mon Dec 9 11:07:59 2019 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Mon, 09 Dec 2019 16:07:59 -0000 Subject: [Python-checkins] (no subject) Message-ID: To: python-checkins at python.org Subject: bpo-34776: Fix dataclasses to support __future__ "annotations" mode (GH-9518) (#17532) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 https://github.com/python/cpython/commit/66d7a5d58a88bce312bc4668f2cc54c9488c= 5bd8 commit: 66d7a5d58a88bce312bc4668f2cc54c9488c5bd8 branch: 3.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.co= m> committer: =C5=81ukasz Langa date: 2019-12-09T17:07:54+01:00 summary: bpo-34776: Fix dataclasses to support __future__ "annotations" mode (GH-9518)= (#17532) (cherry picked from commit d219cc4180e7589807ebbef7421879f095e72a98) Co-authored-by: Yury Selivanov files: A Lib/test/dataclass_textanno.py A Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst M Lib/dataclasses.py M Lib/test/test_dataclasses.py diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py index 33e26460c74ea..146468ba6c06c 100644 --- a/Lib/dataclasses.py +++ b/Lib/dataclasses.py @@ -368,23 +368,24 @@ def _create_fn(name, args, body, *, globals=3DNone, loc= als=3DNone, # worries about external callers. if locals is None: locals =3D {} - # __builtins__ may be the "builtins" module or - # the value of its "__dict__", - # so make sure "__builtins__" is the module. - if globals is not None and '__builtins__' not in globals: - globals['__builtins__'] =3D builtins + if 'BUILTINS' not in locals: + locals['BUILTINS'] =3D builtins return_annotation =3D '' if return_type is not MISSING: locals['_return_type'] =3D return_type return_annotation =3D '->_return_type' args =3D ','.join(args) - body =3D '\n'.join(f' {b}' for b in body) + body =3D '\n'.join(f' {b}' for b in body) =20 # Compute the text of the entire function. - txt =3D f'def {name}({args}){return_annotation}:\n{body}' + txt =3D f' def {name}({args}){return_annotation}:\n{body}' =20 - exec(txt, globals, locals) - return locals[name] + local_vars =3D ', '.join(locals.keys()) + txt =3D f"def __create_fn__({local_vars}):\n{txt}\n return {name}" + + ns =3D {} + exec(txt, globals, ns) + return ns['__create_fn__'](**locals) =20 =20 def _field_assign(frozen, name, value, self_name): @@ -395,7 +396,7 @@ def _field_assign(frozen, name, value, self_name): # self_name is what "self" is called in this function: don't # hard-code "self", since that might be a field name. if frozen: - return f'__builtins__.object.__setattr__({self_name},{name!r},{value= })' + return f'BUILTINS.object.__setattr__({self_name},{name!r},{value})' return f'{self_name}.{name}=3D{value}' =20 =20 @@ -472,7 +473,7 @@ def _init_param(f): return f'{f.name}:_type_{f.name}{default}' =20 =20 -def _init_fn(fields, frozen, has_post_init, self_name): +def _init_fn(fields, frozen, has_post_init, self_name, globals): # fields contains both real fields and InitVar pseudo-fields. =20 # Make sure we don't have fields without defaults following fields @@ -490,12 +491,15 @@ def _init_fn(fields, frozen, has_post_init, self_name): raise TypeError(f'non-default argument {f.name!r} ' 'follows default argument') =20 - globals =3D {'MISSING': MISSING, - '_HAS_DEFAULT_FACTORY': _HAS_DEFAULT_FACTORY} + locals =3D {f'_type_{f.name}': f.type for f in fields} + locals.update({ + 'MISSING': MISSING, + '_HAS_DEFAULT_FACTORY': _HAS_DEFAULT_FACTORY, + }) =20 body_lines =3D [] for f in fields: - line =3D _field_init(f, frozen, globals, self_name) + line =3D _field_init(f, frozen, locals, self_name) # line is None means that this field doesn't require # initialization (it's a pseudo-field). Just skip it. if line: @@ -511,7 +515,6 @@ def _init_fn(fields, frozen, has_post_init, self_name): if not body_lines: body_lines =3D ['pass'] =20 - locals =3D {f'_type_{f.name}': f.type for f in fields} return _create_fn('__init__', [self_name] + [_init_param(f) for f in fields if f.ini= t], body_lines, @@ -520,20 +523,19 @@ def _init_fn(fields, frozen, has_post_init, self_name): return_type=3DNone) =20 =20 -def _repr_fn(fields): +def _repr_fn(fields, globals): fn =3D _create_fn('__repr__', ('self',), ['return self.__class__.__qualname__ + f"(' + ', '.join([f"{f.name}=3D{{self.{f.name}!r}}" for f in fields]) + - ')"']) + ')"'], + globals=3Dglobals) return _recursive_repr(fn) =20 =20 -def _frozen_get_del_attr(cls, fields): - # XXX: globals is modified on the first call to _create_fn, then - # the modified version is used in the second call. Is this okay? - globals =3D {'cls': cls, +def _frozen_get_del_attr(cls, fields, globals): + locals =3D {'cls': cls, 'FrozenInstanceError': FrozenInstanceError} if fields: fields_str =3D '(' + ','.join(repr(f.name) for f in fields) + ',)' @@ -545,17 +547,19 @@ def _frozen_get_del_attr(cls, fields): (f'if type(self) is cls or name in {fields_str}:', ' raise FrozenInstanceError(f"cannot assign to field= {name!r}")', f'super(cls, self).__setattr__(name, value)'), + locals=3Dlocals, globals=3Dglobals), _create_fn('__delattr__', ('self', 'name'), (f'if type(self) is cls or name in {fields_str}:', ' raise FrozenInstanceError(f"cannot delete field {n= ame!r}")', f'super(cls, self).__delattr__(name)'), + locals=3Dlocals, globals=3Dglobals), ) =20 =20 -def _cmp_fn(name, op, self_tuple, other_tuple): +def _cmp_fn(name, op, self_tuple, other_tuple, globals): # Create a comparison function. If the fields in the object are # named 'x' and 'y', then self_tuple is the string # '(self.x,self.y)' and other_tuple is the string @@ -565,14 +569,16 @@ def _cmp_fn(name, op, self_tuple, other_tuple): ('self', 'other'), [ 'if other.__class__ is self.__class__:', f' return {self_tuple}{op}{other_tuple}', - 'return NotImplemented']) + 'return NotImplemented'], + globals=3Dglobals) =20 =20 -def _hash_fn(fields): +def _hash_fn(fields, globals): self_tuple =3D _tuple_str('self', fields) return _create_fn('__hash__', ('self',), - [f'return hash({self_tuple})']) + [f'return hash({self_tuple})'], + globals=3Dglobals) =20 =20 def _is_classvar(a_type, typing): @@ -744,14 +750,14 @@ def _set_new_attribute(cls, name, value): # take. The common case is to do nothing, so instead of providing a # function that is a no-op, use None to signify that. =20 -def _hash_set_none(cls, fields): +def _hash_set_none(cls, fields, globals): return None =20 -def _hash_add(cls, fields): +def _hash_add(cls, fields, globals): flds =3D [f for f in fields if (f.compare if f.hash is None else f.hash)] - return _hash_fn(flds) + return _hash_fn(flds, globals) =20 -def _hash_exception(cls, fields): +def _hash_exception(cls, fields, globals): # Raise an exception. raise TypeError(f'Cannot overwrite attribute __hash__ ' f'in class {cls.__name__}') @@ -793,6 +799,16 @@ def _process_class(cls, init, repr, eq, order, unsafe_ha= sh, frozen): # is defined by the base class, which is found first. fields =3D {} =20 + if cls.__module__ in sys.modules: + globals =3D sys.modules[cls.__module__].__dict__ + else: + # Theoretically this can happen if someone writes + # a custom string to cls.__module__. In which case + # such dataclass won't be fully introspectable + # (w.r.t. typing.get_type_hints) but will still function + # correctly. + globals =3D {} + setattr(cls, _PARAMS, _DataclassParams(init, repr, eq, order, unsafe_hash, frozen)) =20 @@ -902,6 +918,7 @@ def _process_class(cls, init, repr, eq, order, unsafe_has= h, frozen): # if possible. '__dataclass_self__' if 'self' in fields else 'self', + globals, )) =20 # Get the fields as a list, and include only real fields. This is @@ -910,7 +927,7 @@ def _process_class(cls, init, repr, eq, order, unsafe_has= h, frozen): =20 if repr: flds =3D [f for f in field_list if f.repr] - _set_new_attribute(cls, '__repr__', _repr_fn(flds)) + _set_new_attribute(cls, '__repr__', _repr_fn(flds, globals)) =20 if eq: # Create _eq__ method. There's no need for a __ne__ method, @@ -920,7 +937,8 @@ def _process_class(cls, init, repr, eq, order, unsafe_has= h, frozen): other_tuple =3D _tuple_str('other', flds) _set_new_attribute(cls, '__eq__', _cmp_fn('__eq__', '=3D=3D', - self_tuple, other_tuple)) + self_tuple, other_tuple, + globals=3Dglobals)) =20 if order: # Create and set the ordering methods. @@ -933,13 +951,14 @@ def _process_class(cls, init, repr, eq, order, unsafe_h= ash, frozen): ('__ge__', '>=3D'), ]: if _set_new_attribute(cls, name, - _cmp_fn(name, op, self_tuple, other_tuple)= ): + _cmp_fn(name, op, self_tuple, other_tuple, + globals=3Dglobals)): raise TypeError(f'Cannot overwrite attribute {name} ' f'in class {cls.__name__}. Consider using ' 'functools.total_ordering') =20 if frozen: - for fn in _frozen_get_del_attr(cls, field_list): + for fn in _frozen_get_del_attr(cls, field_list, globals): if _set_new_attribute(cls, fn.__name__, fn): raise TypeError(f'Cannot overwrite attribute {fn.__name__} ' f'in class {cls.__name__}') @@ -952,7 +971,7 @@ def _process_class(cls, init, repr, eq, order, unsafe_has= h, frozen): if hash_action: # No need to call _set_new_attribute here, since by the time # we're here the overwriting is unconditional. - cls.__hash__ =3D hash_action(cls, field_list) + cls.__hash__ =3D hash_action(cls, field_list, globals) =20 if not getattr(cls, '__doc__'): # Create a class doc-string. diff --git a/Lib/test/dataclass_textanno.py b/Lib/test/dataclass_textanno.py new file mode 100644 index 0000000000000..3eb6c943d4c43 --- /dev/null +++ b/Lib/test/dataclass_textanno.py @@ -0,0 +1,12 @@ +from __future__ import annotations + +import dataclasses + + +class Foo: + pass + + + at dataclasses.dataclass +class Bar: + foo: Foo diff --git a/Lib/test/test_dataclasses.py b/Lib/test/test_dataclasses.py index 99086e5f6d254..284484547c814 100755 --- a/Lib/test/test_dataclasses.py +++ b/Lib/test/test_dataclasses.py @@ -10,6 +10,7 @@ import unittest from unittest.mock import Mock from typing import ClassVar, Any, List, Union, Tuple, Dict, Generic, TypeVar= , Optional +from typing import get_type_hints from collections import deque, OrderedDict, namedtuple from functools import total_ordering =20 @@ -2918,6 +2919,17 @@ def test_classvar_module_level_import(self): # won't exist on the instance. self.assertNotIn('not_iv4', c.__dict__) =20 + def test_text_annotations(self): + from test import dataclass_textanno + + self.assertEqual( + get_type_hints(dataclass_textanno.Bar), + {'foo': dataclass_textanno.Foo}) + self.assertEqual( + get_type_hints(dataclass_textanno.Bar.__init__), + {'foo': dataclass_textanno.Foo, + 'return': type(None)}) + =20 class TestMakeDataclass(unittest.TestCase): def test_simple(self): diff --git a/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rs= t b/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst new file mode 100644 index 0000000000000..815a4876e0b4a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst @@ -0,0 +1 @@ +Fix dataclasses to support forward references in type annotations From webhook-mailer at python.org Tue Dec 10 03:22:21 2019 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Tue, 10 Dec 2019 08:22:21 -0000 Subject: [Python-checkins] (no subject) Message-ID: To: python-checkins at python.org Subject: Python 3.8.1rc1 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 https://github.com/python/cpython/commit/b00a2b5b76afded9fccaad61cfca1cc0baaf= dbdc commit: b00a2b5b76afded9fccaad61cfca1cc0baafdbdc branch: 3.8 author: =C5=81ukasz Langa committer: =C5=81ukasz Langa date: 2019-12-09T18:47:55+01:00 summary: Python 3.8.1rc1 files: A Misc/NEWS.d/3.8.1rc1.rst D Misc/NEWS.d/next/Build/2019-10-11-15-32-58.bpo-37415.D9RXrq.rst D Misc/NEWS.d/next/Build/2019-11-04-14-30-37.bpo-38684.aed593.rst D Misc/NEWS.d/next/Build/2019-11-15-09-25-44.bpo-38809.9jwta6.rst D Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst D Misc/NEWS.d/next/C API/2019-10-07-17-15-09.bpo-36389.hFX_jD.rst D Misc/NEWS.d/next/C API/2019-10-21-09-24-03.bpo-38540.314N_T.rst D Misc/NEWS.d/next/C API/2019-11-04-21-10-47.bpo-37633.oOGVdo.rst D Misc/NEWS.d/next/Core and Builtins/2019-07-13-18-01-13.bpo-35409.ozbcsR.rst D Misc/NEWS.d/next/Core and Builtins/2019-10-20-00-36-18.bpo-38525.Vty1cA.rst D Misc/NEWS.d/next/Core and Builtins/2019-10-20-12-43-48.bpo-38535.ESMkVN.rst D Misc/NEWS.d/next/Core and Builtins/2019-10-30-11-25-25.bpo-38640.4sAFh5.rst D Misc/NEWS.d/next/Core and Builtins/2019-11-08-00-36-10.bpo-38707.SZL036.rst D Misc/NEWS.d/next/Core and Builtins/2019-11-22-22-18-50.bpo-38892.LS586s.rst D Misc/NEWS.d/next/Core and Builtins/2019-11-26-09-16-47.bpo-38920.Vx__sT.rst D Misc/NEWS.d/next/Core and Builtins/2019-11-26-12-20-34.bpo-38922.i6ja-i.rst D Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst D Misc/NEWS.d/next/Documentation/2019-10-26-13-19-07.bpo-38592.Y96BYO.rst D Misc/NEWS.d/next/Documentation/2019-11-12-15-31-09.bpo-38778.PHhTlv.rst D Misc/NEWS.d/next/Documentation/2019-11-15-09-22-28.bpo-38351.xwhlse.rst D Misc/NEWS.d/next/Documentation/2019-11-15-11-39-13.bpo-38816.vUaSVL.rst D Misc/NEWS.d/next/IDLE/2019-10-26-18-16-24.bpo-38598.6kH9FY.rst D Misc/NEWS.d/next/IDLE/2019-10-28-04-48-03.bpo-4630.upgjiV.rst D Misc/NEWS.d/next/IDLE/2019-10-30-22-11-16.bpo-38636.hUhDeB.rst D Misc/NEWS.d/next/IDLE/2019-11-09-23-55-59.bpo-26353.duYZiF.rst D Misc/NEWS.d/next/IDLE/2019-11-23-21-50-57.bpo-38862.KQ9A0m.rst D Misc/NEWS.d/next/Library/2017-12-26-14-32-23.bpo-27657.6BhyVK.rst D Misc/NEWS.d/next/Library/2018-04-24-13-18-48.bpo-33348.XaJDei.rst D Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst D Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst D Misc/NEWS.d/next/Library/2019-07-09-05-44-39.bpo-36993.4javqu.rst D Misc/NEWS.d/next/Library/2019-10-09-18-16-51.bpo-38422.aiM5bq.rst D Misc/NEWS.d/next/Library/2019-10-15-09-47-40.bpo-33604.J12cWT.rst D Misc/NEWS.d/next/Library/2019-10-15-11-37-57.bpo-38478.A87OPO.rst D Misc/NEWS.d/next/Library/2019-10-18-13-57-31.bpo-38521.U-7aaM.rst D Misc/NEWS.d/next/Library/2019-10-20-12-04-48.bpo-31202.NfdIus.rst D Misc/NEWS.d/next/Library/2019-10-23-16-25-12.bpo-34679.Bnw8o3.rst D Misc/NEWS.d/next/Library/2019-10-27-00-08-49.bpo-38334.pfLLmc.rst D Misc/NEWS.d/next/Library/2019-11-06-15-26-15.bpo-38686.HNFBce.rst D Misc/NEWS.d/next/Library/2019-11-11-21-43-06.bpo-27805.D3zl1_.rst D Misc/NEWS.d/next/Library/2019-11-12-15-46-28.bpo-38723.gcdMFn.rst D Misc/NEWS.d/next/Library/2019-11-13-16-17-43.bpo-38785.NEOEfk.rst D Misc/NEWS.d/next/Library/2019-11-15-09-30-29.bpo-38807.PsmRog.rst D Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst D Misc/NEWS.d/next/Library/2019-11-16-23-26-25.bpo-38821.-albNN.rst D Misc/NEWS.d/next/Library/2019-11-19-16-28-25.bpo-38857.YPUkU9.rst D Misc/NEWS.d/next/Library/2019-11-19-16-30-46.bpo-38859.AZUzL8.rst D Misc/NEWS.d/next/Library/2019-11-21-11-39-17.bpo-37838.lRFcEC.rst D Misc/NEWS.d/next/Library/2019-11-22-10-45-03.bpo-38668.iKx23z.rst D Misc/NEWS.d/next/Library/2019-11-27-16-30-02.bpo-26730.56cdBn.rst D Misc/NEWS.d/next/Library/2019-12-02-10-35-19.bpo-38698.WZnAPQ.rst D Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst D Misc/NEWS.d/next/Library/2019-12-04-15-56-28.bpo-38634.pq0ZWa.rst D Misc/NEWS.d/next/Library/2019-12-05-16-13-25.bpo-38529.yvQgx3.rst D Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst D Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst D Misc/NEWS.d/next/Library/2019-12-07-21-49-50.bpo-38698.HxoSym.rst D Misc/NEWS.d/next/Library/2019-12-07-22-25-39.bpo-38708.rZTUfk.rst D Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst D Misc/NEWS.d/next/Security/2019-10-08-19-29-55.bpo-38418.QL7s0-.rst D Misc/NEWS.d/next/Security/2019-11-14-16-13-23.bpo-38622.3DYkfb.rst D Misc/NEWS.d/next/Security/2019-11-15-00-54-42.bpo-38804.vjbM8V.rst D Misc/NEWS.d/next/Security/2019-11-18-16-17-56.bpo-38722.x3mECW.rst D Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst D Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst D Misc/NEWS.d/next/Tests/2019-10-16-01-36-15.bpo-35998.G305Bf.rst D Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst D Misc/NEWS.d/next/Tests/2019-11-20-16-08-19.bpo-38841.5F5Lbw.rst D Misc/NEWS.d/next/Tests/2019-11-21-09-11-06.bpo-38875.wSZJal.rst D Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst D Misc/NEWS.d/next/Tests/2019-12-08-15-11-06.bpo-38992.cVoHOZ.rst D Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst D Misc/NEWS.d/next/Windows/2019-10-16-09-49-09.bpo-38492.Te1LxC.rst D Misc/NEWS.d/next/Windows/2019-10-28-05-01-29.bpo-38519.dCkY66.rst D Misc/NEWS.d/next/Windows/2019-10-28-10-32-43.bpo-38453.NwwatW.rst D Misc/NEWS.d/next/Windows/2019-10-28-10-48-16.bpo-38589.V69Q1a.rst D Misc/NEWS.d/next/Windows/2019-11-14-08-57-50.bpo-33125.EN5MWS.rst D Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst M Include/patchlevel.h M Lib/pydoc_data/topics.py M README.rst diff --git a/Include/patchlevel.h b/Include/patchlevel.h index df8bd3448b151..b3a2ecb9e7526 100644 --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -18,12 +18,12 @@ /*--start constants--*/ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 8 -#define PY_MICRO_VERSION 0 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL -#define PY_RELEASE_SERIAL 0 +#define PY_MICRO_VERSION 1 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA +#define PY_RELEASE_SERIAL 1 =20 /* Version as a string */ -#define PY_VERSION "3.8.0+" +#define PY_VERSION "3.8.1rc1" /*--end constants--*/ =20 /* Version as a single 4-byte hex number, e.g. 0x010502B2 =3D=3D 1.5.2b2. diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index 327a421bbb6bc..a11be7ab0f836 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Mon Oct 14 14:33:10 2019 +# Autogenerated by Sphinx on Mon Dec 9 18:44:17 2019 topics =3D {'assert': 'The "assert" statement\n' '**********************\n' '\n' @@ -744,10 +744,11 @@ 'returned.\n' '\n' 'The "__dir__" function should accept no arguments, and= ' - 'return a list\n' - 'of strings that represents the names accessible on ' - 'module. If present,\n' - 'this function overrides the standard "dir()" search on= a ' + 'return a\n' + 'sequence of strings that represents the names accessib= le ' + 'on module. If\n' + 'present, this function overrides the standard "dir()" ' + 'search on a\n' 'module.\n' '\n' 'For a more fine grained customization of the module ' @@ -861,6 +862,22 @@ 'created. The\n' ' descriptor has been assigned to *name*.\n' '\n' + ' Note: "__set_name__()" is only called implicitly as= ' + 'part of the\n' + ' "type" constructor, so it will need to be called ' + 'explicitly with\n' + ' the appropriate parameters when a descriptor is ' + 'added to a class\n' + ' after initial creation:\n' + '\n' + ' class A:\n' + ' pass\n' + ' descr =3D custom_descriptor()\n' + ' A.attr =3D descr\n' + " descr.__set_name__(A, 'attr')\n" + '\n' + ' See Creating the class object for more details.\n' + '\n' ' New in version 3.6.\n' '\n' 'The attribute "__objclass__" is interpreted by the ' @@ -1089,7 +1106,13 @@ 'attributes created by\n' ' slots (the other bases must have empty slot layouts)= - ' 'violations\n' - ' raise "TypeError".\n', + ' raise "TypeError".\n' + '\n' + '* If an iterator is used for *__slots__* then a ' + 'descriptor is\n' + ' created for each of the iterator=E2=80=99s values. H= owever, ' + 'the *__slots__*\n' + ' attribute will be an empty iterator.\n', 'attribute-references': 'Attribute references\n' '********************\n' '\n' @@ -4216,6 +4239,17 @@ ' Quit from the debugger. The program being executed is ' 'aborted.\n' '\n' + 'debug code\n' + '\n' + ' Enter a recursive debugger that steps through the code ' + 'argument\n' + ' (which is an arbitrary expression or statement to be execut= ed ' + 'in\n' + ' the current environment).\n' + '\n' + 'retval\n' + 'Print the return value for the last return of a function.\n' + '\n' '-[ Footnotes ]-\n' '\n' '[1] Whether a frame is considered to originate in a certain ' @@ -6227,6 +6261,10 @@ 'that\n' 'determine dynamically the modules to be loaded.\n' '\n' + 'Raises an auditing event "import" with arguments "module", ' + '"filename",\n' + '"sys.path", "sys.meta_path", "sys.path_hooks".\n' + '\n' '\n' 'Future statements\n' '=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n' @@ -7450,9 +7488,9 @@ 'to allow\n' 'efficient iteration through the container; for mappings,= ' '"__iter__()"\n' - 'should be the same as "keys()"; for sequences, it should= ' - 'iterate\n' - 'through the values.\n' + 'should iterate through the object=E2=80=99s keys; for se= quences, ' + 'it should\n' + 'iterate through the values.\n' '\n' 'object.__len__(self)\n' '\n' @@ -7604,12 +7642,12 @@ '\n' 'The membership test operators ("in" and "not in") are ' 'normally\n' - 'implemented as an iteration through a sequence. However= , ' + 'implemented as an iteration through a container. However= , ' 'container\n' 'objects can supply the following special method with a ' 'more efficient\n' 'implementation, which also does not require the object b= e ' - 'a sequence.\n' + 'iterable.\n' '\n' 'object.__contains__(self, item)\n' '\n' @@ -8391,10 +8429,11 @@ 'returned.\n' '\n' 'The "__dir__" function should accept no arguments, and ' - 'return a list\n' - 'of strings that represents the names accessible on module.= ' - 'If present,\n' - 'this function overrides the standard "dir()" search on a ' + 'return a\n' + 'sequence of strings that represents the names accessible o= n ' + 'module. If\n' + 'present, this function overrides the standard "dir()" sear= ch ' + 'on a\n' 'module.\n' '\n' 'For a more fine grained customization of the module behavi= or ' @@ -8508,6 +8547,22 @@ 'The\n' ' descriptor has been assigned to *name*.\n' '\n' + ' Note: "__set_name__()" is only called implicitly as par= t ' + 'of the\n' + ' "type" constructor, so it will need to be called ' + 'explicitly with\n' + ' the appropriate parameters when a descriptor is added= ' + 'to a class\n' + ' after initial creation:\n' + '\n' + ' class A:\n' + ' pass\n' + ' descr =3D custom_descriptor()\n' + ' A.attr =3D descr\n' + " descr.__set_name__(A, 'attr')\n" + '\n' + ' See Creating the class object for more details.\n' + '\n' ' New in version 3.6.\n' '\n' 'The attribute "__objclass__" is interpreted by the "inspec= t" ' @@ -8734,6 +8789,12 @@ 'violations\n' ' raise "TypeError".\n' '\n' + '* If an iterator is used for *__slots__* then a descriptor= ' + 'is\n' + ' created for each of the iterator=E2=80=99s values. Howev= er, the ' + '*__slots__*\n' + ' attribute will be an empty iterator.\n' + '\n' '\n' 'Customizing class creation\n' '=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D\n' @@ -9179,9 +9240,9 @@ 'allow\n' 'efficient iteration through the container; for mappings, ' '"__iter__()"\n' - 'should be the same as "keys()"; for sequences, it should ' - 'iterate\n' - 'through the values.\n' + 'should iterate through the object=E2=80=99s keys; for sequ= ences, it ' + 'should\n' + 'iterate through the values.\n' '\n' 'object.__len__(self)\n' '\n' @@ -9332,12 +9393,12 @@ '\n' 'The membership test operators ("in" and "not in") are ' 'normally\n' - 'implemented as an iteration through a sequence. However, ' + 'implemented as an iteration through a container. However, ' 'container\n' 'objects can supply the following special method with a mor= e ' 'efficient\n' - 'implementation, which also does not require the object be = a ' - 'sequence.\n' + 'implementation, which also does not require the object be ' + 'iterable.\n' '\n' 'object.__contains__(self, item)\n' '\n' @@ -9941,20 +10002,20 @@ '\n' 'str.isalnum()\n' '\n' - ' Return true if all characters in the string are ' + ' Return "True" if all characters in the string are ' 'alphanumeric and\n' - ' there is at least one character, false otherwise. A ' - 'character "c"\n' - ' is alphanumeric if one of the following returns ' + ' there is at least one character, "False" otherwise. = A ' + 'character\n' + ' "c" is alphanumeric if one of the following returns ' '"True":\n' ' "c.isalpha()", "c.isdecimal()", "c.isdigit()", or ' '"c.isnumeric()".\n' '\n' 'str.isalpha()\n' '\n' - ' Return true if all characters in the string are ' + ' Return "True" if all characters in the string are ' 'alphabetic and\n' - ' there is at least one character, false otherwise. ' + ' there is at least one character, "False" otherwise. ' 'Alphabetic\n' ' characters are those characters defined in the Unicod= e ' 'character\n' @@ -9968,45 +10029,46 @@ '\n' 'str.isascii()\n' '\n' - ' Return true if the string is empty or all characters = in ' - 'the string\n' - ' are ASCII, false otherwise. ASCII characters have cod= e ' - 'points in\n' - ' the range U+0000-U+007F.\n' + ' Return "True" if the string is empty or all character= s ' + 'in the\n' + ' string are ASCII, "False" otherwise. ASCII characters= ' + 'have code\n' + ' points in the range U+0000-U+007F.\n' '\n' ' New in version 3.7.\n' '\n' 'str.isdecimal()\n' '\n' - ' Return true if all characters in the string are decim= al ' - 'characters\n' - ' and there is at least one character, false otherwise.= ' - 'Decimal\n' - ' characters are those that can be used to form numbers= ' - 'in base 10,\n' - ' e.g. U+0660, ARABIC-INDIC DIGIT ZERO. Formally a ' - 'decimal character\n' - ' is a character in the Unicode General Category =E2=80= =9CNd=E2=80=9D.\n' + ' Return "True" if all characters in the string are ' + 'decimal\n' + ' characters and there is at least one character, "Fals= e" ' + 'otherwise.\n' + ' Decimal characters are those that can be used to form= ' + 'numbers in\n' + ' base 10, e.g. U+0660, ARABIC-INDIC DIGIT ZERO. ' + 'Formally a decimal\n' + ' character is a character in the Unicode General ' + 'Category =E2=80=9CNd=E2=80=9D.\n' '\n' 'str.isdigit()\n' '\n' - ' Return true if all characters in the string are digit= s ' - 'and there is\n' - ' at least one character, false otherwise. Digits ' - 'include decimal\n' - ' characters and digits that need special handling, suc= h ' - 'as the\n' - ' compatibility superscript digits. This covers digits ' - 'which cannot\n' - ' be used to form numbers in base 10, like the Kharosth= i ' - 'numbers.\n' - ' Formally, a digit is a character that has the propert= y ' - 'value\n' - ' Numeric_Type=3DDigit or Numeric_Type=3DDecimal.\n' + ' Return "True" if all characters in the string are ' + 'digits and there\n' + ' is at least one character, "False" otherwise. Digits= ' + 'include\n' + ' decimal characters and digits that need special ' + 'handling, such as\n' + ' the compatibility superscript digits. This covers ' + 'digits which\n' + ' cannot be used to form numbers in base 10, like the ' + 'Kharosthi\n' + ' numbers. Formally, a digit is a character that has t= he ' + 'property\n' + ' value Numeric_Type=3DDigit or Numeric_Type=3DDecimal.= \n' '\n' 'str.isidentifier()\n' '\n' - ' Return true if the string is a valid identifier ' + ' Return "True" if the string is a valid identifier ' 'according to the\n' ' language definition, section Identifiers and keywords= .\n' '\n' @@ -10025,32 +10087,33 @@ '\n' 'str.islower()\n' '\n' - ' Return true if all cased characters [4] in the string= ' - 'are lowercase\n' - ' and there is at least one cased character, false ' - 'otherwise.\n' + ' Return "True" if all cased characters [4] in the stri= ng ' + 'are\n' + ' lowercase and there is at least one cased character, ' + '"False"\n' + ' otherwise.\n' '\n' 'str.isnumeric()\n' '\n' - ' Return true if all characters in the string are numer= ic ' - 'characters,\n' - ' and there is at least one character, false otherwise.= ' - 'Numeric\n' - ' characters include digit characters, and all characte= rs ' - 'that have\n' - ' the Unicode numeric value property, e.g. U+2155, VULG= AR ' - 'FRACTION\n' - ' ONE FIFTH. Formally, numeric characters are those wi= th ' - 'the\n' - ' property value Numeric_Type=3DDigit, Numeric_Type=3DD= ecimal ' - 'or\n' + ' Return "True" if all characters in the string are ' + 'numeric\n' + ' characters, and there is at least one character, ' + '"False" otherwise.\n' + ' Numeric characters include digit characters, and all ' + 'characters\n' + ' that have the Unicode numeric value property, e.g. ' + 'U+2155, VULGAR\n' + ' FRACTION ONE FIFTH. Formally, numeric characters are= ' + 'those with\n' + ' the property value Numeric_Type=3DDigit, ' + 'Numeric_Type=3DDecimal or\n' ' Numeric_Type=3DNumeric.\n' '\n' 'str.isprintable()\n' '\n' - ' Return true if all characters in the string are ' + ' Return "True" if all characters in the string are ' 'printable or the\n' - ' string is empty, false otherwise. Nonprintable ' + ' string is empty, "False" otherwise. Nonprintable ' 'characters are\n' ' those characters defined in the Unicode character ' 'database as\n' @@ -10066,9 +10129,10 @@ '\n' 'str.isspace()\n' '\n' - ' Return true if there are only whitespace characters i= n ' - 'the string\n' - ' and there is at least one character, false otherwise.= \n' + ' Return "True" if there are only whitespace characters= ' + 'in the string\n' + ' and there is at least one character, "False" ' + 'otherwise.\n' '\n' ' A character is *whitespace* if in the Unicode charact= er ' 'database\n' @@ -10080,20 +10144,21 @@ '\n' 'str.istitle()\n' '\n' - ' Return true if the string is a titlecased string and ' + ' Return "True" if the string is a titlecased string an= d ' 'there is at\n' ' least one character, for example uppercase characters= ' 'may only\n' ' follow uncased characters and lowercase characters on= ly ' 'cased ones.\n' - ' Return false otherwise.\n' + ' Return "False" otherwise.\n' '\n' 'str.isupper()\n' '\n' - ' Return true if all cased characters [4] in the string= ' - 'are uppercase\n' - ' and there is at least one cased character, false ' - 'otherwise.\n' + ' Return "True" if all cased characters [4] in the stri= ng ' + 'are\n' + ' uppercase and there is at least one cased character, ' + '"False"\n' + ' otherwise.\n' '\n' 'str.join(iterable)\n' '\n' diff --git a/Misc/NEWS.d/3.8.1rc1.rst b/Misc/NEWS.d/3.8.1rc1.rst new file mode 100644 index 0000000000000..958a8b7b80025 --- /dev/null +++ b/Misc/NEWS.d/3.8.1rc1.rst @@ -0,0 +1,778 @@ +.. bpo: 38945 +.. date: 2019-12-01-22-44-40 +.. nonce: ztmNXc +.. release date: 2019-12-09 +.. section: Security + +Newline characters have been escaped when performing uu encoding to prevent +them from overflowing into to content section of the encoded file. This +prevents malicious or accidental modification of data during the decoding +process. + +.. + +.. bpo: 37228 +.. date: 2019-11-21-21-36-54 +.. nonce: yBZnFG +.. section: Security + +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This +is because of the behavior of ``SO_REUSEADDR`` in UDP. For more details, see +the documentation for ``loop.create_datagram_endpoint()``. (Contributed by +Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:`37228`.) + +.. + +.. bpo: 38722 +.. date: 2019-11-18-16-17-56 +.. nonce: x3mECW +.. section: Security + +:mod:`runpy` now uses :meth:`io.open_code` to open code files. Patch by +Jason Killen. + +.. + +.. bpo: 38804 +.. date: 2019-11-15-00-54-42 +.. nonce: vjbM8V +.. section: Security + +Fixes a ReDoS vulnerability in :mod:`http.cookiejar`. Patch by Ben Caller. + +.. + +.. bpo: 38622 +.. date: 2019-11-14-16-13-23 +.. nonce: 3DYkfb +.. section: Security + +Add additional audit events for the :mod:`ctypes` module. + +.. + +.. bpo: 38418 +.. date: 2019-10-08-19-29-55 +.. nonce: QL7s0- +.. section: Security + +Fixes audit event for :func:`os.system` to be named ``os.system``. + +.. + +.. bpo: 38673 +.. date: 2019-12-01-00-17-44 +.. nonce: K_Tze- +.. section: Core and Builtins + +In REPL mode, don't switch to PS2 if the line starts with comment or +whitespace. Based on work by Batuhan Ta=C5=9Fkaya. + +.. + +.. bpo: 38922 +.. date: 2019-11-26-12-20-34 +.. nonce: i6ja-i +.. section: Core and Builtins + +Calling ``replace`` on a code object now raises the ``code.__new__`` audit +event. + +.. + +.. bpo: 38920 +.. date: 2019-11-26-09-16-47 +.. nonce: Vx__sT +.. section: Core and Builtins + +Add audit hooks for when :func:`sys.excepthook` and +:func:`sys.unraisablehook` are invoked + +.. + +.. bpo: 38892 +.. date: 2019-11-22-22-18-50 +.. nonce: LS586s +.. section: Core and Builtins + +Improve documentation for audit events table and functions. + +.. + +.. bpo: 38707 +.. date: 2019-11-08-00-36-10 +.. nonce: SZL036 +.. section: Core and Builtins + +``MainThread.native_id`` is now correctly reset in child processes spawned +using :class:`multiprocessing.Process`, instead of retaining the parent's +value. + +.. + +.. bpo: 38640 +.. date: 2019-10-30-11-25-25 +.. nonce: 4sAFh5 +.. section: Core and Builtins + +Fixed a bug in the compiler that was causing to raise in the presence of +break statements and continue statements inside always false while loops. +Patch by Pablo Galindo. + +.. + +.. bpo: 38535 +.. date: 2019-10-20-12-43-48 +.. nonce: ESMkVN +.. section: Core and Builtins + +Fixed line numbers and column offsets for AST nodes for calls without +arguments in decorators. + +.. + +.. bpo: 38525 +.. date: 2019-10-20-00-36-18 +.. nonce: Vty1cA +.. section: Core and Builtins + +Fix a segmentation fault when using reverse iterators of empty ``dict`` +objects. Patch by Dong-hee Na and Inada Naoki. + +.. + +.. bpo: 35409 +.. date: 2019-07-13-18-01-13 +.. nonce: ozbcsR +.. section: Core and Builtins + +Ignore GeneratorExit exceptions when throwing an exception into the aclose +coroutine of an asynchronous generator. + +.. + +.. bpo: 39006 +.. date: 2019-12-09-14-40-09 +.. nonce: v4VsPg +.. section: Library + +Fix asyncio when the ssl module is missing: only check for ssl.SSLSocket +instance if the ssl module is available. + +.. + +.. bpo: 38708 +.. date: 2019-12-07-22-25-39 +.. nonce: rZTUfk +.. section: Library + +Fix a potential IndexError in email parser when parsing an empty msg-id. + +.. + +.. bpo: 38698 +.. date: 2019-12-07-21-49-50 +.. nonce: HxoSym +.. section: Library + +Add a new ``InvalidMessageID`` token to email parser to represent invalid +Message-ID headers. Also, add defects when there is remaining value after +parsing the header. + +.. + +.. bpo: 38979 +.. date: 2019-12-07-16-32-42 +.. nonce: q0sIHy +.. section: Library + +Return class from ``ContextVar.__class_getitem__`` to simplify subclassing. + +.. + +.. bpo: 38986 +.. date: 2019-12-06-15-11-42 +.. nonce: bg6iZt +.. section: Library + +Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python +version. + +.. + +.. bpo: 38529 +.. date: 2019-12-05-16-13-25 +.. nonce: yvQgx3 +.. section: Library + +Drop too noisy asyncio warning about deletion of a stream without explicit +``.close()`` call. + +.. + +.. bpo: 38634 +.. date: 2019-12-04-15-56-28 +.. nonce: pq0ZWa +.. section: Library + +The :mod:`readline` module now detects if Python is linked to libedit at +runtime on all platforms. Previously, the check was only done on macOS. + +.. + +.. bpo: 33684 +.. date: 2019-12-04-15-28-40 +.. nonce: QeSmQP +.. section: Library + +Fix ``json.tool`` failed to read a JSON file with non-ASCII characters when +locale encoding is not UTF-8. + +.. + +.. bpo: 38698 +.. date: 2019-12-02-10-35-19 +.. nonce: WZnAPQ +.. section: Library + +Prevent UnboundLocalError to pop up in parse_message_id + +parse_message_id() was improperly using a token defined inside an exception +handler, which was raising `UnboundLocalError` on parsing an invalid value. +Patch by Claudiu Popa. + +.. + +.. bpo: 26730 +.. date: 2019-11-27-16-30-02 +.. nonce: 56cdBn +.. section: Library + +Fix ``SpooledTemporaryFile.rollover()`` might corrupt the file when it is in +text mode. Patch by Serhiy Storchaka. + +.. + +.. bpo: 38668 +.. date: 2019-11-22-10-45-03 +.. nonce: iKx23z +.. section: Library + +Calling func:`shutil.copytree` to copy a directory tree from one directory +to another subdirectory resulted in an endless loop and a RecursionError. A +fix was added to consume an iterator and create the list of the entries to +be copied, avoiding the recursion for newly created directories. Patch by +Bruno P. Kinoshita. + +.. + +.. bpo: 37838 +.. date: 2019-11-21-11-39-17 +.. nonce: lRFcEC +.. section: Library + +:meth:`typing.get_type_hints` properly handles functions decorated with +:meth:`functools.wraps`. + +.. + +.. bpo: 38859 +.. date: 2019-11-19-16-30-46 +.. nonce: AZUzL8 +.. section: Library + +AsyncMock now returns StopAsyncIteration on the exaustion of a side_effects +iterable. Since PEP-479 its Impossible to raise a StopIteration exception +from a coroutine. + +.. + +.. bpo: 38857 +.. date: 2019-11-19-16-28-25 +.. nonce: YPUkU9 +.. section: Library + +AsyncMock fix for return values that are awaitable types. This also covers +side_effect iterable values that happend to be awaitable, and wraps +callables that return an awaitable type. Before these awaitables were being +awaited instead of being returned as is. + +.. + +.. bpo: 38821 +.. date: 2019-11-16-23-26-25 +.. nonce: -albNN +.. section: Library + +Fix unhandled exceptions in :mod:`argparse` when internationalizing error +messages for arguments with ``nargs`` set to special (non-integer) values. +Patch by Federico Bond. + +.. + +.. bpo: 38820 +.. date: 2019-11-16-16-09-07 +.. nonce: ivhUSV +.. section: Library + +Make Python compatible with OpenSSL 3.0.0. :func:`ssl.SSLSocket.getpeercert` +no longer returns IPv6 addresses with a trailing new line. + +.. + +.. bpo: 38807 +.. date: 2019-11-15-09-30-29 +.. nonce: PsmRog +.. section: Library + +Update :exc:`TypeError` messages for :meth:`os.path.join` to include +:class:`os.PathLike` objects as acceptable input types. + +.. + +.. bpo: 38785 +.. date: 2019-11-13-16-17-43 +.. nonce: NEOEfk +.. section: Library + +Prevent asyncio from crashing if parent ``__init__`` is not called from a +constructor of object derived from ``asyncio.Future``. + +.. + +.. bpo: 38723 +.. date: 2019-11-12-15-46-28 +.. nonce: gcdMFn +.. section: Library + +:mod:`pdb` now uses :meth:`io.open_code` to trigger auditing events. + +.. + +.. bpo: 27805 +.. date: 2019-11-11-21-43-06 +.. nonce: D3zl1_ +.. section: Library + +Allow opening pipes and other non-seekable files in append mode with +:func:`open`. + +.. + +.. bpo: 38686 +.. date: 2019-11-06-15-26-15 +.. nonce: HNFBce +.. section: Library + +Added support for multiple ``qop`` values in +:class:`urllib.request.AbstractDigestAuthHandler`. + +.. + +.. bpo: 38334 +.. date: 2019-10-27-00-08-49 +.. nonce: pfLLmc +.. section: Library + +Fixed seeking backward on an encrypted :class:`zipfile.ZipExtFile`. + +.. + +.. bpo: 34679 +.. date: 2019-10-23-16-25-12 +.. nonce: Bnw8o3 +.. section: Library + +asynci.ProactorEventLoop.close() now only calls signal.set_wakeup_fd() in +the main thread. + +.. + +.. bpo: 31202 +.. date: 2019-10-20-12-04-48 +.. nonce: NfdIus +.. section: Library + +The case the result of :func:`pathlib.WindowsPath.glob` matches now the case +of the pattern for literal parts. + +.. + +.. bpo: 38521 +.. date: 2019-10-18-13-57-31 +.. nonce: U-7aaM +.. section: Library + +Fixed erroneous equality comparison in statistics.NormalDist(). + +.. + +.. bpo: 38478 +.. date: 2019-10-15-11-37-57 +.. nonce: A87OPO +.. section: Library + +Fixed a bug in :meth:`inspect.signature.bind` that was causing it to fail +when handling a keyword argument with same name as positional-only +parameter. Patch by Pablo Galindo. + +.. + +.. bpo: 33604 +.. date: 2019-10-15-09-47-40 +.. nonce: J12cWT +.. section: Library + +Fixed `hmac.new` and `hmac.HMAC` to raise TypeError instead of ValueError +when the digestmod parameter, now required in 3.8, is omitted. Also +clarified the hmac module documentation and docstrings. + +.. + +.. bpo: 38422 +.. date: 2019-10-09-18-16-51 +.. nonce: aiM5bq +.. section: Library + +Clarify docstrings of pathlib suffix(es) + +.. + +.. bpo: 36993 +.. date: 2019-07-09-05-44-39 +.. nonce: 4javqu +.. section: Library + +Improve error reporting for corrupt zip files with bad zip64 extra data. +Patch by Daniel Hillier. + +.. + +.. bpo: 36820 +.. date: 2019-05-06-15-34-17 +.. nonce: Eh5mIB +.. section: Library + +Break cycle generated when saving an exception in socket.py, codeop.py and +dyld.py as they keep alive not only the exception but user objects through +the ``__traceback__`` attribute. Patch by Mario Corchero. + +.. + +.. bpo: 34776 +.. date: 2018-09-23-14-24-37 +.. nonce: 1SrQe3 +.. section: Library + +Fix dataclasses to support forward references in type annotations + +.. + +.. bpo: 33348 +.. date: 2018-04-24-13-18-48 +.. nonce: XaJDei +.. section: Library + +lib2to3 now recognizes expressions after ``*`` and `**` like in ``f(*[] or +[])``. + +.. + +.. bpo: 27657 +.. date: 2017-12-26-14-32-23 +.. nonce: 6BhyVK +.. section: Library + +Fix urllib.parse.urlparse() with numeric paths. A string like "path:80" is +no longer parsed as a path but as a scheme ("path") and a path ("80"). + +.. + +.. bpo: 38816 +.. date: 2019-11-15-11-39-13 +.. nonce: vUaSVL +.. section: Documentation + +Provides more details about the interaction between :c:func:`fork` and +CPython's runtime, focusing just on the C-API. This includes cautions about +where :c:func:`fork` should and shouldn't be called. + +.. + +.. bpo: 38351 +.. date: 2019-11-15-09-22-28 +.. nonce: xwhlse +.. section: Documentation + +Modernize :mod:`email` examples from %-formatting to f-strings. + +.. + +.. bpo: 38778 +.. date: 2019-11-12-15-31-09 +.. nonce: PHhTlv +.. section: Documentation + +Document the fact that :exc:`RuntimeError` is raised if :meth:`os.fork` is +called in a subinterpreter. + +.. + +.. bpo: 38592 +.. date: 2019-10-26-13-19-07 +.. nonce: Y96BYO +.. section: Documentation + +Add Brazilian Portuguese to the language switcher at Python Documentation +website. + +.. + +.. bpo: 38547 +.. date: 2019-12-09-11-32-34 +.. nonce: Juw54e +.. section: Tests + +Fix test_pty: if the process is the session leader, closing the master file +descriptor raises a SIGHUP signal: simply ignore SIGHUP when running the +tests. + +.. + +.. bpo: 38992 +.. date: 2019-12-08-15-11-06 +.. nonce: cVoHOZ +.. section: Tests + +Fix a test for :func:`math.fsum` that was failing due to constant folding. + +.. + +.. bpo: 38965 +.. date: 2019-12-04-17-08-55 +.. nonce: yqax3m +.. section: Tests + +Fix test_faulthandler on GCC 10. Use the "volatile" keyword in +``faulthandler._stack_overflow()`` to prevent tail call optimization on any +compiler, rather than relying on compiler specific pragma. + +.. + +.. bpo: 38875 +.. date: 2019-11-21-09-11-06 +.. nonce: wSZJal +.. section: Tests + +test_capi: trashcan tests now require the test "cpu" resource. + +.. + +.. bpo: 38841 +.. date: 2019-11-20-16-08-19 +.. nonce: 5F5Lbw +.. section: Tests + +Skip asyncio test_create_datagram_endpoint_existing_sock_unix on platforms +lacking a functional bind() for named unix domain sockets. + +.. + +.. bpo: 38669 +.. date: 2019-11-04-02-54-16 +.. nonce: pazXZ8 +.. section: Tests + +Raise :exc:`TypeError` when passing target as a string with +:meth:`unittest.mock.patch.object`. + +.. + +.. bpo: 35998 +.. date: 2019-10-16-01-36-15 +.. nonce: G305Bf +.. section: Tests + +Fix a race condition in test_asyncio.test_start_tls_server_1(). Previously, +there was a race condition between the test main() function which replaces +the protocol and the test ServerProto protocol which sends ANSWER once it +gets HELLO. Now, only the test main() function is responsible to send data, +ServerProto no longer sends data. + +.. + +.. bpo: 37404 +.. date: 2019-12-01-21-45-24 +.. nonce: cNsA7S +.. section: Build + +:mod:`asyncio` now raises :exc:`TyperError` when calling incompatible +methods with an :class:`ssl.SSLSocket` socket. Patch by Ido Michael. + +.. + +.. bpo: 38809 +.. date: 2019-11-15-09-25-44 +.. nonce: 9jwta6 +.. section: Build + +On Windows, build scripts will now recognize and use python.exe from an +active virtual env. + +.. + +.. bpo: 38684 +.. date: 2019-11-04-14-30-37 +.. nonce: aed593 +.. section: Build + +Fix _hashlib build when Blake2 is disabled, but OpenSSL supports it. + +.. + +.. bpo: 37415 +.. date: 2019-10-11-15-32-58 +.. nonce: D9RXrq +.. section: Build + +Fix stdatomic.h header check for ICC compiler: the ICC implementation lacks +atomic_uintptr_t type which is needed by Python. + +.. + +.. bpo: 33125 +.. date: 2019-11-14-08-57-50 +.. nonce: EN5MWS +.. section: Windows + +Add support for building and releasing Windows ARM64 packages. + +.. + +.. bpo: 38589 +.. date: 2019-10-28-10-48-16 +.. nonce: V69Q1a +.. section: Windows + +Fixes HTML Help shortcut when Windows is not installed to C drive + +.. + +.. bpo: 38453 +.. date: 2019-10-28-10-32-43 +.. nonce: NwwatW +.. section: Windows + +Ensure ntpath.realpath() correctly resolves relative paths. + +.. + +.. bpo: 38519 +.. date: 2019-10-28-05-01-29 +.. nonce: dCkY66 +.. section: Windows + +Restores the internal C headers that were missing from the nuget.org and +Microsoft Store packages. + +.. + +.. bpo: 38492 +.. date: 2019-10-16-09-49-09 +.. nonce: Te1LxC +.. section: Windows + +Remove ``pythonw.exe`` dependency on the Microsoft C++ runtime. + +.. + +.. bpo: 37931 +.. date: 2019-08-23-12-14-34 +.. nonce: goYgQj +.. section: macOS + +Fixed a crash on OSX dynamic builds that occurred when re-initializing the +posix module after a Py_Finalize if the environment had changed since the +previous `import posix`. Patch by Beno=C3=AEt Hudson. + +.. + +.. bpo: 38862 +.. date: 2019-11-23-21-50-57 +.. nonce: KQ9A0m +.. section: IDLE + +'Strip Trailing Whitespace' on the Format menu removes extra newlines at the +end of non-shell files. + +.. + +.. bpo: 26353 +.. date: 2019-11-09-23-55-59 +.. nonce: duYZiF +.. section: IDLE + +Stop adding newline when saving an IDLE shell window. + +.. + +.. bpo: 38636 +.. date: 2019-10-30-22-11-16 +.. nonce: hUhDeB +.. section: IDLE + +Fix IDLE Format menu tab toggle and file indent width. These functions +(default shortcuts Alt-T and Alt-U) were mistakenly disabled in 3.7.5 and +3.8.0. + +.. + +.. bpo: 4630 +.. date: 2019-10-28-04-48-03 +.. nonce: upgjiV +.. section: IDLE + +Add an option to toggle IDLE's cursor blink for shell, editor, and output +windows. See Settings, General, Window Preferences, Cursor Blink. Patch by +Zachary Spytz. + +.. + +.. bpo: 38598 +.. date: 2019-10-26-18-16-24 +.. nonce: 6kH9FY +.. section: IDLE + +Do not try to compile IDLE shell or output windows + +.. + +.. bpo: 37633 +.. date: 2019-11-04-21-10-47 +.. nonce: oOGVdo +.. section: C API + +Re=C3=ABxport some function compatibility wrappers for macros in ``pythonrun= .h``. + +.. + +.. bpo: 38540 +.. date: 2019-10-21-09-24-03 +.. nonce: 314N_T +.. section: C API + +Fixed possible leak in :c:func:`PyArg_Parse` and similar functions for +format units ``"es#"`` and ``"et#"`` when the macro +:c:macro:`PY_SSIZE_T_CLEAN` is not defined. + +.. + +.. bpo: 36389 +.. date: 2019-10-07-17-15-09 +.. nonce: hFX_jD +.. section: C API + +The ``_PyObject_CheckConsistency()`` function is now also available in +release mode. For example, it can be used to debug a crash in the +``visit_decref()`` function of the GC. diff --git a/Misc/NEWS.d/next/Build/2019-10-11-15-32-58.bpo-37415.D9RXrq.rst = b/Misc/NEWS.d/next/Build/2019-10-11-15-32-58.bpo-37415.D9RXrq.rst deleted file mode 100644 index 98f4a3bf4f545..0000000000000 --- a/Misc/NEWS.d/next/Build/2019-10-11-15-32-58.bpo-37415.D9RXrq.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix stdatomic.h header check for ICC compiler: the ICC implementation lacks -atomic_uintptr_t type which is needed by Python. diff --git a/Misc/NEWS.d/next/Build/2019-11-04-14-30-37.bpo-38684.aed593.rst = b/Misc/NEWS.d/next/Build/2019-11-04-14-30-37.bpo-38684.aed593.rst deleted file mode 100644 index c715ff9704127..0000000000000 --- a/Misc/NEWS.d/next/Build/2019-11-04-14-30-37.bpo-38684.aed593.rst +++ /dev/null @@ -1 +0,0 @@ -Fix _hashlib build when Blake2 is disabled, but OpenSSL supports it. diff --git a/Misc/NEWS.d/next/Build/2019-11-15-09-25-44.bpo-38809.9jwta6.rst = b/Misc/NEWS.d/next/Build/2019-11-15-09-25-44.bpo-38809.9jwta6.rst deleted file mode 100644 index 10eaf844e8aaf..0000000000000 --- a/Misc/NEWS.d/next/Build/2019-11-15-09-25-44.bpo-38809.9jwta6.rst +++ /dev/null @@ -1,2 +0,0 @@ -On Windows, build scripts will now recognize and use python.exe from an -active virtual env. diff --git a/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst = b/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst deleted file mode 100644 index 067fc9d3f189d..0000000000000 --- a/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst +++ /dev/null @@ -1,2 +0,0 @@ -:mod:`asyncio` now raises :exc:`TyperError` when calling incompatible methods -with an :class:`ssl.SSLSocket` socket. Patch by Ido Michael. diff --git a/Misc/NEWS.d/next/C API/2019-10-07-17-15-09.bpo-36389.hFX_jD.rst = b/Misc/NEWS.d/next/C API/2019-10-07-17-15-09.bpo-36389.hFX_jD.rst deleted file mode 100644 index 6c42882cdbaa6..0000000000000 --- a/Misc/NEWS.d/next/C API/2019-10-07-17-15-09.bpo-36389.hFX_jD.rst=09 +++ /dev/null @@ -1,3 +0,0 @@ -The ``_PyObject_CheckConsistency()`` function is now also available in relea= se -mode. For example, it can be used to debug a crash in the ``visit_decref()`` -function of the GC. diff --git a/Misc/NEWS.d/next/C API/2019-10-21-09-24-03.bpo-38540.314N_T.rst = b/Misc/NEWS.d/next/C API/2019-10-21-09-24-03.bpo-38540.314N_T.rst deleted file mode 100644 index 1d73ad8fe96e6..0000000000000 --- a/Misc/NEWS.d/next/C API/2019-10-21-09-24-03.bpo-38540.314N_T.rst=09 +++ /dev/null @@ -1,3 +0,0 @@ -Fixed possible leak in :c:func:`PyArg_Parse` and similar functions for -format units ``"es#"`` and ``"et#"`` when the macro -:c:macro:`PY_SSIZE_T_CLEAN` is not defined. diff --git a/Misc/NEWS.d/next/C API/2019-11-04-21-10-47.bpo-37633.oOGVdo.rst = b/Misc/NEWS.d/next/C API/2019-11-04-21-10-47.bpo-37633.oOGVdo.rst deleted file mode 100644 index fdf6abbf1c649..0000000000000 --- a/Misc/NEWS.d/next/C API/2019-11-04-21-10-47.bpo-37633.oOGVdo.rst=09 +++ /dev/null @@ -1 +0,0 @@ -Re=C3=ABxport some function compatibility wrappers for macros in ``pythonrun= .h``. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-07-13-18-01-13.bpo-35409= .ozbcsR.rst b/Misc/NEWS.d/next/Core and Builtins/2019-07-13-18-01-13.bpo-3540= 9.ozbcsR.rst deleted file mode 100644 index 0f35a91ec74e6..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-07-13-18-01-13.bpo-35409.ozbcsR= .rst=09 +++ /dev/null @@ -1,2 +0,0 @@ -Ignore GeneratorExit exceptions when throwing an exception into the aclose -coroutine of an asynchronous generator. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-10-20-00-36-18.bpo-38525= .Vty1cA.rst b/Misc/NEWS.d/next/Core and Builtins/2019-10-20-00-36-18.bpo-3852= 5.Vty1cA.rst deleted file mode 100644 index c74d143762253..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-10-20-00-36-18.bpo-38525.Vty1cA= .rst=09 +++ /dev/null @@ -1,2 +0,0 @@ -Fix a segmentation fault when using reverse iterators of empty ``dict`` obje= cts. -Patch by Dong-hee Na and Inada Naoki. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-10-20-12-43-48.bpo-38535= .ESMkVN.rst b/Misc/NEWS.d/next/Core and Builtins/2019-10-20-12-43-48.bpo-3853= 5.ESMkVN.rst deleted file mode 100644 index 7671fd06474ba..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-10-20-12-43-48.bpo-38535.ESMkVN= .rst=09 +++ /dev/null @@ -1,2 +0,0 @@ -Fixed line numbers and column offsets for AST nodes for calls without -arguments in decorators. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-10-30-11-25-25.bpo-38640= .4sAFh5.rst b/Misc/NEWS.d/next/Core and Builtins/2019-10-30-11-25-25.bpo-3864= 0.4sAFh5.rst deleted file mode 100644 index d99db3cce49a6..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-10-30-11-25-25.bpo-38640.4sAFh5= .rst=09 +++ /dev/null @@ -1,3 +0,0 @@ -Fixed a bug in the compiler that was causing to raise in the presence of -break statements and continue statements inside always false while loops. -Patch by Pablo Galindo. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-08-00-36-10.bpo-38707= .SZL036.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-08-00-36-10.bpo-3870= 7.SZL036.rst deleted file mode 100644 index 4ef9ed81931b7..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-11-08-00-36-10.bpo-38707.SZL036= .rst=09 +++ /dev/null @@ -1 +0,0 @@ -``MainThread.native_id`` is now correctly reset in child processes spawned u= sing :class:`multiprocessing.Process`, instead of retaining the parent's valu= e. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-22-22-18-50.bpo-38892= .LS586s.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-22-22-18-50.bpo-3889= 2.LS586s.rst deleted file mode 100644 index 5df67dcbfeac9..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-11-22-22-18-50.bpo-38892.LS586s= .rst=09 +++ /dev/null @@ -1 +0,0 @@ -Improve documentation for audit events table and functions. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-26-09-16-47.bpo-38920= .Vx__sT.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-26-09-16-47.bpo-3892= 0.Vx__sT.rst deleted file mode 100644 index 2e9e443dd999b..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-11-26-09-16-47.bpo-38920.Vx__sT= .rst=09 +++ /dev/null @@ -1,2 +0,0 @@ -Add audit hooks for when :func:`sys.excepthook` and -:func:`sys.unraisablehook` are invoked diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-26-12-20-34.bpo-38922= .i6ja-i.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-26-12-20-34.bpo-3892= 2.i6ja-i.rst deleted file mode 100644 index a7af652e5a5bd..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-11-26-12-20-34.bpo-38922.i6ja-i= .rst=09 +++ /dev/null @@ -1,2 +0,0 @@ -Calling ``replace`` on a code object now raises the ``code.__new__`` audit -event. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673= .K_Tze-.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-3867= 3.K_Tze-.rst deleted file mode 100644 index 8f8cf88e5e210..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-= .rst=09 +++ /dev/null @@ -1 +0,0 @@ -In REPL mode, don't switch to PS2 if the line starts with comment or whitesp= ace. Based on work by Batuhan Ta=C5=9Fkaya. diff --git a/Misc/NEWS.d/next/Documentation/2019-10-26-13-19-07.bpo-38592.Y96= BYO.rst b/Misc/NEWS.d/next/Documentation/2019-10-26-13-19-07.bpo-38592.Y96BYO= .rst deleted file mode 100644 index 3752d48a7cb4f..0000000000000 --- a/Misc/NEWS.d/next/Documentation/2019-10-26-13-19-07.bpo-38592.Y96BYO.rst +++ /dev/null @@ -1 +0,0 @@ -Add Brazilian Portuguese to the language switcher at Python Documentation we= bsite. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Documentation/2019-11-12-15-31-09.bpo-38778.PHh= Tlv.rst b/Misc/NEWS.d/next/Documentation/2019-11-12-15-31-09.bpo-38778.PHhTlv= .rst deleted file mode 100644 index 053e1d294b70f..0000000000000 --- a/Misc/NEWS.d/next/Documentation/2019-11-12-15-31-09.bpo-38778.PHhTlv.rst +++ /dev/null @@ -1 +0,0 @@ -Document the fact that :exc:`RuntimeError` is raised if :meth:`os.fork` is c= alled in a subinterpreter. diff --git a/Misc/NEWS.d/next/Documentation/2019-11-15-09-22-28.bpo-38351.xwh= lse.rst b/Misc/NEWS.d/next/Documentation/2019-11-15-09-22-28.bpo-38351.xwhlse= .rst deleted file mode 100644 index 8e0dc9eb4ca2f..0000000000000 --- a/Misc/NEWS.d/next/Documentation/2019-11-15-09-22-28.bpo-38351.xwhlse.rst +++ /dev/null @@ -1 +0,0 @@ -Modernize :mod:`email` examples from %-formatting to f-strings. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Documentation/2019-11-15-11-39-13.bpo-38816.vUa= SVL.rst b/Misc/NEWS.d/next/Documentation/2019-11-15-11-39-13.bpo-38816.vUaSVL= .rst deleted file mode 100644 index 49accbc70663a..0000000000000 --- a/Misc/NEWS.d/next/Documentation/2019-11-15-11-39-13.bpo-38816.vUaSVL.rst +++ /dev/null @@ -1,3 +0,0 @@ -Provides more details about the interaction between :c:func:`fork` and -CPython's runtime, focusing just on the C-API. This includes cautions -about where :c:func:`fork` should and shouldn't be called. diff --git a/Misc/NEWS.d/next/IDLE/2019-10-26-18-16-24.bpo-38598.6kH9FY.rst b= /Misc/NEWS.d/next/IDLE/2019-10-26-18-16-24.bpo-38598.6kH9FY.rst deleted file mode 100644 index 5d04e4a79b622..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-10-26-18-16-24.bpo-38598.6kH9FY.rst +++ /dev/null @@ -1 +0,0 @@ -Do not try to compile IDLE shell or output windows diff --git a/Misc/NEWS.d/next/IDLE/2019-10-28-04-48-03.bpo-4630.upgjiV.rst b/= Misc/NEWS.d/next/IDLE/2019-10-28-04-48-03.bpo-4630.upgjiV.rst deleted file mode 100644 index 759b35b77fb8d..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-10-28-04-48-03.bpo-4630.upgjiV.rst +++ /dev/null @@ -1,3 +0,0 @@ -Add an option to toggle IDLE's cursor blink for shell, editor, and output -windows. See Settings, General, Window Preferences, Cursor Blink. -Patch by Zachary Spytz. diff --git a/Misc/NEWS.d/next/IDLE/2019-10-30-22-11-16.bpo-38636.hUhDeB.rst b= /Misc/NEWS.d/next/IDLE/2019-10-30-22-11-16.bpo-38636.hUhDeB.rst deleted file mode 100644 index 4262dbea6d867..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-10-30-22-11-16.bpo-38636.hUhDeB.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix IDLE Format menu tab toggle and file indent width. These functions -(default shortcuts Alt-T and Alt-U) were mistakenly disabled in 3.7.5 -and 3.8.0. diff --git a/Misc/NEWS.d/next/IDLE/2019-11-09-23-55-59.bpo-26353.duYZiF.rst b= /Misc/NEWS.d/next/IDLE/2019-11-09-23-55-59.bpo-26353.duYZiF.rst deleted file mode 100644 index fd0a2a3682100..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-11-09-23-55-59.bpo-26353.duYZiF.rst +++ /dev/null @@ -1,2 +0,0 @@ -Stop adding newline when saving an IDLE shell window. - diff --git a/Misc/NEWS.d/next/IDLE/2019-11-23-21-50-57.bpo-38862.KQ9A0m.rst b= /Misc/NEWS.d/next/IDLE/2019-11-23-21-50-57.bpo-38862.KQ9A0m.rst deleted file mode 100644 index 14bab9e854bdc..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-11-23-21-50-57.bpo-38862.KQ9A0m.rst +++ /dev/null @@ -1,2 +0,0 @@ -'Strip Trailing Whitespace' on the Format menu removes extra newlines -at the end of non-shell files. diff --git a/Misc/NEWS.d/next/Library/2017-12-26-14-32-23.bpo-27657.6BhyVK.rs= t b/Misc/NEWS.d/next/Library/2017-12-26-14-32-23.bpo-27657.6BhyVK.rst deleted file mode 100644 index 77746c0ce630f..0000000000000 --- a/Misc/NEWS.d/next/Library/2017-12-26-14-32-23.bpo-27657.6BhyVK.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix urllib.parse.urlparse() with numeric paths. A string like "path:80" is -no longer parsed as a path but as a scheme ("path") and a path ("80"). diff --git a/Misc/NEWS.d/next/Library/2018-04-24-13-18-48.bpo-33348.XaJDei.rs= t b/Misc/NEWS.d/next/Library/2018-04-24-13-18-48.bpo-33348.XaJDei.rst deleted file mode 100644 index f95a73fb57ed4..0000000000000 --- a/Misc/NEWS.d/next/Library/2018-04-24-13-18-48.bpo-33348.XaJDei.rst +++ /dev/null @@ -1,2 +0,0 @@ -lib2to3 now recognizes expressions after ``*`` and `**` like in ``f(*[] or -[])``. diff --git a/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rs= t b/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst deleted file mode 100644 index 815a4876e0b4a..0000000000000 --- a/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst +++ /dev/null @@ -1 +0,0 @@ -Fix dataclasses to support forward references in type annotations diff --git a/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rs= t b/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst deleted file mode 100644 index 82f6635c81582..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst +++ /dev/null @@ -1,3 +0,0 @@ -Break cycle generated when saving an exception in socket.py, codeop.py and -dyld.py as they keep alive not only the exception but user objects through -the ``__traceback__`` attribute. Patch by Mario Corchero. diff --git a/Misc/NEWS.d/next/Library/2019-07-09-05-44-39.bpo-36993.4javqu.rs= t b/Misc/NEWS.d/next/Library/2019-07-09-05-44-39.bpo-36993.4javqu.rst deleted file mode 100644 index 009e07b92d22d..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-07-09-05-44-39.bpo-36993.4javqu.rst +++ /dev/null @@ -1,2 +0,0 @@ -Improve error reporting for corrupt zip files with bad zip64 extra data. Pat= ch -by Daniel Hillier. diff --git a/Misc/NEWS.d/next/Library/2019-10-09-18-16-51.bpo-38422.aiM5bq.rs= t b/Misc/NEWS.d/next/Library/2019-10-09-18-16-51.bpo-38422.aiM5bq.rst deleted file mode 100644 index 0958fe265db56..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-10-09-18-16-51.bpo-38422.aiM5bq.rst +++ /dev/null @@ -1 +0,0 @@ -Clarify docstrings of pathlib suffix(es) diff --git a/Misc/NEWS.d/next/Library/2019-10-15-09-47-40.bpo-33604.J12cWT.rs= t b/Misc/NEWS.d/next/Library/2019-10-15-09-47-40.bpo-33604.J12cWT.rst deleted file mode 100644 index fbd73003cfcb6..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-10-15-09-47-40.bpo-33604.J12cWT.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed `hmac.new` and `hmac.HMAC` to raise TypeError instead of ValueError -when the digestmod parameter, now required in 3.8, is omitted. Also -clarified the hmac module documentation and docstrings. diff --git a/Misc/NEWS.d/next/Library/2019-10-15-11-37-57.bpo-38478.A87OPO.rs= t b/Misc/NEWS.d/next/Library/2019-10-15-11-37-57.bpo-38478.A87OPO.rst deleted file mode 100644 index b19fa23639d88..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-10-15-11-37-57.bpo-38478.A87OPO.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed a bug in :meth:`inspect.signature.bind` that was causing it to fail -when handling a keyword argument with same name as positional-only parameter. -Patch by Pablo Galindo. diff --git a/Misc/NEWS.d/next/Library/2019-10-18-13-57-31.bpo-38521.U-7aaM.rs= t b/Misc/NEWS.d/next/Library/2019-10-18-13-57-31.bpo-38521.U-7aaM.rst deleted file mode 100644 index 9335bdc9545c4..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-10-18-13-57-31.bpo-38521.U-7aaM.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed erroneous equality comparison in statistics.NormalDist(). diff --git a/Misc/NEWS.d/next/Library/2019-10-20-12-04-48.bpo-31202.NfdIus.rs= t b/Misc/NEWS.d/next/Library/2019-10-20-12-04-48.bpo-31202.NfdIus.rst deleted file mode 100644 index 8edb09d61317b..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-10-20-12-04-48.bpo-31202.NfdIus.rst +++ /dev/null @@ -1,2 +0,0 @@ -The case the result of :func:`pathlib.WindowsPath.glob` matches now the case -of the pattern for literal parts. diff --git a/Misc/NEWS.d/next/Library/2019-10-23-16-25-12.bpo-34679.Bnw8o3.rs= t b/Misc/NEWS.d/next/Library/2019-10-23-16-25-12.bpo-34679.Bnw8o3.rst deleted file mode 100644 index 34334db6032b5..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-10-23-16-25-12.bpo-34679.Bnw8o3.rst +++ /dev/null @@ -1,2 +0,0 @@ -asynci.ProactorEventLoop.close() now only calls signal.set_wakeup_fd() in the -main thread. diff --git a/Misc/NEWS.d/next/Library/2019-10-27-00-08-49.bpo-38334.pfLLmc.rs= t b/Misc/NEWS.d/next/Library/2019-10-27-00-08-49.bpo-38334.pfLLmc.rst deleted file mode 100644 index 0d05d3f6e6c09..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-10-27-00-08-49.bpo-38334.pfLLmc.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed seeking backward on an encrypted :class:`zipfile.ZipExtFile`. diff --git a/Misc/NEWS.d/next/Library/2019-11-06-15-26-15.bpo-38686.HNFBce.rs= t b/Misc/NEWS.d/next/Library/2019-11-06-15-26-15.bpo-38686.HNFBce.rst deleted file mode 100644 index 7a419ff1e3338..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-06-15-26-15.bpo-38686.HNFBce.rst +++ /dev/null @@ -1 +0,0 @@ -Added support for multiple ``qop`` values in :class:`urllib.request.Abstract= DigestAuthHandler`. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Library/2019-11-11-21-43-06.bpo-27805.D3zl1_.rs= t b/Misc/NEWS.d/next/Library/2019-11-11-21-43-06.bpo-27805.D3zl1_.rst deleted file mode 100644 index 37be6a5d0b22b..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-11-21-43-06.bpo-27805.D3zl1_.rst +++ /dev/null @@ -1,2 +0,0 @@ -Allow opening pipes and other non-seekable files in append mode with -:func:`open`. diff --git a/Misc/NEWS.d/next/Library/2019-11-12-15-46-28.bpo-38723.gcdMFn.rs= t b/Misc/NEWS.d/next/Library/2019-11-12-15-46-28.bpo-38723.gcdMFn.rst deleted file mode 100644 index c84bb8589d303..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-12-15-46-28.bpo-38723.gcdMFn.rst +++ /dev/null @@ -1 +0,0 @@ -:mod:`pdb` now uses :meth:`io.open_code` to trigger auditing events. diff --git a/Misc/NEWS.d/next/Library/2019-11-13-16-17-43.bpo-38785.NEOEfk.rs= t b/Misc/NEWS.d/next/Library/2019-11-13-16-17-43.bpo-38785.NEOEfk.rst deleted file mode 100644 index 49e9937998081..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-13-16-17-43.bpo-38785.NEOEfk.rst +++ /dev/null @@ -1,2 +0,0 @@ -Prevent asyncio from crashing if parent ``__init__`` is not called from a -constructor of object derived from ``asyncio.Future``. diff --git a/Misc/NEWS.d/next/Library/2019-11-15-09-30-29.bpo-38807.PsmRog.rs= t b/Misc/NEWS.d/next/Library/2019-11-15-09-30-29.bpo-38807.PsmRog.rst deleted file mode 100644 index 2bd7e3deb19ed..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-15-09-30-29.bpo-38807.PsmRog.rst +++ /dev/null @@ -1 +0,0 @@ -Update :exc:`TypeError` messages for :meth:`os.path.join` to include :class:= `os.PathLike` objects as acceptable input types. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rs= t b/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst deleted file mode 100644 index 2c6a6e853c25f..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst +++ /dev/null @@ -1,2 +0,0 @@ -Make Python compatible with OpenSSL 3.0.0. :func:`ssl.SSLSocket.getpeercert` -no longer returns IPv6 addresses with a trailing new line. diff --git a/Misc/NEWS.d/next/Library/2019-11-16-23-26-25.bpo-38821.-albNN.rs= t b/Misc/NEWS.d/next/Library/2019-11-16-23-26-25.bpo-38821.-albNN.rst deleted file mode 100644 index 2e7a22f661ac6..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-16-23-26-25.bpo-38821.-albNN.rst +++ /dev/null @@ -1 +0,0 @@ -Fix unhandled exceptions in :mod:`argparse` when internationalizing error me= ssages for arguments with ``nargs`` set to special (non-integer) values. Pat= ch by Federico Bond. diff --git a/Misc/NEWS.d/next/Library/2019-11-19-16-28-25.bpo-38857.YPUkU9.rs= t b/Misc/NEWS.d/next/Library/2019-11-19-16-28-25.bpo-38857.YPUkU9.rst deleted file mode 100644 index f28df2811fb78..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-19-16-28-25.bpo-38857.YPUkU9.rst +++ /dev/null @@ -1,4 +0,0 @@ -AsyncMock fix for return values that are awaitable types. This also covers -side_effect iterable values that happend to be awaitable, and wraps -callables that return an awaitable type. Before these awaitables were being -awaited instead of being returned as is. diff --git a/Misc/NEWS.d/next/Library/2019-11-19-16-30-46.bpo-38859.AZUzL8.rs= t b/Misc/NEWS.d/next/Library/2019-11-19-16-30-46.bpo-38859.AZUzL8.rst deleted file mode 100644 index c059539a1de60..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-19-16-30-46.bpo-38859.AZUzL8.rst +++ /dev/null @@ -1,3 +0,0 @@ -AsyncMock now returns StopAsyncIteration on the exaustion of a side_effects -iterable. Since PEP-479 its Impossible to raise a StopIteration exception -from a coroutine. diff --git a/Misc/NEWS.d/next/Library/2019-11-21-11-39-17.bpo-37838.lRFcEC.rs= t b/Misc/NEWS.d/next/Library/2019-11-21-11-39-17.bpo-37838.lRFcEC.rst deleted file mode 100644 index 96d804addeb60..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-21-11-39-17.bpo-37838.lRFcEC.rst +++ /dev/null @@ -1 +0,0 @@ -:meth:`typing.get_type_hints` properly handles functions decorated with :met= h:`functools.wraps`. diff --git a/Misc/NEWS.d/next/Library/2019-11-22-10-45-03.bpo-38668.iKx23z.rs= t b/Misc/NEWS.d/next/Library/2019-11-22-10-45-03.bpo-38668.iKx23z.rst deleted file mode 100644 index 28b82ab1619e3..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-22-10-45-03.bpo-38668.iKx23z.rst +++ /dev/null @@ -1,5 +0,0 @@ -Calling func:`shutil.copytree` to copy a directory tree from one directory -to another subdirectory resulted in an endless loop and a RecursionError. A -fix was added to consume an iterator and create the list of the entries to -be copied, avoiding the recursion for newly created directories. Patch by -Bruno P. Kinoshita. diff --git a/Misc/NEWS.d/next/Library/2019-11-27-16-30-02.bpo-26730.56cdBn.rs= t b/Misc/NEWS.d/next/Library/2019-11-27-16-30-02.bpo-26730.56cdBn.rst deleted file mode 100644 index a92b90a495605..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-27-16-30-02.bpo-26730.56cdBn.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix ``SpooledTemporaryFile.rollover()`` might corrupt the file when it is in -text mode. Patch by Serhiy Storchaka. diff --git a/Misc/NEWS.d/next/Library/2019-12-02-10-35-19.bpo-38698.WZnAPQ.rs= t b/Misc/NEWS.d/next/Library/2019-12-02-10-35-19.bpo-38698.WZnAPQ.rst deleted file mode 100644 index e606acb5dcf57..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-02-10-35-19.bpo-38698.WZnAPQ.rst +++ /dev/null @@ -1,5 +0,0 @@ -Prevent UnboundLocalError to pop up in parse_message_id - -parse_message_id() was improperly using a token defined inside an exception -handler, which was raising `UnboundLocalError` on parsing an invalid value. -Patch by Claudiu Popa. diff --git a/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rs= t b/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst deleted file mode 100644 index 107f9bb008330..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix ``json.tool`` failed to read a JSON file with non-ASCII characters when -locale encoding is not UTF-8. diff --git a/Misc/NEWS.d/next/Library/2019-12-04-15-56-28.bpo-38634.pq0ZWa.rs= t b/Misc/NEWS.d/next/Library/2019-12-04-15-56-28.bpo-38634.pq0ZWa.rst deleted file mode 100644 index d60c3172c2e51..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-04-15-56-28.bpo-38634.pq0ZWa.rst +++ /dev/null @@ -1,2 +0,0 @@ -The :mod:`readline` module now detects if Python is linked to libedit at run= time -on all platforms. Previously, the check was only done on macOS. diff --git a/Misc/NEWS.d/next/Library/2019-12-05-16-13-25.bpo-38529.yvQgx3.rs= t b/Misc/NEWS.d/next/Library/2019-12-05-16-13-25.bpo-38529.yvQgx3.rst deleted file mode 100644 index c688926b4a49b..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-05-16-13-25.bpo-38529.yvQgx3.rst +++ /dev/null @@ -1,2 +0,0 @@ -Drop too noisy asyncio warning about deletion of a stream without explicit -``.close()`` call. diff --git a/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rs= t b/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst deleted file mode 100644 index 777535299be17..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst +++ /dev/null @@ -1,2 +0,0 @@ -Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python -version. diff --git a/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rs= t b/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst deleted file mode 100644 index 6a91a12e4930a..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst +++ /dev/null @@ -1 +0,0 @@ -Return class from ``ContextVar.__class_getitem__`` to simplify subclassing. diff --git a/Misc/NEWS.d/next/Library/2019-12-07-21-49-50.bpo-38698.HxoSym.rs= t b/Misc/NEWS.d/next/Library/2019-12-07-21-49-50.bpo-38698.HxoSym.rst deleted file mode 100644 index b930dea0fa7bc..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-07-21-49-50.bpo-38698.HxoSym.rst +++ /dev/null @@ -1,3 +0,0 @@ -Add a new ``InvalidMessageID`` token to email parser to represent invalid -Message-ID headers. Also, add defects when there is remaining value after -parsing the header. diff --git a/Misc/NEWS.d/next/Library/2019-12-07-22-25-39.bpo-38708.rZTUfk.rs= t b/Misc/NEWS.d/next/Library/2019-12-07-22-25-39.bpo-38708.rZTUfk.rst deleted file mode 100644 index 23a0a46d1fea1..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-07-22-25-39.bpo-38708.rZTUfk.rst +++ /dev/null @@ -1 +0,0 @@ -Fix a potential IndexError in email parser when parsing an empty msg-id. diff --git a/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rs= t b/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst deleted file mode 100644 index 8402845a5a047..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix asyncio when the ssl module is missing: only check for ssl.SSLSocket -instance if the ssl module is available. diff --git a/Misc/NEWS.d/next/Security/2019-10-08-19-29-55.bpo-38418.QL7s0-.r= st b/Misc/NEWS.d/next/Security/2019-10-08-19-29-55.bpo-38418.QL7s0-.rst deleted file mode 100644 index b42a00047b96c..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-10-08-19-29-55.bpo-38418.QL7s0-.rst +++ /dev/null @@ -1 +0,0 @@ -Fixes audit event for :func:`os.system` to be named ``os.system``. diff --git a/Misc/NEWS.d/next/Security/2019-11-14-16-13-23.bpo-38622.3DYkfb.r= st b/Misc/NEWS.d/next/Security/2019-11-14-16-13-23.bpo-38622.3DYkfb.rst deleted file mode 100644 index 0373c14d0a1cd..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-11-14-16-13-23.bpo-38622.3DYkfb.rst +++ /dev/null @@ -1 +0,0 @@ -Add additional audit events for the :mod:`ctypes` module. diff --git a/Misc/NEWS.d/next/Security/2019-11-15-00-54-42.bpo-38804.vjbM8V.r= st b/Misc/NEWS.d/next/Security/2019-11-15-00-54-42.bpo-38804.vjbM8V.rst deleted file mode 100644 index 1f45142d9f743..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-11-15-00-54-42.bpo-38804.vjbM8V.rst +++ /dev/null @@ -1 +0,0 @@ -Fixes a ReDoS vulnerability in :mod:`http.cookiejar`. Patch by Ben Caller. diff --git a/Misc/NEWS.d/next/Security/2019-11-18-16-17-56.bpo-38722.x3mECW.r= st b/Misc/NEWS.d/next/Security/2019-11-18-16-17-56.bpo-38722.x3mECW.rst deleted file mode 100644 index 0277d3e5689a2..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-11-18-16-17-56.bpo-38722.x3mECW.rst +++ /dev/null @@ -1,2 +0,0 @@ -:mod:`runpy` now uses :meth:`io.open_code` to open code files. -Patch by Jason Killen. diff --git a/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.r= st b/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst deleted file mode 100644 index 0fafb63402e46..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst +++ /dev/null @@ -1,6 +0,0 @@ -Due to significant security concerns, the *reuse_address* parameter of -:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is -because of the behavior of ``SO_REUSEADDR`` in UDP. For more details, see the -documentation for ``loop.create_datagram_endpoint()``. -(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in -:issue:`37228`.) diff --git a/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.r= st b/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst deleted file mode 100644 index 1bf6ed567b241..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst +++ /dev/null @@ -1 +0,0 @@ -Newline characters have been escaped when performing uu encoding to prevent = them from overflowing into to content section of the encoded file. This preve= nts malicious or accidental modification of data during the decoding process. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Tests/2019-10-16-01-36-15.bpo-35998.G305Bf.rst = b/Misc/NEWS.d/next/Tests/2019-10-16-01-36-15.bpo-35998.G305Bf.rst deleted file mode 100644 index 43d3942fd0772..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-10-16-01-36-15.bpo-35998.G305Bf.rst +++ /dev/null @@ -1,5 +0,0 @@ -Fix a race condition in test_asyncio.test_start_tls_server_1(). Previously, -there was a race condition between the test main() function which replaces t= he -protocol and the test ServerProto protocol which sends ANSWER once it gets -HELLO. Now, only the test main() function is responsible to send data, -ServerProto no longer sends data. diff --git a/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst = b/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst deleted file mode 100644 index 5060ecf2dc5a4..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst +++ /dev/null @@ -1 +0,0 @@ -Raise :exc:`TypeError` when passing target as a string with :meth:`unittest.= mock.patch.object`. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Tests/2019-11-20-16-08-19.bpo-38841.5F5Lbw.rst = b/Misc/NEWS.d/next/Tests/2019-11-20-16-08-19.bpo-38841.5F5Lbw.rst deleted file mode 100644 index 1f4ae424bbcde..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-11-20-16-08-19.bpo-38841.5F5Lbw.rst +++ /dev/null @@ -1,2 +0,0 @@ -Skip asyncio test_create_datagram_endpoint_existing_sock_unix on platforms -lacking a functional bind() for named unix domain sockets. diff --git a/Misc/NEWS.d/next/Tests/2019-11-21-09-11-06.bpo-38875.wSZJal.rst = b/Misc/NEWS.d/next/Tests/2019-11-21-09-11-06.bpo-38875.wSZJal.rst deleted file mode 100644 index 3f6c86d32262c..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-11-21-09-11-06.bpo-38875.wSZJal.rst +++ /dev/null @@ -1 +0,0 @@ -test_capi: trashcan tests now require the test "cpu" resource. diff --git a/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst = b/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst deleted file mode 100644 index 517a1371eacd9..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix test_faulthandler on GCC 10. Use the "volatile" keyword in -``faulthandler._stack_overflow()`` to prevent tail call optimization on any -compiler, rather than relying on compiler specific pragma. diff --git a/Misc/NEWS.d/next/Tests/2019-12-08-15-11-06.bpo-38992.cVoHOZ.rst = b/Misc/NEWS.d/next/Tests/2019-12-08-15-11-06.bpo-38992.cVoHOZ.rst deleted file mode 100644 index 815ae0f65c873..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-12-08-15-11-06.bpo-38992.cVoHOZ.rst +++ /dev/null @@ -1 +0,0 @@ -Fix a test for :func:`math.fsum` that was failing due to constant folding. diff --git a/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst = b/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst deleted file mode 100644 index 10f3cc08511dd..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix test_pty: if the process is the session leader, closing the master file -descriptor raises a SIGHUP signal: simply ignore SIGHUP when running the -tests. diff --git a/Misc/NEWS.d/next/Windows/2019-10-16-09-49-09.bpo-38492.Te1LxC.rs= t b/Misc/NEWS.d/next/Windows/2019-10-16-09-49-09.bpo-38492.Te1LxC.rst deleted file mode 100644 index 41fe695413f97..0000000000000 --- a/Misc/NEWS.d/next/Windows/2019-10-16-09-49-09.bpo-38492.Te1LxC.rst +++ /dev/null @@ -1 +0,0 @@ -Remove ``pythonw.exe`` dependency on the Microsoft C++ runtime. diff --git a/Misc/NEWS.d/next/Windows/2019-10-28-05-01-29.bpo-38519.dCkY66.rs= t b/Misc/NEWS.d/next/Windows/2019-10-28-05-01-29.bpo-38519.dCkY66.rst deleted file mode 100644 index 56d8bb2b34c10..0000000000000 --- a/Misc/NEWS.d/next/Windows/2019-10-28-05-01-29.bpo-38519.dCkY66.rst +++ /dev/null @@ -1,2 +0,0 @@ -Restores the internal C headers that were missing from the nuget.org and -Microsoft Store packages. diff --git a/Misc/NEWS.d/next/Windows/2019-10-28-10-32-43.bpo-38453.NwwatW.rs= t b/Misc/NEWS.d/next/Windows/2019-10-28-10-32-43.bpo-38453.NwwatW.rst deleted file mode 100644 index deacb03c6f01d..0000000000000 --- a/Misc/NEWS.d/next/Windows/2019-10-28-10-32-43.bpo-38453.NwwatW.rst +++ /dev/null @@ -1 +0,0 @@ -Ensure ntpath.realpath() correctly resolves relative paths. diff --git a/Misc/NEWS.d/next/Windows/2019-10-28-10-48-16.bpo-38589.V69Q1a.rs= t b/Misc/NEWS.d/next/Windows/2019-10-28-10-48-16.bpo-38589.V69Q1a.rst deleted file mode 100644 index e864290723e07..0000000000000 --- a/Misc/NEWS.d/next/Windows/2019-10-28-10-48-16.bpo-38589.V69Q1a.rst +++ /dev/null @@ -1 +0,0 @@ -Fixes HTML Help shortcut when Windows is not installed to C drive diff --git a/Misc/NEWS.d/next/Windows/2019-11-14-08-57-50.bpo-33125.EN5MWS.rs= t b/Misc/NEWS.d/next/Windows/2019-11-14-08-57-50.bpo-33125.EN5MWS.rst deleted file mode 100644 index 0bc98c1a2fae7..0000000000000 --- a/Misc/NEWS.d/next/Windows/2019-11-14-08-57-50.bpo-33125.EN5MWS.rst +++ /dev/null @@ -1 +0,0 @@ -Add support for building and releasing Windows ARM64 packages. diff --git a/Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst = b/Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst deleted file mode 100644 index 45b54e89cb89e..0000000000000 --- a/Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed a crash on OSX dynamic builds that occurred when re-initializing the -posix module after a Py_Finalize if the environment had changed since the -previous `import posix`. Patch by Beno=C3=AEt Hudson. diff --git a/README.rst b/README.rst index 76d70b3e2d6d1..4064b511a87a1 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ -This is Python version 3.8.0 -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D +This is Python version 3.8.1rc1 +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D =20 .. image:: https://travis-ci.org/python/cpython.svg?branch=3D3.8 :alt: CPython build status on Travis CI From webhook-mailer at python.org Thu Dec 12 08:48:42 2019 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Thu, 12 Dec 2019 13:48:42 -0000 Subject: [Python-checkins] (no subject) Message-ID: To: python-checkins at python.org Subject: Fix warnings in test_asyncio.test_base_events (#17577) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 https://github.com/python/cpython/commit/1988344a6bff253f017e053f69318ecf0358= 7294 commit: 1988344a6bff253f017e053f69318ecf03587294 branch: master author: Kyle Stanley committer: =C5=81ukasz Langa date: 2019-12-12T14:48:20+01:00 summary: Fix warnings in test_asyncio.test_base_events (#17577) Co-authored-by: tirkarthi files: M Lib/test/test_asyncio/test_base_events.py diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asynci= o/test_base_events.py index 6c0f00dc93647..fc832d3467131 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -1814,7 +1814,10 @@ def test_create_datagram_endpoint_reuse_address_warnin= g(self): reuse_address=3DFalse) =20 with self.assertWarns(DeprecationWarning): - self.loop.run_until_complete(coro) + transport, protocol =3D self.loop.run_until_complete(coro) + transport.close() + self.loop.run_until_complete(protocol.done) + self.assertEqual('CLOSED', protocol.state) =20 @patch_socket def test_create_datagram_endpoint_nosoreuseport(self, m_socket): @@ -1824,7 +1827,6 @@ def test_create_datagram_endpoint_nosoreuseport(self, m= _socket): coro =3D self.loop.create_datagram_endpoint( lambda: MyDatagramProto(loop=3Dself.loop), local_addr=3D('127.0.0.1', 0), - reuse_address=3DFalse, reuse_port=3DTrue) =20 self.assertRaises(ValueError, self.loop.run_until_complete, coro) @@ -1843,7 +1845,6 @@ def getaddrinfo(*args, **kw): coro =3D self.loop.create_datagram_endpoint( lambda: MyDatagramProto(loop=3Dself.loop), local_addr=3D('1.2.3.4', 0), - reuse_address=3DFalse, reuse_port=3Dreuseport_supported) =20 t, p =3D self.loop.run_until_complete(coro) From webhook-mailer at python.org Thu Dec 12 09:08:54 2019 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Thu, 12 Dec 2019 14:08:54 -0000 Subject: [Python-checkins] (no subject) Message-ID: To: python-checkins at python.org Subject: Fix warnings in test_asyncio.test_base_events (GH-17577) (#17581) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 https://github.com/python/cpython/commit/b35ec007b60bcf91f76ae3efc3e8cc1e032b= fc66 commit: b35ec007b60bcf91f76ae3efc3e8cc1e032bfc66 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.co= m> committer: =C5=81ukasz Langa date: 2019-12-12T15:08:48+01:00 summary: Fix warnings in test_asyncio.test_base_events (GH-17577) (#17581) Co-authored-by: tirkarthi (cherry picked from commit 1988344a6bff253f017e053f69318ecf03587294) Co-authored-by: Kyle Stanley files: M Lib/test/test_asyncio/test_base_events.py diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asynci= o/test_base_events.py index 93e8903c2ce77..06f1f68294b3f 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -1708,7 +1708,10 @@ def test_create_datagram_endpoint_reuse_address_warnin= g(self): reuse_address=3DFalse) =20 with self.assertWarns(DeprecationWarning): - self.loop.run_until_complete(coro) + transport, protocol =3D self.loop.run_until_complete(coro) + transport.close() + self.loop.run_until_complete(protocol.done) + self.assertEqual('CLOSED', protocol.state) =20 @patch_socket def test_create_datagram_endpoint_nosoreuseport(self, m_socket): @@ -1718,7 +1721,6 @@ def test_create_datagram_endpoint_nosoreuseport(self, m= _socket): coro =3D self.loop.create_datagram_endpoint( lambda: MyDatagramProto(loop=3Dself.loop), local_addr=3D('127.0.0.1', 0), - reuse_address=3DFalse, reuse_port=3DTrue) =20 self.assertRaises(ValueError, self.loop.run_until_complete, coro) @@ -1737,7 +1739,6 @@ def getaddrinfo(*args, **kw): coro =3D self.loop.create_datagram_endpoint( lambda: MyDatagramProto(loop=3Dself.loop), local_addr=3D('1.2.3.4', 0), - reuse_address=3DFalse, reuse_port=3Dreuseport_supported) =20 t, p =3D self.loop.run_until_complete(coro) From webhook-mailer at python.org Thu Dec 19 03:03:04 2019 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Thu, 19 Dec 2019 08:03:04 -0000 Subject: [Python-checkins] (no subject) Message-ID: To: python-checkins at python.org Subject: Python 3.8.1 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 https://github.com/python/cpython/commit/1b293b60067f6f4a95984d064ce0f6b6d34c= 1216 commit: 1b293b60067f6f4a95984d064ce0f6b6d34c1216 branch: 3.8 author: =C5=81ukasz Langa committer: =C5=81ukasz Langa date: 2019-12-18T18:21:23+01:00 summary: Python 3.8.1 files: A Misc/NEWS.d/3.8.1.rst D Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008.Rrp6f1.rst D Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031.imlCYZ.rst D Misc/NEWS.d/next/Core and Builtins/2019-12-17-21-45-36.bpo-39080.OrxEVS.rst D Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst D Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst D Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst D Misc/NEWS.d/next/Library/2019-11-15-18-06-04.bpo-38811.AmdQ6M.rst D Misc/NEWS.d/next/Library/2019-12-10-23-34-48.bpo-39022.QDtIxI.rst D Misc/NEWS.d/next/Tests/2019-12-17-15-27-07.bpo-38546.82JwN2.rst D Misc/NEWS.d/next/Windows/2019-12-09-10-40-34.bpo-39007.vtarxo.rst D Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst M Include/patchlevel.h M Lib/pydoc_data/topics.py M README.rst diff --git a/Include/patchlevel.h b/Include/patchlevel.h index cbffcd13a858e..6936a3feee7c0 100644 --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -19,11 +19,11 @@ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 8 #define PY_MICRO_VERSION 1 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 =20 /* Version as a string */ -#define PY_VERSION "3.8.1rc1+" +#define PY_VERSION "3.8.1" /*--end constants--*/ =20 /* Version as a single 4-byte hex number, e.g. 0x010502B2 =3D=3D 1.5.2b2. diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index a11be7ab0f836..9d779d1e69f23 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Mon Dec 9 18:44:17 2019 +# Autogenerated by Sphinx on Wed Dec 18 18:17:58 2019 topics =3D {'assert': 'The "assert" statement\n' '**********************\n' '\n' diff --git a/Misc/NEWS.d/3.8.1.rst b/Misc/NEWS.d/3.8.1.rst new file mode 100644 index 0000000000000..8cd4b359f7b4f --- /dev/null +++ b/Misc/NEWS.d/3.8.1.rst @@ -0,0 +1,108 @@ +.. bpo: 39080 +.. date: 2019-12-17-21-45-36 +.. nonce: OrxEVS +.. release date: 2019-12-18 +.. section: Core and Builtins + +Fix the value of *end_col_offset* for Starred Expression AST nodes when they +are among the elements in the *args* attribute of Call AST nodes. + +.. + +.. bpo: 39031 +.. date: 2019-12-12-21-05-43 +.. nonce: imlCYZ +.. section: Core and Builtins + +When parsing an "elif" node, lineno and col_offset of the node now point to +the "elif" keyword and not to its condition, making it consistent with the +"if" node. Patch by Lysandros Nikolaou. + +.. + +.. bpo: 39008 +.. date: 2019-12-09-10-38-51 +.. nonce: Rrp6f1 +.. section: Core and Builtins + +:c:func:`PySys_Audit` now requires ``Py_ssize_t`` to be used for size +arguments in the format string, regardless of whethen ``PY_SSIZE_T_CLEAN`` +was defined at include time. + +.. + +.. bpo: 39022 +.. date: 2019-12-10-23-34-48 +.. nonce: QDtIxI +.. section: Library + +Update importliib.metadata to include improvements from importlib_metadata +1.3 including better serialization of EntryPoints and improved documentation +for custom finders. + +.. + +.. bpo: 38811 +.. date: 2019-11-15-18-06-04 +.. nonce: AmdQ6M +.. section: Library + +Fix an unhandled exception in :mod:`pathlib` when :meth:`os.link` is +missing. Patch by Toke H=C3=B8iland-J=C3=B8rgensen. + +.. + +.. bpo: 36406 +.. date: 2019-03-24-12-12-27 +.. nonce: mCEkOl +.. section: Library + +Handle namespace packages in :mod:`doctest`. Patch by Karthikeyan +Singaravelan. + +.. + +.. bpo: 38546 +.. date: 2019-12-17-15-27-07 +.. nonce: 82JwN2 +.. section: Tests + +Multiprocessing and concurrent.futures tests now stop the resource tracker +process when tests complete. + +.. + +.. bpo: 39007 +.. date: 2019-12-09-10-40-34 +.. nonce: vtarxo +.. section: Windows + +Add auditing events to functions in :mod:`winreg`. + +.. + +.. bpo: 38295 +.. date: 2019-12-17-03-43-04 +.. nonce: hgDvlB +.. section: macOS + +Prevent failure of test_relative_path in test_py_compile on macOS Catalina. + +.. + +.. bpo: 38944 +.. date: 2019-11-30-12-10-36 +.. nonce: _3xjKG +.. section: IDLE + +Excape key now closes IDLE completion windows. Patch by Johnny Najera. + +.. + +.. bpo: 38943 +.. date: 2019-11-29-23-44-11 +.. nonce: 8pUKKs +.. section: IDLE + +Fix IDLE autocomplete windows not always appearing on some systems. Patch by +Johnny Najera. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008= .Rrp6f1.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-3900= 8.Rrp6f1.rst deleted file mode 100644 index 35237ce2714a0..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008.Rrp6f1= .rst=09 +++ /dev/null @@ -1,3 +0,0 @@ -:c:func:`PySys_Audit` now requires ``Py_ssize_t`` to be used for size -arguments in the format string, regardless of whethen ``PY_SSIZE_T_CLEAN`` -was defined at include time. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031= .imlCYZ.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-3903= 1.imlCYZ.rst deleted file mode 100644 index 738902ce907ad..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031.imlCYZ= .rst=09 +++ /dev/null @@ -1,2 +0,0 @@ -When parsing an "elif" node, lineno and col_offset of the node now point to = the "elif" keyword and not to its condition, making it consistent with the "i= f" node. -Patch by Lysandros Nikolaou. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-17-21-45-36.bpo-39080= .OrxEVS.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-17-21-45-36.bpo-3908= 0.OrxEVS.rst deleted file mode 100644 index b120d496b81e0..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-12-17-21-45-36.bpo-39080.OrxEVS= .rst=09 +++ /dev/null @@ -1 +0,0 @@ -Fix the value of *end_col_offset* for Starred Expression AST nodes when they= are among the elements in the *args* attribute of Call AST nodes. diff --git a/Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst b= /Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst deleted file mode 100644 index 5c9323e246787..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix IDLE autocomplete windows not always appearing on some systems. -Patch by Johnny Najera. diff --git a/Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst b= /Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst deleted file mode 100644 index 38084fafd2f56..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst +++ /dev/null @@ -1 +0,0 @@ -Excape key now closes IDLE completion windows. Patch by Johnny Najera. diff --git a/Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rs= t b/Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst deleted file mode 100644 index 3d81eb50418b0..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst +++ /dev/null @@ -1 +0,0 @@ -Handle namespace packages in :mod:`doctest`. Patch by Karthikeyan Singaravel= an. diff --git a/Misc/NEWS.d/next/Library/2019-11-15-18-06-04.bpo-38811.AmdQ6M.rs= t b/Misc/NEWS.d/next/Library/2019-11-15-18-06-04.bpo-38811.AmdQ6M.rst deleted file mode 100644 index 0e4a7f5bdf538..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-15-18-06-04.bpo-38811.AmdQ6M.rst +++ /dev/null @@ -1 +0,0 @@ -Fix an unhandled exception in :mod:`pathlib` when :meth:`os.link` is missing= . Patch by Toke H=C3=B8iland-J=C3=B8rgensen. diff --git a/Misc/NEWS.d/next/Library/2019-12-10-23-34-48.bpo-39022.QDtIxI.rs= t b/Misc/NEWS.d/next/Library/2019-12-10-23-34-48.bpo-39022.QDtIxI.rst deleted file mode 100644 index 4af21be607426..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-10-23-34-48.bpo-39022.QDtIxI.rst +++ /dev/null @@ -1 +0,0 @@ -Update importliib.metadata to include improvements from importlib_metadata 1= .3 including better serialization of EntryPoints and improved documentation f= or custom finders. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Tests/2019-12-17-15-27-07.bpo-38546.82JwN2.rst = b/Misc/NEWS.d/next/Tests/2019-12-17-15-27-07.bpo-38546.82JwN2.rst deleted file mode 100644 index 78d9df3469182..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-12-17-15-27-07.bpo-38546.82JwN2.rst +++ /dev/null @@ -1,2 +0,0 @@ -Multiprocessing and concurrent.futures tests now stop the resource tracker -process when tests complete. diff --git a/Misc/NEWS.d/next/Windows/2019-12-09-10-40-34.bpo-39007.vtarxo.rs= t b/Misc/NEWS.d/next/Windows/2019-12-09-10-40-34.bpo-39007.vtarxo.rst deleted file mode 100644 index f2f72f9dad3f6..0000000000000 --- a/Misc/NEWS.d/next/Windows/2019-12-09-10-40-34.bpo-39007.vtarxo.rst +++ /dev/null @@ -1 +0,0 @@ -Add auditing events to functions in :mod:`winreg`. diff --git a/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst = b/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst deleted file mode 100644 index cc9ceb4cc50b3..0000000000000 --- a/Misc/NEWS.d/next/macOS/2019-12-17-03-43-04.bpo-38295.hgDvlB.rst +++ /dev/null @@ -1 +0,0 @@ -Prevent failure of test_relative_path in test_py_compile on macOS Catalina. diff --git a/README.rst b/README.rst index 4064b511a87a1..d14f2b3ad99a6 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ -This is Python version 3.8.1rc1 -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D +This is Python version 3.8.1 +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D =20 .. image:: https://travis-ci.org/python/cpython.svg?branch=3D3.8 :alt: CPython build status on Travis CI From webhook-mailer at python.org Thu Dec 19 03:16:01 2019 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Thu, 19 Dec 2019 08:16:01 -0000 Subject: [Python-checkins] (no subject) Message-ID: To: python-checkins at python.org Subject: Python 3.9.0a2 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 https://github.com/python/cpython/commit/6202d856d637a9b4eb9789b4d4a1edb12d87= 7de5 commit: 6202d856d637a9b4eb9789b4d4a1edb12d877de5 branch: master author: =C5=81ukasz Langa committer: =C5=81ukasz Langa date: 2019-12-18T22:09:19+01:00 summary: Python 3.9.0a2 files: A Misc/NEWS.d/3.9.0a2.rst D Misc/NEWS.d/next/Build/2019-04-02-01-59-26.bpo-36500.fyG6_U.rst D Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst D Misc/NEWS.d/next/C API/2019-11-18-15-38-23.bpo-38835.II8Szd.rst D Misc/NEWS.d/next/C API/2019-11-20-11-08-06.bpo-37340.JBQJMS.rst D Misc/NEWS.d/next/C API/2019-11-22-19-43-43.bpo-38896.6wvNMJ.rst D Misc/NEWS.d/next/Core and Builtins/2018-03-13-14-46-03.bpo-32949.v821M7.rst D Misc/NEWS.d/next/Core and Builtins/2019-07-13-18-01-13.bpo-35409.ozbcsR.rst D Misc/NEWS.d/next/Core and Builtins/2019-09-03-19-16-57.bpo-38021.KnUhdB.rst D Misc/NEWS.d/next/Core and Builtins/2019-09-06-16-40-12.bpo-27145.njuCXU.rst D Misc/NEWS.d/next/Core and Builtins/2019-10-29-17-11-15.bpo-38629.3qinhF.rst D Misc/NEWS.d/next/Core and Builtins/2019-11-08-00-36-10.bpo-38707.SZL036.rst D Misc/NEWS.d/next/Core and Builtins/2019-11-11-23-44-15.bpo-38328.IFrrjq.rst D Misc/NEWS.d/next/Core and Builtins/2019-11-18-16-37-49.bpo-38835.-U4se1.rst D Misc/NEWS.d/next/Core and Builtins/2019-11-20-12-01-37.bpo-36854.Zga_md.rst D Misc/NEWS.d/next/Core and Builtins/2019-11-21-09-02-49.bpo-38858.bDLH04.rst D Misc/NEWS.d/next/Core and Builtins/2019-11-22-09-55-21.bpo-38852.y7oPEa.rst D Misc/NEWS.d/next/Core and Builtins/2019-11-22-22-18-50.bpo-38892.LS586s.rst D Misc/NEWS.d/next/Core and Builtins/2019-11-26-09-16-47.bpo-38920.Vx__sT.rst D Misc/NEWS.d/next/Core and Builtins/2019-11-26-12-20-34.bpo-38922.i6ja-i.rst D Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-.rst D Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008.Rrp6f1.rst D Misc/NEWS.d/next/Core and Builtins/2019-12-09-17-05-53.bpo-20443.8OyT5P.rst D Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031.imlCYZ.rst D Misc/NEWS.d/next/Core and Builtins/2019-12-17-21-45-36.bpo-39080.OrxEVS.rst D Misc/NEWS.d/next/Core and Builtins/2019-12-17-23-20-51.bpo-39028.SND4TB.rst D Misc/NEWS.d/next/Documentation/2019-10-01-10-53-46.bpo-22377.5ni-iC.rst D Misc/NEWS.d/next/Documentation/2019-11-22-15-57-29.bpo-38899.4aYPW2.rst D Misc/NEWS.d/next/Documentation/2019-11-27-17-51-27.bpo-38928.AfgvfO.rst D Misc/NEWS.d/next/IDLE/2019-10-30-22-11-16.bpo-38636.hUhDeB.rst D Misc/NEWS.d/next/IDLE/2019-11-23-21-50-57.bpo-38862.KQ9A0m.rst D Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst D Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst D Misc/NEWS.d/next/Library/2018-02-22-11-24-33.bpo-29636.ogGRE2.rst D Misc/NEWS.d/next/Library/2018-03-30-16-18-12.bpo-20928.ieXu6I.rst D Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst D Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst D Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst D Misc/NEWS.d/next/Library/2019-09-30-12-09-41.bpo-38045.VDRtd3.rst D Misc/NEWS.d/next/Library/2019-10-02-02-55-37.bpo-37523.GguwJ6.rst D Misc/NEWS.d/next/Library/2019-10-02-18-15-28.bpo-38348._-5eq2.rst D Misc/NEWS.d/next/Library/2019-11-05-21-10-12.bpo-38712.ezJ0TP.rst D Misc/NEWS.d/next/Library/2019-11-06-15-26-15.bpo-38686.HNFBce.rst D Misc/NEWS.d/next/Library/2019-11-15-18-06-04.bpo-38811.AmdQ6M.rst D Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst D Misc/NEWS.d/next/Library/2019-11-16-23-26-25.bpo-38821.-albNN.rst D Misc/NEWS.d/next/Library/2019-11-18-17-08-23.bpo-38834.abcdef.rst D Misc/NEWS.d/next/Library/2019-11-19-16-28-25.bpo-38857.YPUkU9.rst D Misc/NEWS.d/next/Library/2019-11-19-16-30-46.bpo-38859.AZUzL8.rst D Misc/NEWS.d/next/Library/2019-11-20-22-43-48.bpo-38870.rLVZEv.rst D Misc/NEWS.d/next/Library/2019-11-21-11-39-17.bpo-37838.lRFcEC.rst D Misc/NEWS.d/next/Library/2019-11-21-16-30-00.bpo-38863.RkdTjf.rst D Misc/NEWS.d/next/Library/2019-11-22-10-45-03.bpo-38668.iKx23z.rst D Misc/NEWS.d/next/Library/2019-11-22-10-58-58.bpo-38876.qqy1Vp.rst D Misc/NEWS.d/next/Library/2019-11-22-20-03-46.bpo-38881.7HV1Q0.rst D Misc/NEWS.d/next/Library/2019-11-27-16-30-02.bpo-26730.56cdBn.rst D Misc/NEWS.d/next/Library/2019-11-27-17-47-00.bpo-38927.qT7xKY.rst D Misc/NEWS.d/next/Library/2019-12-02-10-35-19.bpo-38698.WZnAPQ.rst D Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst D Misc/NEWS.d/next/Library/2019-12-04-15-56-28.bpo-38634.pq0ZWa.rst D Misc/NEWS.d/next/Library/2019-12-05-02-02-58.bpo-27413.212Th2.rst D Misc/NEWS.d/next/Library/2019-12-05-16-13-25.bpo-38529.yvQgx3.rst D Misc/NEWS.d/next/Library/2019-12-05-18-21-26.bpo-38982.W3u-03.rst D Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst D Misc/NEWS.d/next/Library/2019-12-06-18-47-56.bpo-38916.K-raU8.rst D Misc/NEWS.d/next/Library/2019-12-07-13-40-52.bpo-38978.R3gHZI.rst D Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst D Misc/NEWS.d/next/Library/2019-12-07-18-58-44.bpo-38994.IJYhz_.rst D Misc/NEWS.d/next/Library/2019-12-07-21-49-50.bpo-38698.HxoSym.rst D Misc/NEWS.d/next/Library/2019-12-07-22-25-39.bpo-38708.rZTUfk.rst D Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst D Misc/NEWS.d/next/Library/2019-12-10-23-34-48.bpo-39022.QDtIxI.rst D Misc/NEWS.d/next/Library/2019-12-13-18-54-49.bpo-39033.cepuyD.rst D Misc/NEWS.d/next/Security/2019-11-15-00-54-42.bpo-38804.vjbM8V.rst D Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst D Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst D Misc/NEWS.d/next/Tests/2019-10-30-00-01-43.bpo-37957.X1r78F.rst D Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst D Misc/NEWS.d/next/Tests/2019-11-18-22-10-55.bpo-38839.di6tXv.rst D Misc/NEWS.d/next/Tests/2019-11-20-15-42-06.bpo-38692.aqAvyF.rst D Misc/NEWS.d/next/Tests/2019-11-20-16-08-19.bpo-38841.5F5Lbw.rst D Misc/NEWS.d/next/Tests/2019-11-21-09-11-06.bpo-38875.wSZJal.rst D Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst D Misc/NEWS.d/next/Tests/2019-12-07-00-52-09.bpo-38991.JE3_o-.rst D Misc/NEWS.d/next/Tests/2019-12-08-15-11-06.bpo-38992.cVoHOZ.rst D Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst D Misc/NEWS.d/next/Tests/2019-12-10-14-26-23.bpo-38614.89JpNh.rst D Misc/NEWS.d/next/Tests/2019-12-17-15-27-07.bpo-38546.82JwN2.rst D Misc/NEWS.d/next/Tests/2019-12-18-14-52-08.bpo-38546.2kxNuM.rst D Misc/NEWS.d/next/Windows/2019-11-14-08-57-50.bpo-33125.EN5MWS.rst D Misc/NEWS.d/next/Windows/2019-12-09-10-40-34.bpo-39007.vtarxo.rst D Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst M Include/patchlevel.h M Lib/pydoc_data/topics.py M README.rst diff --git a/Include/patchlevel.h b/Include/patchlevel.h index 42f4f865e05ec..87fd69309286d 100644 --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -20,10 +20,10 @@ #define PY_MINOR_VERSION 9 #define PY_MICRO_VERSION 0 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_SERIAL 2 =20 /* Version as a string */ -#define PY_VERSION "3.9.0a1+" +#define PY_VERSION "3.9.0a2" /*--end constants--*/ =20 /* Version as a single 4-byte hex number, e.g. 0x010502B2 =3D=3D 1.5.2b2. diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index c3fe0798943f4..d9535f70be861 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Tue Nov 19 11:42:25 2019 +# Autogenerated by Sphinx on Wed Dec 18 22:05:39 2019 topics =3D {'assert': 'The "assert" statement\n' '**********************\n' '\n' @@ -862,6 +862,22 @@ 'created. The\n' ' descriptor has been assigned to *name*.\n' '\n' + ' Note: "__set_name__()" is only called implicitly as= ' + 'part of the\n' + ' "type" constructor, so it will need to be called ' + 'explicitly with\n' + ' the appropriate parameters when a descriptor is ' + 'added to a class\n' + ' after initial creation:\n' + '\n' + ' class A:\n' + ' pass\n' + ' descr =3D custom_descriptor()\n' + ' A.attr =3D descr\n' + " descr.__set_name__(A, 'attr')\n" + '\n' + ' See Creating the class object for more details.\n' + '\n' ' New in version 3.6.\n' '\n' 'The attribute "__objclass__" is interpreted by the ' @@ -4224,6 +4240,17 @@ ' Quit from the debugger. The program being executed is ' 'aborted.\n' '\n' + 'debug code\n' + '\n' + ' Enter a recursive debugger that steps through the code ' + 'argument\n' + ' (which is an arbitrary expression or statement to be execut= ed ' + 'in\n' + ' the current environment).\n' + '\n' + 'retval\n' + 'Print the return value for the last return of a function.\n' + '\n' '-[ Footnotes ]-\n' '\n' '[1] Whether a frame is considered to originate in a certain ' @@ -8525,6 +8552,22 @@ 'The\n' ' descriptor has been assigned to *name*.\n' '\n' + ' Note: "__set_name__()" is only called implicitly as par= t ' + 'of the\n' + ' "type" constructor, so it will need to be called ' + 'explicitly with\n' + ' the appropriate parameters when a descriptor is added= ' + 'to a class\n' + ' after initial creation:\n' + '\n' + ' class A:\n' + ' pass\n' + ' descr =3D custom_descriptor()\n' + ' A.attr =3D descr\n' + " descr.__set_name__(A, 'attr')\n" + '\n' + ' See Creating the class object for more details.\n' + '\n' ' New in version 3.6.\n' '\n' 'The attribute "__objclass__" is interpreted by the "inspec= t" ' @@ -11902,8 +11945,9 @@ ' bytecode offsets to line numbers (for details see the sourc= e\n' ' code of the interpreter); "co_stacksize" is the required ' 'stack\n' - ' size (including local variables); "co_flags" is an integer\= n' - ' encoding a number of flags for the interpreter.\n' + ' size; "co_flags" is an integer encoding a number of flags ' + 'for\n' + ' the interpreter.\n' '\n' ' The following flag bits are defined for "co_flags": bit ' '"0x04"\n' diff --git a/Misc/NEWS.d/3.9.0a2.rst b/Misc/NEWS.d/3.9.0a2.rst new file mode 100644 index 0000000000000..a418fe0ef80b2 --- /dev/null +++ b/Misc/NEWS.d/3.9.0a2.rst @@ -0,0 +1,959 @@ +.. bpo: 38945 +.. date: 2019-12-01-22-44-40 +.. nonce: ztmNXc +.. release date: 2019-12-18 +.. section: Security + +Newline characters have been escaped when performing uu encoding to prevent +them from overflowing into to content section of the encoded file. This +prevents malicious or accidental modification of data during the decoding +process. + +.. + +.. bpo: 37228 +.. date: 2019-11-21-21-36-54 +.. nonce: yBZnFG +.. section: Security + +Due to significant security concerns, the *reuse_address* parameter of +:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This +is because of the behavior of ``SO_REUSEADDR`` in UDP. For more details, see +the documentation for ``loop.create_datagram_endpoint()``. (Contributed by +Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:`37228`.) + +.. + +.. bpo: 38804 +.. date: 2019-11-15-00-54-42 +.. nonce: vjbM8V +.. section: Security + +Fixes a ReDoS vulnerability in :mod:`http.cookiejar`. Patch by Ben Caller. + +.. + +.. bpo: 39028 +.. date: 2019-12-17-23-20-51 +.. nonce: SND4TB +.. section: Core and Builtins + +Slightly improve the speed of keyword argument parsing with many kwargs by +strengthening the assumption that kwargs are interned strings. + +.. + +.. bpo: 39080 +.. date: 2019-12-17-21-45-36 +.. nonce: OrxEVS +.. section: Core and Builtins + +Fix the value of *end_col_offset* for Starred Expression AST nodes when they +are among the elements in the *args* attribute of Call AST nodes. + +.. + +.. bpo: 39031 +.. date: 2019-12-12-21-05-43 +.. nonce: imlCYZ +.. section: Core and Builtins + +When parsing an "elif" node, lineno and col_offset of the node now point to +the "elif" keyword and not to its condition, making it consistent with the +"if" node. Patch by Lysandros Nikolaou. + +.. + +.. bpo: 20443 +.. date: 2019-12-09-17-05-53 +.. nonce: 8OyT5P +.. section: Core and Builtins + +In Python 3.9.0a1, sys.argv[0] was made an asolute path if a filename was +specified on the command line. Revert this change, since most users expect +sys.argv to be unmodified. + +.. + +.. bpo: 39008 +.. date: 2019-12-09-10-38-51 +.. nonce: Rrp6f1 +.. section: Core and Builtins + +:c:func:`PySys_Audit` now requires ``Py_ssize_t`` to be used for size +arguments in the format string, regardless of whethen ``PY_SSIZE_T_CLEAN`` +was defined at include time. + +.. + +.. bpo: 38673 +.. date: 2019-12-01-00-17-44 +.. nonce: K_Tze- +.. section: Core and Builtins + +In REPL mode, don't switch to PS2 if the line starts with comment or +whitespace. Based on work by Batuhan Ta=C5=9Fkaya. + +.. + +.. bpo: 38922 +.. date: 2019-11-26-12-20-34 +.. nonce: i6ja-i +.. section: Core and Builtins + +Calling ``replace`` on a code object now raises the ``code.__new__`` audit +event. + +.. + +.. bpo: 38920 +.. date: 2019-11-26-09-16-47 +.. nonce: Vx__sT +.. section: Core and Builtins + +Add audit hooks for when :func:`sys.excepthook` and +:func:`sys.unraisablehook` are invoked + +.. + +.. bpo: 38892 +.. date: 2019-11-22-22-18-50 +.. nonce: LS586s +.. section: Core and Builtins + +Improve documentation for audit events table and functions. + +.. + +.. bpo: 38852 +.. date: 2019-11-22-09-55-21 +.. nonce: y7oPEa +.. section: Core and Builtins + +Set the thread stack size to 8 Mb for debug builds on android platforms. + +.. + +.. bpo: 38858 +.. date: 2019-11-21-09-02-49 +.. nonce: bDLH04 +.. section: Core and Builtins + +Each Python subinterpreter now has its own "small integer singletons": +numbers in [-5; 257] range. It is no longer possible to change the number of +small integers at build time by overriding ``NSMALLNEGINTS`` and +``NSMALLPOSINTS`` macros: macros should now be modified manually in +``pycore_pystate.h`` header file. + +.. + +.. bpo: 36854 +.. date: 2019-11-20-12-01-37 +.. nonce: Zga_md +.. section: Core and Builtins + +The garbage collector state becomes per interpreter +(``PyInterpreterState.gc``), rather than being global +(``_PyRuntimeState.gc``). + +.. + +.. bpo: 38835 +.. date: 2019-11-18-16-37-49 +.. nonce: -U4se1 +.. section: Core and Builtins + +The ``PyFPE_START_PROTECT()`` and ``PyFPE_END_PROTECT()`` macros are empty: +they have been doing nothing for the last year, so stop using them. + +.. + +.. bpo: 38328 +.. date: 2019-11-11-23-44-15 +.. nonce: IFrrjq +.. section: Core and Builtins + +Sped up the creation time of constant :class:`list` and :class:`set` +displays. Patch by Brandt Bucher. + +.. + +.. bpo: 38707 +.. date: 2019-11-08-00-36-10 +.. nonce: SZL036 +.. section: Core and Builtins + +``MainThread.native_id`` is now correctly reset in child processes spawned +using :class:`multiprocessing.Process`, instead of retaining the parent's +value. + +.. + +.. bpo: 38629 +.. date: 2019-10-29-17-11-15 +.. nonce: 3qinhF +.. section: Core and Builtins + +Added ``__floor__`` and ``__ceil__`` methods to float object. Patch by +Batuhan Ta=C5=9Fkaya. + +.. + +.. bpo: 27145 +.. date: 2019-09-06-16-40-12 +.. nonce: njuCXU +.. section: Core and Builtins + +int + int and int - int operators can now return small integer singletons. +Patch by hongweipeng. + +.. + +.. bpo: 38021 +.. date: 2019-09-03-19-16-57 +.. nonce: KnUhdB +.. section: Core and Builtins + +Provide a platform tag for AIX that is sufficient for PEP425 binary +distribution identification. + +Patch by Michael Felt + +.. + +.. bpo: 35409 +.. date: 2019-07-13-18-01-13 +.. nonce: ozbcsR +.. section: Core and Builtins + +Ignore GeneratorExit exceptions when throwing an exception into the aclose +coroutine of an asynchronous generator. + +.. + +.. bpo: 32949 +.. date: 2018-03-13-14-46-03 +.. nonce: v821M7 +.. section: Core and Builtins + +Removed WITH_CLEANUP_START, WITH_CLEANUP_FINISH, BEGIN_FINALLY, END_FINALLY, +CALL_FINALLY and POP_FINALLY bytecodes. Replaced with RERAISE and +WITH_EXCEPT_FINISH bytecodes. The compiler now generates different code for +exceptional and non-exceptional branches for 'with' and 'try-except' +statements. For 'try-finally' statements the 'finally' block is replicated +for each exit from the 'try' body. + +.. + +.. bpo: 39033 +.. date: 2019-12-13-18-54-49 +.. nonce: cepuyD +.. section: Library + +Fix :exc:`NameError` in :mod:`zipimport`. Patch by Karthikeyan Singaravelan. + +.. + +.. bpo: 39022 +.. date: 2019-12-10-23-34-48 +.. nonce: QDtIxI +.. section: Library + +Update importliib.metadata to include improvements from importlib_metadata +1.3 including better serialization of EntryPoints and improved documentation +for custom finders. + +.. + +.. bpo: 39006 +.. date: 2019-12-09-14-40-09 +.. nonce: v4VsPg +.. section: Library + +Fix asyncio when the ssl module is missing: only check for ssl.SSLSocket +instance if the ssl module is available. + +.. + +.. bpo: 38708 +.. date: 2019-12-07-22-25-39 +.. nonce: rZTUfk +.. section: Library + +Fix a potential IndexError in email parser when parsing an empty msg-id. + +.. + +.. bpo: 38698 +.. date: 2019-12-07-21-49-50 +.. nonce: HxoSym +.. section: Library + +Add a new ``InvalidMessageID`` token to email parser to represent invalid +Message-ID headers. Also, add defects when there is remaining value after +parsing the header. + +.. + +.. bpo: 38994 +.. date: 2019-12-07-18-58-44 +.. nonce: IJYhz_ +.. section: Library + +Implement ``__class_getitem__`` for ``os.PathLike``, ``pathlib.Path`` + +.. + +.. bpo: 38979 +.. date: 2019-12-07-16-32-42 +.. nonce: q0sIHy +.. section: Library + +Return class from ``ContextVar.__class_getitem__`` to simplify subclassing. + +.. + +.. bpo: 38978 +.. date: 2019-12-07-13-40-52 +.. nonce: R3gHZI +.. section: Library + +Implement ``__class_getitem__`` on asyncio objects (Future, Task, Queue). +Patch by Batuhan Taskaya. + +.. + +.. bpo: 38916 +.. date: 2019-12-06-18-47-56 +.. nonce: K-raU8 +.. section: Library + +:class:`array.array`: Remove ``tostring()`` and ``fromstring()`` methods. +They were aliases to ``tobytes()`` and ``frombytes()``, deprecated since +Python 3.2. + +.. + +.. bpo: 38986 +.. date: 2019-12-06-15-11-42 +.. nonce: bg6iZt +.. section: Library + +Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python +version. + +.. + +.. bpo: 38982 +.. date: 2019-12-05-18-21-26 +.. nonce: W3u-03 +.. section: Library + +Fix asyncio ``PidfdChildWatcher``: handle ``waitpid()`` error. If +``waitpid()`` is called elsewhere, ``waitpid()`` call fails with +:exc:`ChildProcessError`: use return code 255 in this case, and log a +warning. It ensures that the pidfd file descriptor is closed if this error +occurs. + +.. + +.. bpo: 38529 +.. date: 2019-12-05-16-13-25 +.. nonce: yvQgx3 +.. section: Library + +Drop too noisy asyncio warning about deletion of a stream without explicit +``.close()`` call. + +.. + +.. bpo: 27413 +.. date: 2019-12-05-02-02-58 +.. nonce: 212Th2 +.. section: Library + +Added ability to pass through ``ensure_ascii`` options to json.dumps in the +``json.tool`` command-line interface. + +.. + +.. bpo: 38634 +.. date: 2019-12-04-15-56-28 +.. nonce: pq0ZWa +.. section: Library + +The :mod:`readline` module now detects if Python is linked to libedit at +runtime on all platforms. Previously, the check was only done on macOS. + +.. + +.. bpo: 33684 +.. date: 2019-12-04-15-28-40 +.. nonce: QeSmQP +.. section: Library + +Fix ``json.tool`` failed to read a JSON file with non-ASCII characters when +locale encoding is not UTF-8. + +.. + +.. bpo: 38698 +.. date: 2019-12-02-10-35-19 +.. nonce: WZnAPQ +.. section: Library + +Prevent UnboundLocalError to pop up in parse_message_id + +parse_message_id() was improperly using a token defined inside an exception +handler, which was raising `UnboundLocalError` on parsing an invalid value. +Patch by Claudiu Popa. + +.. + +.. bpo: 38927 +.. date: 2019-11-27-17-47-00 +.. nonce: qT7xKY +.. section: Library + +Use ``python -m pip`` instead of ``pip`` to upgrade dependencies in venv. + +.. + +.. bpo: 26730 +.. date: 2019-11-27-16-30-02 +.. nonce: 56cdBn +.. section: Library + +Fix ``SpooledTemporaryFile.rollover()`` might corrupt the file when it is in +text mode. Patch by Serhiy Storchaka. + +.. + +.. bpo: 38881 +.. date: 2019-11-22-20-03-46 +.. nonce: 7HV1Q0 +.. section: Library + +random.choices() now raises a ValueError when all the weights are zero. + +.. + +.. bpo: 38876 +.. date: 2019-11-22-10-58-58 +.. nonce: qqy1Vp +.. section: Library + +Raise pickle.UnpicklingError when loading an item from memo for invalid +input + +The previous code was raising a `KeyError` for both the Python and C +implementation. This was caused by the specified index of an invalid input +which did not exist in the memo structure, where the pickle stores what +objects it has seen. The malformed input would have caused either a `BINGET` +or `LONG_BINGET` load from the memo, leading to a `KeyError` as the +determined index was bogus. Patch by Claudiu Popa + +.. + +.. bpo: 38668 +.. date: 2019-11-22-10-45-03 +.. nonce: iKx23z +.. section: Library + +Calling func:`shutil.copytree` to copy a directory tree from one directory +to another subdirectory resulted in an endless loop and a RecursionError. A +fix was added to consume an iterator and create the list of the entries to +be copied, avoiding the recursion for newly created directories. Patch by +Bruno P. Kinoshita. + +.. + +.. bpo: 38863 +.. date: 2019-11-21-16-30-00 +.. nonce: RkdTjf +.. section: Library + +Improve :func:`is_cgi` function in :mod:`http.server`, which enables +processing the case that cgi directory is a child of another directory other +than root. + +.. + +.. bpo: 37838 +.. date: 2019-11-21-11-39-17 +.. nonce: lRFcEC +.. section: Library + +:meth:`typing.get_type_hints` properly handles functions decorated with +:meth:`functools.wraps`. + +.. + +.. bpo: 38870 +.. date: 2019-11-20-22-43-48 +.. nonce: rLVZEv +.. section: Library + +Expose :func:`ast.unparse` as a function of the :mod:`ast` module that can +be used to unparse an :class:`ast.AST` object and produce a string with code +that would produce an equivalent :class:`ast.AST` object when parsed. Patch +by Pablo Galindo and Batuhan Taskaya. + +.. + +.. bpo: 38859 +.. date: 2019-11-19-16-30-46 +.. nonce: AZUzL8 +.. section: Library + +AsyncMock now returns StopAsyncIteration on the exaustion of a side_effects +iterable. Since PEP-479 its Impossible to raise a StopIteration exception +from a coroutine. + +.. + +.. bpo: 38857 +.. date: 2019-11-19-16-28-25 +.. nonce: YPUkU9 +.. section: Library + +AsyncMock fix for return values that are awaitable types. This also covers +side_effect iterable values that happend to be awaitable, and wraps +callables that return an awaitable type. Before these awaitables were being +awaited instead of being returned as is. + +.. + +.. bpo: 38834 +.. date: 2019-11-18-17-08-23 +.. nonce: abcdef +.. section: Library + +:class:`typing.TypedDict` subclasses now track which keys are optional using +the ``__required_keys__`` and ``__optional_keys__`` attributes, to enable +runtime validation by downstream projects. Patch by Zac Hatfield-Dodds. + +.. + +.. bpo: 38821 +.. date: 2019-11-16-23-26-25 +.. nonce: -albNN +.. section: Library + +Fix unhandled exceptions in :mod:`argparse` when internationalizing error +messages for arguments with ``nargs`` set to special (non-integer) values. +Patch by Federico Bond. + +.. + +.. bpo: 38820 +.. date: 2019-11-16-16-09-07 +.. nonce: ivhUSV +.. section: Library + +Make Python compatible with OpenSSL 3.0.0. :func:`ssl.SSLSocket.getpeercert` +no longer returns IPv6 addresses with a trailing new line. + +.. + +.. bpo: 38811 +.. date: 2019-11-15-18-06-04 +.. nonce: AmdQ6M +.. section: Library + +Fix an unhandled exception in :mod:`pathlib` when :meth:`os.link` is +missing. Patch by Toke H=C3=B8iland-J=C3=B8rgensen. + +.. + +.. bpo: 38686 +.. date: 2019-11-06-15-26-15 +.. nonce: HNFBce +.. section: Library + +Added support for multiple ``qop`` values in +:class:`urllib.request.AbstractDigestAuthHandler`. + +.. + +.. bpo: 38712 +.. date: 2019-11-05-21-10-12 +.. nonce: ezJ0TP +.. section: Library + +Add the Linux-specific :func:`signal.pidfd_send_signal` function, which +allows sending a signal to a process identified by a file descriptor rather +than a pid. + +.. + +.. bpo: 38348 +.. date: 2019-10-02-18-15-28 +.. nonce: _-5eq2 +.. section: Library + +Add ``-i`` and ``--indent`` (indentation level), and ``--no-type-comments`` +(type comments) command line options to ast parsing tool. + +.. + +.. bpo: 37523 +.. date: 2019-10-02-02-55-37 +.. nonce: GguwJ6 +.. section: Library + +Change :class:`zipfile.ZipExtFile` to raise ``ValueError`` when trying to +access the underlying file object after it has been closed. This new +behavior is consistent with how accessing closed files is handled in other +parts of Python. + +.. + +.. bpo: 38045 +.. date: 2019-09-30-12-09-41 +.. nonce: VDRtd3 +.. section: Library + +Improve the performance of :func:`enum._decompose` in :mod:`enum`. Patch by +hongweipeng. + +.. + +.. bpo: 36820 +.. date: 2019-05-06-15-34-17 +.. nonce: Eh5mIB +.. section: Library + +Break cycle generated when saving an exception in socket.py, codeop.py and +dyld.py as they keep alive not only the exception but user objects through +the ``__traceback__`` attribute. Patch by Mario Corchero. + +.. + +.. bpo: 36406 +.. date: 2019-03-24-12-12-27 +.. nonce: mCEkOl +.. section: Library + +Handle namespace packages in :mod:`doctest`. Patch by Karthikeyan +Singaravelan. + +.. + +.. bpo: 34776 +.. date: 2018-09-23-14-24-37 +.. nonce: 1SrQe3 +.. section: Library + +Fix dataclasses to support forward references in type annotations + +.. + +.. bpo: 20928 +.. date: 2018-03-30-16-18-12 +.. nonce: ieXu6I +.. section: Library + +ElementTree supports recursive XInclude processing. Patch by Stefan Behnel. + +.. + +.. bpo: 29636 +.. date: 2018-02-22-11-24-33 +.. nonce: ogGRE2 +.. section: Library + +Add whitespace options for formatting JSON with the ``json.tool`` CLI. The +following mutually exclusive options are now supported: ``--indent`` for +setting the indent level in spaces; ``--tab`` for indenting with tabs; +``--no-indent`` for suppressing newlines; and ``--compact`` for suppressing +all whitespace. The default behavior remains the same as ``--indent=3D4``. + +.. + +.. bpo: 38928 +.. date: 2019-11-27-17-51-27 +.. nonce: AfgvfO +.. section: Documentation + +Correct when venv's ``upgrade_dependencies()`` and ``--upgrade-deps`` are +added. + +.. + +.. bpo: 38899 +.. date: 2019-11-22-15-57-29 +.. nonce: 4aYPW2 +.. section: Documentation + +Update documentation to state that to activate virtual environments under +fish one should use `source`, not `.` as documented at +https://fishshell.com/docs/current/commands.html#source. + +.. + +.. bpo: 22377 +.. date: 2019-10-01-10-53-46 +.. nonce: 5ni-iC +.. section: Documentation + +Improves documentation of the values that :meth:`datetime.datetime.strptime` +accepts for ``%Z``. Patch by Karl Dubost. + +.. + +.. bpo: 38546 +.. date: 2019-12-18-14-52-08 +.. nonce: 2kxNuM +.. section: Tests + +Fix test_ressources_gced_in_workers() of test_concurrent_futures: explicitly +stop the manager to prevent leaking a child process running in the +background after the test completes. + +.. + +.. bpo: 38546 +.. date: 2019-12-17-15-27-07 +.. nonce: 82JwN2 +.. section: Tests + +Multiprocessing and concurrent.futures tests now stop the resource tracker +process when tests complete. + +.. + +.. bpo: 38614 +.. date: 2019-12-10-14-26-23 +.. nonce: 89JpNh +.. section: Tests + +Replace hardcoded timeout constants in tests with new :mod:`test.support` +constants: :data:`~test.support.LOOPBACK_TIMEOUT`, +:data:`~test.support.INTERNET_TIMEOUT`, :data:`~test.support.SHORT_TIMEOUT` +and :data:`~test.support.LONG_TIMEOUT`. It becomes easier to adjust these +four timeout constants for all tests at once, rather than having to adjust +every single test file. + +.. + +.. bpo: 38547 +.. date: 2019-12-09-11-32-34 +.. nonce: Juw54e +.. section: Tests + +Fix test_pty: if the process is the session leader, closing the master file +descriptor raises a SIGHUP signal: simply ignore SIGHUP when running the +tests. + +.. + +.. bpo: 38992 +.. date: 2019-12-08-15-11-06 +.. nonce: cVoHOZ +.. section: Tests + +Fix a test for :func:`math.fsum` that was failing due to constant folding. + +.. + +.. bpo: 38991 +.. date: 2019-12-07-00-52-09 +.. nonce: JE3_o- +.. section: Tests + +:mod:`test.support`: :func:`~test.support.run_python_until_end`, +:func:`~test.support.assert_python_ok` and +:func:`~test.support.assert_python_failure` functions no longer strip +whitespaces from stderr. Remove ``test.support.strip_python_stderr()`` +function. + +.. + +.. bpo: 38965 +.. date: 2019-12-04-17-08-55 +.. nonce: yqax3m +.. section: Tests + +Fix test_faulthandler on GCC 10. Use the "volatile" keyword in +``faulthandler._stack_overflow()`` to prevent tail call optimization on any +compiler, rather than relying on compiler specific pragma. + +.. + +.. bpo: 38875 +.. date: 2019-11-21-09-11-06 +.. nonce: wSZJal +.. section: Tests + +test_capi: trashcan tests now require the test "cpu" resource. + +.. + +.. bpo: 38841 +.. date: 2019-11-20-16-08-19 +.. nonce: 5F5Lbw +.. section: Tests + +Skip asyncio test_create_datagram_endpoint_existing_sock_unix on platforms +lacking a functional bind() for named unix domain sockets. + +.. + +.. bpo: 38692 +.. date: 2019-11-20-15-42-06 +.. nonce: aqAvyF +.. section: Tests + +Skip the test_posix.test_pidfd_open() test if ``os.pidfd_open()`` fails with +a :exc:`PermissionError`. This situation can happen in a Linux sandbox using +a syscall whitelist which doesn't allow the ``pidfd_open()`` syscall yet. + +.. + +.. bpo: 38839 +.. date: 2019-11-18-22-10-55 +.. nonce: di6tXv +.. section: Tests + +Fix some unused functions in tests. Patch by Adam Johnson. + +.. + +.. bpo: 38669 +.. date: 2019-11-04-02-54-16 +.. nonce: pazXZ8 +.. section: Tests + +Raise :exc:`TypeError` when passing target as a string with +:meth:`unittest.mock.patch.object`. + +.. + +.. bpo: 37957 +.. date: 2019-10-30-00-01-43 +.. nonce: X1r78F +.. section: Tests + +test.regrtest now can receive a list of test patterns to ignore (using the +-i/--ignore argument) or a file with a list of patterns to ignore (using the +--ignore-file argument). Patch by Pablo Galindo. + +.. + +.. bpo: 37404 +.. date: 2019-12-01-21-45-24 +.. nonce: cNsA7S +.. section: Build + +:mod:`asyncio` now raises :exc:`TyperError` when calling incompatible +methods with an :class:`ssl.SSLSocket` socket. Patch by Ido Michael. + +.. + +.. bpo: 36500 +.. date: 2019-04-02-01-59-26 +.. nonce: fyG6_U +.. section: Build + +Added an optional "regen" project to the Visual Studio solution that will +regenerate all grammar, tokens, and opcodes. + +.. + +.. bpo: 39007 +.. date: 2019-12-09-10-40-34 +.. nonce: vtarxo +.. section: Windows + +Add auditing events to functions in :mod:`winreg`. + +.. + +.. bpo: 33125 +.. date: 2019-11-14-08-57-50 +.. nonce: EN5MWS +.. section: Windows + +Add support for building and releasing Windows ARM64 packages. + +.. + +.. bpo: 37931 +.. date: 2019-08-23-12-14-34 +.. nonce: goYgQj +.. section: macOS + +Fixed a crash on OSX dynamic builds that occurred when re-initializing the +posix module after a Py_Finalize if the environment had changed since the +previous `import posix`. Patch by Beno=C3=AEt Hudson. + +.. + +.. bpo: 38944 +.. date: 2019-11-30-12-10-36 +.. nonce: _3xjKG +.. section: IDLE + +Excape key now closes IDLE completion windows. Patch by Johnny Najera. + +.. + +.. bpo: 38943 +.. date: 2019-11-29-23-44-11 +.. nonce: 8pUKKs +.. section: IDLE + +Fix IDLE autocomplete windows not always appearing on some systems. Patch by +Johnny Najera. + +.. + +.. bpo: 38862 +.. date: 2019-11-23-21-50-57 +.. nonce: KQ9A0m +.. section: IDLE + +'Strip Trailing Whitespace' on the Format menu removes extra newlines at the +end of non-shell files. + +.. + +.. bpo: 38636 +.. date: 2019-10-30-22-11-16 +.. nonce: hUhDeB +.. section: IDLE + +Fix IDLE Format menu tab toggle and file indent width. These functions +(default shortcuts Alt-T and Alt-U) were mistakenly disabled in 3.7.5 and +3.8.0. + +.. + +.. bpo: 38896 +.. date: 2019-11-22-19-43-43 +.. nonce: 6wvNMJ +.. section: C API + +Remove ``PyUnicode_ClearFreeList()`` function: the Unicode free list has +been removed in Python 3.3. + +.. + +.. bpo: 37340 +.. date: 2019-11-20-11-08-06 +.. nonce: JBQJMS +.. section: C API + +Remove ``PyMethod_ClearFreeList()`` and ``PyCFunction_ClearFreeList()`` +functions: the free lists of bound method objects have been removed. + +.. + +.. bpo: 38835 +.. date: 2019-11-18-15-38-23 +.. nonce: II8Szd +.. section: C API + +Exclude ``PyFPE_START_PROTECT()`` and ``PyFPE_END_PROTECT()`` macros of +``pyfpe.h`` from ``Py_LIMITED_API`` (stable API). diff --git a/Misc/NEWS.d/next/Build/2019-04-02-01-59-26.bpo-36500.fyG6_U.rst = b/Misc/NEWS.d/next/Build/2019-04-02-01-59-26.bpo-36500.fyG6_U.rst deleted file mode 100644 index cd230e4069e67..0000000000000 --- a/Misc/NEWS.d/next/Build/2019-04-02-01-59-26.bpo-36500.fyG6_U.rst +++ /dev/null @@ -1,2 +0,0 @@ -Added an optional "regen" project to the Visual Studio solution that will -regenerate all grammar, tokens, and opcodes. diff --git a/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst = b/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst deleted file mode 100644 index 067fc9d3f189d..0000000000000 --- a/Misc/NEWS.d/next/Build/2019-12-01-21-45-24.bpo-37404.cNsA7S.rst +++ /dev/null @@ -1,2 +0,0 @@ -:mod:`asyncio` now raises :exc:`TyperError` when calling incompatible methods -with an :class:`ssl.SSLSocket` socket. Patch by Ido Michael. diff --git a/Misc/NEWS.d/next/C API/2019-11-18-15-38-23.bpo-38835.II8Szd.rst = b/Misc/NEWS.d/next/C API/2019-11-18-15-38-23.bpo-38835.II8Szd.rst deleted file mode 100644 index 2bb84dc19b6ff..0000000000000 --- a/Misc/NEWS.d/next/C API/2019-11-18-15-38-23.bpo-38835.II8Szd.rst=09 +++ /dev/null @@ -1,2 +0,0 @@ -Exclude ``PyFPE_START_PROTECT()`` and ``PyFPE_END_PROTECT()`` macros of -``pyfpe.h`` from ``Py_LIMITED_API`` (stable API). diff --git a/Misc/NEWS.d/next/C API/2019-11-20-11-08-06.bpo-37340.JBQJMS.rst = b/Misc/NEWS.d/next/C API/2019-11-20-11-08-06.bpo-37340.JBQJMS.rst deleted file mode 100644 index 8ffa4eb12bd4e..0000000000000 --- a/Misc/NEWS.d/next/C API/2019-11-20-11-08-06.bpo-37340.JBQJMS.rst=09 +++ /dev/null @@ -1,2 +0,0 @@ -Remove ``PyMethod_ClearFreeList()`` and ``PyCFunction_ClearFreeList()`` -functions: the free lists of bound method objects have been removed. diff --git a/Misc/NEWS.d/next/C API/2019-11-22-19-43-43.bpo-38896.6wvNMJ.rst = b/Misc/NEWS.d/next/C API/2019-11-22-19-43-43.bpo-38896.6wvNMJ.rst deleted file mode 100644 index c5e108d769312..0000000000000 --- a/Misc/NEWS.d/next/C API/2019-11-22-19-43-43.bpo-38896.6wvNMJ.rst=09 +++ /dev/null @@ -1,2 +0,0 @@ -Remove ``PyUnicode_ClearFreeList()`` function: the Unicode free list has -been removed in Python 3.3. diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-03-13-14-46-03.bpo-32949= .v821M7.rst b/Misc/NEWS.d/next/Core and Builtins/2018-03-13-14-46-03.bpo-3294= 9.v821M7.rst deleted file mode 100644 index 16b3058ee68bb..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2018-03-13-14-46-03.bpo-32949.v821M7= .rst=09 +++ /dev/null @@ -1,5 +0,0 @@ -Removed WITH_CLEANUP_START, WITH_CLEANUP_FINISH, BEGIN_FINALLY, END_FINALLY,= CALL_FINALLY and POP_FINALLY bytecodes. -Replaced with RERAISE and WITH_EXCEPT_FINISH bytecodes. -The compiler now generates different code for exceptional and non-exceptiona= l branches for 'with' and 'try-except' -statements. For 'try-finally' statements the 'finally' block is replicated f= or each exit from the 'try' body. - diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-07-13-18-01-13.bpo-35409= .ozbcsR.rst b/Misc/NEWS.d/next/Core and Builtins/2019-07-13-18-01-13.bpo-3540= 9.ozbcsR.rst deleted file mode 100644 index 0f35a91ec74e6..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-07-13-18-01-13.bpo-35409.ozbcsR= .rst=09 +++ /dev/null @@ -1,2 +0,0 @@ -Ignore GeneratorExit exceptions when throwing an exception into the aclose -coroutine of an asynchronous generator. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-09-03-19-16-57.bpo-38021= .KnUhdB.rst b/Misc/NEWS.d/next/Core and Builtins/2019-09-03-19-16-57.bpo-3802= 1.KnUhdB.rst deleted file mode 100644 index d971647c21eae..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-09-03-19-16-57.bpo-38021.KnUhdB= .rst=09 +++ /dev/null @@ -1,4 +0,0 @@ -Provide a platform tag for AIX that is sufficient for PEP425 binary -distribution identification. - -Patch by Michael Felt diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-09-06-16-40-12.bpo-27145= .njuCXU.rst b/Misc/NEWS.d/next/Core and Builtins/2019-09-06-16-40-12.bpo-2714= 5.njuCXU.rst deleted file mode 100644 index 229753a3730c1..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-09-06-16-40-12.bpo-27145.njuCXU= .rst=09 +++ /dev/null @@ -1 +0,0 @@ -int + int and int - int operators can now return small integer singletons. P= atch by hongweipeng. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-10-29-17-11-15.bpo-38629= .3qinhF.rst b/Misc/NEWS.d/next/Core and Builtins/2019-10-29-17-11-15.bpo-3862= 9.3qinhF.rst deleted file mode 100644 index dadafcd898af5..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-10-29-17-11-15.bpo-38629.3qinhF= .rst=09 +++ /dev/null @@ -1 +0,0 @@ -Added ``__floor__`` and ``__ceil__`` methods to float object. Patch by Batuh= an Ta=C5=9Fkaya. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-08-00-36-10.bpo-38707= .SZL036.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-08-00-36-10.bpo-3870= 7.SZL036.rst deleted file mode 100644 index 4ef9ed81931b7..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-11-08-00-36-10.bpo-38707.SZL036= .rst=09 +++ /dev/null @@ -1 +0,0 @@ -``MainThread.native_id`` is now correctly reset in child processes spawned u= sing :class:`multiprocessing.Process`, instead of retaining the parent's valu= e. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-11-23-44-15.bpo-38328= .IFrrjq.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-11-23-44-15.bpo-3832= 8.IFrrjq.rst deleted file mode 100644 index e0c5ca7bfe891..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-11-11-23-44-15.bpo-38328.IFrrjq= .rst=09 +++ /dev/null @@ -1,2 +0,0 @@ -Sped up the creation time of constant :class:`list` and :class:`set` display= s. -Patch by Brandt Bucher. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-18-16-37-49.bpo-38835= .-U4se1.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-18-16-37-49.bpo-3883= 5.-U4se1.rst deleted file mode 100644 index edc70b137ba9f..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-11-18-16-37-49.bpo-38835.-U4se1= .rst=09 +++ /dev/null @@ -1,2 +0,0 @@ -The ``PyFPE_START_PROTECT()`` and ``PyFPE_END_PROTECT()`` macros are empty: -they have been doing nothing for the last year, so stop using them. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-20-12-01-37.bpo-36854= .Zga_md.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-20-12-01-37.bpo-3685= 4.Zga_md.rst deleted file mode 100644 index 2b4d5b3bc8590..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-11-20-12-01-37.bpo-36854.Zga_md= .rst=09 +++ /dev/null @@ -1,3 +0,0 @@ -The garbage collector state becomes per interpreter -(``PyInterpreterState.gc``), rather than being global -(``_PyRuntimeState.gc``). diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-21-09-02-49.bpo-38858= .bDLH04.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-21-09-02-49.bpo-3885= 8.bDLH04.rst deleted file mode 100644 index e489c947f97c5..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-11-21-09-02-49.bpo-38858.bDLH04= .rst=09 +++ /dev/null @@ -1,5 +0,0 @@ -Each Python subinterpreter now has its own "small integer singletons": -numbers in [-5; 257] range. It is no longer possible to change the number of -small integers at build time by overriding ``NSMALLNEGINTS`` and -``NSMALLPOSINTS`` macros: macros should now be modified manually in -``pycore_pystate.h`` header file. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-22-09-55-21.bpo-38852= .y7oPEa.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-22-09-55-21.bpo-3885= 2.y7oPEa.rst deleted file mode 100644 index 915a936aae2d3..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-11-22-09-55-21.bpo-38852.y7oPEa= .rst=09 +++ /dev/null @@ -1 +0,0 @@ -Set the thread stack size to 8 Mb for debug builds on android platforms. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-22-22-18-50.bpo-38892= .LS586s.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-22-22-18-50.bpo-3889= 2.LS586s.rst deleted file mode 100644 index 5df67dcbfeac9..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-11-22-22-18-50.bpo-38892.LS586s= .rst=09 +++ /dev/null @@ -1 +0,0 @@ -Improve documentation for audit events table and functions. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-26-09-16-47.bpo-38920= .Vx__sT.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-26-09-16-47.bpo-3892= 0.Vx__sT.rst deleted file mode 100644 index 2e9e443dd999b..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-11-26-09-16-47.bpo-38920.Vx__sT= .rst=09 +++ /dev/null @@ -1,2 +0,0 @@ -Add audit hooks for when :func:`sys.excepthook` and -:func:`sys.unraisablehook` are invoked diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-26-12-20-34.bpo-38922= .i6ja-i.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-26-12-20-34.bpo-3892= 2.i6ja-i.rst deleted file mode 100644 index a7af652e5a5bd..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-11-26-12-20-34.bpo-38922.i6ja-i= .rst=09 +++ /dev/null @@ -1,2 +0,0 @@ -Calling ``replace`` on a code object now raises the ``code.__new__`` audit -event. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673= .K_Tze-.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-3867= 3.K_Tze-.rst deleted file mode 100644 index 8f8cf88e5e210..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-12-01-00-17-44.bpo-38673.K_Tze-= .rst=09 +++ /dev/null @@ -1 +0,0 @@ -In REPL mode, don't switch to PS2 if the line starts with comment or whitesp= ace. Based on work by Batuhan Ta=C5=9Fkaya. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008= .Rrp6f1.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-3900= 8.Rrp6f1.rst deleted file mode 100644 index 35237ce2714a0..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-12-09-10-38-51.bpo-39008.Rrp6f1= .rst=09 +++ /dev/null @@ -1,3 +0,0 @@ -:c:func:`PySys_Audit` now requires ``Py_ssize_t`` to be used for size -arguments in the format string, regardless of whethen ``PY_SSIZE_T_CLEAN`` -was defined at include time. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-09-17-05-53.bpo-20443= .8OyT5P.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-09-17-05-53.bpo-2044= 3.8OyT5P.rst deleted file mode 100644 index d3855f293b9f0..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-12-09-17-05-53.bpo-20443.8OyT5P= .rst=09 +++ /dev/null @@ -1,3 +0,0 @@ -In Python 3.9.0a1, sys.argv[0] was made an asolute path if a filename was -specified on the command line. Revert this change, since most users expect -sys.argv to be unmodified. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031= .imlCYZ.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-3903= 1.imlCYZ.rst deleted file mode 100644 index 738902ce907ad..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-12-12-21-05-43.bpo-39031.imlCYZ= .rst=09 +++ /dev/null @@ -1,2 +0,0 @@ -When parsing an "elif" node, lineno and col_offset of the node now point to = the "elif" keyword and not to its condition, making it consistent with the "i= f" node. -Patch by Lysandros Nikolaou. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-17-21-45-36.bpo-39080= .OrxEVS.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-17-21-45-36.bpo-3908= 0.OrxEVS.rst deleted file mode 100644 index b120d496b81e0..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-12-17-21-45-36.bpo-39080.OrxEVS= .rst=09 +++ /dev/null @@ -1 +0,0 @@ -Fix the value of *end_col_offset* for Starred Expression AST nodes when they= are among the elements in the *args* attribute of Call AST nodes. diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-17-23-20-51.bpo-39028= .SND4TB.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-17-23-20-51.bpo-3902= 8.SND4TB.rst deleted file mode 100644 index ee7639ead9dd9..0000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2019-12-17-23-20-51.bpo-39028.SND4TB= .rst=09 +++ /dev/null @@ -1 +0,0 @@ -Slightly improve the speed of keyword argument parsing with many kwargs by s= trengthening the assumption that kwargs are interned strings. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Documentation/2019-10-01-10-53-46.bpo-22377.5ni= -iC.rst b/Misc/NEWS.d/next/Documentation/2019-10-01-10-53-46.bpo-22377.5ni-iC= .rst deleted file mode 100644 index d2943f75a8436..0000000000000 --- a/Misc/NEWS.d/next/Documentation/2019-10-01-10-53-46.bpo-22377.5ni-iC.rst +++ /dev/null @@ -1,2 +0,0 @@ -Improves documentation of the values that :meth:`datetime.datetime.strptime`= accepts for ``%Z``. -Patch by Karl Dubost. diff --git a/Misc/NEWS.d/next/Documentation/2019-11-22-15-57-29.bpo-38899.4aY= PW2.rst b/Misc/NEWS.d/next/Documentation/2019-11-22-15-57-29.bpo-38899.4aYPW2= .rst deleted file mode 100644 index 4ee178bfb1b3a..0000000000000 --- a/Misc/NEWS.d/next/Documentation/2019-11-22-15-57-29.bpo-38899.4aYPW2.rst +++ /dev/null @@ -1,3 +0,0 @@ -Update documentation to state that to activate virtual environments under -fish one should use `source`, not `.` as documented at -https://fishshell.com/docs/current/commands.html#source. diff --git a/Misc/NEWS.d/next/Documentation/2019-11-27-17-51-27.bpo-38928.Afg= vfO.rst b/Misc/NEWS.d/next/Documentation/2019-11-27-17-51-27.bpo-38928.AfgvfO= .rst deleted file mode 100644 index 952d4a8664d33..0000000000000 --- a/Misc/NEWS.d/next/Documentation/2019-11-27-17-51-27.bpo-38928.AfgvfO.rst +++ /dev/null @@ -1,2 +0,0 @@ -Correct when venv's ``upgrade_dependencies()`` and ``--upgrade-deps`` are -added. diff --git a/Misc/NEWS.d/next/IDLE/2019-10-30-22-11-16.bpo-38636.hUhDeB.rst b= /Misc/NEWS.d/next/IDLE/2019-10-30-22-11-16.bpo-38636.hUhDeB.rst deleted file mode 100644 index 4262dbea6d867..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-10-30-22-11-16.bpo-38636.hUhDeB.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix IDLE Format menu tab toggle and file indent width. These functions -(default shortcuts Alt-T and Alt-U) were mistakenly disabled in 3.7.5 -and 3.8.0. diff --git a/Misc/NEWS.d/next/IDLE/2019-11-23-21-50-57.bpo-38862.KQ9A0m.rst b= /Misc/NEWS.d/next/IDLE/2019-11-23-21-50-57.bpo-38862.KQ9A0m.rst deleted file mode 100644 index 14bab9e854bdc..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-11-23-21-50-57.bpo-38862.KQ9A0m.rst +++ /dev/null @@ -1,2 +0,0 @@ -'Strip Trailing Whitespace' on the Format menu removes extra newlines -at the end of non-shell files. diff --git a/Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst b= /Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst deleted file mode 100644 index 5c9323e246787..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-11-29-23-44-11.bpo-38943.8pUKKs.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix IDLE autocomplete windows not always appearing on some systems. -Patch by Johnny Najera. diff --git a/Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst b= /Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst deleted file mode 100644 index 38084fafd2f56..0000000000000 --- a/Misc/NEWS.d/next/IDLE/2019-11-30-12-10-36.bpo-38944._3xjKG.rst +++ /dev/null @@ -1 +0,0 @@ -Excape key now closes IDLE completion windows. Patch by Johnny Najera. diff --git a/Misc/NEWS.d/next/Library/2018-02-22-11-24-33.bpo-29636.ogGRE2.rs= t b/Misc/NEWS.d/next/Library/2018-02-22-11-24-33.bpo-29636.ogGRE2.rst deleted file mode 100644 index 9f96ed28f927f..0000000000000 --- a/Misc/NEWS.d/next/Library/2018-02-22-11-24-33.bpo-29636.ogGRE2.rst +++ /dev/null @@ -1,5 +0,0 @@ -Add whitespace options for formatting JSON with the ``json.tool`` CLI. The -following mutually exclusive options are now supported: ``--indent`` for -setting the indent level in spaces; ``--tab`` for indenting with tabs; -``--no-indent`` for suppressing newlines; and ``--compact`` for suppressing -all whitespace. The default behavior remains the same as ``--indent=3D4``. diff --git a/Misc/NEWS.d/next/Library/2018-03-30-16-18-12.bpo-20928.ieXu6I.rs= t b/Misc/NEWS.d/next/Library/2018-03-30-16-18-12.bpo-20928.ieXu6I.rst deleted file mode 100644 index 2585400907799..0000000000000 --- a/Misc/NEWS.d/next/Library/2018-03-30-16-18-12.bpo-20928.ieXu6I.rst +++ /dev/null @@ -1 +0,0 @@ -ElementTree supports recursive XInclude processing. Patch by Stefan Behnel. diff --git a/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rs= t b/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst deleted file mode 100644 index 815a4876e0b4a..0000000000000 --- a/Misc/NEWS.d/next/Library/2018-09-23-14-24-37.bpo-34776.1SrQe3.rst +++ /dev/null @@ -1 +0,0 @@ -Fix dataclasses to support forward references in type annotations diff --git a/Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rs= t b/Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst deleted file mode 100644 index 3d81eb50418b0..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-03-24-12-12-27.bpo-36406.mCEkOl.rst +++ /dev/null @@ -1 +0,0 @@ -Handle namespace packages in :mod:`doctest`. Patch by Karthikeyan Singaravel= an. diff --git a/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rs= t b/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst deleted file mode 100644 index 82f6635c81582..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-05-06-15-34-17.bpo-36820.Eh5mIB.rst +++ /dev/null @@ -1,3 +0,0 @@ -Break cycle generated when saving an exception in socket.py, codeop.py and -dyld.py as they keep alive not only the exception but user objects through -the ``__traceback__`` attribute. Patch by Mario Corchero. diff --git a/Misc/NEWS.d/next/Library/2019-09-30-12-09-41.bpo-38045.VDRtd3.rs= t b/Misc/NEWS.d/next/Library/2019-09-30-12-09-41.bpo-38045.VDRtd3.rst deleted file mode 100644 index e7e515f5c2511..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-09-30-12-09-41.bpo-38045.VDRtd3.rst +++ /dev/null @@ -1 +0,0 @@ -Improve the performance of :func:`enum._decompose` in :mod:`enum`. Patch by = hongweipeng. diff --git a/Misc/NEWS.d/next/Library/2019-10-02-02-55-37.bpo-37523.GguwJ6.rs= t b/Misc/NEWS.d/next/Library/2019-10-02-02-55-37.bpo-37523.GguwJ6.rst deleted file mode 100644 index 5711969ff38cf..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-10-02-02-55-37.bpo-37523.GguwJ6.rst +++ /dev/null @@ -1 +0,0 @@ -Change :class:`zipfile.ZipExtFile` to raise ``ValueError`` when trying to ac= cess the underlying file object after it has been closed. This new behavior i= s consistent with how accessing closed files is handled in other parts of Pyt= hon. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Library/2019-10-02-18-15-28.bpo-38348._-5eq2.rs= t b/Misc/NEWS.d/next/Library/2019-10-02-18-15-28.bpo-38348._-5eq2.rst deleted file mode 100644 index 5ca72dea97702..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-10-02-18-15-28.bpo-38348._-5eq2.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add ``-i`` and ``--indent`` (indentation level), and ``--no-type-comments`` -(type comments) command line options to ast parsing tool. diff --git a/Misc/NEWS.d/next/Library/2019-11-05-21-10-12.bpo-38712.ezJ0TP.rs= t b/Misc/NEWS.d/next/Library/2019-11-05-21-10-12.bpo-38712.ezJ0TP.rst deleted file mode 100644 index 81d01aa7111d4..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-05-21-10-12.bpo-38712.ezJ0TP.rst +++ /dev/null @@ -1,3 +0,0 @@ -Add the Linux-specific :func:`signal.pidfd_send_signal` function, which -allows sending a signal to a process identified by a file descriptor rather -than a pid. diff --git a/Misc/NEWS.d/next/Library/2019-11-06-15-26-15.bpo-38686.HNFBce.rs= t b/Misc/NEWS.d/next/Library/2019-11-06-15-26-15.bpo-38686.HNFBce.rst deleted file mode 100644 index 7a419ff1e3338..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-06-15-26-15.bpo-38686.HNFBce.rst +++ /dev/null @@ -1 +0,0 @@ -Added support for multiple ``qop`` values in :class:`urllib.request.Abstract= DigestAuthHandler`. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Library/2019-11-15-18-06-04.bpo-38811.AmdQ6M.rs= t b/Misc/NEWS.d/next/Library/2019-11-15-18-06-04.bpo-38811.AmdQ6M.rst deleted file mode 100644 index 0e4a7f5bdf538..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-15-18-06-04.bpo-38811.AmdQ6M.rst +++ /dev/null @@ -1 +0,0 @@ -Fix an unhandled exception in :mod:`pathlib` when :meth:`os.link` is missing= . Patch by Toke H=C3=B8iland-J=C3=B8rgensen. diff --git a/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rs= t b/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst deleted file mode 100644 index 2c6a6e853c25f..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-16-16-09-07.bpo-38820.ivhUSV.rst +++ /dev/null @@ -1,2 +0,0 @@ -Make Python compatible with OpenSSL 3.0.0. :func:`ssl.SSLSocket.getpeercert` -no longer returns IPv6 addresses with a trailing new line. diff --git a/Misc/NEWS.d/next/Library/2019-11-16-23-26-25.bpo-38821.-albNN.rs= t b/Misc/NEWS.d/next/Library/2019-11-16-23-26-25.bpo-38821.-albNN.rst deleted file mode 100644 index 2e7a22f661ac6..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-16-23-26-25.bpo-38821.-albNN.rst +++ /dev/null @@ -1 +0,0 @@ -Fix unhandled exceptions in :mod:`argparse` when internationalizing error me= ssages for arguments with ``nargs`` set to special (non-integer) values. Pat= ch by Federico Bond. diff --git a/Misc/NEWS.d/next/Library/2019-11-18-17-08-23.bpo-38834.abcdef.rs= t b/Misc/NEWS.d/next/Library/2019-11-18-17-08-23.bpo-38834.abcdef.rst deleted file mode 100644 index af108b1efbc3b..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-18-17-08-23.bpo-38834.abcdef.rst +++ /dev/null @@ -1,3 +0,0 @@ -:class:`typing.TypedDict` subclasses now track which keys are optional using -the ``__required_keys__`` and ``__optional_keys__`` attributes, to enable -runtime validation by downstream projects. Patch by Zac Hatfield-Dodds. diff --git a/Misc/NEWS.d/next/Library/2019-11-19-16-28-25.bpo-38857.YPUkU9.rs= t b/Misc/NEWS.d/next/Library/2019-11-19-16-28-25.bpo-38857.YPUkU9.rst deleted file mode 100644 index f28df2811fb78..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-19-16-28-25.bpo-38857.YPUkU9.rst +++ /dev/null @@ -1,4 +0,0 @@ -AsyncMock fix for return values that are awaitable types. This also covers -side_effect iterable values that happend to be awaitable, and wraps -callables that return an awaitable type. Before these awaitables were being -awaited instead of being returned as is. diff --git a/Misc/NEWS.d/next/Library/2019-11-19-16-30-46.bpo-38859.AZUzL8.rs= t b/Misc/NEWS.d/next/Library/2019-11-19-16-30-46.bpo-38859.AZUzL8.rst deleted file mode 100644 index c059539a1de60..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-19-16-30-46.bpo-38859.AZUzL8.rst +++ /dev/null @@ -1,3 +0,0 @@ -AsyncMock now returns StopAsyncIteration on the exaustion of a side_effects -iterable. Since PEP-479 its Impossible to raise a StopIteration exception -from a coroutine. diff --git a/Misc/NEWS.d/next/Library/2019-11-20-22-43-48.bpo-38870.rLVZEv.rs= t b/Misc/NEWS.d/next/Library/2019-11-20-22-43-48.bpo-38870.rLVZEv.rst deleted file mode 100644 index 61af368ba556f..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-20-22-43-48.bpo-38870.rLVZEv.rst +++ /dev/null @@ -1,4 +0,0 @@ -Expose :func:`ast.unparse` as a function of the :mod:`ast` module that can -be used to unparse an :class:`ast.AST` object and produce a string with code -that would produce an equivalent :class:`ast.AST` object when parsed. Patch -by Pablo Galindo and Batuhan Taskaya. diff --git a/Misc/NEWS.d/next/Library/2019-11-21-11-39-17.bpo-37838.lRFcEC.rs= t b/Misc/NEWS.d/next/Library/2019-11-21-11-39-17.bpo-37838.lRFcEC.rst deleted file mode 100644 index 96d804addeb60..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-21-11-39-17.bpo-37838.lRFcEC.rst +++ /dev/null @@ -1 +0,0 @@ -:meth:`typing.get_type_hints` properly handles functions decorated with :met= h:`functools.wraps`. diff --git a/Misc/NEWS.d/next/Library/2019-11-21-16-30-00.bpo-38863.RkdTjf.rs= t b/Misc/NEWS.d/next/Library/2019-11-21-16-30-00.bpo-38863.RkdTjf.rst deleted file mode 100644 index 6b621eeea2fb6..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-21-16-30-00.bpo-38863.RkdTjf.rst +++ /dev/null @@ -1,2 +0,0 @@ -Improve :func:`is_cgi` function in :mod:`http.server`, which enables process= ing -the case that cgi directory is a child of another directory other than root. diff --git a/Misc/NEWS.d/next/Library/2019-11-22-10-45-03.bpo-38668.iKx23z.rs= t b/Misc/NEWS.d/next/Library/2019-11-22-10-45-03.bpo-38668.iKx23z.rst deleted file mode 100644 index 28b82ab1619e3..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-22-10-45-03.bpo-38668.iKx23z.rst +++ /dev/null @@ -1,5 +0,0 @@ -Calling func:`shutil.copytree` to copy a directory tree from one directory -to another subdirectory resulted in an endless loop and a RecursionError. A -fix was added to consume an iterator and create the list of the entries to -be copied, avoiding the recursion for newly created directories. Patch by -Bruno P. Kinoshita. diff --git a/Misc/NEWS.d/next/Library/2019-11-22-10-58-58.bpo-38876.qqy1Vp.rs= t b/Misc/NEWS.d/next/Library/2019-11-22-10-58-58.bpo-38876.qqy1Vp.rst deleted file mode 100644 index 43b25acc39d2e..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-22-10-58-58.bpo-38876.qqy1Vp.rst +++ /dev/null @@ -1,9 +0,0 @@ -Raise pickle.UnpicklingError when loading an item from memo for invalid -input - -The previous code was raising a `KeyError` for both the Python and C -implementation. This was caused by the specified index of an invalid input -which did not exist in the memo structure, where the pickle stores what -objects it has seen. The malformed input would have caused either a `BINGET` -or `LONG_BINGET` load from the memo, leading to a `KeyError` as the -determined index was bogus. Patch by Claudiu Popa diff --git a/Misc/NEWS.d/next/Library/2019-11-22-20-03-46.bpo-38881.7HV1Q0.rs= t b/Misc/NEWS.d/next/Library/2019-11-22-20-03-46.bpo-38881.7HV1Q0.rst deleted file mode 100644 index 9f4a27db4524f..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-22-20-03-46.bpo-38881.7HV1Q0.rst +++ /dev/null @@ -1 +0,0 @@ -random.choices() now raises a ValueError when all the weights are zero. diff --git a/Misc/NEWS.d/next/Library/2019-11-27-16-30-02.bpo-26730.56cdBn.rs= t b/Misc/NEWS.d/next/Library/2019-11-27-16-30-02.bpo-26730.56cdBn.rst deleted file mode 100644 index a92b90a495605..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-27-16-30-02.bpo-26730.56cdBn.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix ``SpooledTemporaryFile.rollover()`` might corrupt the file when it is in -text mode. Patch by Serhiy Storchaka. diff --git a/Misc/NEWS.d/next/Library/2019-11-27-17-47-00.bpo-38927.qT7xKY.rs= t b/Misc/NEWS.d/next/Library/2019-11-27-17-47-00.bpo-38927.qT7xKY.rst deleted file mode 100644 index ca6ed63e5ccc1..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-11-27-17-47-00.bpo-38927.qT7xKY.rst +++ /dev/null @@ -1 +0,0 @@ -Use ``python -m pip`` instead of ``pip`` to upgrade dependencies in venv. diff --git a/Misc/NEWS.d/next/Library/2019-12-02-10-35-19.bpo-38698.WZnAPQ.rs= t b/Misc/NEWS.d/next/Library/2019-12-02-10-35-19.bpo-38698.WZnAPQ.rst deleted file mode 100644 index e606acb5dcf57..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-02-10-35-19.bpo-38698.WZnAPQ.rst +++ /dev/null @@ -1,5 +0,0 @@ -Prevent UnboundLocalError to pop up in parse_message_id - -parse_message_id() was improperly using a token defined inside an exception -handler, which was raising `UnboundLocalError` on parsing an invalid value. -Patch by Claudiu Popa. diff --git a/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rs= t b/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst deleted file mode 100644 index 107f9bb008330..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-04-15-28-40.bpo-33684.QeSmQP.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix ``json.tool`` failed to read a JSON file with non-ASCII characters when -locale encoding is not UTF-8. diff --git a/Misc/NEWS.d/next/Library/2019-12-04-15-56-28.bpo-38634.pq0ZWa.rs= t b/Misc/NEWS.d/next/Library/2019-12-04-15-56-28.bpo-38634.pq0ZWa.rst deleted file mode 100644 index d60c3172c2e51..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-04-15-56-28.bpo-38634.pq0ZWa.rst +++ /dev/null @@ -1,2 +0,0 @@ -The :mod:`readline` module now detects if Python is linked to libedit at run= time -on all platforms. Previously, the check was only done on macOS. diff --git a/Misc/NEWS.d/next/Library/2019-12-05-02-02-58.bpo-27413.212Th2.rs= t b/Misc/NEWS.d/next/Library/2019-12-05-02-02-58.bpo-27413.212Th2.rst deleted file mode 100644 index 0116b8c2813f5..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-05-02-02-58.bpo-27413.212Th2.rst +++ /dev/null @@ -1,2 +0,0 @@ -Added ability to pass through ``ensure_ascii`` options to json.dumps in the -``json.tool`` command-line interface. diff --git a/Misc/NEWS.d/next/Library/2019-12-05-16-13-25.bpo-38529.yvQgx3.rs= t b/Misc/NEWS.d/next/Library/2019-12-05-16-13-25.bpo-38529.yvQgx3.rst deleted file mode 100644 index c688926b4a49b..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-05-16-13-25.bpo-38529.yvQgx3.rst +++ /dev/null @@ -1,2 +0,0 @@ -Drop too noisy asyncio warning about deletion of a stream without explicit -``.close()`` call. diff --git a/Misc/NEWS.d/next/Library/2019-12-05-18-21-26.bpo-38982.W3u-03.rs= t b/Misc/NEWS.d/next/Library/2019-12-05-18-21-26.bpo-38982.W3u-03.rst deleted file mode 100644 index b591209ea06ef..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-05-18-21-26.bpo-38982.W3u-03.rst +++ /dev/null @@ -1,5 +0,0 @@ -Fix asyncio ``PidfdChildWatcher``: handle ``waitpid()`` error. If -``waitpid()`` is called elsewhere, ``waitpid()`` call fails with -:exc:`ChildProcessError`: use return code 255 in this case, and log a -warning. It ensures that the pidfd file descriptor is closed if this error -occurs. diff --git a/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rs= t b/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst deleted file mode 100644 index 777535299be17..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst +++ /dev/null @@ -1,2 +0,0 @@ -Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python -version. diff --git a/Misc/NEWS.d/next/Library/2019-12-06-18-47-56.bpo-38916.K-raU8.rs= t b/Misc/NEWS.d/next/Library/2019-12-06-18-47-56.bpo-38916.K-raU8.rst deleted file mode 100644 index cb4c4c03c128a..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-06-18-47-56.bpo-38916.K-raU8.rst +++ /dev/null @@ -1,3 +0,0 @@ -:class:`array.array`: Remove ``tostring()`` and ``fromstring()`` methods. -They were aliases to ``tobytes()`` and ``frombytes()``, deprecated since -Python 3.2. diff --git a/Misc/NEWS.d/next/Library/2019-12-07-13-40-52.bpo-38978.R3gHZI.rs= t b/Misc/NEWS.d/next/Library/2019-12-07-13-40-52.bpo-38978.R3gHZI.rst deleted file mode 100644 index 8b2eab0d52acf..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-07-13-40-52.bpo-38978.R3gHZI.rst +++ /dev/null @@ -1,2 +0,0 @@ -Implement ``__class_getitem__`` on asyncio objects (Future, Task, Queue). -Patch by Batuhan Taskaya. diff --git a/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rs= t b/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst deleted file mode 100644 index 6a91a12e4930a..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-07-16-32-42.bpo-38979.q0sIHy.rst +++ /dev/null @@ -1 +0,0 @@ -Return class from ``ContextVar.__class_getitem__`` to simplify subclassing. diff --git a/Misc/NEWS.d/next/Library/2019-12-07-18-58-44.bpo-38994.IJYhz_.rs= t b/Misc/NEWS.d/next/Library/2019-12-07-18-58-44.bpo-38994.IJYhz_.rst deleted file mode 100644 index b9cb4176350cb..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-07-18-58-44.bpo-38994.IJYhz_.rst +++ /dev/null @@ -1 +0,0 @@ -Implement ``__class_getitem__`` for ``os.PathLike``, ``pathlib.Path`` diff --git a/Misc/NEWS.d/next/Library/2019-12-07-21-49-50.bpo-38698.HxoSym.rs= t b/Misc/NEWS.d/next/Library/2019-12-07-21-49-50.bpo-38698.HxoSym.rst deleted file mode 100644 index b930dea0fa7bc..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-07-21-49-50.bpo-38698.HxoSym.rst +++ /dev/null @@ -1,3 +0,0 @@ -Add a new ``InvalidMessageID`` token to email parser to represent invalid -Message-ID headers. Also, add defects when there is remaining value after -parsing the header. diff --git a/Misc/NEWS.d/next/Library/2019-12-07-22-25-39.bpo-38708.rZTUfk.rs= t b/Misc/NEWS.d/next/Library/2019-12-07-22-25-39.bpo-38708.rZTUfk.rst deleted file mode 100644 index 23a0a46d1fea1..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-07-22-25-39.bpo-38708.rZTUfk.rst +++ /dev/null @@ -1 +0,0 @@ -Fix a potential IndexError in email parser when parsing an empty msg-id. diff --git a/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rs= t b/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst deleted file mode 100644 index 8402845a5a047..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-09-14-40-09.bpo-39006.v4VsPg.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix asyncio when the ssl module is missing: only check for ssl.SSLSocket -instance if the ssl module is available. diff --git a/Misc/NEWS.d/next/Library/2019-12-10-23-34-48.bpo-39022.QDtIxI.rs= t b/Misc/NEWS.d/next/Library/2019-12-10-23-34-48.bpo-39022.QDtIxI.rst deleted file mode 100644 index 4af21be607426..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-10-23-34-48.bpo-39022.QDtIxI.rst +++ /dev/null @@ -1 +0,0 @@ -Update importliib.metadata to include improvements from importlib_metadata 1= .3 including better serialization of EntryPoints and improved documentation f= or custom finders. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Library/2019-12-13-18-54-49.bpo-39033.cepuyD.rs= t b/Misc/NEWS.d/next/Library/2019-12-13-18-54-49.bpo-39033.cepuyD.rst deleted file mode 100644 index 3dee3c08cc5be..0000000000000 --- a/Misc/NEWS.d/next/Library/2019-12-13-18-54-49.bpo-39033.cepuyD.rst +++ /dev/null @@ -1 +0,0 @@ -Fix :exc:`NameError` in :mod:`zipimport`. Patch by Karthikeyan Singaravelan. diff --git a/Misc/NEWS.d/next/Security/2019-11-15-00-54-42.bpo-38804.vjbM8V.r= st b/Misc/NEWS.d/next/Security/2019-11-15-00-54-42.bpo-38804.vjbM8V.rst deleted file mode 100644 index 1f45142d9f743..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-11-15-00-54-42.bpo-38804.vjbM8V.rst +++ /dev/null @@ -1 +0,0 @@ -Fixes a ReDoS vulnerability in :mod:`http.cookiejar`. Patch by Ben Caller. diff --git a/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.r= st b/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst deleted file mode 100644 index 0fafb63402e46..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-11-21-21-36-54.bpo-37228.yBZnFG.rst +++ /dev/null @@ -1,6 +0,0 @@ -Due to significant security concerns, the *reuse_address* parameter of -:meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. This is -because of the behavior of ``SO_REUSEADDR`` in UDP. For more details, see the -documentation for ``loop.create_datagram_endpoint()``. -(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in -:issue:`37228`.) diff --git a/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.r= st b/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst deleted file mode 100644 index 1bf6ed567b241..0000000000000 --- a/Misc/NEWS.d/next/Security/2019-12-01-22-44-40.bpo-38945.ztmNXc.rst +++ /dev/null @@ -1 +0,0 @@ -Newline characters have been escaped when performing uu encoding to prevent = them from overflowing into to content section of the encoded file. This preve= nts malicious or accidental modification of data during the decoding process. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Tests/2019-10-30-00-01-43.bpo-37957.X1r78F.rst = b/Misc/NEWS.d/next/Tests/2019-10-30-00-01-43.bpo-37957.X1r78F.rst deleted file mode 100644 index 75e186ef33e07..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-10-30-00-01-43.bpo-37957.X1r78F.rst +++ /dev/null @@ -1,3 +0,0 @@ -test.regrtest now can receive a list of test patterns to ignore (using the --i/--ignore argument) or a file with a list of patterns to ignore (using the ---ignore-file argument). Patch by Pablo Galindo. diff --git a/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst = b/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst deleted file mode 100644 index 5060ecf2dc5a4..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-11-04-02-54-16.bpo-38669.pazXZ8.rst +++ /dev/null @@ -1 +0,0 @@ -Raise :exc:`TypeError` when passing target as a string with :meth:`unittest.= mock.patch.object`. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Tests/2019-11-18-22-10-55.bpo-38839.di6tXv.rst = b/Misc/NEWS.d/next/Tests/2019-11-18-22-10-55.bpo-38839.di6tXv.rst deleted file mode 100644 index 80c5a5bdfbba6..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-11-18-22-10-55.bpo-38839.di6tXv.rst +++ /dev/null @@ -1 +0,0 @@ -Fix some unused functions in tests. Patch by Adam Johnson. diff --git a/Misc/NEWS.d/next/Tests/2019-11-20-15-42-06.bpo-38692.aqAvyF.rst = b/Misc/NEWS.d/next/Tests/2019-11-20-15-42-06.bpo-38692.aqAvyF.rst deleted file mode 100644 index fa2056632ba8b..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-11-20-15-42-06.bpo-38692.aqAvyF.rst +++ /dev/null @@ -1,3 +0,0 @@ -Skip the test_posix.test_pidfd_open() test if ``os.pidfd_open()`` fails with= a -:exc:`PermissionError`. This situation can happen in a Linux sandbox using a -syscall whitelist which doesn't allow the ``pidfd_open()`` syscall yet. diff --git a/Misc/NEWS.d/next/Tests/2019-11-20-16-08-19.bpo-38841.5F5Lbw.rst = b/Misc/NEWS.d/next/Tests/2019-11-20-16-08-19.bpo-38841.5F5Lbw.rst deleted file mode 100644 index 1f4ae424bbcde..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-11-20-16-08-19.bpo-38841.5F5Lbw.rst +++ /dev/null @@ -1,2 +0,0 @@ -Skip asyncio test_create_datagram_endpoint_existing_sock_unix on platforms -lacking a functional bind() for named unix domain sockets. diff --git a/Misc/NEWS.d/next/Tests/2019-11-21-09-11-06.bpo-38875.wSZJal.rst = b/Misc/NEWS.d/next/Tests/2019-11-21-09-11-06.bpo-38875.wSZJal.rst deleted file mode 100644 index 3f6c86d32262c..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-11-21-09-11-06.bpo-38875.wSZJal.rst +++ /dev/null @@ -1 +0,0 @@ -test_capi: trashcan tests now require the test "cpu" resource. diff --git a/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst = b/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst deleted file mode 100644 index 517a1371eacd9..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-12-04-17-08-55.bpo-38965.yqax3m.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix test_faulthandler on GCC 10. Use the "volatile" keyword in -``faulthandler._stack_overflow()`` to prevent tail call optimization on any -compiler, rather than relying on compiler specific pragma. diff --git a/Misc/NEWS.d/next/Tests/2019-12-07-00-52-09.bpo-38991.JE3_o-.rst = b/Misc/NEWS.d/next/Tests/2019-12-07-00-52-09.bpo-38991.JE3_o-.rst deleted file mode 100644 index cff5a65646551..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-12-07-00-52-09.bpo-38991.JE3_o-.rst +++ /dev/null @@ -1,5 +0,0 @@ -:mod:`test.support`: :func:`~test.support.run_python_until_end`, -:func:`~test.support.assert_python_ok` and -:func:`~test.support.assert_python_failure` functions no longer strip -whitespaces from stderr. Remove ``test.support.strip_python_stderr()`` -function. diff --git a/Misc/NEWS.d/next/Tests/2019-12-08-15-11-06.bpo-38992.cVoHOZ.rst = b/Misc/NEWS.d/next/Tests/2019-12-08-15-11-06.bpo-38992.cVoHOZ.rst deleted file mode 100644 index 815ae0f65c873..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-12-08-15-11-06.bpo-38992.cVoHOZ.rst +++ /dev/null @@ -1 +0,0 @@ -Fix a test for :func:`math.fsum` that was failing due to constant folding. diff --git a/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst = b/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst deleted file mode 100644 index 10f3cc08511dd..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-12-09-11-32-34.bpo-38547.Juw54e.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix test_pty: if the process is the session leader, closing the master file -descriptor raises a SIGHUP signal: simply ignore SIGHUP when running the -tests. diff --git a/Misc/NEWS.d/next/Tests/2019-12-10-14-26-23.bpo-38614.89JpNh.rst = b/Misc/NEWS.d/next/Tests/2019-12-10-14-26-23.bpo-38614.89JpNh.rst deleted file mode 100644 index 102563f5b3b51..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-12-10-14-26-23.bpo-38614.89JpNh.rst +++ /dev/null @@ -1,6 +0,0 @@ -Replace hardcoded timeout constants in tests with -new :mod:`test.support` constants: :data:`~test.support.LOOPBACK_TIMEOUT`, -:data:`~test.support.INTERNET_TIMEOUT`, :data:`~test.support.SHORT_TIMEOUT` = and -:data:`~test.support.LONG_TIMEOUT`. It becomes easier to adjust these four -timeout constants for all tests at once, rather than having to adjust every -single test file. diff --git a/Misc/NEWS.d/next/Tests/2019-12-17-15-27-07.bpo-38546.82JwN2.rst = b/Misc/NEWS.d/next/Tests/2019-12-17-15-27-07.bpo-38546.82JwN2.rst deleted file mode 100644 index 78d9df3469182..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-12-17-15-27-07.bpo-38546.82JwN2.rst +++ /dev/null @@ -1,2 +0,0 @@ -Multiprocessing and concurrent.futures tests now stop the resource tracker -process when tests complete. diff --git a/Misc/NEWS.d/next/Tests/2019-12-18-14-52-08.bpo-38546.2kxNuM.rst = b/Misc/NEWS.d/next/Tests/2019-12-18-14-52-08.bpo-38546.2kxNuM.rst deleted file mode 100644 index d8ec7cabbbab8..0000000000000 --- a/Misc/NEWS.d/next/Tests/2019-12-18-14-52-08.bpo-38546.2kxNuM.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix test_ressources_gced_in_workers() of test_concurrent_futures: explicitly -stop the manager to prevent leaking a child process running in the background -after the test completes. diff --git a/Misc/NEWS.d/next/Windows/2019-11-14-08-57-50.bpo-33125.EN5MWS.rs= t b/Misc/NEWS.d/next/Windows/2019-11-14-08-57-50.bpo-33125.EN5MWS.rst deleted file mode 100644 index 0bc98c1a2fae7..0000000000000 --- a/Misc/NEWS.d/next/Windows/2019-11-14-08-57-50.bpo-33125.EN5MWS.rst +++ /dev/null @@ -1 +0,0 @@ -Add support for building and releasing Windows ARM64 packages. diff --git a/Misc/NEWS.d/next/Windows/2019-12-09-10-40-34.bpo-39007.vtarxo.rs= t b/Misc/NEWS.d/next/Windows/2019-12-09-10-40-34.bpo-39007.vtarxo.rst deleted file mode 100644 index f2f72f9dad3f6..0000000000000 --- a/Misc/NEWS.d/next/Windows/2019-12-09-10-40-34.bpo-39007.vtarxo.rst +++ /dev/null @@ -1 +0,0 @@ -Add auditing events to functions in :mod:`winreg`. diff --git a/Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst = b/Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst deleted file mode 100644 index 45b54e89cb89e..0000000000000 --- a/Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed a crash on OSX dynamic builds that occurred when re-initializing the -posix module after a Py_Finalize if the environment had changed since the -previous `import posix`. Patch by Beno=C3=AEt Hudson. diff --git a/README.rst b/README.rst index 43f619792925c..ae56ff025279f 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -This is Python version 3.9.0 alpha 1 +This is Python version 3.9.0 alpha 2 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 .. image:: https://travis-ci.org/python/cpython.svg?branch=3Dmaster From webhook-mailer at python.org Thu Dec 19 21:21:08 2019 From: webhook-mailer at python.org (=?utf-8?q?Jes=C3=BAs?= Cea) Date: Fri, 20 Dec 2019 02:21:08 -0000 Subject: [Python-checkins] (no subject) Message-ID: To: python-checkins at python.org Subject: Doc typo (#17667) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 https://github.com/python/cpython/commit/b0d4949f1fb04f83691e10a5453d1e10e459= 8bb9 commit: b0d4949f1fb04f83691e10a5453d1e10e4598bb9 branch: master author: Jes=C3=BAs Cea committer: GitHub date: 2019-12-20T03:21:03+01:00 summary: Doc typo (#17667) files: M Doc/library/asyncio-eventloop.rst diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloo= p.rst index d9b1cf7a8d835..ee995e04e4765 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -479,7 +479,7 @@ Opening network connections UDP. Explicitly passing ``reuse_address=3DTrue`` will raise an excepti= on. =20 When multiple processes with differing UIDs assign sockets to an - indentical UDP socket address with ``SO_REUSEADDR``, incoming packets = can + identical UDP socket address with ``SO_REUSEADDR``, incoming packets c= an become randomly distributed among the sockets. =20 For supported platforms, *reuse_port* can be used as a replacement for From webhook-mailer at python.org Fri Dec 20 09:53:59 2019 From: webhook-mailer at python.org (=?utf-8?q?=C3=89ric?= Araujo) Date: Fri, 20 Dec 2019 14:53:59 -0000 Subject: [Python-checkins] (no subject) Message-ID: To: python-checkins at python.org Subject: reorder entries in Misc/ACKS (#17663) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 https://github.com/python/cpython/commit/dd1a20f324d88f4171aca480b7972d68cab2= 12c5 commit: dd1a20f324d88f4171aca480b7972d68cab212c5 branch: master author: =C3=89ric Araujo committer: GitHub date: 2019-12-20T09:53:33-05:00 summary: reorder entries in Misc/ACKS (#17663) files: M Misc/ACKS diff --git a/Misc/ACKS b/Misc/ACKS index 5f42760cb9267..de532fc9646e7 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -12,6 +12,7 @@ PS: In the standard Python distribution, this file is encod= ed in UTF-8 and the list is in rough alphabetical order by last names. =20 Aahz +Edison Abahurire Michael Abbott Rajiv Abraham David Abrahams @@ -83,6 +84,7 @@ Marcin Bachry Alfonso Baciero Dwayne Bailey Stig Bakken +Aleksandr Balezin Greg Ball Luigi Ballabio Thomas Ballinger @@ -558,6 +560,7 @@ Paul Ganssle Lars Marius Garshol Jake Garver Dan Gass +Tim Gates Andrew Gaul Matthieu Gautier Stephen M. Gava @@ -721,6 +724,7 @@ Rob Hooft Michiel de Hoon Brian Hooper Randall Hopper +Tim Hopper Nadav Horesh Alon Horev Jan Hosang @@ -866,6 +870,7 @@ Kamil Kisiel Akira Kitada Ron Klatchko Reid Kleckner +Carsten Klein Bastian Kleineidam Bob Kline Matthias Klose @@ -958,6 +963,7 @@ Inyeol Lee James Lee John J. Lee Thomas Lee +Robert Leenders Cooper Ry Lees Yaron de Leeuw Tennessee Leeuwenburg @@ -989,6 +995,8 @@ Akira Li Robert Li Xuanji Li Zekun Li +Zheao Li +Dan Lidral-Porter Robert van Liere Ross Light Shawn Ligocki @@ -1407,6 +1415,7 @@ Giampaolo Rodola Mauro S. M. Rodrigues Elson Rodriguez Adi Roiban +Diego Rojas Luis Rojas Mike Romberg Armin Ronacher @@ -1516,6 +1525,7 @@ Dmitry Shachnev Anish Shah Daniel Shahaf Hui Shang +Geoff Shannon Mark Shannon Ha Shao Richard Shapiro @@ -1547,8 +1557,9 @@ Kirill Simonov Nathan Paul Simons Guilherme Sim=C3=B5es Adam Simpkins -Ravi Sinha +Karthikeyan Singaravelan Mandeep Singh +Ravi Sinha Janne Sinkkonen Ng Pheng Siong Yann Sionneau @@ -1652,6 +1663,7 @@ Musashi Tamura William Tanksley Christian Tanzer Steven Taschuk +Batuhan Taskaya Amy Taylor Julian Taylor Monty Taylor @@ -1889,16 +1901,3 @@ Jelle Zijlstra Gennadiy Zlobin Doug Zongker Peter =C3=85strand -Zheao Li -Carsten Klein -Diego Rojas -Edison Abahurire -Geoff Shannon -Batuhan Taskaya -Aleksandr Balezin -Robert Leenders -Tim Hopper -Dan Lidral-Porter -Ngalim Siregar -Tim Gates -Karthikeyan Singaravelan \ No newline at end of file From webhook-mailer at python.org Mon Dec 23 10:52:36 2019 From: webhook-mailer at python.org (=?utf-8?q?Jes=C3=BAs?= Cea) Date: Mon, 23 Dec 2019 15:52:36 -0000 Subject: [Python-checkins] (no subject) Message-ID: To: python-checkins at python.org Subject: Doc typo (GH-17667) (#17668) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 https://github.com/python/cpython/commit/7eb8c6d2c89a8a7ba3af4a99ab20456dff54= 4881 commit: 7eb8c6d2c89a8a7ba3af4a99ab20456dff544881 branch: 3.8 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.co= m> committer: Jes=C3=BAs Cea date: 2019-12-23T16:52:29+01:00 summary: Doc typo (GH-17667) (#17668) (cherry picked from commit b0d4949f1fb04f83691e10a5453d1e10e4598bb9) Co-authored-by: Jes=C3=BAs Cea Co-authored-by: Jes=C3=BAs Cea files: M Doc/library/asyncio-eventloop.rst diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloo= p.rst index ecd69fd669f1a..7fed2c23df7d5 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -467,7 +467,7 @@ Opening network connections UDP. Explicitly passing ``reuse_address=3DTrue`` will raise an excepti= on. =20 When multiple processes with differing UIDs assign sockets to an - indentical UDP socket address with ``SO_REUSEADDR``, incoming packets = can + identical UDP socket address with ``SO_REUSEADDR``, incoming packets c= an become randomly distributed among the sockets. =20 For supported platforms, *reuse_port* can be used as a replacement for From webhook-mailer at python.org Mon Dec 23 12:03:35 2019 From: webhook-mailer at python.org (=?utf-8?q?=C3=89ric?= Araujo) Date: Mon, 23 Dec 2019 17:03:35 -0000 Subject: [Python-checkins] (no subject) Message-ID: To: python-checkins at python.org Subject: Add comment to avoid ACKS losing order (GH-17678) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 https://github.com/python/cpython/commit/3c75f31bb2b88b3e3d858448e789b2c0d2e3= e082 commit: 3c75f31bb2b88b3e3d858448e789b2c0d2e3e082 branch: master author: =C3=89ric Araujo committer: GitHub date: 2019-12-23T12:03:30-05:00 summary: Add comment to avoid ACKS losing order (GH-17678) files: M Misc/ACKS diff --git a/Misc/ACKS b/Misc/ACKS index de532fc9646e7..8ab7a6cee5a3f 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1901,3 +1901,5 @@ Jelle Zijlstra Gennadiy Zlobin Doug Zongker Peter =C3=85strand + +(Entries should be added in rough alphabetical order by last names) From webhook-mailer at python.org Sat Dec 28 15:41:28 2019 From: webhook-mailer at python.org (=?utf-8?q?=C3=89ric?= Araujo) Date: Sat, 28 Dec 2019 20:41:28 -0000 Subject: [Python-checkins] (no subject) Message-ID: To: python-checkins at python.org Subject: Reorder entries in Misc/ACKS (GH-17663) (GH-17673) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 https://github.com/python/cpython/commit/9ee1b156146cb8114ba6d24811bdec456bbf= 7b8f commit: 9ee1b156146cb8114ba6d24811bdec456bbf7b8f branch: 3.8 author: =C3=89ric Araujo committer: GitHub date: 2019-12-28T15:41:21-05:00 summary: Reorder entries in Misc/ACKS (GH-17663) (GH-17673) files: M Misc/ACKS diff --git a/Misc/ACKS b/Misc/ACKS index a17db45657631..21ee85b4558ed 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -12,6 +12,7 @@ PS: In the standard Python distribution, this file is encod= ed in UTF-8 and the list is in rough alphabetical order by last names. =20 Aahz +Edison Abahurire Michael Abbott Rajiv Abraham David Abrahams @@ -82,6 +83,7 @@ Marcin Bachry Alfonso Baciero Dwayne Bailey Stig Bakken +Aleksandr Balezin Greg Ball Luigi Ballabio Thomas Ballinger @@ -551,6 +553,7 @@ Fred Gansevles Lars Marius Garshol Jake Garver Dan Gass +Tim Gates Andrew Gaul Matthieu Gautier Stephen M. Gava @@ -856,6 +859,7 @@ Kamil Kisiel Akira Kitada Ron Klatchko Reid Kleckner +Carsten Klein Bastian Kleineidam Bob Kline Matthias Klose @@ -948,6 +952,7 @@ Inyeol Lee James Lee John J. Lee Thomas Lee +Robert Leenders Cooper Ry Lees Yaron de Leeuw Tennessee Leeuwenburg @@ -979,6 +984,7 @@ Akira Li Robert Li Xuanji Li Zekun Li +Zheao Li Robert van Liere Ross Light Shawn Ligocki @@ -1397,6 +1403,7 @@ Giampaolo Rodola Mauro S. M. Rodrigues Elson Rodriguez Adi Roiban +Diego Rojas Luis Rojas Mike Romberg Armin Ronacher @@ -1506,6 +1513,7 @@ Dmitry Shachnev Anish Shah Daniel Shahaf Hui Shang +Geoff Shannon Mark Shannon Ha Shao Richard Shapiro @@ -1537,8 +1545,8 @@ Kirill Simonov Nathan Paul Simons Guilherme Sim=C3=B5es Adam Simpkins -Ravi Sinha Mandeep Singh +Ravi Sinha Janne Sinkkonen Ng Pheng Siong Yann Sionneau @@ -1641,6 +1649,7 @@ Musashi Tamura William Tanksley Christian Tanzer Steven Taschuk +Batuhan Taskaya Amy Taylor Julian Taylor Monty Taylor @@ -1876,13 +1885,5 @@ Jelle Zijlstra Gennadiy Zlobin Doug Zongker Peter =C3=85strand -Zheao Li -Carsten Klein -Diego Rojas -Edison Abahurire -Geoff Shannon -Batuhan Taskaya -Aleksandr Balezin -Robert Leenders -Ngalim Siregar -Tim Gates + +(Entries should be added in rough alphabetical order by last names) From webhook-mailer at python.org Sat Dec 28 15:41:52 2019 From: webhook-mailer at python.org (=?utf-8?q?=C3=89ric?= Araujo) Date: Sat, 28 Dec 2019 20:41:52 -0000 Subject: [Python-checkins] (no subject) Message-ID: To: python-checkins at python.org Subject: Reorder entries in Misc/ACKS (GH-17663) (GH-17672) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 https://github.com/python/cpython/commit/eeebc44db49b0bc282f549e0f297a1573260= 9e67 commit: eeebc44db49b0bc282f549e0f297a15732609e67 branch: 3.7 author: =C3=89ric Araujo committer: GitHub date: 2019-12-28T15:41:48-05:00 summary: Reorder entries in Misc/ACKS (GH-17663) (GH-17672) files: M Misc/ACKS diff --git a/Misc/ACKS b/Misc/ACKS index ad012eae7a323..613763195b687 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -957,6 +957,7 @@ Akira Li Robert Li Xuanji Li Zekun Li +Zheao Li Robert van Liere Ross Light Shawn Ligocki @@ -1478,6 +1479,7 @@ Dmitry Shachnev Anish Shah Daniel Shahaf Hui Shang +Geoff Shannon Mark Shannon Ha Shao Richard Shapiro @@ -1840,6 +1842,5 @@ Jelle Zijlstra Gennadiy Zlobin Doug Zongker Peter =C3=85strand -Zheao Li -Geoff Shannon -Ngalim Siregar + +(Entries should be added in rough alphabetical order by last names)