From webhook-mailer at python.org Wed Jan 1 01:11:23 2020
From: webhook-mailer at python.org (Pablo Galindo)
Date: Wed, 01 Jan 2020 06:11:23 -0000
Subject: [Python-checkins] Document CodeType.replace (GH-17776)
Message-ID:
https://github.com/python/cpython/commit/22424c02e51fab3b62cbe255d0b87d1b55b9a6c3
commit: 22424c02e51fab3b62cbe255d0b87d1b55b9a6c3
branch: master
author: Anthony Sottile
committer: Pablo Galindo
date: 2020-01-01T06:11:16Z
summary:
Document CodeType.replace (GH-17776)
files:
M Doc/library/types.rst
M Objects/clinic/codeobject.c.h
M Objects/codeobject.c
diff --git a/Doc/library/types.rst b/Doc/library/types.rst
index 9393f9e6db990..3529c2b0edb89 100644
--- a/Doc/library/types.rst
+++ b/Doc/library/types.rst
@@ -132,7 +132,7 @@ Standard names are defined for the following types:
.. versionadded:: 3.6
-.. data:: CodeType
+.. class:: CodeType(**kwargs)
.. index:: builtin: compile
@@ -143,6 +143,12 @@ Standard names are defined for the following types:
Note that the audited arguments may not match the names or positions
required by the initializer.
+ .. method:: CodeType.replace(**kwargs)
+
+ Return a copy of the code object with new values for the specified fields.
+
+ .. versionadded:: 3.8
+
.. data:: CellType
The type for cell objects: such objects are used as containers for
diff --git a/Objects/clinic/codeobject.c.h b/Objects/clinic/codeobject.c.h
index 6596de051cacb..1dd82278cf3d5 100644
--- a/Objects/clinic/codeobject.c.h
+++ b/Objects/clinic/codeobject.c.h
@@ -11,7 +11,7 @@ PyDoc_STRVAR(code_replace__doc__,
" co_lnotab=None)\n"
"--\n"
"\n"
-"Return a new code object with new specified fields.");
+"Return a copy of the code object with new values for the specified fields.");
#define CODE_REPLACE_METHODDEF \
{"replace", (PyCFunction)(void(*)(void))code_replace, METH_FASTCALL|METH_KEYWORDS, code_replace__doc__},
@@ -253,4 +253,4 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
exit:
return return_value;
}
-/*[clinic end generated code: output=fade581d6313a0c2 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=27fe34e82106b220 input=a9049054013a1b77]*/
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index f0b62ec94148d..522e1a9f2a419 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -610,7 +610,7 @@ code.replace
co_name: unicode(c_default="self->co_name") = None
co_lnotab: PyBytesObject(c_default="(PyBytesObject *)self->co_lnotab") = None
-Return a new code object with new specified fields.
+Return a copy of the code object with new values for the specified fields.
[clinic start generated code]*/
static PyObject *
@@ -622,7 +622,7 @@ code_replace_impl(PyCodeObject *self, int co_argcount,
PyObject *co_varnames, PyObject *co_freevars,
PyObject *co_cellvars, PyObject *co_filename,
PyObject *co_name, PyBytesObject *co_lnotab)
-/*[clinic end generated code: output=25c8e303913bcace input=77189e46579ec426]*/
+/*[clinic end generated code: output=25c8e303913bcace input=d9051bc8f24e6b28]*/
{
#define CHECK_INT_ARG(ARG) \
if (ARG < 0) { \
From webhook-mailer at python.org Wed Jan 1 01:28:00 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Wed, 01 Jan 2020 06:28:00 -0000
Subject: [Python-checkins] Document CodeType.replace (GH-17776)
Message-ID:
https://github.com/python/cpython/commit/dad526eb36530186f625a2724c8835fe3df3c8c1
commit: dad526eb36530186f625a2724c8835fe3df3c8c1
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2019-12-31T22:27:56-08:00
summary:
Document CodeType.replace (GH-17776)
(cherry picked from commit 22424c02e51fab3b62cbe255d0b87d1b55b9a6c3)
Co-authored-by: Anthony Sottile
files:
M Doc/library/types.rst
M Objects/clinic/codeobject.c.h
M Objects/codeobject.c
diff --git a/Doc/library/types.rst b/Doc/library/types.rst
index 9393f9e6db990..3529c2b0edb89 100644
--- a/Doc/library/types.rst
+++ b/Doc/library/types.rst
@@ -132,7 +132,7 @@ Standard names are defined for the following types:
.. versionadded:: 3.6
-.. data:: CodeType
+.. class:: CodeType(**kwargs)
.. index:: builtin: compile
@@ -143,6 +143,12 @@ Standard names are defined for the following types:
Note that the audited arguments may not match the names or positions
required by the initializer.
+ .. method:: CodeType.replace(**kwargs)
+
+ Return a copy of the code object with new values for the specified fields.
+
+ .. versionadded:: 3.8
+
.. data:: CellType
The type for cell objects: such objects are used as containers for
diff --git a/Objects/clinic/codeobject.c.h b/Objects/clinic/codeobject.c.h
index 6596de051cacb..1dd82278cf3d5 100644
--- a/Objects/clinic/codeobject.c.h
+++ b/Objects/clinic/codeobject.c.h
@@ -11,7 +11,7 @@ PyDoc_STRVAR(code_replace__doc__,
" co_lnotab=None)\n"
"--\n"
"\n"
-"Return a new code object with new specified fields.");
+"Return a copy of the code object with new values for the specified fields.");
#define CODE_REPLACE_METHODDEF \
{"replace", (PyCFunction)(void(*)(void))code_replace, METH_FASTCALL|METH_KEYWORDS, code_replace__doc__},
@@ -253,4 +253,4 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
exit:
return return_value;
}
-/*[clinic end generated code: output=fade581d6313a0c2 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=27fe34e82106b220 input=a9049054013a1b77]*/
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index f0b62ec94148d..522e1a9f2a419 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -610,7 +610,7 @@ code.replace
co_name: unicode(c_default="self->co_name") = None
co_lnotab: PyBytesObject(c_default="(PyBytesObject *)self->co_lnotab") = None
-Return a new code object with new specified fields.
+Return a copy of the code object with new values for the specified fields.
[clinic start generated code]*/
static PyObject *
@@ -622,7 +622,7 @@ code_replace_impl(PyCodeObject *self, int co_argcount,
PyObject *co_varnames, PyObject *co_freevars,
PyObject *co_cellvars, PyObject *co_filename,
PyObject *co_name, PyBytesObject *co_lnotab)
-/*[clinic end generated code: output=25c8e303913bcace input=77189e46579ec426]*/
+/*[clinic end generated code: output=25c8e303913bcace input=d9051bc8f24e6b28]*/
{
#define CHECK_INT_ARG(ARG) \
if (ARG < 0) { \
From webhook-mailer at python.org Wed Jan 1 14:32:25 2020
From: webhook-mailer at python.org (Vinay Sajip)
Date: Wed, 01 Jan 2020 19:32:25 -0000
Subject: [Python-checkins] bpo-39142: Avoid converting namedtuple instances
to ConvertingTuple. (GH-17773)
Message-ID:
https://github.com/python/cpython/commit/46abfc1416ff8e450999611ef8f231ff871ab133
commit: 46abfc1416ff8e450999611ef8f231ff871ab133
branch: master
author: Vinay Sajip
committer: GitHub
date: 2020-01-01T19:32:11Z
summary:
bpo-39142: Avoid converting namedtuple instances to ConvertingTuple. (GH-17773)
This uses the heuristic of assuming a named tuple is a subclass of
tuple with a _fields attribute. This change means that contents of
a named tuple wouldn't be converted - if a user wants to have
ConvertingTuple functionality from a namedtuple, they will have to
implement it themselves.
files:
A Misc/NEWS.d/next/Library/2019-12-31-19-27-23.bpo-39142.oqU5iD.rst
M Lib/logging/config.py
M Lib/test/test_logging.py
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 4a3b8966ede1c..fd3aded7608cb 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -448,7 +448,7 @@ def convert(self, value):
value = ConvertingList(value)
value.configurator = self
elif not isinstance(value, ConvertingTuple) and\
- isinstance(value, tuple):
+ isinstance(value, tuple) and not hasattr(value, '_fields'):
value = ConvertingTuple(value)
value.configurator = self
elif isinstance(value, str): # str for py3k
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 4feed03fec2a8..c38fdae03385e 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -3379,6 +3379,37 @@ def test_baseconfig(self):
self.assertRaises(ValueError, bc.convert, 'cfg://!')
self.assertRaises(KeyError, bc.convert, 'cfg://adict[2]')
+ def test_namedtuple(self):
+ # see bpo-39142
+ from collections import namedtuple
+
+ class MyHandler(logging.StreamHandler):
+ def __init__(self, resource, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.resource: namedtuple = resource
+
+ def emit(self, record):
+ record.msg += f' {self.resource.type}'
+ return super().emit(record)
+
+ Resource = namedtuple('Resource', ['type', 'labels'])
+ resource = Resource(type='my_type', labels=['a'])
+
+ config = {
+ 'version': 1,
+ 'handlers': {
+ 'myhandler': {
+ '()': MyHandler,
+ 'resource': resource
+ }
+ },
+ 'root': {'level': 'INFO', 'handlers': ['myhandler']},
+ }
+ with support.captured_stderr() as stderr:
+ self.apply_config(config)
+ logging.info('some log')
+ self.assertEqual(stderr.getvalue(), 'some log my_type\n')
+
class ManagerTest(BaseTest):
def test_manager_loggerclass(self):
logged = []
diff --git a/Misc/NEWS.d/next/Library/2019-12-31-19-27-23.bpo-39142.oqU5iD.rst b/Misc/NEWS.d/next/Library/2019-12-31-19-27-23.bpo-39142.oqU5iD.rst
new file mode 100644
index 0000000000000..508d1338d7c31
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-12-31-19-27-23.bpo-39142.oqU5iD.rst
@@ -0,0 +1,5 @@
+A change was made to logging.config.dictConfig to avoid converting instances
+of named tuples to ConvertingTuple. It's assumed that named tuples are too
+specialised to be treated like ordinary tuples; if a user of named tuples
+requires ConvertingTuple functionality, they will have to implement that
+themselves in their named tuple class.
From webhook-mailer at python.org Wed Jan 1 15:06:56 2020
From: webhook-mailer at python.org (Vinay Sajip)
Date: Wed, 01 Jan 2020 20:06:56 -0000
Subject: [Python-checkins] bpo-39142: Avoid converting namedtuple instances
to ConvertingTuple. (GH-17773) (GH-17785)
Message-ID:
https://github.com/python/cpython/commit/1d5a7e5694bd9104f56f4f28357c2d13afd58a29
commit: 1d5a7e5694bd9104f56f4f28357c2d13afd58a29
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Vinay Sajip
date: 2020-01-01T20:06:52Z
summary:
bpo-39142: Avoid converting namedtuple instances to ConvertingTuple. (GH-17773) (GH-17785)
(cherry picked from commit 46abfc1416ff8e450999611ef8f231ff871ab133)
files:
A Misc/NEWS.d/next/Library/2019-12-31-19-27-23.bpo-39142.oqU5iD.rst
M Lib/logging/config.py
M Lib/test/test_logging.py
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 9dd35e11aab39..3cd5fea852449 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -447,7 +447,7 @@ def convert(self, value):
value = ConvertingList(value)
value.configurator = self
elif not isinstance(value, ConvertingTuple) and\
- isinstance(value, tuple):
+ isinstance(value, tuple) and not hasattr(value, '_fields'):
value = ConvertingTuple(value)
value.configurator = self
elif isinstance(value, str): # str for py3k
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 37655a5ccc40c..90bf2a4d3ac06 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -3361,6 +3361,37 @@ def test_baseconfig(self):
self.assertRaises(ValueError, bc.convert, 'cfg://!')
self.assertRaises(KeyError, bc.convert, 'cfg://adict[2]')
+ def test_namedtuple(self):
+ # see bpo-39142
+ from collections import namedtuple
+
+ class MyHandler(logging.StreamHandler):
+ def __init__(self, resource, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.resource: namedtuple = resource
+
+ def emit(self, record):
+ record.msg += f' {self.resource.type}'
+ return super().emit(record)
+
+ Resource = namedtuple('Resource', ['type', 'labels'])
+ resource = Resource(type='my_type', labels=['a'])
+
+ config = {
+ 'version': 1,
+ 'handlers': {
+ 'myhandler': {
+ '()': MyHandler,
+ 'resource': resource
+ }
+ },
+ 'root': {'level': 'INFO', 'handlers': ['myhandler']},
+ }
+ with support.captured_stderr() as stderr:
+ self.apply_config(config)
+ logging.info('some log')
+ self.assertEqual(stderr.getvalue(), 'some log my_type\n')
+
class ManagerTest(BaseTest):
def test_manager_loggerclass(self):
logged = []
diff --git a/Misc/NEWS.d/next/Library/2019-12-31-19-27-23.bpo-39142.oqU5iD.rst b/Misc/NEWS.d/next/Library/2019-12-31-19-27-23.bpo-39142.oqU5iD.rst
new file mode 100644
index 0000000000000..508d1338d7c31
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-12-31-19-27-23.bpo-39142.oqU5iD.rst
@@ -0,0 +1,5 @@
+A change was made to logging.config.dictConfig to avoid converting instances
+of named tuples to ConvertingTuple. It's assumed that named tuples are too
+specialised to be treated like ordinary tuples; if a user of named tuples
+requires ConvertingTuple functionality, they will have to implement that
+themselves in their named tuple class.
From webhook-mailer at python.org Wed Jan 1 15:07:36 2020
From: webhook-mailer at python.org (Vinay Sajip)
Date: Wed, 01 Jan 2020 20:07:36 -0000
Subject: [Python-checkins] bpo-39142: Avoid converting namedtuple instances
to ConvertingTuple. (GH-17773) (GH-17786)
Message-ID:
https://github.com/python/cpython/commit/0e0e4acaabdcf8efb60cf75f08301022ac4422a4
commit: 0e0e4acaabdcf8efb60cf75f08301022ac4422a4
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Vinay Sajip
date: 2020-01-01T20:07:31Z
summary:
bpo-39142: Avoid converting namedtuple instances to ConvertingTuple. (GH-17773) (GH-17786)
(cherry picked from commit 46abfc1416ff8e450999611ef8f231ff871ab133)
files:
A Misc/NEWS.d/next/Library/2019-12-31-19-27-23.bpo-39142.oqU5iD.rst
M Lib/logging/config.py
M Lib/test/test_logging.py
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index f58be93089359..626aeea7c2c56 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -447,7 +447,7 @@ def convert(self, value):
value = ConvertingList(value)
value.configurator = self
elif not isinstance(value, ConvertingTuple) and\
- isinstance(value, tuple):
+ isinstance(value, tuple) and not hasattr(value, '_fields'):
value = ConvertingTuple(value)
value.configurator = self
elif isinstance(value, str): # str for py3k
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 546cea98c1ea4..c24a30286806a 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -3223,6 +3223,37 @@ def test_baseconfig(self):
self.assertRaises(ValueError, bc.convert, 'cfg://!')
self.assertRaises(KeyError, bc.convert, 'cfg://adict[2]')
+ def test_namedtuple(self):
+ # see bpo-39142
+ from collections import namedtuple
+
+ class MyHandler(logging.StreamHandler):
+ def __init__(self, resource, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.resource: namedtuple = resource
+
+ def emit(self, record):
+ record.msg += f' {self.resource.type}'
+ return super().emit(record)
+
+ Resource = namedtuple('Resource', ['type', 'labels'])
+ resource = Resource(type='my_type', labels=['a'])
+
+ config = {
+ 'version': 1,
+ 'handlers': {
+ 'myhandler': {
+ '()': MyHandler,
+ 'resource': resource
+ }
+ },
+ 'root': {'level': 'INFO', 'handlers': ['myhandler']},
+ }
+ with support.captured_stderr() as stderr:
+ self.apply_config(config)
+ logging.info('some log')
+ self.assertEqual(stderr.getvalue(), 'some log my_type\n')
+
class ManagerTest(BaseTest):
def test_manager_loggerclass(self):
logged = []
diff --git a/Misc/NEWS.d/next/Library/2019-12-31-19-27-23.bpo-39142.oqU5iD.rst b/Misc/NEWS.d/next/Library/2019-12-31-19-27-23.bpo-39142.oqU5iD.rst
new file mode 100644
index 0000000000000..508d1338d7c31
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-12-31-19-27-23.bpo-39142.oqU5iD.rst
@@ -0,0 +1,5 @@
+A change was made to logging.config.dictConfig to avoid converting instances
+of named tuples to ConvertingTuple. It's assumed that named tuples are too
+specialised to be treated like ordinary tuples; if a user of named tuples
+requires ConvertingTuple functionality, they will have to implement that
+themselves in their named tuple class.
From webhook-mailer at python.org Wed Jan 1 17:21:50 2020
From: webhook-mailer at python.org (Antoine Pitrou)
Date: Wed, 01 Jan 2020 22:21:50 -0000
Subject: [Python-checkins] bpo-13601: always use line-buffering for
sys.stderr (GH-17646)
Message-ID:
https://github.com/python/cpython/commit/5b9077134cd0535f21905d5f5195847526cac99c
commit: 5b9077134cd0535f21905d5f5195847526cac99c
branch: master
author: Jendrik Seipp
committer: Antoine Pitrou
date: 2020-01-01T23:21:43+01:00
summary:
bpo-13601: always use line-buffering for sys.stderr (GH-17646)
files:
A Misc/NEWS.d/next/Core and Builtins/2019-12-17-22-32-11.bpo-13601.vNP4LC.rst
M Doc/library/sys.rst
M Lib/test/test_cmd_line.py
M Misc/ACKS
M Python/pylifecycle.c
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index a824fb95e8ecf..0aae263ff5f4c 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -1446,9 +1446,15 @@ always available.
for the Windows console, this only applies when
:envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set.
- * When interactive, ``stdout`` and ``stderr`` streams are line-buffered.
- Otherwise, they are block-buffered like regular text files. You can
- override this value with the :option:`-u` command-line option.
+ * When interactive, the ``stdout`` stream is line-buffered. Otherwise,
+ it is block-buffered like regular text files. The ``stderr`` stream
+ is line-buffered in both cases. You can make both streams unbuffered
+ by passing the :option:`-u` command-line option or setting the
+ :envvar:`PYTHONUNBUFFERED` environment variable.
+
+ .. versionchanged:: 3.9
+ Non-interactive ``stderr`` is now line-buffered instead of fully
+ buffered.
.. note::
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index 47810020dd353..ee96473322dba 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -6,6 +6,7 @@
import subprocess
import sys
import tempfile
+import textwrap
import unittest
from test import support
from test.support.script_helper import (
@@ -219,6 +220,21 @@ def check_output(text):
)
check_output(text)
+ def test_non_interactive_output_buffering(self):
+ code = textwrap.dedent("""
+ import sys
+ out = sys.stdout
+ print(out.isatty(), out.write_through, out.line_buffering)
+ err = sys.stderr
+ print(err.isatty(), err.write_through, err.line_buffering)
+ """)
+ args = [sys.executable, '-c', code]
+ proc = subprocess.run(args, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, text=True, check=True)
+ self.assertEqual(proc.stdout,
+ 'False False False\n'
+ 'False False True\n')
+
def test_unbuffered_output(self):
# Test expected operation of the '-u' switch
for stream in ('stdout', 'stderr'):
diff --git a/Misc/ACKS b/Misc/ACKS
index 5ecbac13e0bb4..d3e683d4a085f 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1510,6 +1510,7 @@ Steven Scott
Nick Seidenman
Michael Seifert
?iga Seilnacht
+Jendrik Seipp
Michael Selik
Yury Selivanov
Fred Sells
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-17-22-32-11.bpo-13601.vNP4LC.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-17-22-32-11.bpo-13601.vNP4LC.rst
new file mode 100644
index 0000000000000..f2c9495a59afb
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-17-22-32-11.bpo-13601.vNP4LC.rst
@@ -0,0 +1,6 @@
+By default, ``sys.stderr`` is line-buffered now, even if ``stderr`` is
+redirected to a file. You can still make ``sys.stderr`` unbuffered by
+passing the :option:`-u` command-line option or setting the
+:envvar:`PYTHONUNBUFFERED` environment variable.
+
+(Contributed by Jendrik Seipp in bpo-13601.)
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 4f05dfc349033..94bbbdb560e79 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1817,7 +1817,7 @@ create_stdio(const PyConfig *config, PyObject* io,
write_through = Py_True;
else
write_through = Py_False;
- if (isatty && buffered_stdio)
+ if (buffered_stdio && (isatty || fd == fileno(stderr)))
line_buffering = Py_True;
else
line_buffering = Py_False;
From webhook-mailer at python.org Wed Jan 1 17:26:37 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Wed, 01 Jan 2020 22:26:37 -0000
Subject: [Python-checkins] bpo-39183: Fix formatting in library/ensurepip
(GH-17787)
Message-ID:
https://github.com/python/cpython/commit/149175c6dfc8455023e4335575f3fe3d606729f9
commit: 149175c6dfc8455023e4335575f3fe3d606729f9
branch: master
author: Rafael Fontenelle
committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
date: 2020-01-01T14:26:33-08:00
summary:
bpo-39183: Fix formatting in library/ensurepip (GH-17787)
Remove extra space to fix formatting and avoid from splitting text in to strings.
https://bugs.python.org/issue39183
files:
M Doc/library/ensurepip.rst
diff --git a/Doc/library/ensurepip.rst b/Doc/library/ensurepip.rst
index a2bb045e57e3c..a5221250c4048 100644
--- a/Doc/library/ensurepip.rst
+++ b/Doc/library/ensurepip.rst
@@ -74,7 +74,7 @@ options:
script will *not* be installed.
* ``--default-pip``: if a "default pip" installation is requested, the
- ``pip`` script will be installed in addition to the two regular scripts.
+ ``pip`` script will be installed in addition to the two regular scripts.
Providing both of the script selection options will trigger an exception.
From webhook-mailer at python.org Wed Jan 1 17:32:21 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Wed, 01 Jan 2020 22:32:21 -0000
Subject: [Python-checkins] bpo-39183: Fix formatting in library/ensurepip
(GH-17787)
Message-ID:
https://github.com/python/cpython/commit/3959638ba1b1e25c25a2da880aba78fd53dd947f
commit: 3959638ba1b1e25c25a2da880aba78fd53dd947f
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-01T14:32:17-08:00
summary:
bpo-39183: Fix formatting in library/ensurepip (GH-17787)
Remove extra space to fix formatting and avoid from splitting text in to strings.
https://bugs.python.org/issue39183
(cherry picked from commit 149175c6dfc8455023e4335575f3fe3d606729f9)
Co-authored-by: Rafael Fontenelle
files:
M Doc/library/ensurepip.rst
diff --git a/Doc/library/ensurepip.rst b/Doc/library/ensurepip.rst
index c797f63326d1a..1b6fe65b08a21 100644
--- a/Doc/library/ensurepip.rst
+++ b/Doc/library/ensurepip.rst
@@ -74,7 +74,7 @@ options:
script will *not* be installed.
* ``--default-pip``: if a "default pip" installation is requested, the
- ``pip`` script will be installed in addition to the two regular scripts.
+ ``pip`` script will be installed in addition to the two regular scripts.
Providing both of the script selection options will trigger an exception.
From webhook-mailer at python.org Wed Jan 1 17:32:28 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Wed, 01 Jan 2020 22:32:28 -0000
Subject: [Python-checkins] bpo-39183: Fix formatting in library/ensurepip
(GH-17787)
Message-ID:
https://github.com/python/cpython/commit/6bf382ac9a07f42c6f91f35a7f0df4c63e35a8a7
commit: 6bf382ac9a07f42c6f91f35a7f0df4c63e35a8a7
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-01T14:32:23-08:00
summary:
bpo-39183: Fix formatting in library/ensurepip (GH-17787)
Remove extra space to fix formatting and avoid from splitting text in to strings.
https://bugs.python.org/issue39183
(cherry picked from commit 149175c6dfc8455023e4335575f3fe3d606729f9)
Co-authored-by: Rafael Fontenelle
files:
M Doc/library/ensurepip.rst
diff --git a/Doc/library/ensurepip.rst b/Doc/library/ensurepip.rst
index a2bb045e57e3c..a5221250c4048 100644
--- a/Doc/library/ensurepip.rst
+++ b/Doc/library/ensurepip.rst
@@ -74,7 +74,7 @@ options:
script will *not* be installed.
* ``--default-pip``: if a "default pip" installation is requested, the
- ``pip`` script will be installed in addition to the two regular scripts.
+ ``pip`` script will be installed in addition to the two regular scripts.
Providing both of the script selection options will trigger an exception.
From webhook-mailer at python.org Thu Jan 2 06:38:56 2020
From: webhook-mailer at python.org (Pablo Galindo)
Date: Thu, 02 Jan 2020 11:38:56 -0000
Subject: [Python-checkins] bpo-39114: Fix tracing of except handlers with
name binding (GH-17769)
Message-ID:
https://github.com/python/cpython/commit/04ec7a1f7a5b92187a73cd02670958444c6f2220
commit: 04ec7a1f7a5b92187a73cd02670958444c6f2220
branch: master
author: Pablo Galindo
committer: GitHub
date: 2020-01-02T11:38:44Z
summary:
bpo-39114: Fix tracing of except handlers with name binding (GH-17769)
When producing the bytecode of exception handlers with name binding (like `except Exception as e`) we need to produce a try-finally block to make sure that the name is deleted after the handler is executed to prevent cycles in the stack frame objects. The bytecode associated with this try-finally block does not have source lines associated and it was causing problems when the tracing functionality was running over it.
files:
A Misc/NEWS.d/next/Core and Builtins/2019-12-31-18-25-45.bpo-39114.WG9alt.rst
M Lib/test/test_sys_settrace.py
M Python/ceval.c
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py
index 0af015aa56bb4..a0d1122fad83b 100644
--- a/Lib/test/test_sys_settrace.py
+++ b/Lib/test/test_sys_settrace.py
@@ -481,6 +481,51 @@ def func():
[(0, 'call'),
(1, 'line')])
+ def test_18_except_with_name(self):
+ def func():
+ try:
+ try:
+ raise Exception
+ except Exception as e:
+ raise
+ x = "Something"
+ y = "Something"
+ except Exception:
+ pass
+
+ self.run_and_compare(func,
+ [(0, 'call'),
+ (1, 'line'),
+ (2, 'line'),
+ (3, 'line'),
+ (3, 'exception'),
+ (4, 'line'),
+ (5, 'line'),
+ (8, 'line'),
+ (9, 'line'),
+ (9, 'return')])
+
+ def test_19_except_with_finally(self):
+ def func():
+ try:
+ try:
+ raise Exception
+ finally:
+ y = "Something"
+ except Exception:
+ b = 23
+
+ self.run_and_compare(func,
+ [(0, 'call'),
+ (1, 'line'),
+ (2, 'line'),
+ (3, 'line'),
+ (3, 'exception'),
+ (5, 'line'),
+ (6, 'line'),
+ (7, 'line'),
+ (7, 'return')])
+
class SkipLineEventsTraceTestCase(TraceTestCase):
"""Repeat the trace tests, but with per-line events skipped"""
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-12-31-18-25-45.bpo-39114.WG9alt.rst b/Misc/NEWS.d/next/Core and Builtins/2019-12-31-18-25-45.bpo-39114.WG9alt.rst
new file mode 100644
index 0000000000000..d742af9d3262e
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-12-31-18-25-45.bpo-39114.WG9alt.rst
@@ -0,0 +1,2 @@
+Fix incorrent line execution reporting in trace functions when tracing
+exception handlers with name binding. Patch by Pablo Galindo.
diff --git a/Python/ceval.c b/Python/ceval.c
index 96ed329b0d995..bd9454b2812dd 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3610,7 +3610,9 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
PUSH(val);
PUSH(exc);
JUMPTO(handler);
- if (_Py_TracingPossible(ceval)) {
+ if (_Py_TracingPossible(ceval) &&
+ ((f->f_lasti < instr_lb || f->f_lasti >= instr_ub) ||
+ !(f->f_lasti == instr_lb || f->f_lasti < instr_prev))) {
/* Make sure that we trace line after exception */
instr_prev = INT_MAX;
}
From webhook-mailer at python.org Thu Jan 2 12:33:02 2020
From: webhook-mailer at python.org (Zachary Ware)
Date: Thu, 02 Jan 2020 17:33:02 -0000
Subject: [Python-checkins] Remove outdated mention of hg.exe from
Tools/msi/README.txt (GH-17792)
Message-ID:
https://github.com/python/cpython/commit/78018bb1621e5ecb61cba6e664d14ff789d2874c
commit: 78018bb1621e5ecb61cba6e664d14ff789d2874c
branch: master
author: Anthony Shaw
committer: Zachary Ware
date: 2020-01-02T11:32:55-06:00
summary:
Remove outdated mention of hg.exe from Tools/msi/README.txt (GH-17792)
files:
M Tools/msi/README.txt
diff --git a/Tools/msi/README.txt b/Tools/msi/README.txt
index f5656b971b3ce..82635f3d2c2a1 100644
--- a/Tools/msi/README.txt
+++ b/Tools/msi/README.txt
@@ -11,7 +11,7 @@ Tools/msi/buildrelease.bat script and environment variables:
set PYTHON=
set SPHINXBUILD=
- set PATH=;
+ set PATH=;
;%PATH%
buildrelease.bat [-x86] [-x64] [-D] [-B]
@@ -106,7 +106,7 @@ Tools/msi/buildrelease.bat script:
set PYTHON=
set SPHINXBUILD=
- set PATH=;
+ set PATH=;
;%PATH%
buildrelease.bat [-x86] [-x64] [-D] [-B]
@@ -131,7 +131,7 @@ installer. Official releases of Python must be signed.
Ensure %PYTHON% and %SPHINXBUILD% are set when passing this option. You
may also set %HTMLHELP% to the Html Help Compiler (hhc.exe), or put HHC
-on your PATH or in externals/. You will also need Mercurial (hg.exe) on
+on your PATH or in externals/. You will also need Git (git.exe) on
your PATH.
If WiX is not found on your system, it will be automatically downloaded
From webhook-mailer at python.org Thu Jan 2 13:20:34 2020
From: webhook-mailer at python.org (Pablo Galindo)
Date: Thu, 02 Jan 2020 18:20:34 -0000
Subject: [Python-checkins] bpo-38870: Throw ValueError on invalid yield from
usage (GH-17798)
Message-ID:
https://github.com/python/cpython/commit/7b35bef9787cd80ed1e12124f759b4be03c849db
commit: 7b35bef9787cd80ed1e12124f759b4be03c849db
branch: master
author: Batuhan Ta?kaya <47358913+isidentical at users.noreply.github.com>
committer: Pablo Galindo
date: 2020-01-02T18:20:04Z
summary:
bpo-38870: Throw ValueError on invalid yield from usage (GH-17798)
files:
M Lib/ast.py
M Lib/test/test_unparse.py
diff --git a/Lib/ast.py b/Lib/ast.py
index 62f6e075a09fd..ece8b139e460e 100644
--- a/Lib/ast.py
+++ b/Lib/ast.py
@@ -735,10 +735,10 @@ def visit_Yield(self, node):
def visit_YieldFrom(self, node):
with self.delimit("(", ")"):
- self.write("yield from")
- if node.value:
- self.write(" ")
- self.traverse(node.value)
+ self.write("yield from ")
+ if not node.value:
+ raise ValueError("Node can't be used without a value attribute.")
+ self.traverse(node.value)
def visit_Raise(self, node):
self.fill("raise")
diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py
index 49767dbac16d1..e8b0d4b06f9e9 100644
--- a/Lib/test/test_unparse.py
+++ b/Lib/test/test_unparse.py
@@ -278,6 +278,8 @@ def test_invalid_fstring_conversion(self):
def test_invalid_set(self):
self.check_invalid(ast.Set(elts=[]))
+ def test_invalid_yield_from(self):
+ self.check_invalid(ast.YieldFrom(value=None))
class DirectoryTestCase(ASTTestCase):
"""Test roundtrip behaviour on all files in Lib and Lib/test."""
From webhook-mailer at python.org Thu Jan 2 21:56:41 2020
From: webhook-mailer at python.org (Benjamin Peterson)
Date: Fri, 03 Jan 2020 02:56:41 -0000
Subject: [Python-checkins] Bring Python into the next decade. (GH-17801)
Message-ID:
https://github.com/python/cpython/commit/946b29ea0b3b386ed05e87e60b8617c9dc19cd53
commit: 946b29ea0b3b386ed05e87e60b8617c9dc19cd53
branch: master
author: Benjamin Peterson
committer: GitHub
date: 2020-01-02T18:56:34-08:00
summary:
Bring Python into the next decade. (GH-17801)
files:
M Doc/copyright.rst
M Doc/license.rst
M LICENSE
M Mac/IDLE/IDLE.app/Contents/Info.plist
M Mac/PythonLauncher/Info.plist.in
M Mac/Resources/app/Info.plist.in
M Python/getcopyright.c
M README.rst
diff --git a/Doc/copyright.rst b/Doc/copyright.rst
index 393a1f03751f8..1b90d9f172c99 100644
--- a/Doc/copyright.rst
+++ b/Doc/copyright.rst
@@ -4,7 +4,7 @@ Copyright
Python and this documentation is:
-Copyright ? 2001-2019 Python Software Foundation. All rights reserved.
+Copyright ? 2001-2020 Python Software Foundation. All rights reserved.
Copyright ? 2000 BeOpen.com. All rights reserved.
diff --git a/Doc/license.rst b/Doc/license.rst
index 810d2e63fd48c..472a5cf3d88b3 100644
--- a/Doc/license.rst
+++ b/Doc/license.rst
@@ -87,7 +87,7 @@ PSF LICENSE AGREEMENT FOR PYTHON |release|
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python |release| alone or in any derivative
version, provided, however, that PSF's License Agreement and PSF's notice of
- copyright, i.e., "Copyright ? 2001-2019 Python Software Foundation; All Rights
+ copyright, i.e., "Copyright ? 2001-2020 Python Software Foundation; All Rights
Reserved" are retained in Python |release| alone or in any derivative version
prepared by Licensee.
diff --git a/LICENSE b/LICENSE
index 9dc010d80348f..66a3ac80d729a 100644
--- a/LICENSE
+++ b/LICENSE
@@ -73,7 +73,7 @@ analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python alone or in any derivative version,
provided, however, that PSF's License Agreement and PSF's notice of copyright,
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation;
+2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation;
All Rights Reserved" are retained in Python alone or in any derivative version
prepared by Licensee.
diff --git a/Mac/IDLE/IDLE.app/Contents/Info.plist b/Mac/IDLE/IDLE.app/Contents/Info.plist
index 04a0a08c83639..dcc48abdd2a39 100644
--- a/Mac/IDLE/IDLE.app/Contents/Info.plist
+++ b/Mac/IDLE/IDLE.app/Contents/Info.plist
@@ -36,7 +36,7 @@
CFBundleExecutable
IDLE
CFBundleGetInfoString
- %version%, ? 2001-2019 Python Software Foundation
+ %version%, ? 2001-2020 Python Software Foundation
CFBundleIconFile
IDLE.icns
CFBundleIdentifier
diff --git a/Mac/PythonLauncher/Info.plist.in b/Mac/PythonLauncher/Info.plist.in
index 9fb4e0affd9c4..21a051535fb92 100644
--- a/Mac/PythonLauncher/Info.plist.in
+++ b/Mac/PythonLauncher/Info.plist.in
@@ -40,7 +40,7 @@
CFBundleExecutable
Python Launcher
CFBundleGetInfoString
- %VERSION%, ? 2001-2019 Python Software Foundation
+ %VERSION%, ? 2001-2020 Python Software Foundation
CFBundleIconFile
PythonLauncher.icns
CFBundleIdentifier
diff --git a/Mac/Resources/app/Info.plist.in b/Mac/Resources/app/Info.plist.in
index b7581984dd676..66b5e764c54b0 100644
--- a/Mac/Resources/app/Info.plist.in
+++ b/Mac/Resources/app/Info.plist.in
@@ -37,7 +37,7 @@
CFBundleInfoDictionaryVersion
6.0
CFBundleLongVersionString
- %version%, (c) 2001-2019 Python Software Foundation.
+ %version%, (c) 2001-2020 Python Software Foundation.
CFBundleName
Python
CFBundlePackageType
diff --git a/Python/getcopyright.c b/Python/getcopyright.c
index 27a1731f46ded..299ccc08c44f8 100644
--- a/Python/getcopyright.c
+++ b/Python/getcopyright.c
@@ -4,7 +4,7 @@
static const char cprt[] =
"\
-Copyright (c) 2001-2019 Python Software Foundation.\n\
+Copyright (c) 2001-2020 Python Software Foundation.\n\
All Rights Reserved.\n\
\n\
Copyright (c) 2000 BeOpen.com.\n\
diff --git a/README.rst b/README.rst
index ae56ff025279f..e8fd598a61edd 100644
--- a/README.rst
+++ b/README.rst
@@ -22,7 +22,7 @@ This is Python version 3.9.0 alpha 2
:target: https://python.zulipchat.com
-Copyright (c) 2001-2019 Python Software Foundation. All rights reserved.
+Copyright (c) 2001-2020 Python Software Foundation. All rights reserved.
See the end of this file for further copyright and license information.
@@ -250,7 +250,7 @@ See :pep:`596` for Python 3.9 release details.
Copyright and License Information
---------------------------------
-Copyright (c) 2001-2019 Python Software Foundation. All rights reserved.
+Copyright (c) 2001-2020 Python Software Foundation. All rights reserved.
Copyright (c) 2000 BeOpen.com. All rights reserved.
From webhook-mailer at python.org Thu Jan 2 22:10:10 2020
From: webhook-mailer at python.org (Benjamin Peterson)
Date: Fri, 03 Jan 2020 03:10:10 -0000
Subject: [Python-checkins] [2.7] Bring Python into the next decade.
(GH-17805)
Message-ID:
https://github.com/python/cpython/commit/aa5b196c180d4c1dbe5a8593e55066e630d38c09
commit: aa5b196c180d4c1dbe5a8593e55066e630d38c09
branch: 2.7
author: Benjamin Peterson
committer: GitHub
date: 2020-01-02T19:10:06-08:00
summary:
[2.7] Bring Python into the next decade. (GH-17805)
(cherry picked from commit 946b29ea0b3b386ed05e87e60b8617c9dc19cd53)
Co-authored-by: Benjamin Peterson
files:
M Doc/copyright.rst
M Doc/license.rst
M LICENSE
M Mac/PythonLauncher/Info.plist.in
M Mac/Resources/app/Info.plist.in
M Python/getcopyright.c
M README
diff --git a/Doc/copyright.rst b/Doc/copyright.rst
index 393a1f03751f8..1b90d9f172c99 100644
--- a/Doc/copyright.rst
+++ b/Doc/copyright.rst
@@ -4,7 +4,7 @@ Copyright
Python and this documentation is:
-Copyright ? 2001-2019 Python Software Foundation. All rights reserved.
+Copyright ? 2001-2020 Python Software Foundation. All rights reserved.
Copyright ? 2000 BeOpen.com. All rights reserved.
diff --git a/Doc/license.rst b/Doc/license.rst
index 56687ac224850..c347cf52f884c 100644
--- a/Doc/license.rst
+++ b/Doc/license.rst
@@ -87,7 +87,7 @@ PSF LICENSE AGREEMENT FOR PYTHON |release|
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python |release| alone or in any derivative
version, provided, however, that PSF's License Agreement and PSF's notice of
- copyright, i.e., "Copyright ? 2001-2019 Python Software Foundation; All Rights
+ copyright, i.e., "Copyright ? 2001-2020 Python Software Foundation; All Rights
Reserved" are retained in Python |release| alone or in any derivative version
prepared by Licensee.
diff --git a/LICENSE b/LICENSE
index 9dc010d80348f..66a3ac80d729a 100644
--- a/LICENSE
+++ b/LICENSE
@@ -73,7 +73,7 @@ analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python alone or in any derivative version,
provided, however, that PSF's License Agreement and PSF's notice of copyright,
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation;
+2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation;
All Rights Reserved" are retained in Python alone or in any derivative version
prepared by Licensee.
diff --git a/Mac/PythonLauncher/Info.plist.in b/Mac/PythonLauncher/Info.plist.in
index 77dbb0fe84e46..dba64546b8232 100644
--- a/Mac/PythonLauncher/Info.plist.in
+++ b/Mac/PythonLauncher/Info.plist.in
@@ -40,7 +40,7 @@
CFBundleExecutable
PythonLauncher
CFBundleGetInfoString
- %VERSION%, ? 2001-2019 Python Software Foundation
+ %VERSION%, ? 2001-2020 Python Software Foundation
CFBundleIconFile
PythonLauncher.icns
CFBundleIdentifier
diff --git a/Mac/Resources/app/Info.plist.in b/Mac/Resources/app/Info.plist.in
index b7581984dd676..66b5e764c54b0 100644
--- a/Mac/Resources/app/Info.plist.in
+++ b/Mac/Resources/app/Info.plist.in
@@ -37,7 +37,7 @@
CFBundleInfoDictionaryVersion
6.0
CFBundleLongVersionString
- %version%, (c) 2001-2019 Python Software Foundation.
+ %version%, (c) 2001-2020 Python Software Foundation.
CFBundleName
Python
CFBundlePackageType
diff --git a/Python/getcopyright.c b/Python/getcopyright.c
index 0ef16d0923810..3362ed59842ae 100644
--- a/Python/getcopyright.c
+++ b/Python/getcopyright.c
@@ -4,7 +4,7 @@
static char cprt[] =
"\
-Copyright (c) 2001-2019 Python Software Foundation.\n\
+Copyright (c) 2001-2020 Python Software Foundation.\n\
All Rights Reserved.\n\
\n\
Copyright (c) 2000 BeOpen.com.\n\
diff --git a/README b/README
index a2b0543dcdc5a..67eb5fe8b0259 100644
--- a/README
+++ b/README
@@ -2,7 +2,7 @@ This is Python version 2.7.17
=============================
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
-2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation. All
+2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation. All
rights reserved.
Copyright (c) 2000 BeOpen.com.
From webhook-mailer at python.org Thu Jan 2 22:14:01 2020
From: webhook-mailer at python.org (Benjamin Peterson)
Date: Fri, 03 Jan 2020 03:14:01 -0000
Subject: [Python-checkins] [3.6] Bring Python into the next decade.
(GH-17804)
Message-ID:
https://github.com/python/cpython/commit/a9964b0aca784c16227a703626701e9003bdebf6
commit: a9964b0aca784c16227a703626701e9003bdebf6
branch: 3.6
author: Benjamin Peterson
committer: GitHub
date: 2020-01-02T19:13:57-08:00
summary:
[3.6] Bring Python into the next decade. (GH-17804)
(cherry picked from commit 946b29ea0b3b386ed05e87e60b8617c9dc19cd53)
Co-authored-by: Benjamin Peterson
files:
M Doc/copyright.rst
M Doc/license.rst
M LICENSE
M Mac/IDLE/IDLE.app/Contents/Info.plist
M Mac/PythonLauncher/Info.plist.in
M Mac/Resources/app/Info.plist.in
M Python/getcopyright.c
M README.rst
diff --git a/Doc/copyright.rst b/Doc/copyright.rst
index 393a1f03751f8..1b90d9f172c99 100644
--- a/Doc/copyright.rst
+++ b/Doc/copyright.rst
@@ -4,7 +4,7 @@ Copyright
Python and this documentation is:
-Copyright ? 2001-2019 Python Software Foundation. All rights reserved.
+Copyright ? 2001-2020 Python Software Foundation. All rights reserved.
Copyright ? 2000 BeOpen.com. All rights reserved.
diff --git a/Doc/license.rst b/Doc/license.rst
index ed8b8bc65348e..c046cd2a35936 100644
--- a/Doc/license.rst
+++ b/Doc/license.rst
@@ -87,7 +87,7 @@ PSF LICENSE AGREEMENT FOR PYTHON |release|
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python |release| alone or in any derivative
version, provided, however, that PSF's License Agreement and PSF's notice of
- copyright, i.e., "Copyright ? 2001-2019 Python Software Foundation; All Rights
+ copyright, i.e., "Copyright ? 2001-2020 Python Software Foundation; All Rights
Reserved" are retained in Python |release| alone or in any derivative version
prepared by Licensee.
diff --git a/LICENSE b/LICENSE
index 9dc010d80348f..66a3ac80d729a 100644
--- a/LICENSE
+++ b/LICENSE
@@ -73,7 +73,7 @@ analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python alone or in any derivative version,
provided, however, that PSF's License Agreement and PSF's notice of copyright,
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation;
+2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation;
All Rights Reserved" are retained in Python alone or in any derivative version
prepared by Licensee.
diff --git a/Mac/IDLE/IDLE.app/Contents/Info.plist b/Mac/IDLE/IDLE.app/Contents/Info.plist
index 04a0a08c83639..dcc48abdd2a39 100644
--- a/Mac/IDLE/IDLE.app/Contents/Info.plist
+++ b/Mac/IDLE/IDLE.app/Contents/Info.plist
@@ -36,7 +36,7 @@
CFBundleExecutable
IDLE
CFBundleGetInfoString
- %version%, ? 2001-2019 Python Software Foundation
+ %version%, ? 2001-2020 Python Software Foundation
CFBundleIconFile
IDLE.icns
CFBundleIdentifier
diff --git a/Mac/PythonLauncher/Info.plist.in b/Mac/PythonLauncher/Info.plist.in
index 9fb4e0affd9c4..21a051535fb92 100644
--- a/Mac/PythonLauncher/Info.plist.in
+++ b/Mac/PythonLauncher/Info.plist.in
@@ -40,7 +40,7 @@
CFBundleExecutable
Python Launcher
CFBundleGetInfoString
- %VERSION%, ? 2001-2019 Python Software Foundation
+ %VERSION%, ? 2001-2020 Python Software Foundation
CFBundleIconFile
PythonLauncher.icns
CFBundleIdentifier
diff --git a/Mac/Resources/app/Info.plist.in b/Mac/Resources/app/Info.plist.in
index b7581984dd676..66b5e764c54b0 100644
--- a/Mac/Resources/app/Info.plist.in
+++ b/Mac/Resources/app/Info.plist.in
@@ -37,7 +37,7 @@
CFBundleInfoDictionaryVersion
6.0
CFBundleLongVersionString
- %version%, (c) 2001-2019 Python Software Foundation.
+ %version%, (c) 2001-2020 Python Software Foundation.
CFBundleName
Python
CFBundlePackageType
diff --git a/Python/getcopyright.c b/Python/getcopyright.c
index 27a1731f46ded..299ccc08c44f8 100644
--- a/Python/getcopyright.c
+++ b/Python/getcopyright.c
@@ -4,7 +4,7 @@
static const char cprt[] =
"\
-Copyright (c) 2001-2019 Python Software Foundation.\n\
+Copyright (c) 2001-2020 Python Software Foundation.\n\
All Rights Reserved.\n\
\n\
Copyright (c) 2000 BeOpen.com.\n\
diff --git a/README.rst b/README.rst
index 9c8c15858ebd5..81d457c5640b5 100644
--- a/README.rst
+++ b/README.rst
@@ -17,9 +17,7 @@ This is Python version 3.6.10+
:alt: CPython code coverage on Codecov
:target: https://codecov.io/gh/python/cpython
-Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
-2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation. All
-rights reserved.
+Copyright (c) 2001-2020 Python Software Foundation. All rights reserved.
See the end of this file for further copyright and license information.
@@ -244,9 +242,7 @@ See :pep:`494` for Python 3.6 release details.
Copyright and License Information
---------------------------------
-Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
-2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation. All
-rights reserved.
+Copyright (c) 2001-2020 Python Software Foundation. All rights reserved.
Copyright (c) 2000 BeOpen.com. All rights reserved.
From webhook-mailer at python.org Thu Jan 2 22:15:41 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Fri, 03 Jan 2020 03:15:41 -0000
Subject: [Python-checkins] Bring Python into the next decade. (GH-17801)
Message-ID:
https://github.com/python/cpython/commit/10dc738bdac7ef4e2ba0785f65c9cb4696aa241d
commit: 10dc738bdac7ef4e2ba0785f65c9cb4696aa241d
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-02T19:15:37-08:00
summary:
Bring Python into the next decade. (GH-17801)
(cherry picked from commit 946b29ea0b3b386ed05e87e60b8617c9dc19cd53)
Co-authored-by: Benjamin Peterson
files:
M Doc/copyright.rst
M Doc/license.rst
M LICENSE
M Mac/IDLE/IDLE.app/Contents/Info.plist
M Mac/PythonLauncher/Info.plist.in
M Mac/Resources/app/Info.plist.in
M Python/getcopyright.c
M README.rst
diff --git a/Doc/copyright.rst b/Doc/copyright.rst
index 393a1f03751f8..1b90d9f172c99 100644
--- a/Doc/copyright.rst
+++ b/Doc/copyright.rst
@@ -4,7 +4,7 @@ Copyright
Python and this documentation is:
-Copyright ? 2001-2019 Python Software Foundation. All rights reserved.
+Copyright ? 2001-2020 Python Software Foundation. All rights reserved.
Copyright ? 2000 BeOpen.com. All rights reserved.
diff --git a/Doc/license.rst b/Doc/license.rst
index 810d2e63fd48c..472a5cf3d88b3 100644
--- a/Doc/license.rst
+++ b/Doc/license.rst
@@ -87,7 +87,7 @@ PSF LICENSE AGREEMENT FOR PYTHON |release|
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python |release| alone or in any derivative
version, provided, however, that PSF's License Agreement and PSF's notice of
- copyright, i.e., "Copyright ? 2001-2019 Python Software Foundation; All Rights
+ copyright, i.e., "Copyright ? 2001-2020 Python Software Foundation; All Rights
Reserved" are retained in Python |release| alone or in any derivative version
prepared by Licensee.
diff --git a/LICENSE b/LICENSE
index 9dc010d80348f..66a3ac80d729a 100644
--- a/LICENSE
+++ b/LICENSE
@@ -73,7 +73,7 @@ analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python alone or in any derivative version,
provided, however, that PSF's License Agreement and PSF's notice of copyright,
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation;
+2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation;
All Rights Reserved" are retained in Python alone or in any derivative version
prepared by Licensee.
diff --git a/Mac/IDLE/IDLE.app/Contents/Info.plist b/Mac/IDLE/IDLE.app/Contents/Info.plist
index 04a0a08c83639..dcc48abdd2a39 100644
--- a/Mac/IDLE/IDLE.app/Contents/Info.plist
+++ b/Mac/IDLE/IDLE.app/Contents/Info.plist
@@ -36,7 +36,7 @@
CFBundleExecutable
IDLE
CFBundleGetInfoString
- %version%, ? 2001-2019 Python Software Foundation
+ %version%, ? 2001-2020 Python Software Foundation
CFBundleIconFile
IDLE.icns
CFBundleIdentifier
diff --git a/Mac/PythonLauncher/Info.plist.in b/Mac/PythonLauncher/Info.plist.in
index 9fb4e0affd9c4..21a051535fb92 100644
--- a/Mac/PythonLauncher/Info.plist.in
+++ b/Mac/PythonLauncher/Info.plist.in
@@ -40,7 +40,7 @@
CFBundleExecutable
Python Launcher
CFBundleGetInfoString
- %VERSION%, ? 2001-2019 Python Software Foundation
+ %VERSION%, ? 2001-2020 Python Software Foundation
CFBundleIconFile
PythonLauncher.icns
CFBundleIdentifier
diff --git a/Mac/Resources/app/Info.plist.in b/Mac/Resources/app/Info.plist.in
index b7581984dd676..66b5e764c54b0 100644
--- a/Mac/Resources/app/Info.plist.in
+++ b/Mac/Resources/app/Info.plist.in
@@ -37,7 +37,7 @@
CFBundleInfoDictionaryVersion
6.0
CFBundleLongVersionString
- %version%, (c) 2001-2019 Python Software Foundation.
+ %version%, (c) 2001-2020 Python Software Foundation.
CFBundleName
Python
CFBundlePackageType
diff --git a/Python/getcopyright.c b/Python/getcopyright.c
index 27a1731f46ded..299ccc08c44f8 100644
--- a/Python/getcopyright.c
+++ b/Python/getcopyright.c
@@ -4,7 +4,7 @@
static const char cprt[] =
"\
-Copyright (c) 2001-2019 Python Software Foundation.\n\
+Copyright (c) 2001-2020 Python Software Foundation.\n\
All Rights Reserved.\n\
\n\
Copyright (c) 2000 BeOpen.com.\n\
diff --git a/README.rst b/README.rst
index d14f2b3ad99a6..be371c6498079 100644
--- a/README.rst
+++ b/README.rst
@@ -18,7 +18,7 @@ This is Python version 3.8.1
:target: https://python.zulipchat.com
-Copyright (c) 2001-2019 Python Software Foundation. All rights reserved.
+Copyright (c) 2001-2020 Python Software Foundation. All rights reserved.
See the end of this file for further copyright and license information.
@@ -246,7 +246,7 @@ See :pep:`569` for Python 3.8 release details.
Copyright and License Information
---------------------------------
-Copyright (c) 2001-2019 Python Software Foundation. All rights reserved.
+Copyright (c) 2001-2020 Python Software Foundation. All rights reserved.
Copyright (c) 2000 BeOpen.com. All rights reserved.
From webhook-mailer at python.org Thu Jan 2 22:28:43 2020
From: webhook-mailer at python.org (Ned Deily)
Date: Fri, 03 Jan 2020 03:28:43 -0000
Subject: [Python-checkins] Update copyright year in macOS installer license
copy (GH-17806)
Message-ID:
https://github.com/python/cpython/commit/32f1443aa98db769d87db497b45bd0dcb732445b
commit: 32f1443aa98db769d87db497b45bd0dcb732445b
branch: master
author: Ned Deily
committer: GitHub
date: 2020-01-02T22:28:37-05:00
summary:
Update copyright year in macOS installer license copy (GH-17806)
files:
M Mac/BuildScript/resources/License.rtf
diff --git a/Mac/BuildScript/resources/License.rtf b/Mac/BuildScript/resources/License.rtf
index 7566cf3b44618..25d53386da01a 100644
--- a/Mac/BuildScript/resources/License.rtf
+++ b/Mac/BuildScript/resources/License.rtf
@@ -1,5 +1,5 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
-{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fmodern\fcharset0 CourierNewPS-BoldMT;
+{\rtf1\ansi\ansicpg1252\cocoartf2511
+\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fmodern\fcharset0 CourierNewPS-BoldMT;
\f3\fmodern\fcharset0 CourierNewPSMT;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
@@ -55,7 +55,7 @@ Thanks to the many outside volunteers who have worked under Guido's direction to
\f1\b0 \
1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization ("Licensee") accessing and otherwise using this software ("Python") in source or binary form and its associated documentation.\
\
-2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee.\
+2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright \'a9 2001-2020 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee.\
\
3. In the event Licensee prepares a derivative work that is based on or incorporates Python or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python.\
\
From webhook-mailer at python.org Thu Jan 2 22:39:27 2020
From: webhook-mailer at python.org (Ned Deily)
Date: Fri, 03 Jan 2020 03:39:27 -0000
Subject: [Python-checkins] [3.7] Bring Python into the next decade.
(GH-17801). (GH-17803)
Message-ID:
https://github.com/python/cpython/commit/8978ae9705f56e2a4ed7e7b819eea21b2190f9ab
commit: 8978ae9705f56e2a4ed7e7b819eea21b2190f9ab
branch: 3.7
author: Benjamin Peterson
committer: Ned Deily
date: 2020-01-02T22:39:21-05:00
summary:
[3.7] Bring Python into the next decade. (GH-17801). (GH-17803)
(cherry picked from commit 946b29ea0b3b386ed05e87e60b8617c9dc19cd53)
Co-authored-by: Benjamin Peterson
files:
M Doc/copyright.rst
M Doc/license.rst
M LICENSE
M Mac/IDLE/IDLE.app/Contents/Info.plist
M Mac/PythonLauncher/Info.plist.in
M Mac/Resources/app/Info.plist.in
M Python/getcopyright.c
M README.rst
diff --git a/Doc/copyright.rst b/Doc/copyright.rst
index 393a1f03751f8..1b90d9f172c99 100644
--- a/Doc/copyright.rst
+++ b/Doc/copyright.rst
@@ -4,7 +4,7 @@ Copyright
Python and this documentation is:
-Copyright ? 2001-2019 Python Software Foundation. All rights reserved.
+Copyright ? 2001-2020 Python Software Foundation. All rights reserved.
Copyright ? 2000 BeOpen.com. All rights reserved.
diff --git a/Doc/license.rst b/Doc/license.rst
index d9a4314f057f8..9b98b1b2f68e4 100644
--- a/Doc/license.rst
+++ b/Doc/license.rst
@@ -87,7 +87,7 @@ PSF LICENSE AGREEMENT FOR PYTHON |release|
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python |release| alone or in any derivative
version, provided, however, that PSF's License Agreement and PSF's notice of
- copyright, i.e., "Copyright ? 2001-2019 Python Software Foundation; All Rights
+ copyright, i.e., "Copyright ? 2001-2020 Python Software Foundation; All Rights
Reserved" are retained in Python |release| alone or in any derivative version
prepared by Licensee.
diff --git a/LICENSE b/LICENSE
index 9dc010d80348f..66a3ac80d729a 100644
--- a/LICENSE
+++ b/LICENSE
@@ -73,7 +73,7 @@ analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python alone or in any derivative version,
provided, however, that PSF's License Agreement and PSF's notice of copyright,
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation;
+2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation;
All Rights Reserved" are retained in Python alone or in any derivative version
prepared by Licensee.
diff --git a/Mac/IDLE/IDLE.app/Contents/Info.plist b/Mac/IDLE/IDLE.app/Contents/Info.plist
index 04a0a08c83639..dcc48abdd2a39 100644
--- a/Mac/IDLE/IDLE.app/Contents/Info.plist
+++ b/Mac/IDLE/IDLE.app/Contents/Info.plist
@@ -36,7 +36,7 @@
CFBundleExecutable
IDLE
CFBundleGetInfoString
- %version%, ? 2001-2019 Python Software Foundation
+ %version%, ? 2001-2020 Python Software Foundation
CFBundleIconFile
IDLE.icns
CFBundleIdentifier
diff --git a/Mac/PythonLauncher/Info.plist.in b/Mac/PythonLauncher/Info.plist.in
index 9fb4e0affd9c4..21a051535fb92 100644
--- a/Mac/PythonLauncher/Info.plist.in
+++ b/Mac/PythonLauncher/Info.plist.in
@@ -40,7 +40,7 @@
CFBundleExecutable
Python Launcher
CFBundleGetInfoString
- %VERSION%, ? 2001-2019 Python Software Foundation
+ %VERSION%, ? 2001-2020 Python Software Foundation
CFBundleIconFile
PythonLauncher.icns
CFBundleIdentifier
diff --git a/Mac/Resources/app/Info.plist.in b/Mac/Resources/app/Info.plist.in
index b7581984dd676..66b5e764c54b0 100644
--- a/Mac/Resources/app/Info.plist.in
+++ b/Mac/Resources/app/Info.plist.in
@@ -37,7 +37,7 @@
CFBundleInfoDictionaryVersion
6.0
CFBundleLongVersionString
- %version%, (c) 2001-2019 Python Software Foundation.
+ %version%, (c) 2001-2020 Python Software Foundation.
CFBundleName
Python
CFBundlePackageType
diff --git a/Python/getcopyright.c b/Python/getcopyright.c
index 27a1731f46ded..299ccc08c44f8 100644
--- a/Python/getcopyright.c
+++ b/Python/getcopyright.c
@@ -4,7 +4,7 @@
static const char cprt[] =
"\
-Copyright (c) 2001-2019 Python Software Foundation.\n\
+Copyright (c) 2001-2020 Python Software Foundation.\n\
All Rights Reserved.\n\
\n\
Copyright (c) 2000 BeOpen.com.\n\
diff --git a/README.rst b/README.rst
index b4b9fbf8f6b65..886b5829d92c1 100644
--- a/README.rst
+++ b/README.rst
@@ -13,9 +13,7 @@ This is Python version 3.7.6+
:alt: CPython code coverage on Codecov
:target: https://codecov.io/gh/python/cpython/branch/3.7
-Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
-2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation. All
-rights reserved.
+Copyright (c) 2001-2020 Python Software Foundation. All rights reserved.
See the end of this file for further copyright and license information.
@@ -244,9 +242,7 @@ See :pep:`537` for Python 3.7 release details.
Copyright and License Information
---------------------------------
-Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
-2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation. All
-rights reserved.
+Copyright (c) 2001-2020 Python Software Foundation. All rights reserved.
Copyright (c) 2000 BeOpen.com. All rights reserved.
From webhook-mailer at python.org Thu Jan 2 22:44:08 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Fri, 03 Jan 2020 03:44:08 -0000
Subject: [Python-checkins] Update copyright year in macOS installer license
copy (GH-17806)
Message-ID:
https://github.com/python/cpython/commit/ecd572ae7abf22460296e0a306080d1f5209c73f
commit: ecd572ae7abf22460296e0a306080d1f5209c73f
branch: 2.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-02T19:44:03-08:00
summary:
Update copyright year in macOS installer license copy (GH-17806)
(cherry picked from commit 32f1443aa98db769d87db497b45bd0dcb732445b)
Co-authored-by: Ned Deily
files:
M Mac/BuildScript/resources/License.rtf
diff --git a/Mac/BuildScript/resources/License.rtf b/Mac/BuildScript/resources/License.rtf
index 7566cf3b44618..25d53386da01a 100644
--- a/Mac/BuildScript/resources/License.rtf
+++ b/Mac/BuildScript/resources/License.rtf
@@ -1,5 +1,5 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
-{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fmodern\fcharset0 CourierNewPS-BoldMT;
+{\rtf1\ansi\ansicpg1252\cocoartf2511
+\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fmodern\fcharset0 CourierNewPS-BoldMT;
\f3\fmodern\fcharset0 CourierNewPSMT;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
@@ -55,7 +55,7 @@ Thanks to the many outside volunteers who have worked under Guido's direction to
\f1\b0 \
1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization ("Licensee") accessing and otherwise using this software ("Python") in source or binary form and its associated documentation.\
\
-2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee.\
+2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright \'a9 2001-2020 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee.\
\
3. In the event Licensee prepares a derivative work that is based on or incorporates Python or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python.\
\
From webhook-mailer at python.org Thu Jan 2 22:47:05 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Fri, 03 Jan 2020 03:47:05 -0000
Subject: [Python-checkins] Update copyright year in macOS installer license
copy (GH-17806)
Message-ID:
https://github.com/python/cpython/commit/83638fe0a7b90189677e0d4b40426f50a3a89a2c
commit: 83638fe0a7b90189677e0d4b40426f50a3a89a2c
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-02T19:47:00-08:00
summary:
Update copyright year in macOS installer license copy (GH-17806)
(cherry picked from commit 32f1443aa98db769d87db497b45bd0dcb732445b)
Co-authored-by: Ned Deily
files:
M Mac/BuildScript/resources/License.rtf
diff --git a/Mac/BuildScript/resources/License.rtf b/Mac/BuildScript/resources/License.rtf
index 7566cf3b44618..25d53386da01a 100644
--- a/Mac/BuildScript/resources/License.rtf
+++ b/Mac/BuildScript/resources/License.rtf
@@ -1,5 +1,5 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
-{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fmodern\fcharset0 CourierNewPS-BoldMT;
+{\rtf1\ansi\ansicpg1252\cocoartf2511
+\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fmodern\fcharset0 CourierNewPS-BoldMT;
\f3\fmodern\fcharset0 CourierNewPSMT;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
@@ -55,7 +55,7 @@ Thanks to the many outside volunteers who have worked under Guido's direction to
\f1\b0 \
1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization ("Licensee") accessing and otherwise using this software ("Python") in source or binary form and its associated documentation.\
\
-2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee.\
+2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright \'a9 2001-2020 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee.\
\
3. In the event Licensee prepares a derivative work that is based on or incorporates Python or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python.\
\
From webhook-mailer at python.org Thu Jan 2 22:50:04 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Fri, 03 Jan 2020 03:50:04 -0000
Subject: [Python-checkins] Update copyright year in macOS installer license
copy (GH-17806)
Message-ID:
https://github.com/python/cpython/commit/526f0b3d93b50dda26cff03e92ed0d361dbea828
commit: 526f0b3d93b50dda26cff03e92ed0d361dbea828
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-02T19:49:59-08:00
summary:
Update copyright year in macOS installer license copy (GH-17806)
(cherry picked from commit 32f1443aa98db769d87db497b45bd0dcb732445b)
Co-authored-by: Ned Deily
files:
M Mac/BuildScript/resources/License.rtf
diff --git a/Mac/BuildScript/resources/License.rtf b/Mac/BuildScript/resources/License.rtf
index 7566cf3b44618..25d53386da01a 100644
--- a/Mac/BuildScript/resources/License.rtf
+++ b/Mac/BuildScript/resources/License.rtf
@@ -1,5 +1,5 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
-{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fmodern\fcharset0 CourierNewPS-BoldMT;
+{\rtf1\ansi\ansicpg1252\cocoartf2511
+\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fmodern\fcharset0 CourierNewPS-BoldMT;
\f3\fmodern\fcharset0 CourierNewPSMT;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
@@ -55,7 +55,7 @@ Thanks to the many outside volunteers who have worked under Guido's direction to
\f1\b0 \
1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization ("Licensee") accessing and otherwise using this software ("Python") in source or binary form and its associated documentation.\
\
-2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee.\
+2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright \'a9 2001-2020 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee.\
\
3. In the event Licensee prepares a derivative work that is based on or incorporates Python or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python.\
\
From webhook-mailer at python.org Thu Jan 2 23:14:06 2020
From: webhook-mailer at python.org (Ned Deily)
Date: Fri, 03 Jan 2020 04:14:06 -0000
Subject: [Python-checkins] Update copyright year in macOS installer license
copy (GH-17806) (GH-17810)
Message-ID:
https://github.com/python/cpython/commit/4171b8e41165daadb034867eae61e05f8d2bc9c0
commit: 4171b8e41165daadb034867eae61e05f8d2bc9c0
branch: 3.6
author: Ned Deily
committer: GitHub
date: 2020-01-02T23:13:59-05:00
summary:
Update copyright year in macOS installer license copy (GH-17806) (GH-17810)
files:
M Mac/BuildScript/resources/License.rtf
diff --git a/Mac/BuildScript/resources/License.rtf b/Mac/BuildScript/resources/License.rtf
index 5475d7255bd19..25d53386da01a 100644
--- a/Mac/BuildScript/resources/License.rtf
+++ b/Mac/BuildScript/resources/License.rtf
@@ -1,16 +1,17 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160
-{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fmodern\fcharset0 CourierNewPS-BoldMT;\f2\fmodern\fcharset0 CourierNewPSMT;
-}
+{\rtf1\ansi\ansicpg1252\cocoartf2511
+\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fmodern\fcharset0 CourierNewPS-BoldMT;
+\f3\fmodern\fcharset0 CourierNewPSMT;}
{\colortbl;\red255\green255\blue255;}
+{\*\expandedcolortbl;;}
\margl1440\margr1440\vieww14620\viewh13380\viewkind0
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
+\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\f0\b\fs36 \cf0 \ul \ulc0 HISTORY AND LICENSE\
\fs24 \
HISTORY OF THE SOFTWARE\
-\b0 \ulnone \
+\f1\b0 \ulnone \
Python was created in the early 1990s by Guido van Rossum at Stichting Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands as a successor of a language called ABC. Guido remains Python's principal author, although it includes many contributions from others.\
\
In 1995, Guido continued his work on Python at the Corporation for National Research Initiatives (CNRI, see http://www.cnri.reston.va.us) in Reston, Virginia where he released several versions of the software.\
@@ -20,10 +21,10 @@ In May 2000, Guido and the Python core development team moved to BeOpen.com to f
All Python releases are Open Source (see http://www.opensource.org for the Open Source Definition). Historically, most, but not all, Python releases have also been GPL-compatible; the table below summarizes the various releases.\
\
-\f1\b Release Derived Year Owner GPL-\
+\f2\b Release Derived Year Owner GPL-\
from compatible?\
-\f2\b0 \
+\f3\b0 \
0.9.0 thru 1.2 n/a 1991-1995 CWI yes\
1.3 thru 1.5.2 1.2 1995-1999 CNRI yes\
1.6 1.5.2 2000 CNRI no\
@@ -36,25 +37,25 @@ All Python releases are Open Source (see http://www.opensource.org for the Open
2.1.3 2.1.2 2002 PSF yes\
2.2 and above 2.1.1 2001-now PSF yes\
-\f0 \
+\f1 \
-\b Note:
-\b0 GPL-compatible doesn't mean that we're distributing Python under the GPL. All Python licenses, unlike the GPL, let you distribute a modified version without making your changes open source. The GPL-compatible licenses make it possible to combine Python with other software that is released under the GPL; the others don't.\
+\f0\b Note:
+\f1\b0 GPL-compatible doesn't mean that we're distributing Python under the GPL. All Python licenses, unlike the GPL, let you distribute a modified version without making your changes open source. The GPL-compatible licenses make it possible to combine Python with other software that is released under the GPL; the others don't.\
\
Thanks to the many outside volunteers who have worked under Guido's direction to make these releases possible.\
\
\
-\b \ul TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON\
+\f0\b \ul TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON\
-\b0 \ulnone \
+\f1\b0 \ulnone \
-\b PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2\
+\f0\b PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2\
-\b0 \
+\f1\b0 \
1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization ("Licensee") accessing and otherwise using this software ("Python") in source or binary form and its associated documentation.\
\
-2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee.\
+2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright \'a9 2001-2020 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee.\
\
3. In the event Licensee prepares a derivative work that is based on or incorporates Python or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python.\
\
@@ -70,9 +71,9 @@ Thanks to the many outside volunteers who have worked under Guido's direction to
\
\
-\b BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0\
+\f0\b BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0\
-\b0 \
+\f1\b0 \
BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1\
\
1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the Individual or Organization ("Licensee") accessing and otherwise using this software in source or binary form and its associated documentation ("the Software").\
@@ -91,9 +92,9 @@ BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1\
\
\
-\b CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1\
+\f0\b CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1\
-\b0 \
+\f1\b0 \
1. This LICENSE AGREEMENT is between the Corporation for National Research Initiatives, having an office at 1895 Preston White Drive, Reston, VA 20191 ("CNRI"), and the Individual or Organization ("Licensee") accessing and otherwise using Python 1.6.1 software in source or binary form and its associated documentation.\
\
2. Subject to the terms and conditions of this License Agreement, CNRI hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python 1.6.1 alone or in any derivative version, provided, however, that CNRI's License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) 1995-2001 Corporation for National Research Initiatives; All Rights Reserved" are retained in Python 1.6.1 alone or in any derivative version prepared by Licensee. Alternately, in lieu of CNRI's License Agreement, Licensee may substitute the following text (omitting the quotes): "Python 1.6.1 is made available subject to the terms and conditions in CNRI's License Agreement. This Agreement together with Python 1.6.1 may be located on the Internet using the following unique, persistent identifier (known as a handle): 1895.22/1013. This Agreement may also be obtained from a proxy server on the Internet using the following URL: http://hdl.handle.net/1895.22/1013".\
@@ -114,9 +115,9 @@ BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1\
\
\
-\b CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2\
+\f0\b CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2\
-\b0 \
+\f1\b0 \
Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, The Netherlands. All rights reserved.\
\
Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Stichting Mathematisch Centrum or CWI not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission.\
@@ -125,16 +126,16 @@ STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFT
\
\
-\b \ul LICENSES AND ACKNOWLEDGEMENTS FOR INCORPORATED SOFTWARE\
+\f0\b \ul LICENSES AND ACKNOWLEDGEMENTS FOR INCORPORATED SOFTWARE\
-\b0 \ulnone \
+\f1\b0 \ulnone \
This installer incorporates portions of the following third-party software:\
\
-\f2 $THIRD_PARTY_LIBS\
+\f3 $THIRD_PARTY_LIBS\
\
-\f0 For licenses and acknowledgements for these and other third-party software incorporated in this Python distribution, please refer to the on-line documentation {\field{\*\fldinst{HYPERLINK "https://docs.python.org/$VERSION/license.html#licenses-and-acknowledgements-for-incorporated-software"}}{\fldrslt here}}.\
+\f1 For licenses and acknowledgements for these and other third-party software incorporated in this Python distribution, please refer to the on-line documentation {\field{\*\fldinst{HYPERLINK "https://docs.python.org/$VERSION/license.html#licenses-and-acknowledgements-for-incorporated-software"}}{\fldrslt here}}.\
\
\
\
From webhook-mailer at python.org Fri Jan 3 00:21:27 2020
From: webhook-mailer at python.org (Raymond Hettinger)
Date: Fri, 03 Jan 2020 05:21:27 -0000
Subject: [Python-checkins] bpo-39158: ast.literal_eval() doesn't support
empty sets (GH-17742)
Message-ID:
https://github.com/python/cpython/commit/4fcf5c12a37a8d3d8d6303c44c223dbc8d568cfd
commit: 4fcf5c12a37a8d3d8d6303c44c223dbc8d568cfd
branch: master
author: Raymond Hettinger
committer: GitHub
date: 2020-01-02T22:21:18-07:00
summary:
bpo-39158: ast.literal_eval() doesn't support empty sets (GH-17742)
files:
A Misc/NEWS.d/next/Library/2019-12-29-15-44-38.bpo-39158.cxVoOR.rst
M Doc/library/ast.rst
M Lib/ast.py
M Lib/test/test_ast.py
diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst
index 190d9286effb0..c380a81bee6d2 100644
--- a/Doc/library/ast.rst
+++ b/Doc/library/ast.rst
@@ -194,6 +194,9 @@ and classes for traversing abstract syntax trees:
.. versionchanged:: 3.2
Now allows bytes and set literals.
+ .. versionchanged:: 3.9
+ Now supports creating empty sets with ``'set()'``.
+
.. function:: get_docstring(node, clean=True)
diff --git a/Lib/ast.py b/Lib/ast.py
index ece8b139e460e..495c0d618f12c 100644
--- a/Lib/ast.py
+++ b/Lib/ast.py
@@ -83,6 +83,9 @@ def _convert(node):
return list(map(_convert, node.elts))
elif isinstance(node, Set):
return set(map(_convert, node.elts))
+ elif (isinstance(node, Call) and isinstance(node.func, Name) and
+ node.func.id == 'set' and node.args == node.keywords == []):
+ return set()
elif isinstance(node, Dict):
return dict(zip(map(_convert, node.keys),
map(_convert, node.values)))
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index 51a7c1af1ffe7..55b91cfa23bec 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -891,6 +891,7 @@ def test_literal_eval(self):
self.assertEqual(ast.literal_eval('(True, False, None)'), (True, False, None))
self.assertEqual(ast.literal_eval('{1, 2, 3}'), {1, 2, 3})
self.assertEqual(ast.literal_eval('b"hi"'), b"hi")
+ self.assertEqual(ast.literal_eval('set()'), set())
self.assertRaises(ValueError, ast.literal_eval, 'foo()')
self.assertEqual(ast.literal_eval('6'), 6)
self.assertEqual(ast.literal_eval('+6'), 6)
diff --git a/Misc/NEWS.d/next/Library/2019-12-29-15-44-38.bpo-39158.cxVoOR.rst b/Misc/NEWS.d/next/Library/2019-12-29-15-44-38.bpo-39158.cxVoOR.rst
new file mode 100644
index 0000000000000..c41799bebaeb9
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-12-29-15-44-38.bpo-39158.cxVoOR.rst
@@ -0,0 +1 @@
+ast.literal_eval() now supports empty sets.
From webhook-mailer at python.org Fri Jan 3 07:10:32 2020
From: webhook-mailer at python.org (T. Wouters)
Date: Fri, 03 Jan 2020 12:10:32 -0000
Subject: [Python-checkins] Add link to zlib v1.1.3 vulnerability (GH-17156)
Message-ID:
https://github.com/python/cpython/commit/b789202cbedd93898c29b08a44ca085bf0723d81
commit: b789202cbedd93898c29b08a44ca085bf0723d81
branch: master
author: Emmanuel Nosa E
committer: T. Wouters
date: 2020-01-03T13:10:16+01:00
summary:
Add link to zlib v1.1.3 vulnerability (GH-17156)
files:
M Doc/library/zlib.rst
diff --git a/Doc/library/zlib.rst b/Doc/library/zlib.rst
index 339acfd0e5786..ec60ea24db662 100644
--- a/Doc/library/zlib.rst
+++ b/Doc/library/zlib.rst
@@ -9,9 +9,9 @@
For applications that require data compression, the functions in this module
allow compression and decompression, using the zlib library. The zlib library
-has its own home page at http://www.zlib.net. There are known
+has its own home page at https://www.zlib.net. There are known
incompatibilities between the Python module and versions of the zlib library
-earlier than 1.1.3; 1.1.3 has a security vulnerability, so we recommend using
+earlier than 1.1.3; 1.1.3 has a `security vulnerability `_, so we recommend using
1.1.4 or later.
zlib's functions have many options and often need to be used in a particular
@@ -337,4 +337,3 @@ the following constants:
http://www.zlib.net/manual.html
The zlib manual explains the semantics and usage of the library's many
functions.
-
From webhook-mailer at python.org Fri Jan 3 07:16:16 2020
From: webhook-mailer at python.org (T. Wouters)
Date: Fri, 03 Jan 2020 12:16:16 -0000
Subject: [Python-checkins] bpo-38532: Add missing decrefs in
PyCFuncPtr_FromDll() (GH-16857)
Message-ID:
https://github.com/python/cpython/commit/e02ab59fdffa0bb841182c30ef1355c89578d945
commit: e02ab59fdffa0bb841182c30ef1355c89578d945
branch: master
author: Zackery Spytz
committer: T. Wouters
date: 2020-01-03T13:16:12+01:00
summary:
bpo-38532: Add missing decrefs in PyCFuncPtr_FromDll() (GH-16857)
files:
M Modules/_ctypes/_ctypes.c
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index d38d892be621c..93af497bda25f 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -3554,10 +3554,12 @@ PyCFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (PySys_Audit("ctypes.dlsym",
((uintptr_t)name & ~0xFFFF) ? "Os" : "On",
dll, name) < 0) {
+ Py_DECREF(ftuple);
return NULL;
}
#else
if (PySys_Audit("ctypes.dlsym", "Os", dll, name) < 0) {
+ Py_DECREF(ftuple);
return NULL;
}
#endif
From webhook-mailer at python.org Fri Jan 3 07:50:20 2020
From: webhook-mailer at python.org (T. Wouters)
Date: Fri, 03 Jan 2020 12:50:20 -0000
Subject: [Python-checkins] bpo-38532: Add missing decrefs in
PyCFuncPtr_FromDll() (GH-17811)
Message-ID:
https://github.com/python/cpython/commit/aa3efea9c5f4d25afc3fa4cfd5e6d789943893c9
commit: aa3efea9c5f4d25afc3fa4cfd5e6d789943893c9
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: T. Wouters
date: 2020-01-03T13:50:11+01:00
summary:
bpo-38532: Add missing decrefs in PyCFuncPtr_FromDll() (GH-17811)
(cherry picked from commit e02ab59fdffa0bb841182c30ef1355c89578d945)
Co-authored-by: Zackery Spytz
files:
M Modules/_ctypes/_ctypes.c
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 347a3656b6257..c6da0d804453e 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -3554,10 +3554,12 @@ PyCFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (PySys_Audit("ctypes.dlsym",
((uintptr_t)name & ~0xFFFF) ? "Os" : "On",
dll, name) < 0) {
+ Py_DECREF(ftuple);
return NULL;
}
#else
if (PySys_Audit("ctypes.dlsym", "Os", dll, name) < 0) {
+ Py_DECREF(ftuple);
return NULL;
}
#endif
From webhook-mailer at python.org Fri Jan 3 21:14:23 2020
From: webhook-mailer at python.org (Senthil Kumaran)
Date: Sat, 04 Jan 2020 02:14:23 -0000
Subject: [Python-checkins] bpo-27973 - Use test.support.temp_dir instead of
NamedTemporaryFile for the (#17774)
Message-ID:
https://github.com/python/cpython/commit/5bba60290b4ac8c95ac46cfdaba5deee37be1fab
commit: 5bba60290b4ac8c95ac46cfdaba5deee37be1fab
branch: 2.7
author: Senthil Kumaran
committer: GitHub
date: 2020-01-03T18:14:18-08:00
summary:
bpo-27973 - Use test.support.temp_dir instead of NamedTemporaryFile for the (#17774)
desired behavior under windows platform.
Suggestion by David Bolen
files:
M Lib/test/test_urllibnet.py
diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py
index df118dc75d1b3..ef33e3a0ea617 100644
--- a/Lib/test/test_urllibnet.py
+++ b/Lib/test/test_urllibnet.py
@@ -1,4 +1,3 @@
-import tempfile
import unittest
from test import test_support
from test.test_urllib2net import skip_ftp_test_on_travis
@@ -224,9 +223,10 @@ 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)
+ for file_num in range(self.NUM_FTP_RETRIEVES):
+ with test_support.temp_dir() as td:
+ urllib.FancyURLopener().retrieve(self.FTP_TEST_FILE,
+ os.path.join(td, str(file_num)))
except IOError as e:
self.fail("Failed FTP retrieve while accessing ftp url "
"multiple times.\n Error message was : %s" % e)
From webhook-mailer at python.org Sat Jan 4 04:10:29 2020
From: webhook-mailer at python.org (Andrew Svetlov)
Date: Sat, 04 Jan 2020 09:10:29 -0000
Subject: [Python-checkins] Fix #39191: Don't spawn a task before failing
(#17796)
Message-ID:
https://github.com/python/cpython/commit/3a5de511596f17575de082dcb8d43d63b2bd2da9
commit: 3a5de511596f17575de082dcb8d43d63b2bd2da9
branch: master
author: Andrew Svetlov
committer: GitHub
date: 2020-01-04T11:10:14+02:00
summary:
Fix #39191: Don't spawn a task before failing (#17796)
files:
A Misc/NEWS.d/next/Library/2020-01-02-17-28-03.bpo-39191.ur_scy.rst
M Lib/asyncio/base_events.py
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index adcdec171b07a..e53ca73803463 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -573,14 +573,17 @@ def _do_shutdown(self, future):
except Exception as ex:
self.call_soon_threadsafe(future.set_exception, ex)
- def run_forever(self):
- """Run until stop() is called."""
- self._check_closed()
+ def _check_runnung(self):
if self.is_running():
raise RuntimeError('This event loop is already running')
if events._get_running_loop() is not None:
raise RuntimeError(
'Cannot run the event loop while another loop is running')
+
+ def run_forever(self):
+ """Run until stop() is called."""
+ self._check_closed()
+ self._check_runnung()
self._set_coroutine_origin_tracking(self._debug)
self._thread_id = threading.get_ident()
@@ -612,6 +615,7 @@ def run_until_complete(self, future):
Return the Future's result, or raise its exception.
"""
self._check_closed()
+ self._check_runnung()
new_task = not futures.isfuture(future)
future = tasks.ensure_future(future, loop=self)
diff --git a/Misc/NEWS.d/next/Library/2020-01-02-17-28-03.bpo-39191.ur_scy.rst b/Misc/NEWS.d/next/Library/2020-01-02-17-28-03.bpo-39191.ur_scy.rst
new file mode 100644
index 0000000000000..138c93c2e4877
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-01-02-17-28-03.bpo-39191.ur_scy.rst
@@ -0,0 +1,3 @@
+Perform a check for running loop before starting a new task in
+``loop.run_until_complete()`` to fail fast; it prevents the side effect of
+new task spawning before exception raising.
From webhook-mailer at python.org Sat Jan 4 04:49:23 2020
From: webhook-mailer at python.org (Andrew Svetlov)
Date: Sat, 04 Jan 2020 09:49:23 -0000
Subject: [Python-checkins] [3.8] bpo-39191: Don't spawn a task before
failing (GH-17796) (GH-17820)
Message-ID:
https://github.com/python/cpython/commit/867d8333ce6a7f74191ad464acc609d4a04e4acb
commit: 867d8333ce6a7f74191ad464acc609d4a04e4acb
branch: 3.8
author: Andrew Svetlov
committer: GitHub
date: 2020-01-04T11:49:11+02:00
summary:
[3.8] bpo-39191: Don't spawn a task before failing (GH-17796) (GH-17820)
(cherry picked from commit 3a5de511596f17575de082dcb8d43d63b2bd2da9)
Co-authored-by: Andrew Svetlov
files:
A Misc/NEWS.d/next/Library/2020-01-02-17-28-03.bpo-39191.ur_scy.rst
M Lib/asyncio/base_events.py
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index bfd40115bed38..aedf0c5e6d3d2 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -547,14 +547,17 @@ def _asyncgen_firstiter_hook(self, agen):
'asyncgen': agen
})
- def run_forever(self):
- """Run until stop() is called."""
- self._check_closed()
+ def _check_runnung(self):
if self.is_running():
raise RuntimeError('This event loop is already running')
if events._get_running_loop() is not None:
raise RuntimeError(
'Cannot run the event loop while another loop is running')
+
+ def run_forever(self):
+ """Run until stop() is called."""
+ self._check_closed()
+ self._check_runnung()
self._set_coroutine_origin_tracking(self._debug)
self._thread_id = threading.get_ident()
@@ -586,6 +589,7 @@ def run_until_complete(self, future):
Return the Future's result, or raise its exception.
"""
self._check_closed()
+ self._check_runnung()
new_task = not futures.isfuture(future)
future = tasks.ensure_future(future, loop=self)
diff --git a/Misc/NEWS.d/next/Library/2020-01-02-17-28-03.bpo-39191.ur_scy.rst b/Misc/NEWS.d/next/Library/2020-01-02-17-28-03.bpo-39191.ur_scy.rst
new file mode 100644
index 0000000000000..138c93c2e4877
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-01-02-17-28-03.bpo-39191.ur_scy.rst
@@ -0,0 +1,3 @@
+Perform a check for running loop before starting a new task in
+``loop.run_until_complete()`` to fail fast; it prevents the side effect of
+new task spawning before exception raising.
From webhook-mailer at python.org Sat Jan 4 04:49:37 2020
From: webhook-mailer at python.org (Andrew Svetlov)
Date: Sat, 04 Jan 2020 09:49:37 -0000
Subject: [Python-checkins] [3.7] bpo-39191: Don't spawn a task before
failing (GH-17796) (#17821)
Message-ID:
https://github.com/python/cpython/commit/9c145e19fba53369da5cd23a1e71de489836f827
commit: 9c145e19fba53369da5cd23a1e71de489836f827
branch: 3.7
author: Andrew Svetlov
committer: GitHub
date: 2020-01-04T11:49:32+02:00
summary:
[3.7] bpo-39191: Don't spawn a task before failing (GH-17796) (#17821)
(cherry picked from commit 3a5de511596f17575de082dcb8d43d63b2bd2da9)
Co-authored-by: Andrew Svetlov
files:
A Misc/NEWS.d/next/Library/2020-01-02-17-28-03.bpo-39191.ur_scy.rst
M Lib/asyncio/base_events.py
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index fdd80bcfdd906..f7233563446d2 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -518,14 +518,17 @@ def _asyncgen_firstiter_hook(self, agen):
'asyncgen': agen
})
- def run_forever(self):
- """Run until stop() is called."""
- self._check_closed()
+ def _check_runnung(self):
if self.is_running():
raise RuntimeError('This event loop is already running')
if events._get_running_loop() is not None:
raise RuntimeError(
'Cannot run the event loop while another loop is running')
+
+ def run_forever(self):
+ """Run until stop() is called."""
+ self._check_closed()
+ self._check_runnung()
self._set_coroutine_origin_tracking(self._debug)
self._thread_id = threading.get_ident()
@@ -557,6 +560,7 @@ def run_until_complete(self, future):
Return the Future's result, or raise its exception.
"""
self._check_closed()
+ self._check_runnung()
new_task = not futures.isfuture(future)
future = tasks.ensure_future(future, loop=self)
diff --git a/Misc/NEWS.d/next/Library/2020-01-02-17-28-03.bpo-39191.ur_scy.rst b/Misc/NEWS.d/next/Library/2020-01-02-17-28-03.bpo-39191.ur_scy.rst
new file mode 100644
index 0000000000000..138c93c2e4877
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-01-02-17-28-03.bpo-39191.ur_scy.rst
@@ -0,0 +1,3 @@
+Perform a check for running loop before starting a new task in
+``loop.run_until_complete()`` to fail fast; it prevents the side effect of
+new task spawning before exception raising.
From webhook-mailer at python.org Sat Jan 4 07:56:48 2020
From: webhook-mailer at python.org (T. Wouters)
Date: Sat, 04 Jan 2020 12:56:48 -0000
Subject: [Python-checkins] bpo-28367: Add additional baud rates for termios
(GH-13142)
Message-ID:
https://github.com/python/cpython/commit/7dc72b8d4f2c9d1eed20f314fd6425eab66cbc89
commit: 7dc72b8d4f2c9d1eed20f314fd6425eab66cbc89
branch: master
author: Anthony Shaw
committer: T. Wouters
date: 2020-01-04T13:56:31+01:00
summary:
bpo-28367: Add additional baud rates for termios (GH-13142)
Co-authored-by: Andrey Smirnov .
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
files:
A Misc/NEWS.d/next/Library/2019-05-06-22-38-47.bpo-28367.2AKen5.rst
M Modules/termios.c
diff --git a/Misc/NEWS.d/next/Library/2019-05-06-22-38-47.bpo-28367.2AKen5.rst b/Misc/NEWS.d/next/Library/2019-05-06-22-38-47.bpo-28367.2AKen5.rst
new file mode 100644
index 0000000000000..115f458bfbf3e
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-05-06-22-38-47.bpo-28367.2AKen5.rst
@@ -0,0 +1,13 @@
+Termios magic constants for the following baud rates:
+ - B500000
+ - B576000
+ - B921600
+ - B1000000
+ - B1152000
+ - B1500000
+ - B2000000
+ - B2500000
+ - B3000000
+ - B3500000
+ - B4000000
+Patch by Andrey Smirnov
\ No newline at end of file
diff --git a/Modules/termios.c b/Modules/termios.c
index b3b8c72bf6b84..0fd93c06c7203 100644
--- a/Modules/termios.c
+++ b/Modules/termios.c
@@ -613,6 +613,39 @@ static struct constant {
#ifdef B460800
{"B460800", B460800},
#endif
+#ifdef B500000
+ {"B500000", B500000},
+#endif
+#ifdef B576000
+ { "B576000", B576000},
+#endif
+#ifdef B921600
+ { "B921600", B921600},
+#endif
+#ifdef B1000000
+ { "B1000000", B1000000},
+#endif
+#ifdef B1152000
+ { "B1152000", B1152000},
+#endif
+#ifdef B1500000
+ { "B1500000", B1500000},
+#endif
+#ifdef B2000000
+ { "B2000000", B2000000},
+#endif
+#ifdef B2500000
+ { "B2500000", B2500000},
+#endif
+#ifdef B3000000
+ { "B3000000", B3000000},
+#endif
+#ifdef B3500000
+ { "B3500000", B3500000},
+#endif
+#ifdef B4000000
+ { "B4000000", B4000000},
+#endif
#ifdef CBAUD
{"CBAUD", CBAUD},
#endif
From webhook-mailer at python.org Sat Jan 4 20:57:28 2020
From: webhook-mailer at python.org (Pablo Galindo)
Date: Sun, 05 Jan 2020 01:57:28 -0000
Subject: [Python-checkins] Fix SystemError when nested function has
annotation on positional-only argument (GH-17826)
Message-ID:
https://github.com/python/cpython/commit/ec007cb43faf5f33d06efbc28152c7fdcb2edb9c
commit: ec007cb43faf5f33d06efbc28152c7fdcb2edb9c
branch: master
author: Anthony Sottile
committer: Pablo Galindo
date: 2020-01-05T01:57:21Z
summary:
Fix SystemError when nested function has annotation on positional-only argument (GH-17826)
files:
A Misc/NEWS.d/next/Core and Builtins/2020-01-04-17-25-34.bpo-39215.xiqiIz.rst
M Lib/test/test_positional_only_arg.py
M Python/symtable.c
diff --git a/Lib/test/test_positional_only_arg.py b/Lib/test/test_positional_only_arg.py
index 59b0b8fb55621..63dee7ca434b2 100644
--- a/Lib/test/test_positional_only_arg.py
+++ b/Lib/test/test_positional_only_arg.py
@@ -15,6 +15,10 @@ def global_pos_only_and_normal(a, /, b):
def global_pos_only_defaults(a=1, /, b=2):
return a, b
+def global_inner_has_pos_only():
+ def f(x: int, /): ...
+ return f
+
class PositionalOnlyTestCase(unittest.TestCase):
@@ -412,6 +416,9 @@ def method(self, /):
self.assertEqual(C().method(), sentinel)
+ def test_annotations(self):
+ assert global_inner_has_pos_only().__annotations__ == {'x': int}
+
if __name__ == "__main__":
unittest.main()
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-01-04-17-25-34.bpo-39215.xiqiIz.rst b/Misc/NEWS.d/next/Core and Builtins/2020-01-04-17-25-34.bpo-39215.xiqiIz.rst
new file mode 100644
index 0000000000000..9a3178f9c6218
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-01-04-17-25-34.bpo-39215.xiqiIz.rst
@@ -0,0 +1,2 @@
+Fix ``SystemError`` when nested function has annotation on positional-only
+argument - by Anthony Sottile.
diff --git a/Python/symtable.c b/Python/symtable.c
index b8713588b9a91..30482d99b3ca9 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -1717,6 +1717,8 @@ static int
symtable_visit_annotations(struct symtable *st, stmt_ty s,
arguments_ty a, expr_ty returns)
{
+ if (a->posonlyargs && !symtable_visit_argannotations(st, a->posonlyargs))
+ return 0;
if (a->args && !symtable_visit_argannotations(st, a->args))
return 0;
if (a->vararg && a->vararg->annotation)
From webhook-mailer at python.org Sat Jan 4 21:15:02 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Sun, 05 Jan 2020 02:15:02 -0000
Subject: [Python-checkins] Fix SystemError when nested function has
annotation on positional-only argument (GH-17826)
Message-ID:
https://github.com/python/cpython/commit/859525590c7aad210ae5f2557140a52033c498cd
commit: 859525590c7aad210ae5f2557140a52033c498cd
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-04T18:14:58-08:00
summary:
Fix SystemError when nested function has annotation on positional-only argument (GH-17826)
(cherry picked from commit ec007cb43faf5f33d06efbc28152c7fdcb2edb9c)
Co-authored-by: Anthony Sottile
files:
A Misc/NEWS.d/next/Core and Builtins/2020-01-04-17-25-34.bpo-39215.xiqiIz.rst
M Lib/test/test_positional_only_arg.py
M Python/symtable.c
diff --git a/Lib/test/test_positional_only_arg.py b/Lib/test/test_positional_only_arg.py
index 59b0b8fb55621..63dee7ca434b2 100644
--- a/Lib/test/test_positional_only_arg.py
+++ b/Lib/test/test_positional_only_arg.py
@@ -15,6 +15,10 @@ def global_pos_only_and_normal(a, /, b):
def global_pos_only_defaults(a=1, /, b=2):
return a, b
+def global_inner_has_pos_only():
+ def f(x: int, /): ...
+ return f
+
class PositionalOnlyTestCase(unittest.TestCase):
@@ -412,6 +416,9 @@ def method(self, /):
self.assertEqual(C().method(), sentinel)
+ def test_annotations(self):
+ assert global_inner_has_pos_only().__annotations__ == {'x': int}
+
if __name__ == "__main__":
unittest.main()
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-01-04-17-25-34.bpo-39215.xiqiIz.rst b/Misc/NEWS.d/next/Core and Builtins/2020-01-04-17-25-34.bpo-39215.xiqiIz.rst
new file mode 100644
index 0000000000000..9a3178f9c6218
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-01-04-17-25-34.bpo-39215.xiqiIz.rst
@@ -0,0 +1,2 @@
+Fix ``SystemError`` when nested function has annotation on positional-only
+argument - by Anthony Sottile.
diff --git a/Python/symtable.c b/Python/symtable.c
index b8713588b9a91..30482d99b3ca9 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -1717,6 +1717,8 @@ static int
symtable_visit_annotations(struct symtable *st, stmt_ty s,
arguments_ty a, expr_ty returns)
{
+ if (a->posonlyargs && !symtable_visit_argannotations(st, a->posonlyargs))
+ return 0;
if (a->args && !symtable_visit_argannotations(st, a->args))
return 0;
if (a->vararg && a->vararg->annotation)
From webhook-mailer at python.org Sun Jan 5 07:14:39 2020
From: webhook-mailer at python.org (Serhiy Storchaka)
Date: Sun, 05 Jan 2020 12:14:39 -0000
Subject: [Python-checkins] bpo-39057: Fix
urllib.request.proxy_bypass_environment(). (GH-17619)
Message-ID:
https://github.com/python/cpython/commit/6a265f0d0c0a4b3b8fecf4275d49187a384167f4
commit: 6a265f0d0c0a4b3b8fecf4275d49187a384167f4
branch: master
author: Serhiy Storchaka
committer: GitHub
date: 2020-01-05T14:14:31+02:00
summary:
bpo-39057: Fix urllib.request.proxy_bypass_environment(). (GH-17619)
Ignore leading dots and no longer ignore a trailing newline.
files:
A Misc/NEWS.d/next/Library/2019-12-15-21-47-54.bpo-39057.FOxn-w.rst
M Lib/test/test_urllib.py
M Lib/urllib/parse.py
M Lib/urllib/request.py
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 95c4ecc4dcf29..2e82fc7b7b861 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -270,14 +270,36 @@ def test_proxy_bypass_environment_host_match(self):
self.assertTrue(bypass('localhost'))
self.assertTrue(bypass('LocalHost')) # MixedCase
self.assertTrue(bypass('LOCALHOST')) # UPPERCASE
+ self.assertTrue(bypass('.localhost'))
self.assertTrue(bypass('newdomain.com:1234'))
+ self.assertTrue(bypass('.newdomain.com:1234'))
self.assertTrue(bypass('foo.d.o.t')) # issue 29142
+ self.assertTrue(bypass('d.o.t'))
self.assertTrue(bypass('anotherdomain.com:8888'))
+ self.assertTrue(bypass('.anotherdomain.com:8888'))
self.assertTrue(bypass('www.newdomain.com:1234'))
self.assertFalse(bypass('prelocalhost'))
self.assertFalse(bypass('newdomain.com')) # no port
self.assertFalse(bypass('newdomain.com:1235')) # wrong port
+ def test_proxy_bypass_environment_always_match(self):
+ bypass = urllib.request.proxy_bypass_environment
+ self.env.set('NO_PROXY', '*')
+ self.assertTrue(bypass('newdomain.com'))
+ self.assertTrue(bypass('newdomain.com:1234'))
+ self.env.set('NO_PROXY', '*, anotherdomain.com')
+ self.assertTrue(bypass('anotherdomain.com'))
+ self.assertFalse(bypass('newdomain.com'))
+ self.assertFalse(bypass('newdomain.com:1234'))
+
+ def test_proxy_bypass_environment_newline(self):
+ bypass = urllib.request.proxy_bypass_environment
+ self.env.set('NO_PROXY',
+ 'localhost, anotherdomain.com, newdomain.com:1234')
+ self.assertFalse(bypass('localhost\n'))
+ self.assertFalse(bypass('anotherdomain.com:8888\n'))
+ self.assertFalse(bypass('newdomain.com:1234\n'))
+
class ProxyTests_withOrderedEnv(unittest.TestCase):
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
index 31fd7e16ee72c..34d5f95dd79bd 100644
--- a/Lib/urllib/parse.py
+++ b/Lib/urllib/parse.py
@@ -1056,9 +1056,9 @@ def _splitport(host):
"""splitport('host:port') --> 'host', 'port'."""
global _portprog
if _portprog is None:
- _portprog = re.compile('(.*):([0-9]*)$', re.DOTALL)
+ _portprog = re.compile('(.*):([0-9]*)', re.DOTALL)
- match = _portprog.match(host)
+ match = _portprog.fullmatch(host)
if match:
host, port = match.groups()
if port:
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 39553d809a3f1..a6d350a97a452 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -2492,24 +2492,26 @@ def proxy_bypass_environment(host, proxies=None):
try:
no_proxy = proxies['no']
except KeyError:
- return 0
+ return False
# '*' is special case for always bypass
if no_proxy == '*':
- return 1
+ return True
+ host = host.lower()
# strip port off host
hostonly, port = _splitport(host)
# check if the host ends with any of the DNS suffixes
- no_proxy_list = [proxy.strip() for proxy in no_proxy.split(',')]
- for name in no_proxy_list:
+ for name in no_proxy.split(','):
+ name = name.strip()
if name:
name = name.lstrip('.') # ignore leading dots
- name = re.escape(name)
- pattern = r'(.+\.)?%s$' % name
- if (re.match(pattern, hostonly, re.I)
- or re.match(pattern, host, re.I)):
- return 1
+ name = name.lower()
+ if hostonly == name or host == name:
+ return True
+ name = '.' + name
+ if hostonly.endswith(name) or host.endswith(name):
+ return True
# otherwise, don't bypass
- return 0
+ return False
# This code tests an OSX specific data structure but is testable on all
@@ -2635,7 +2637,7 @@ def getproxies_registry():
for p in proxyServer.split(';'):
protocol, address = p.split('=', 1)
# See if address has a type:// prefix
- if not re.match('^([^/:]+)://', address):
+ if not re.match('(?:[^/:]+)://', address):
address = '%s://%s' % (protocol, address)
proxies[protocol] = address
else:
diff --git a/Misc/NEWS.d/next/Library/2019-12-15-21-47-54.bpo-39057.FOxn-w.rst b/Misc/NEWS.d/next/Library/2019-12-15-21-47-54.bpo-39057.FOxn-w.rst
new file mode 100644
index 0000000000000..24a17444b97da
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-12-15-21-47-54.bpo-39057.FOxn-w.rst
@@ -0,0 +1,2 @@
+:func:`urllib.request.proxy_bypass_environment` now ignores leading dots and
+no longer ignores a trailing newline.
From webhook-mailer at python.org Sun Jan 5 07:15:31 2020
From: webhook-mailer at python.org (Serhiy Storchaka)
Date: Sun, 05 Jan 2020 12:15:31 -0000
Subject: [Python-checkins] bpo-39056: Fix handling invalid warning category
in the -W option. (GH-17618)
Message-ID:
https://github.com/python/cpython/commit/41ec17e45d54473d32f543396293256f1581e44d
commit: 41ec17e45d54473d32f543396293256f1581e44d
branch: master
author: Serhiy Storchaka
committer: GitHub
date: 2020-01-05T14:15:27+02:00
summary:
bpo-39056: Fix handling invalid warning category in the -W option. (GH-17618)
No longer import the re module if it is not needed.
files:
A Misc/NEWS.d/next/Library/2019-12-15-21-05-16.bpo-39056.nEfUM9.rst
M Lib/test/test_warnings/__init__.py
M Lib/warnings.py
diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py
index 3a6d64eaad1f8..c6fb097ae6dd2 100644
--- a/Lib/test/test_warnings/__init__.py
+++ b/Lib/test/test_warnings/__init__.py
@@ -43,6 +43,10 @@ def warnings_state(module):
module.filters = original_filters
+class TestWarning(Warning):
+ pass
+
+
class BaseTest:
"""Basic bookkeeping required for testing."""
@@ -566,9 +570,28 @@ def test_improper_input(self):
self.module._setoption, 'bogus::Warning')
self.assertRaises(self.module._OptionError,
self.module._setoption, 'ignore:2::4:-5')
+ with self.assertRaises(self.module._OptionError):
+ self.module._setoption('ignore::123')
+ with self.assertRaises(self.module._OptionError):
+ self.module._setoption('ignore::123abc')
+ with self.assertRaises(self.module._OptionError):
+ self.module._setoption('ignore::===')
+ with self.assertRaisesRegex(self.module._OptionError, 'W?rning'):
+ self.module._setoption('ignore::W?rning')
self.module._setoption('error::Warning::0')
self.assertRaises(UserWarning, self.module.warn, 'convert to error')
+ def test_import_from_module(self):
+ with original_warnings.catch_warnings(module=self.module):
+ self.module._setoption('ignore::Warning')
+ with self.assertRaises(self.module._OptionError):
+ self.module._setoption('ignore::TestWarning')
+ with self.assertRaises(self.module._OptionError):
+ self.module._setoption('ignore::test.test_warnings.bogus')
+ self.module._setoption('error::test.test_warnings.TestWarning')
+ with self.assertRaises(TestWarning):
+ self.module.warn('test warning', TestWarning)
+
class CWCmdLineTests(WCmdLineTests, unittest.TestCase):
module = c_warnings
diff --git a/Lib/warnings.py b/Lib/warnings.py
index 00f740ca3a95b..691ccddfa450a 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -211,7 +211,6 @@ def _processoptions(args):
# Helper for _processoptions()
def _setoption(arg):
- import re
parts = arg.split(':')
if len(parts) > 5:
raise _OptionError("too many fields (max 5): %r" % (arg,))
@@ -220,11 +219,13 @@ def _setoption(arg):
action, message, category, module, lineno = [s.strip()
for s in parts]
action = _getaction(action)
- message = re.escape(message)
category = _getcategory(category)
- module = re.escape(module)
+ if message or module:
+ import re
+ if message:
+ message = re.escape(message)
if module:
- module = module + '$'
+ module = re.escape(module) + r'\Z'
if lineno:
try:
lineno = int(lineno)
@@ -248,26 +249,21 @@ def _getaction(action):
# Helper for _setoption()
def _getcategory(category):
- import re
if not category:
return Warning
- if re.match("^[a-zA-Z0-9_]+$", category):
- try:
- cat = eval(category)
- except NameError:
- raise _OptionError("unknown warning category: %r" % (category,)) from None
+ if '.' not in category:
+ import builtins as m
+ klass = category
else:
- i = category.rfind(".")
- module = category[:i]
- klass = category[i+1:]
+ module, _, klass = category.rpartition('.')
try:
m = __import__(module, None, None, [klass])
except ImportError:
raise _OptionError("invalid module name: %r" % (module,)) from None
- try:
- cat = getattr(m, klass)
- except AttributeError:
- raise _OptionError("unknown warning category: %r" % (category,)) from None
+ try:
+ cat = getattr(m, klass)
+ except AttributeError:
+ raise _OptionError("unknown warning category: %r" % (category,)) from None
if not issubclass(cat, Warning):
raise _OptionError("invalid warning category: %r" % (category,))
return cat
diff --git a/Misc/NEWS.d/next/Library/2019-12-15-21-05-16.bpo-39056.nEfUM9.rst b/Misc/NEWS.d/next/Library/2019-12-15-21-05-16.bpo-39056.nEfUM9.rst
new file mode 100644
index 0000000000000..d5d2b98e9b0b3
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-12-15-21-05-16.bpo-39056.nEfUM9.rst
@@ -0,0 +1,2 @@
+Fixed handling invalid warning category in the -W option. No longer import
+the re module if it is not needed.
From webhook-mailer at python.org Sun Jan 5 07:15:54 2020
From: webhook-mailer at python.org (Serhiy Storchaka)
Date: Sun, 05 Jan 2020 12:15:54 -0000
Subject: [Python-checkins] bpo-39055: Reject a trailing \n in
base64.b64decode() with validate=True. (GH-17616)
Message-ID:
https://github.com/python/cpython/commit/b19c0d77e6f25ea831ab608c71f15d0d9266c8c4
commit: b19c0d77e6f25ea831ab608c71f15d0d9266c8c4
branch: master
author: Serhiy Storchaka
committer: GitHub
date: 2020-01-05T14:15:50+02:00
summary:
bpo-39055: Reject a trailing \n in base64.b64decode() with validate=True. (GH-17616)
files:
A Misc/NEWS.d/next/Library/2019-12-15-19-23-23.bpo-39055.FmN3un.rst
M Lib/base64.py
M Lib/test/test_base64.py
diff --git a/Lib/base64.py b/Lib/base64.py
index 2be9c395a9667..2e70223dfe782 100755
--- a/Lib/base64.py
+++ b/Lib/base64.py
@@ -82,7 +82,7 @@ def b64decode(s, altchars=None, validate=False):
altchars = _bytes_from_decode_data(altchars)
assert len(altchars) == 2, repr(altchars)
s = s.translate(bytes.maketrans(altchars, b'+/'))
- if validate and not re.match(b'^[A-Za-z0-9+/]*={0,2}$', s):
+ if validate and not re.fullmatch(b'[A-Za-z0-9+/]*={0,2}', s):
raise binascii.Error('Non-base64 digit found')
return binascii.a2b_base64(s)
diff --git a/Lib/test/test_base64.py b/Lib/test/test_base64.py
index 2a4cc2acad24b..7dba6635d4eae 100644
--- a/Lib/test/test_base64.py
+++ b/Lib/test/test_base64.py
@@ -250,6 +250,7 @@ def test_b64decode_invalid_chars(self):
(b'3d}==', b'\xdd'),
(b'@@', b''),
(b'!', b''),
+ (b"YWJj\n", b"abc"),
(b'YWJj\nYWI=', b'abcab'))
funcs = (
base64.b64decode,
diff --git a/Misc/NEWS.d/next/Library/2019-12-15-19-23-23.bpo-39055.FmN3un.rst b/Misc/NEWS.d/next/Library/2019-12-15-19-23-23.bpo-39055.FmN3un.rst
new file mode 100644
index 0000000000000..83b1431e92fcb
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-12-15-19-23-23.bpo-39055.FmN3un.rst
@@ -0,0 +1,2 @@
+:func:`base64.b64decode` with ``validate=True`` raises now a binascii.Error
+if the input ends with a single ``\n``.
From webhook-mailer at python.org Sun Jan 5 07:31:48 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Sun, 05 Jan 2020 12:31:48 -0000
Subject: [Python-checkins] bpo-39057: Fix
urllib.request.proxy_bypass_environment(). (GH-17619)
Message-ID:
https://github.com/python/cpython/commit/880a17af7d063fcef225a46b7f4ae35d792b2f11
commit: 880a17af7d063fcef225a46b7f4ae35d792b2f11
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-05T04:31:44-08:00
summary:
bpo-39057: Fix urllib.request.proxy_bypass_environment(). (GH-17619)
Ignore leading dots and no longer ignore a trailing newline.
(cherry picked from commit 6a265f0d0c0a4b3b8fecf4275d49187a384167f4)
Co-authored-by: Serhiy Storchaka
files:
A Misc/NEWS.d/next/Library/2019-12-15-21-47-54.bpo-39057.FOxn-w.rst
M Lib/test/test_urllib.py
M Lib/urllib/parse.py
M Lib/urllib/request.py
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 7ec365b928a5c..113c678dc1a6d 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -253,14 +253,36 @@ def test_proxy_bypass_environment_host_match(self):
self.assertTrue(bypass('localhost'))
self.assertTrue(bypass('LocalHost')) # MixedCase
self.assertTrue(bypass('LOCALHOST')) # UPPERCASE
+ self.assertTrue(bypass('.localhost'))
self.assertTrue(bypass('newdomain.com:1234'))
+ self.assertTrue(bypass('.newdomain.com:1234'))
self.assertTrue(bypass('foo.d.o.t')) # issue 29142
+ self.assertTrue(bypass('d.o.t'))
self.assertTrue(bypass('anotherdomain.com:8888'))
+ self.assertTrue(bypass('.anotherdomain.com:8888'))
self.assertTrue(bypass('www.newdomain.com:1234'))
self.assertFalse(bypass('prelocalhost'))
self.assertFalse(bypass('newdomain.com')) # no port
self.assertFalse(bypass('newdomain.com:1235')) # wrong port
+ def test_proxy_bypass_environment_always_match(self):
+ bypass = urllib.request.proxy_bypass_environment
+ self.env.set('NO_PROXY', '*')
+ self.assertTrue(bypass('newdomain.com'))
+ self.assertTrue(bypass('newdomain.com:1234'))
+ self.env.set('NO_PROXY', '*, anotherdomain.com')
+ self.assertTrue(bypass('anotherdomain.com'))
+ self.assertFalse(bypass('newdomain.com'))
+ self.assertFalse(bypass('newdomain.com:1234'))
+
+ def test_proxy_bypass_environment_newline(self):
+ bypass = urllib.request.proxy_bypass_environment
+ self.env.set('NO_PROXY',
+ 'localhost, anotherdomain.com, newdomain.com:1234')
+ self.assertFalse(bypass('localhost\n'))
+ self.assertFalse(bypass('anotherdomain.com:8888\n'))
+ self.assertFalse(bypass('newdomain.com:1234\n'))
+
class ProxyTests_withOrderedEnv(unittest.TestCase):
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
index 1d4dc74b040ed..dc3de51a5c2cb 100644
--- a/Lib/urllib/parse.py
+++ b/Lib/urllib/parse.py
@@ -997,9 +997,9 @@ def splitport(host):
"""splitport('host:port') --> 'host', 'port'."""
global _portprog
if _portprog is None:
- _portprog = re.compile('(.*):([0-9]*)$', re.DOTALL)
+ _portprog = re.compile('(.*):([0-9]*)', re.DOTALL)
- match = _portprog.match(host)
+ match = _portprog.fullmatch(host)
if match:
host, port = match.groups()
if port:
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 1ec484ed249c6..211cb6857f728 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -2499,24 +2499,26 @@ def proxy_bypass_environment(host, proxies=None):
try:
no_proxy = proxies['no']
except KeyError:
- return 0
+ return False
# '*' is special case for always bypass
if no_proxy == '*':
- return 1
+ return True
+ host = host.lower()
# strip port off host
hostonly, port = splitport(host)
# check if the host ends with any of the DNS suffixes
- no_proxy_list = [proxy.strip() for proxy in no_proxy.split(',')]
- for name in no_proxy_list:
+ for name in no_proxy.split(','):
+ name = name.strip()
if name:
name = name.lstrip('.') # ignore leading dots
- name = re.escape(name)
- pattern = r'(.+\.)?%s$' % name
- if (re.match(pattern, hostonly, re.I)
- or re.match(pattern, host, re.I)):
- return 1
+ name = name.lower()
+ if hostonly == name or host == name:
+ return True
+ name = '.' + name
+ if hostonly.endswith(name) or host.endswith(name):
+ return True
# otherwise, don't bypass
- return 0
+ return False
# This code tests an OSX specific data structure but is testable on all
@@ -2642,7 +2644,7 @@ def getproxies_registry():
for p in proxyServer.split(';'):
protocol, address = p.split('=', 1)
# See if address has a type:// prefix
- if not re.match('^([^/:]+)://', address):
+ if not re.match('(?:[^/:]+)://', address):
address = '%s://%s' % (protocol, address)
proxies[protocol] = address
else:
diff --git a/Misc/NEWS.d/next/Library/2019-12-15-21-47-54.bpo-39057.FOxn-w.rst b/Misc/NEWS.d/next/Library/2019-12-15-21-47-54.bpo-39057.FOxn-w.rst
new file mode 100644
index 0000000000000..24a17444b97da
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-12-15-21-47-54.bpo-39057.FOxn-w.rst
@@ -0,0 +1,2 @@
+:func:`urllib.request.proxy_bypass_environment` now ignores leading dots and
+no longer ignores a trailing newline.
From webhook-mailer at python.org Sun Jan 5 07:32:05 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Sun, 05 Jan 2020 12:32:05 -0000
Subject: [Python-checkins] bpo-39057: Fix
urllib.request.proxy_bypass_environment(). (GH-17619)
Message-ID:
https://github.com/python/cpython/commit/fc84d501b9d77701cbdd485de45e200bf027c0e9
commit: fc84d501b9d77701cbdd485de45e200bf027c0e9
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-05T04:32:00-08:00
summary:
bpo-39057: Fix urllib.request.proxy_bypass_environment(). (GH-17619)
Ignore leading dots and no longer ignore a trailing newline.
(cherry picked from commit 6a265f0d0c0a4b3b8fecf4275d49187a384167f4)
Co-authored-by: Serhiy Storchaka
files:
A Misc/NEWS.d/next/Library/2019-12-15-21-47-54.bpo-39057.FOxn-w.rst
M Lib/test/test_urllib.py
M Lib/urllib/parse.py
M Lib/urllib/request.py
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 801f0fd647f4a..e9c656c583bbd 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -261,14 +261,36 @@ def test_proxy_bypass_environment_host_match(self):
self.assertTrue(bypass('localhost'))
self.assertTrue(bypass('LocalHost')) # MixedCase
self.assertTrue(bypass('LOCALHOST')) # UPPERCASE
+ self.assertTrue(bypass('.localhost'))
self.assertTrue(bypass('newdomain.com:1234'))
+ self.assertTrue(bypass('.newdomain.com:1234'))
self.assertTrue(bypass('foo.d.o.t')) # issue 29142
+ self.assertTrue(bypass('d.o.t'))
self.assertTrue(bypass('anotherdomain.com:8888'))
+ self.assertTrue(bypass('.anotherdomain.com:8888'))
self.assertTrue(bypass('www.newdomain.com:1234'))
self.assertFalse(bypass('prelocalhost'))
self.assertFalse(bypass('newdomain.com')) # no port
self.assertFalse(bypass('newdomain.com:1235')) # wrong port
+ def test_proxy_bypass_environment_always_match(self):
+ bypass = urllib.request.proxy_bypass_environment
+ self.env.set('NO_PROXY', '*')
+ self.assertTrue(bypass('newdomain.com'))
+ self.assertTrue(bypass('newdomain.com:1234'))
+ self.env.set('NO_PROXY', '*, anotherdomain.com')
+ self.assertTrue(bypass('anotherdomain.com'))
+ self.assertFalse(bypass('newdomain.com'))
+ self.assertFalse(bypass('newdomain.com:1234'))
+
+ def test_proxy_bypass_environment_newline(self):
+ bypass = urllib.request.proxy_bypass_environment
+ self.env.set('NO_PROXY',
+ 'localhost, anotherdomain.com, newdomain.com:1234')
+ self.assertFalse(bypass('localhost\n'))
+ self.assertFalse(bypass('anotherdomain.com:8888\n'))
+ self.assertFalse(bypass('newdomain.com:1234\n'))
+
class ProxyTests_withOrderedEnv(unittest.TestCase):
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
index d497925b943f4..0b39b6eaf7ded 100644
--- a/Lib/urllib/parse.py
+++ b/Lib/urllib/parse.py
@@ -1054,9 +1054,9 @@ def _splitport(host):
"""splitport('host:port') --> 'host', 'port'."""
global _portprog
if _portprog is None:
- _portprog = re.compile('(.*):([0-9]*)$', re.DOTALL)
+ _portprog = re.compile('(.*):([0-9]*)', re.DOTALL)
- match = _portprog.match(host)
+ match = _portprog.fullmatch(host)
if match:
host, port = match.groups()
if port:
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 51c4759629fd1..6f6577bf1d902 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -2500,24 +2500,26 @@ def proxy_bypass_environment(host, proxies=None):
try:
no_proxy = proxies['no']
except KeyError:
- return 0
+ return False
# '*' is special case for always bypass
if no_proxy == '*':
- return 1
+ return True
+ host = host.lower()
# strip port off host
hostonly, port = _splitport(host)
# check if the host ends with any of the DNS suffixes
- no_proxy_list = [proxy.strip() for proxy in no_proxy.split(',')]
- for name in no_proxy_list:
+ for name in no_proxy.split(','):
+ name = name.strip()
if name:
name = name.lstrip('.') # ignore leading dots
- name = re.escape(name)
- pattern = r'(.+\.)?%s$' % name
- if (re.match(pattern, hostonly, re.I)
- or re.match(pattern, host, re.I)):
- return 1
+ name = name.lower()
+ if hostonly == name or host == name:
+ return True
+ name = '.' + name
+ if hostonly.endswith(name) or host.endswith(name):
+ return True
# otherwise, don't bypass
- return 0
+ return False
# This code tests an OSX specific data structure but is testable on all
@@ -2643,7 +2645,7 @@ def getproxies_registry():
for p in proxyServer.split(';'):
protocol, address = p.split('=', 1)
# See if address has a type:// prefix
- if not re.match('^([^/:]+)://', address):
+ if not re.match('(?:[^/:]+)://', address):
address = '%s://%s' % (protocol, address)
proxies[protocol] = address
else:
diff --git a/Misc/NEWS.d/next/Library/2019-12-15-21-47-54.bpo-39057.FOxn-w.rst b/Misc/NEWS.d/next/Library/2019-12-15-21-47-54.bpo-39057.FOxn-w.rst
new file mode 100644
index 0000000000000..24a17444b97da
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-12-15-21-47-54.bpo-39057.FOxn-w.rst
@@ -0,0 +1,2 @@
+:func:`urllib.request.proxy_bypass_environment` now ignores leading dots and
+no longer ignores a trailing newline.
From webhook-mailer at python.org Sun Jan 5 07:32:49 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Sun, 05 Jan 2020 12:32:49 -0000
Subject: [Python-checkins] bpo-39055: Reject a trailing \n in
base64.b64decode() with validate=True. (GH-17616)
Message-ID:
https://github.com/python/cpython/commit/3bdb2d9daf3ce41b325bd508e3dd29041e85dd1f
commit: 3bdb2d9daf3ce41b325bd508e3dd29041e85dd1f
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-05T04:32:45-08:00
summary:
bpo-39055: Reject a trailing \n in base64.b64decode() with validate=True. (GH-17616)
(cherry picked from commit b19c0d77e6f25ea831ab608c71f15d0d9266c8c4)
Co-authored-by: Serhiy Storchaka
files:
A Misc/NEWS.d/next/Library/2019-12-15-19-23-23.bpo-39055.FmN3un.rst
M Lib/base64.py
M Lib/test/test_base64.py
diff --git a/Lib/base64.py b/Lib/base64.py
index 2be9c395a9667..2e70223dfe782 100755
--- a/Lib/base64.py
+++ b/Lib/base64.py
@@ -82,7 +82,7 @@ def b64decode(s, altchars=None, validate=False):
altchars = _bytes_from_decode_data(altchars)
assert len(altchars) == 2, repr(altchars)
s = s.translate(bytes.maketrans(altchars, b'+/'))
- if validate and not re.match(b'^[A-Za-z0-9+/]*={0,2}$', s):
+ if validate and not re.fullmatch(b'[A-Za-z0-9+/]*={0,2}', s):
raise binascii.Error('Non-base64 digit found')
return binascii.a2b_base64(s)
diff --git a/Lib/test/test_base64.py b/Lib/test/test_base64.py
index 2a4cc2acad24b..7dba6635d4eae 100644
--- a/Lib/test/test_base64.py
+++ b/Lib/test/test_base64.py
@@ -250,6 +250,7 @@ def test_b64decode_invalid_chars(self):
(b'3d}==', b'\xdd'),
(b'@@', b''),
(b'!', b''),
+ (b"YWJj\n", b"abc"),
(b'YWJj\nYWI=', b'abcab'))
funcs = (
base64.b64decode,
diff --git a/Misc/NEWS.d/next/Library/2019-12-15-19-23-23.bpo-39055.FmN3un.rst b/Misc/NEWS.d/next/Library/2019-12-15-19-23-23.bpo-39055.FmN3un.rst
new file mode 100644
index 0000000000000..83b1431e92fcb
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-12-15-19-23-23.bpo-39055.FmN3un.rst
@@ -0,0 +1,2 @@
+:func:`base64.b64decode` with ``validate=True`` raises now a binascii.Error
+if the input ends with a single ``\n``.
From webhook-mailer at python.org Sun Jan 5 07:33:12 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Sun, 05 Jan 2020 12:33:12 -0000
Subject: [Python-checkins] bpo-39056: Fix handling invalid warning category
in the -W option. (GH-17618)
Message-ID:
https://github.com/python/cpython/commit/e1caa49f68dd63b534774aebad0c240143e6fb5d
commit: e1caa49f68dd63b534774aebad0c240143e6fb5d
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-05T04:33:08-08:00
summary:
bpo-39056: Fix handling invalid warning category in the -W option. (GH-17618)
No longer import the re module if it is not needed.
(cherry picked from commit 41ec17e45d54473d32f543396293256f1581e44d)
Co-authored-by: Serhiy Storchaka
files:
A Misc/NEWS.d/next/Library/2019-12-15-21-05-16.bpo-39056.nEfUM9.rst
M Lib/test/test_warnings/__init__.py
M Lib/warnings.py
diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py
index fc3f8f6fe7f0c..985adc1cda781 100644
--- a/Lib/test/test_warnings/__init__.py
+++ b/Lib/test/test_warnings/__init__.py
@@ -43,6 +43,10 @@ def warnings_state(module):
module.filters = original_filters
+class TestWarning(Warning):
+ pass
+
+
class BaseTest:
"""Basic bookkeeping required for testing."""
@@ -566,9 +570,28 @@ def test_improper_input(self):
self.module._setoption, 'bogus::Warning')
self.assertRaises(self.module._OptionError,
self.module._setoption, 'ignore:2::4:-5')
+ with self.assertRaises(self.module._OptionError):
+ self.module._setoption('ignore::123')
+ with self.assertRaises(self.module._OptionError):
+ self.module._setoption('ignore::123abc')
+ with self.assertRaises(self.module._OptionError):
+ self.module._setoption('ignore::===')
+ with self.assertRaisesRegex(self.module._OptionError, 'W?rning'):
+ self.module._setoption('ignore::W?rning')
self.module._setoption('error::Warning::0')
self.assertRaises(UserWarning, self.module.warn, 'convert to error')
+ def test_import_from_module(self):
+ with original_warnings.catch_warnings(module=self.module):
+ self.module._setoption('ignore::Warning')
+ with self.assertRaises(self.module._OptionError):
+ self.module._setoption('ignore::TestWarning')
+ with self.assertRaises(self.module._OptionError):
+ self.module._setoption('ignore::test.test_warnings.bogus')
+ self.module._setoption('error::test.test_warnings.TestWarning')
+ with self.assertRaises(TestWarning):
+ self.module.warn('test warning', TestWarning)
+
class CWCmdLineTests(WCmdLineTests, unittest.TestCase):
module = c_warnings
diff --git a/Lib/warnings.py b/Lib/warnings.py
index 00f740ca3a95b..691ccddfa450a 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -211,7 +211,6 @@ def _processoptions(args):
# Helper for _processoptions()
def _setoption(arg):
- import re
parts = arg.split(':')
if len(parts) > 5:
raise _OptionError("too many fields (max 5): %r" % (arg,))
@@ -220,11 +219,13 @@ def _setoption(arg):
action, message, category, module, lineno = [s.strip()
for s in parts]
action = _getaction(action)
- message = re.escape(message)
category = _getcategory(category)
- module = re.escape(module)
+ if message or module:
+ import re
+ if message:
+ message = re.escape(message)
if module:
- module = module + '$'
+ module = re.escape(module) + r'\Z'
if lineno:
try:
lineno = int(lineno)
@@ -248,26 +249,21 @@ def _getaction(action):
# Helper for _setoption()
def _getcategory(category):
- import re
if not category:
return Warning
- if re.match("^[a-zA-Z0-9_]+$", category):
- try:
- cat = eval(category)
- except NameError:
- raise _OptionError("unknown warning category: %r" % (category,)) from None
+ if '.' not in category:
+ import builtins as m
+ klass = category
else:
- i = category.rfind(".")
- module = category[:i]
- klass = category[i+1:]
+ module, _, klass = category.rpartition('.')
try:
m = __import__(module, None, None, [klass])
except ImportError:
raise _OptionError("invalid module name: %r" % (module,)) from None
- try:
- cat = getattr(m, klass)
- except AttributeError:
- raise _OptionError("unknown warning category: %r" % (category,)) from None
+ try:
+ cat = getattr(m, klass)
+ except AttributeError:
+ raise _OptionError("unknown warning category: %r" % (category,)) from None
if not issubclass(cat, Warning):
raise _OptionError("invalid warning category: %r" % (category,))
return cat
diff --git a/Misc/NEWS.d/next/Library/2019-12-15-21-05-16.bpo-39056.nEfUM9.rst b/Misc/NEWS.d/next/Library/2019-12-15-21-05-16.bpo-39056.nEfUM9.rst
new file mode 100644
index 0000000000000..d5d2b98e9b0b3
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-12-15-21-05-16.bpo-39056.nEfUM9.rst
@@ -0,0 +1,2 @@
+Fixed handling invalid warning category in the -W option. No longer import
+the re module if it is not needed.
From webhook-mailer at python.org Sun Jan 5 07:35:03 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Sun, 05 Jan 2020 12:35:03 -0000
Subject: [Python-checkins] bpo-39056: Fix handling invalid warning category
in the -W option. (GH-17618)
Message-ID:
https://github.com/python/cpython/commit/43fbc70360b2a934ea809b2175d7e99031db2df3
commit: 43fbc70360b2a934ea809b2175d7e99031db2df3
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-05T04:34:58-08:00
summary:
bpo-39056: Fix handling invalid warning category in the -W option. (GH-17618)
No longer import the re module if it is not needed.
(cherry picked from commit 41ec17e45d54473d32f543396293256f1581e44d)
Co-authored-by: Serhiy Storchaka
files:
A Misc/NEWS.d/next/Library/2019-12-15-21-05-16.bpo-39056.nEfUM9.rst
M Lib/test/test_warnings/__init__.py
M Lib/warnings.py
diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py
index 87cc3a7e36ae6..d41f3dff02125 100644
--- a/Lib/test/test_warnings/__init__.py
+++ b/Lib/test/test_warnings/__init__.py
@@ -43,6 +43,10 @@ def warnings_state(module):
module.filters = original_filters
+class TestWarning(Warning):
+ pass
+
+
class BaseTest:
"""Basic bookkeeping required for testing."""
@@ -629,9 +633,28 @@ def test_improper_input(self):
self.module._setoption, 'bogus::Warning')
self.assertRaises(self.module._OptionError,
self.module._setoption, 'ignore:2::4:-5')
+ with self.assertRaises(self.module._OptionError):
+ self.module._setoption('ignore::123')
+ with self.assertRaises(self.module._OptionError):
+ self.module._setoption('ignore::123abc')
+ with self.assertRaises(self.module._OptionError):
+ self.module._setoption('ignore::===')
+ with self.assertRaisesRegex(self.module._OptionError, 'W?rning'):
+ self.module._setoption('ignore::W?rning')
self.module._setoption('error::Warning::0')
self.assertRaises(UserWarning, self.module.warn, 'convert to error')
+ def test_import_from_module(self):
+ with original_warnings.catch_warnings(module=self.module):
+ self.module._setoption('ignore::Warning')
+ with self.assertRaises(self.module._OptionError):
+ self.module._setoption('ignore::TestWarning')
+ with self.assertRaises(self.module._OptionError):
+ self.module._setoption('ignore::test.test_warnings.bogus')
+ self.module._setoption('error::test.test_warnings.TestWarning')
+ with self.assertRaises(TestWarning):
+ self.module.warn('test warning', TestWarning)
+
class CWCmdLineTests(WCmdLineTests, unittest.TestCase):
module = c_warnings
diff --git a/Lib/warnings.py b/Lib/warnings.py
index 9064f56827df3..3e1715c4b4935 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -211,7 +211,6 @@ def _processoptions(args):
# Helper for _processoptions()
def _setoption(arg):
- import re
parts = arg.split(':')
if len(parts) > 5:
raise _OptionError("too many fields (max 5): %r" % (arg,))
@@ -220,11 +219,13 @@ def _setoption(arg):
action, message, category, module, lineno = [s.strip()
for s in parts]
action = _getaction(action)
- message = re.escape(message)
category = _getcategory(category)
- module = re.escape(module)
+ if message or module:
+ import re
+ if message:
+ message = re.escape(message)
if module:
- module = module + '$'
+ module = re.escape(module) + r'\Z'
if lineno:
try:
lineno = int(lineno)
@@ -248,26 +249,21 @@ def _getaction(action):
# Helper for _setoption()
def _getcategory(category):
- import re
if not category:
return Warning
- if re.match("^[a-zA-Z0-9_]+$", category):
- try:
- cat = eval(category)
- except NameError:
- raise _OptionError("unknown warning category: %r" % (category,)) from None
+ if '.' not in category:
+ import builtins as m
+ klass = category
else:
- i = category.rfind(".")
- module = category[:i]
- klass = category[i+1:]
+ module, _, klass = category.rpartition('.')
try:
m = __import__(module, None, None, [klass])
except ImportError:
raise _OptionError("invalid module name: %r" % (module,)) from None
- try:
- cat = getattr(m, klass)
- except AttributeError:
- raise _OptionError("unknown warning category: %r" % (category,)) from None
+ try:
+ cat = getattr(m, klass)
+ except AttributeError:
+ raise _OptionError("unknown warning category: %r" % (category,)) from None
if not issubclass(cat, Warning):
raise _OptionError("invalid warning category: %r" % (category,))
return cat
diff --git a/Misc/NEWS.d/next/Library/2019-12-15-21-05-16.bpo-39056.nEfUM9.rst b/Misc/NEWS.d/next/Library/2019-12-15-21-05-16.bpo-39056.nEfUM9.rst
new file mode 100644
index 0000000000000..d5d2b98e9b0b3
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-12-15-21-05-16.bpo-39056.nEfUM9.rst
@@ -0,0 +1,2 @@
+Fixed handling invalid warning category in the -W option. No longer import
+the re module if it is not needed.
From webhook-mailer at python.org Sun Jan 5 07:36:52 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Sun, 05 Jan 2020 12:36:52 -0000
Subject: [Python-checkins] bpo-39055: Reject a trailing \n in
base64.b64decode() with validate=True. (GH-17616)
Message-ID:
https://github.com/python/cpython/commit/34aa3e71dc52c1a31336302905b9ac011a310412
commit: 34aa3e71dc52c1a31336302905b9ac011a310412
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-05T04:36:48-08:00
summary:
bpo-39055: Reject a trailing \n in base64.b64decode() with validate=True. (GH-17616)
(cherry picked from commit b19c0d77e6f25ea831ab608c71f15d0d9266c8c4)
Co-authored-by: Serhiy Storchaka
files:
A Misc/NEWS.d/next/Library/2019-12-15-19-23-23.bpo-39055.FmN3un.rst
M Lib/base64.py
M Lib/test/test_base64.py
diff --git a/Lib/base64.py b/Lib/base64.py
index 2be9c395a9667..2e70223dfe782 100755
--- a/Lib/base64.py
+++ b/Lib/base64.py
@@ -82,7 +82,7 @@ def b64decode(s, altchars=None, validate=False):
altchars = _bytes_from_decode_data(altchars)
assert len(altchars) == 2, repr(altchars)
s = s.translate(bytes.maketrans(altchars, b'+/'))
- if validate and not re.match(b'^[A-Za-z0-9+/]*={0,2}$', s):
+ if validate and not re.fullmatch(b'[A-Za-z0-9+/]*={0,2}', s):
raise binascii.Error('Non-base64 digit found')
return binascii.a2b_base64(s)
diff --git a/Lib/test/test_base64.py b/Lib/test/test_base64.py
index 2a4cc2acad24b..7dba6635d4eae 100644
--- a/Lib/test/test_base64.py
+++ b/Lib/test/test_base64.py
@@ -250,6 +250,7 @@ def test_b64decode_invalid_chars(self):
(b'3d}==', b'\xdd'),
(b'@@', b''),
(b'!', b''),
+ (b"YWJj\n", b"abc"),
(b'YWJj\nYWI=', b'abcab'))
funcs = (
base64.b64decode,
diff --git a/Misc/NEWS.d/next/Library/2019-12-15-19-23-23.bpo-39055.FmN3un.rst b/Misc/NEWS.d/next/Library/2019-12-15-19-23-23.bpo-39055.FmN3un.rst
new file mode 100644
index 0000000000000..83b1431e92fcb
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-12-15-19-23-23.bpo-39055.FmN3un.rst
@@ -0,0 +1,2 @@
+:func:`base64.b64decode` with ``validate=True`` raises now a binascii.Error
+if the input ends with a single ``\n``.
From webhook-mailer at python.org Sun Jan 5 11:24:06 2020
From: webhook-mailer at python.org (Terry Jan Reedy)
Date: Sun, 05 Jan 2020 16:24:06 -0000
Subject: [Python-checkins] bpo-39152: add missing ttk.Scale.configure return
value (GH-17815)
Message-ID:
https://github.com/python/cpython/commit/5ea7bb25e3b192d6c49a49c9e3b316f8559602aa
commit: 5ea7bb25e3b192d6c49a49c9e3b316f8559602aa
branch: master
author: Terry Jan Reedy
committer: GitHub
date: 2020-01-05T11:23:58-05:00
summary:
bpo-39152: add missing ttk.Scale.configure return value (GH-17815)
tkinter.ttk.Scale().configure([name]) now returns a configuration tuple for name
or a list thereof for all options. Based on patch Giovanni Lombardo.
files:
A Misc/NEWS.d/next/Library/2020-01-03-18-02-50.bpo-39152.JgPjCC.rst
M Lib/tkinter/test/widget_tests.py
M Lib/tkinter/ttk.py
diff --git a/Lib/tkinter/test/widget_tests.py b/Lib/tkinter/test/widget_tests.py
index 75a068fbbf26b..b42ff52178f29 100644
--- a/Lib/tkinter/test/widget_tests.py
+++ b/Lib/tkinter/test/widget_tests.py
@@ -3,7 +3,6 @@
import unittest
import sys
import tkinter
-from tkinter.ttk import Scale
from tkinter.test.support import (AbstractTkTest, tcl_version, requires_tcl,
get_tk_patchlevel, pixels_conv, tcl_obj_eq)
import test.support
@@ -63,11 +62,9 @@ def checkParam(self, widget, name, value, *, expected=_sentinel,
eq = tcl_obj_eq
self.assertEqual2(widget[name], expected, eq=eq)
self.assertEqual2(widget.cget(name), expected, eq=eq)
- # XXX
- if not isinstance(widget, Scale):
- t = widget.configure(name)
- self.assertEqual(len(t), 5)
- self.assertEqual2(t[4], expected, eq=eq)
+ t = widget.configure(name)
+ self.assertEqual(len(t), 5)
+ self.assertEqual2(t[4], expected, eq=eq)
def checkInvalidParam(self, widget, name, value, errmsg=None, *,
keep_orig=True):
@@ -209,9 +206,7 @@ def assertIsBoundingBox(self, bbox):
def test_keys(self):
widget = self.create()
keys = widget.keys()
- # XXX
- if not isinstance(widget, Scale):
- self.assertEqual(sorted(keys), sorted(widget.configure()))
+ self.assertEqual(sorted(keys), sorted(widget.configure()))
for k in keys:
widget[k]
# Test if OPTIONS contains all keys
diff --git a/Lib/tkinter/ttk.py b/Lib/tkinter/ttk.py
index 573544dd84a39..c7c71cd5a559c 100644
--- a/Lib/tkinter/ttk.py
+++ b/Lib/tkinter/ttk.py
@@ -1084,11 +1084,12 @@ def configure(self, cnf=None, **kw):
Setting a value for any of the "from", "from_" or "to" options
generates a <> event."""
- if cnf:
+ retval = Widget.configure(self, cnf, **kw)
+ if not isinstance(cnf, (type(None), str)):
kw.update(cnf)
- Widget.configure(self, **kw)
if any(['from' in kw, 'from_' in kw, 'to' in kw]):
self.event_generate('<>')
+ return retval
def get(self, x=None, y=None):
diff --git a/Misc/NEWS.d/next/Library/2020-01-03-18-02-50.bpo-39152.JgPjCC.rst b/Misc/NEWS.d/next/Library/2020-01-03-18-02-50.bpo-39152.JgPjCC.rst
new file mode 100644
index 0000000000000..abb3df0da0fe4
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-01-03-18-02-50.bpo-39152.JgPjCC.rst
@@ -0,0 +1,2 @@
+Fix ttk.Scale.configure([name]) to return configuration tuple for name
+or all options. Giovanni Lombardo contributed part of the patch.
From webhook-mailer at python.org Sun Jan 5 11:49:52 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Sun, 05 Jan 2020 16:49:52 -0000
Subject: [Python-checkins] bpo-39152: add missing ttk.Scale.configure return
value (GH-17815)
Message-ID:
https://github.com/python/cpython/commit/6234301bb56a9b388a1c3bf51169a2762ea09172
commit: 6234301bb56a9b388a1c3bf51169a2762ea09172
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-05T08:49:48-08:00
summary:
bpo-39152: add missing ttk.Scale.configure return value (GH-17815)
tkinter.ttk.Scale().configure([name]) now returns a configuration tuple for name
or a list thereof for all options. Based on patch Giovanni Lombardo.
(cherry picked from commit 5ea7bb25e3b192d6c49a49c9e3b316f8559602aa)
Co-authored-by: Terry Jan Reedy
files:
A Misc/NEWS.d/next/Library/2020-01-03-18-02-50.bpo-39152.JgPjCC.rst
M Lib/tkinter/test/widget_tests.py
M Lib/tkinter/ttk.py
diff --git a/Lib/tkinter/test/widget_tests.py b/Lib/tkinter/test/widget_tests.py
index 75a068fbbf26b..b42ff52178f29 100644
--- a/Lib/tkinter/test/widget_tests.py
+++ b/Lib/tkinter/test/widget_tests.py
@@ -3,7 +3,6 @@
import unittest
import sys
import tkinter
-from tkinter.ttk import Scale
from tkinter.test.support import (AbstractTkTest, tcl_version, requires_tcl,
get_tk_patchlevel, pixels_conv, tcl_obj_eq)
import test.support
@@ -63,11 +62,9 @@ def checkParam(self, widget, name, value, *, expected=_sentinel,
eq = tcl_obj_eq
self.assertEqual2(widget[name], expected, eq=eq)
self.assertEqual2(widget.cget(name), expected, eq=eq)
- # XXX
- if not isinstance(widget, Scale):
- t = widget.configure(name)
- self.assertEqual(len(t), 5)
- self.assertEqual2(t[4], expected, eq=eq)
+ t = widget.configure(name)
+ self.assertEqual(len(t), 5)
+ self.assertEqual2(t[4], expected, eq=eq)
def checkInvalidParam(self, widget, name, value, errmsg=None, *,
keep_orig=True):
@@ -209,9 +206,7 @@ def assertIsBoundingBox(self, bbox):
def test_keys(self):
widget = self.create()
keys = widget.keys()
- # XXX
- if not isinstance(widget, Scale):
- self.assertEqual(sorted(keys), sorted(widget.configure()))
+ self.assertEqual(sorted(keys), sorted(widget.configure()))
for k in keys:
widget[k]
# Test if OPTIONS contains all keys
diff --git a/Lib/tkinter/ttk.py b/Lib/tkinter/ttk.py
index 12f4ac0bd9086..52b1a30928c6e 100644
--- a/Lib/tkinter/ttk.py
+++ b/Lib/tkinter/ttk.py
@@ -1086,11 +1086,12 @@ def configure(self, cnf=None, **kw):
Setting a value for any of the "from", "from_" or "to" options
generates a <> event."""
- if cnf:
+ retval = Widget.configure(self, cnf, **kw)
+ if not isinstance(cnf, (type(None), str)):
kw.update(cnf)
- Widget.configure(self, **kw)
if any(['from' in kw, 'from_' in kw, 'to' in kw]):
self.event_generate('<>')
+ return retval
def get(self, x=None, y=None):
diff --git a/Misc/NEWS.d/next/Library/2020-01-03-18-02-50.bpo-39152.JgPjCC.rst b/Misc/NEWS.d/next/Library/2020-01-03-18-02-50.bpo-39152.JgPjCC.rst
new file mode 100644
index 0000000000000..abb3df0da0fe4
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-01-03-18-02-50.bpo-39152.JgPjCC.rst
@@ -0,0 +1,2 @@
+Fix ttk.Scale.configure([name]) to return configuration tuple for name
+or all options. Giovanni Lombardo contributed part of the patch.
From webhook-mailer at python.org Sun Jan 5 12:04:03 2020
From: webhook-mailer at python.org (Pablo Galindo)
Date: Sun, 05 Jan 2020 17:04:03 -0000
Subject: [Python-checkins] Fix constant folding optimization for positional
only arguments (GH-17837)
Message-ID:
https://github.com/python/cpython/commit/b121a4a45ff4bab8812a9b26ceffe5ad642f5d5a
commit: b121a4a45ff4bab8812a9b26ceffe5ad642f5d5a
branch: master
author: Anthony Sottile
committer: Pablo Galindo
date: 2020-01-05T17:03:56Z
summary:
Fix constant folding optimization for positional only arguments (GH-17837)
files:
A Misc/NEWS.d/next/Core and Builtins/2020-01-05-06-55-52.bpo-39216.74jLh9.rst
M Lib/test/test_positional_only_arg.py
M Python/ast_opt.c
diff --git a/Lib/test/test_positional_only_arg.py b/Lib/test/test_positional_only_arg.py
index 63dee7ca434b2..2ef40e3a5a113 100644
--- a/Lib/test/test_positional_only_arg.py
+++ b/Lib/test/test_positional_only_arg.py
@@ -1,5 +1,6 @@
"""Unit tests for the positional only argument syntax specified in PEP 570."""
+import dis
import pickle
import unittest
@@ -419,6 +420,17 @@ def method(self, /):
def test_annotations(self):
assert global_inner_has_pos_only().__annotations__ == {'x': int}
+ def test_annotations_constant_fold(self):
+ def g():
+ def f(x: not (int is int), /): ...
+
+ # without constant folding we end up with
+ # COMPARE_OP(is), UNARY_NOT
+ # with constant folding we should expect a COMPARE_OP(is not)
+ codes = [(i.opname, i.argval) for i in dis.get_instructions(g)]
+ self.assertNotIn(('UNARY_NOT', None), codes)
+ self.assertIn(('COMPARE_OP', 'is not'), codes)
+
if __name__ == "__main__":
unittest.main()
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-01-05-06-55-52.bpo-39216.74jLh9.rst b/Misc/NEWS.d/next/Core and Builtins/2020-01-05-06-55-52.bpo-39216.74jLh9.rst
new file mode 100644
index 0000000000000..971b06552973e
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-01-05-06-55-52.bpo-39216.74jLh9.rst
@@ -0,0 +1,2 @@
+Fix constant folding optimization for positional only arguments - by Anthony
+Sottile.
diff --git a/Python/ast_opt.c b/Python/ast_opt.c
index 96c766fc0957d..f2a2c25914993 100644
--- a/Python/ast_opt.c
+++ b/Python/ast_opt.c
@@ -617,6 +617,7 @@ astfold_comprehension(comprehension_ty node_, PyArena *ctx_, int optimize_)
static int
astfold_arguments(arguments_ty node_, PyArena *ctx_, int optimize_)
{
+ CALL_SEQ(astfold_arg, arg_ty, node_->posonlyargs);
CALL_SEQ(astfold_arg, arg_ty, node_->args);
CALL_OPT(astfold_arg, arg_ty, node_->vararg);
CALL_SEQ(astfold_arg, arg_ty, node_->kwonlyargs);
From webhook-mailer at python.org Sun Jan 5 12:07:37 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Sun, 05 Jan 2020 17:07:37 -0000
Subject: [Python-checkins] bpo-39152: add missing ttk.Scale.configure return
value (GH-17815)
Message-ID:
https://github.com/python/cpython/commit/636a850ed81cf9b8feed523f277b1538bfc5230b
commit: 636a850ed81cf9b8feed523f277b1538bfc5230b
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-05T09:07:30-08:00
summary:
bpo-39152: add missing ttk.Scale.configure return value (GH-17815)
tkinter.ttk.Scale().configure([name]) now returns a configuration tuple for name
or a list thereof for all options. Based on patch Giovanni Lombardo.
(cherry picked from commit 5ea7bb25e3b192d6c49a49c9e3b316f8559602aa)
Co-authored-by: Terry Jan Reedy
files:
A Misc/NEWS.d/next/Library/2020-01-03-18-02-50.bpo-39152.JgPjCC.rst
M Lib/tkinter/test/widget_tests.py
M Lib/tkinter/ttk.py
diff --git a/Lib/tkinter/test/widget_tests.py b/Lib/tkinter/test/widget_tests.py
index 75a068fbbf26b..b42ff52178f29 100644
--- a/Lib/tkinter/test/widget_tests.py
+++ b/Lib/tkinter/test/widget_tests.py
@@ -3,7 +3,6 @@
import unittest
import sys
import tkinter
-from tkinter.ttk import Scale
from tkinter.test.support import (AbstractTkTest, tcl_version, requires_tcl,
get_tk_patchlevel, pixels_conv, tcl_obj_eq)
import test.support
@@ -63,11 +62,9 @@ def checkParam(self, widget, name, value, *, expected=_sentinel,
eq = tcl_obj_eq
self.assertEqual2(widget[name], expected, eq=eq)
self.assertEqual2(widget.cget(name), expected, eq=eq)
- # XXX
- if not isinstance(widget, Scale):
- t = widget.configure(name)
- self.assertEqual(len(t), 5)
- self.assertEqual2(t[4], expected, eq=eq)
+ t = widget.configure(name)
+ self.assertEqual(len(t), 5)
+ self.assertEqual2(t[4], expected, eq=eq)
def checkInvalidParam(self, widget, name, value, errmsg=None, *,
keep_orig=True):
@@ -209,9 +206,7 @@ def assertIsBoundingBox(self, bbox):
def test_keys(self):
widget = self.create()
keys = widget.keys()
- # XXX
- if not isinstance(widget, Scale):
- self.assertEqual(sorted(keys), sorted(widget.configure()))
+ self.assertEqual(sorted(keys), sorted(widget.configure()))
for k in keys:
widget[k]
# Test if OPTIONS contains all keys
diff --git a/Lib/tkinter/ttk.py b/Lib/tkinter/ttk.py
index 573544dd84a39..c7c71cd5a559c 100644
--- a/Lib/tkinter/ttk.py
+++ b/Lib/tkinter/ttk.py
@@ -1084,11 +1084,12 @@ def configure(self, cnf=None, **kw):
Setting a value for any of the "from", "from_" or "to" options
generates a <> event."""
- if cnf:
+ retval = Widget.configure(self, cnf, **kw)
+ if not isinstance(cnf, (type(None), str)):
kw.update(cnf)
- Widget.configure(self, **kw)
if any(['from' in kw, 'from_' in kw, 'to' in kw]):
self.event_generate('<>')
+ return retval
def get(self, x=None, y=None):
diff --git a/Misc/NEWS.d/next/Library/2020-01-03-18-02-50.bpo-39152.JgPjCC.rst b/Misc/NEWS.d/next/Library/2020-01-03-18-02-50.bpo-39152.JgPjCC.rst
new file mode 100644
index 0000000000000..abb3df0da0fe4
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-01-03-18-02-50.bpo-39152.JgPjCC.rst
@@ -0,0 +1,2 @@
+Fix ttk.Scale.configure([name]) to return configuration tuple for name
+or all options. Giovanni Lombardo contributed part of the patch.
From webhook-mailer at python.org Sun Jan 5 12:21:51 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Sun, 05 Jan 2020 17:21:51 -0000
Subject: [Python-checkins] Fix constant folding optimization for positional
only arguments (GH-17837)
Message-ID:
https://github.com/python/cpython/commit/49c108c8324c14e41ddf2a909dcab687f3d34b14
commit: 49c108c8324c14e41ddf2a909dcab687f3d34b14
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-05T09:21:47-08:00
summary:
Fix constant folding optimization for positional only arguments (GH-17837)
(cherry picked from commit b121a4a45ff4bab8812a9b26ceffe5ad642f5d5a)
Co-authored-by: Anthony Sottile
files:
A Misc/NEWS.d/next/Core and Builtins/2020-01-05-06-55-52.bpo-39216.74jLh9.rst
M Lib/test/test_positional_only_arg.py
M Python/ast_opt.c
diff --git a/Lib/test/test_positional_only_arg.py b/Lib/test/test_positional_only_arg.py
index 63dee7ca434b2..2ef40e3a5a113 100644
--- a/Lib/test/test_positional_only_arg.py
+++ b/Lib/test/test_positional_only_arg.py
@@ -1,5 +1,6 @@
"""Unit tests for the positional only argument syntax specified in PEP 570."""
+import dis
import pickle
import unittest
@@ -419,6 +420,17 @@ def method(self, /):
def test_annotations(self):
assert global_inner_has_pos_only().__annotations__ == {'x': int}
+ def test_annotations_constant_fold(self):
+ def g():
+ def f(x: not (int is int), /): ...
+
+ # without constant folding we end up with
+ # COMPARE_OP(is), UNARY_NOT
+ # with constant folding we should expect a COMPARE_OP(is not)
+ codes = [(i.opname, i.argval) for i in dis.get_instructions(g)]
+ self.assertNotIn(('UNARY_NOT', None), codes)
+ self.assertIn(('COMPARE_OP', 'is not'), codes)
+
if __name__ == "__main__":
unittest.main()
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-01-05-06-55-52.bpo-39216.74jLh9.rst b/Misc/NEWS.d/next/Core and Builtins/2020-01-05-06-55-52.bpo-39216.74jLh9.rst
new file mode 100644
index 0000000000000..971b06552973e
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-01-05-06-55-52.bpo-39216.74jLh9.rst
@@ -0,0 +1,2 @@
+Fix constant folding optimization for positional only arguments - by Anthony
+Sottile.
diff --git a/Python/ast_opt.c b/Python/ast_opt.c
index 96c766fc0957d..f2a2c25914993 100644
--- a/Python/ast_opt.c
+++ b/Python/ast_opt.c
@@ -617,6 +617,7 @@ astfold_comprehension(comprehension_ty node_, PyArena *ctx_, int optimize_)
static int
astfold_arguments(arguments_ty node_, PyArena *ctx_, int optimize_)
{
+ CALL_SEQ(astfold_arg, arg_ty, node_->posonlyargs);
CALL_SEQ(astfold_arg, arg_ty, node_->args);
CALL_OPT(astfold_arg, arg_ty, node_->vararg);
CALL_SEQ(astfold_arg, arg_ty, node_->kwonlyargs);
From webhook-mailer at python.org Sun Jan 5 12:30:58 2020
From: webhook-mailer at python.org (Pablo Galindo)
Date: Sun, 05 Jan 2020 17:30:58 -0000
Subject: [Python-checkins] bpo-39200: Correct the error message for range()
empty constructor (GH-17813)
Message-ID:
https://github.com/python/cpython/commit/4b66fa6ce9c37e70b55af220d0e07368319de803
commit: 4b66fa6ce9c37e70b55af220d0e07368319de803
branch: master
author: Pablo Galindo
committer: GitHub
date: 2020-01-05T17:30:53Z
summary:
bpo-39200: Correct the error message for range() empty constructor (GH-17813)
Co-authored-by: Serhiy Storchaka
files:
A Misc/NEWS.d/next/Core and Builtins/2020-01-03-14-50-14.bpo-39200.Ip2_iI.rst
M Lib/test/test_range.py
M Objects/rangeobject.c
diff --git a/Lib/test/test_range.py b/Lib/test/test_range.py
index 73cbcc4717d7d..30fa129b50ecb 100644
--- a/Lib/test/test_range.py
+++ b/Lib/test/test_range.py
@@ -91,6 +91,19 @@ def test_range(self):
r = range(-sys.maxsize, sys.maxsize, 2)
self.assertEqual(len(r), sys.maxsize)
+ def test_range_constructor_error_messages(self):
+ with self.assertRaisesRegex(
+ TypeError,
+ "range expected at least 1 argument, got 0"
+ ):
+ range()
+
+ with self.assertRaisesRegex(
+ TypeError,
+ "range expected at most 3 arguments, got 6"
+ ):
+ range(1, 2, 3, 4, 5, 6)
+
def test_large_operands(self):
x = range(10**20, 10**20+10, 3)
self.assertEqual(len(x), 4)
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-01-03-14-50-14.bpo-39200.Ip2_iI.rst b/Misc/NEWS.d/next/Core and Builtins/2020-01-03-14-50-14.bpo-39200.Ip2_iI.rst
new file mode 100644
index 0000000000000..e5cb396643fe0
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-01-03-14-50-14.bpo-39200.Ip2_iI.rst
@@ -0,0 +1,2 @@
+Correct the error message when trying to construct :class:`range` objects
+with no arguments. Patch by Pablo Galindo.
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index 239ace6f4235e..9311f8b1f174c 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -77,37 +77,52 @@ range_new(PyTypeObject *type, PyObject *args, PyObject *kw)
if (!_PyArg_NoKeywords("range", kw))
return NULL;
- if (PyTuple_Size(args) <= 1) {
- if (!PyArg_UnpackTuple(args, "range", 1, 1, &stop))
+ Py_ssize_t num_args = PyTuple_GET_SIZE(args);
+ switch (num_args) {
+ case 3:
+ step = PyTuple_GET_ITEM(args, 2);
+ /* fallthrough */
+ case 2:
+ start = PyTuple_GET_ITEM(args, 0);
+ start = PyNumber_Index(start);
+ if (!start) {
+ return NULL;
+ }
+
+ stop = PyTuple_GET_ITEM(args, 1);
+ stop = PyNumber_Index(stop);
+ if (!stop) {
+ Py_DECREF(start);
+ return NULL;
+ }
+
+ step = validate_step(step);
+ if (!step) {
+ Py_DECREF(start);
+ Py_DECREF(stop);
+ return NULL;
+ }
+ break;
+ case 1:
+ stop = PyTuple_GET_ITEM(args, 0);
+ stop = PyNumber_Index(stop);
+ if (!stop) {
+ return NULL;
+ }
+ Py_INCREF(_PyLong_Zero);
+ start = _PyLong_Zero;
+ Py_INCREF(_PyLong_One);
+ step = _PyLong_One;
+ break;
+ case 0:
+ PyErr_SetString(PyExc_TypeError,
+ "range expected at least 1 argument, got 0");
return NULL;
- stop = PyNumber_Index(stop);
- if (!stop)
+ default:
+ PyErr_Format(PyExc_TypeError,
+ "range expected at most 3 arguments, got %zd",
+ num_args);
return NULL;
- Py_INCREF(_PyLong_Zero);
- start = _PyLong_Zero;
- Py_INCREF(_PyLong_One);
- step = _PyLong_One;
- }
- else {
- if (!PyArg_UnpackTuple(args, "range", 2, 3,
- &start, &stop, &step))
- return NULL;
-
- /* Convert borrowed refs to owned refs */
- start = PyNumber_Index(start);
- if (!start)
- return NULL;
- stop = PyNumber_Index(stop);
- if (!stop) {
- Py_DECREF(start);
- return NULL;
- }
- step = validate_step(step); /* Caution, this can clear exceptions */
- if (!step) {
- Py_DECREF(start);
- Py_DECREF(stop);
- return NULL;
- }
}
obj = make_range_object(type, start, stop, step);
From webhook-mailer at python.org Sun Jan 5 13:52:46 2020
From: webhook-mailer at python.org (Pablo Galindo)
Date: Sun, 05 Jan 2020 18:52:46 -0000
Subject: [Python-checkins] Organise and clean test_positional_only_arg and
add more tests (GH-17842)
Message-ID:
https://github.com/python/cpython/commit/422ed16fb846eec0b5b2a4eb3a978c9862615665
commit: 422ed16fb846eec0b5b2a4eb3a978c9862615665
branch: master
author: Pablo Galindo
committer: GitHub
date: 2020-01-05T18:52:39Z
summary:
Organise and clean test_positional_only_arg and add more tests (GH-17842)
files:
M Lib/test/test_positional_only_arg.py
diff --git a/Lib/test/test_positional_only_arg.py b/Lib/test/test_positional_only_arg.py
index 2ef40e3a5a113..bf332e552590b 100644
--- a/Lib/test/test_positional_only_arg.py
+++ b/Lib/test/test_positional_only_arg.py
@@ -16,11 +16,6 @@ def global_pos_only_and_normal(a, /, b):
def global_pos_only_defaults(a=1, /, b=2):
return a, b
-def global_inner_has_pos_only():
- def f(x: int, /): ...
- return f
-
-
class PositionalOnlyTestCase(unittest.TestCase):
def assertRaisesSyntaxError(self, codestr, regex="invalid syntax"):
@@ -266,12 +261,6 @@ def f(self, a, b, /):
with self.assertRaisesRegex(TypeError, expected):
Example().f(1, b=2)
- def test_mangling(self):
- class X:
- def f(self, *, __a=42):
- return __a
- self.assertEqual(X().f(), 42)
-
def test_module_function(self):
with self.assertRaisesRegex(TypeError, r"f\(\) missing 2 required positional arguments: 'a' and 'b'"):
global_pos_only_f()
@@ -307,6 +296,29 @@ def g(x2,/,y2):
with self.assertRaisesRegex(TypeError, r"g\(\) takes 2 positional arguments but 3 were given"):
f(1,2)(3,4,5)
+ def test_annotations_in_closures(self):
+
+ def inner_has_pos_only():
+ def f(x: int, /): ...
+ return f
+
+ assert inner_has_pos_only().__annotations__ == {'x': int}
+
+ class Something:
+ def method(self):
+ def f(x: int, /): ...
+ return f
+
+ assert Something().method().__annotations__ == {'x': int}
+
+ def multiple_levels():
+ def inner_has_pos_only():
+ def f(x: int, /): ...
+ return f
+ return inner_has_pos_only()
+
+ assert multiple_levels().__annotations__ == {'x': int}
+
def test_same_keyword_as_positional_with_kwargs(self):
def f(something,/,**kwargs):
return (something, kwargs)
@@ -417,9 +429,6 @@ def method(self, /):
self.assertEqual(C().method(), sentinel)
- def test_annotations(self):
- assert global_inner_has_pos_only().__annotations__ == {'x': int}
-
def test_annotations_constant_fold(self):
def g():
def f(x: not (int is int), /): ...
From webhook-mailer at python.org Sun Jan 5 17:08:37 2020
From: webhook-mailer at python.org (Cheryl Sabella)
Date: Sun, 05 Jan 2020 22:08:37 -0000
Subject: [Python-checkins] Replace links in howto/pyporting.rst with sphinx
references (GH-17781)
Message-ID:
https://github.com/python/cpython/commit/e6ae90dede07e8599cc6906417ca4aa99d8aa6e4
commit: e6ae90dede07e8599cc6906417ca4aa99d8aa6e4
branch: master
author: Oleg H?fling
committer: Cheryl Sabella
date: 2020-01-05T17:08:14-05:00
summary:
Replace links in howto/pyporting.rst with sphinx references (GH-17781)
Signed-off-by: Oleg H?fling
files:
M Doc/howto/pyporting.rst
diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst
index f7d12a1565c17..1543823c104c2 100644
--- a/Doc/howto/pyporting.rst
+++ b/Doc/howto/pyporting.rst
@@ -125,7 +125,7 @@ Once you have your code well-tested you are ready to begin porting your code to
Python 3! But to fully understand how your code is going to change and what
you want to look out for while you code, you will want to learn what changes
Python 3 makes in terms of Python 2. Typically the two best ways of doing that
-is reading the `"What's New"`_ doc for each release of Python 3 and the
+is reading the :ref:`"What's New" ` doc for each release of Python 3 and the
`Porting to Python 3`_ book (which is free online). There is also a handy
`cheat sheet`_ from the Python-Future project.
@@ -308,10 +308,10 @@ If for some reason that doesn't work then you should make the version check be
against Python 2 and not Python 3. To help explain this, let's look at an
example.
-Let's pretend that you need access to a feature of importlib_ that
+Let's pretend that you need access to a feature of :mod:`importlib` that
is available in Python's standard library since Python 3.3 and available for
Python 2 through importlib2_ on PyPI. You might be tempted to write code to
-access e.g. the ``importlib.abc`` module by doing the following::
+access e.g. the :mod:`importlib.abc` module by doing the following::
import sys
@@ -432,12 +432,10 @@ can also explicitly state whether your APIs use textual or binary data, helping
to make sure everything functions as expected in both versions of Python.
-.. _2to3: https://docs.python.org/3/library/2to3.html
.. _caniusepython3: https://pypi.org/project/caniusepython3
.. _cheat sheet: http://python-future.org/compatible_idioms.html
.. _coverage.py: https://pypi.org/project/coverage
.. _Futurize: http://python-future.org/automatic_conversion.html
-.. _importlib: https://docs.python.org/3/library/importlib.html#module-importlib
.. _importlib2: https://pypi.org/project/importlib2
.. _Modernize: https://python-modernize.readthedocs.io/
.. _mypy: http://mypy-lang.org/
@@ -453,6 +451,4 @@ to make sure everything functions as expected in both versions of Python.
.. _tox: https://pypi.org/project/tox
.. _trove classifier: https://pypi.org/classifiers
-.. _"What's New": https://docs.python.org/3/whatsnew/index.html
-
.. _Why Python 3 exists: https://snarky.ca/why-python-3-exists
From webhook-mailer at python.org Sun Jan 5 17:13:49 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Sun, 05 Jan 2020 22:13:49 -0000
Subject: [Python-checkins] Replace links in howto/pyporting.rst with sphinx
references (GH-17781)
Message-ID:
https://github.com/python/cpython/commit/cb4ed24a384b67ea07f0aae185c6e65049166ff8
commit: cb4ed24a384b67ea07f0aae185c6e65049166ff8
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-05T14:13:44-08:00
summary:
Replace links in howto/pyporting.rst with sphinx references (GH-17781)
Signed-off-by: Oleg H?fling
(cherry picked from commit e6ae90dede07e8599cc6906417ca4aa99d8aa6e4)
Co-authored-by: Oleg H?fling
files:
M Doc/howto/pyporting.rst
diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst
index 3be6bb380d663..8608162bace35 100644
--- a/Doc/howto/pyporting.rst
+++ b/Doc/howto/pyporting.rst
@@ -119,7 +119,7 @@ Once you have your code well-tested you are ready to begin porting your code to
Python 3! But to fully understand how your code is going to change and what
you want to look out for while you code, you will want to learn what changes
Python 3 makes in terms of Python 2. Typically the two best ways of doing that
-is reading the `"What's New"`_ doc for each release of Python 3 and the
+is reading the :ref:`"What's New" ` doc for each release of Python 3 and the
`Porting to Python 3`_ book (which is free online). There is also a handy
`cheat sheet`_ from the Python-Future project.
@@ -302,10 +302,10 @@ If for some reason that doesn't work then you should make the version check be
against Python 2 and not Python 3. To help explain this, let's look at an
example.
-Let's pretend that you need access to a feature of importlib_ that
+Let's pretend that you need access to a feature of :mod:`importlib` that
is available in Python's standard library since Python 3.3 and available for
Python 2 through importlib2_ on PyPI. You might be tempted to write code to
-access e.g. the ``importlib.abc`` module by doing the following::
+access e.g. the :mod:`importlib.abc` module by doing the following::
import sys
@@ -426,12 +426,10 @@ can also explicitly state whether your APIs use textual or binary data, helping
to make sure everything functions as expected in both versions of Python.
-.. _2to3: https://docs.python.org/3/library/2to3.html
.. _caniusepython3: https://pypi.org/project/caniusepython3
.. _cheat sheet: http://python-future.org/compatible_idioms.html
.. _coverage.py: https://pypi.org/project/coverage
.. _Futurize: http://python-future.org/automatic_conversion.html
-.. _importlib: https://docs.python.org/3/library/importlib.html#module-importlib
.. _importlib2: https://pypi.org/project/importlib2
.. _Modernize: https://python-modernize.readthedocs.io/
.. _mypy: http://mypy-lang.org/
@@ -447,6 +445,4 @@ to make sure everything functions as expected in both versions of Python.
.. _tox: https://pypi.org/project/tox
.. _trove classifier: https://pypi.org/classifiers
-.. _"What's New": https://docs.python.org/3/whatsnew/index.html
-
.. _Why Python 3 exists: https://snarky.ca/why-python-3-exists
From webhook-mailer at python.org Sun Jan 5 17:14:01 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Sun, 05 Jan 2020 22:14:01 -0000
Subject: [Python-checkins] Replace links in howto/pyporting.rst with sphinx
references (GH-17781)
Message-ID:
https://github.com/python/cpython/commit/183fbd1982a24465487b391debc0940b9bad20b3
commit: 183fbd1982a24465487b391debc0940b9bad20b3
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-05T14:13:57-08:00
summary:
Replace links in howto/pyporting.rst with sphinx references (GH-17781)
Signed-off-by: Oleg H?fling
(cherry picked from commit e6ae90dede07e8599cc6906417ca4aa99d8aa6e4)
Co-authored-by: Oleg H?fling
files:
M Doc/howto/pyporting.rst
diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst
index 3be6bb380d663..8608162bace35 100644
--- a/Doc/howto/pyporting.rst
+++ b/Doc/howto/pyporting.rst
@@ -119,7 +119,7 @@ Once you have your code well-tested you are ready to begin porting your code to
Python 3! But to fully understand how your code is going to change and what
you want to look out for while you code, you will want to learn what changes
Python 3 makes in terms of Python 2. Typically the two best ways of doing that
-is reading the `"What's New"`_ doc for each release of Python 3 and the
+is reading the :ref:`"What's New" ` doc for each release of Python 3 and the
`Porting to Python 3`_ book (which is free online). There is also a handy
`cheat sheet`_ from the Python-Future project.
@@ -302,10 +302,10 @@ If for some reason that doesn't work then you should make the version check be
against Python 2 and not Python 3. To help explain this, let's look at an
example.
-Let's pretend that you need access to a feature of importlib_ that
+Let's pretend that you need access to a feature of :mod:`importlib` that
is available in Python's standard library since Python 3.3 and available for
Python 2 through importlib2_ on PyPI. You might be tempted to write code to
-access e.g. the ``importlib.abc`` module by doing the following::
+access e.g. the :mod:`importlib.abc` module by doing the following::
import sys
@@ -426,12 +426,10 @@ can also explicitly state whether your APIs use textual or binary data, helping
to make sure everything functions as expected in both versions of Python.
-.. _2to3: https://docs.python.org/3/library/2to3.html
.. _caniusepython3: https://pypi.org/project/caniusepython3
.. _cheat sheet: http://python-future.org/compatible_idioms.html
.. _coverage.py: https://pypi.org/project/coverage
.. _Futurize: http://python-future.org/automatic_conversion.html
-.. _importlib: https://docs.python.org/3/library/importlib.html#module-importlib
.. _importlib2: https://pypi.org/project/importlib2
.. _Modernize: https://python-modernize.readthedocs.io/
.. _mypy: http://mypy-lang.org/
@@ -447,6 +445,4 @@ to make sure everything functions as expected in both versions of Python.
.. _tox: https://pypi.org/project/tox
.. _trove classifier: https://pypi.org/classifiers
-.. _"What's New": https://docs.python.org/3/whatsnew/index.html
-
.. _Why Python 3 exists: https://snarky.ca/why-python-3-exists
From webhook-mailer at python.org Sun Jan 5 17:20:34 2020
From: webhook-mailer at python.org (Cheryl Sabella)
Date: Sun, 05 Jan 2020 22:20:34 -0000
Subject: [Python-checkins] Fix the parameter list of object. _rpow_
(#GH-16477)
Message-ID:
https://github.com/python/cpython/commit/abc0c4fa9970931849b3da598c5980a5b170661e
commit: abc0c4fa9970931849b3da598c5980a5b170661e
branch: master
author: HongWeipeng <961365124 at qq.com>
committer: Cheryl Sabella
date: 2020-01-05T17:20:29-05:00
summary:
Fix the parameter list of object. _rpow_ (#GH-16477)
files:
M Doc/reference/datamodel.rst
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index c242041c73d41..1442fbeb33d76 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -2331,7 +2331,7 @@ left undefined.
object.__rfloordiv__(self, other)
object.__rmod__(self, other)
object.__rdivmod__(self, other)
- object.__rpow__(self, other)
+ object.__rpow__(self, other[, modulo])
object.__rlshift__(self, other)
object.__rrshift__(self, other)
object.__rand__(self, other)
From webhook-mailer at python.org Sun Jan 5 17:37:45 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Sun, 05 Jan 2020 22:37:45 -0000
Subject: [Python-checkins] Fix the parameter list of object. _rpow_
(GH-GH-16477)
Message-ID:
https://github.com/python/cpython/commit/b853a7c6c0cf19c081efcc07336d9e9b8d2a7fae
commit: b853a7c6c0cf19c081efcc07336d9e9b8d2a7fae
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-05T14:37:37-08:00
summary:
Fix the parameter list of object. _rpow_ (GH-GH-16477)
(cherry picked from commit abc0c4fa9970931849b3da598c5980a5b170661e)
Co-authored-by: HongWeipeng <961365124 at qq.com>
files:
M Doc/reference/datamodel.rst
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index c38dcdc4e512d..7d6cc34373b6c 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -2318,7 +2318,7 @@ left undefined.
object.__rfloordiv__(self, other)
object.__rmod__(self, other)
object.__rdivmod__(self, other)
- object.__rpow__(self, other)
+ object.__rpow__(self, other[, modulo])
object.__rlshift__(self, other)
object.__rrshift__(self, other)
object.__rand__(self, other)
From webhook-mailer at python.org Sun Jan 5 17:37:51 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Sun, 05 Jan 2020 22:37:51 -0000
Subject: [Python-checkins] Fix the parameter list of object. _rpow_
(GH-GH-16477)
Message-ID:
https://github.com/python/cpython/commit/cfeacf228924bed5e79d420eac682708b7fad727
commit: cfeacf228924bed5e79d420eac682708b7fad727
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-05T14:37:44-08:00
summary:
Fix the parameter list of object. _rpow_ (GH-GH-16477)
(cherry picked from commit abc0c4fa9970931849b3da598c5980a5b170661e)
Co-authored-by: HongWeipeng <961365124 at qq.com>
files:
M Doc/reference/datamodel.rst
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index c530e4117af97..e801ee392f195 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -2331,7 +2331,7 @@ left undefined.
object.__rfloordiv__(self, other)
object.__rmod__(self, other)
object.__rdivmod__(self, other)
- object.__rpow__(self, other)
+ object.__rpow__(self, other[, modulo])
object.__rlshift__(self, other)
object.__rrshift__(self, other)
object.__rand__(self, other)
From webhook-mailer at python.org Sun Jan 5 17:39:47 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Sun, 05 Jan 2020 22:39:47 -0000
Subject: [Python-checkins] bpo-39130: Dict reversed was added in v3.8 so
should say in the doc as well (GH-17694)
Message-ID:
https://github.com/python/cpython/commit/94d9cfc4ed9dd3c4a3a359bc194b4dc3f6ba63eb
commit: 94d9cfc4ed9dd3c4a3a359bc194b4dc3f6ba63eb
branch: master
author: Khalid Mammadov
committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
date: 2020-01-05T14:39:38-08:00
summary:
bpo-39130: Dict reversed was added in v3.8 so should say in the doc as well (GH-17694)
To be consistent with document layout, it should say when the feature was added.
Although it's mentioned few other places in the doc but it's not explicitly say that at that place.
https://bugs.python.org/issue39130
files:
M Doc/library/stdtypes.rst
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index c4588f89c0662..3e25faaa42714 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -4351,6 +4351,8 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
Return a reverse iterator over the keys of the dictionary. This is a
shortcut for ``reversed(d.keys())``.
+ .. versionadded:: 3.8
+
.. method:: setdefault(key[, default])
If *key* is in the dictionary, return its value. If not, insert *key*
From webhook-mailer at python.org Sun Jan 5 17:45:39 2020
From: webhook-mailer at python.org (Miss Islington (bot))
Date: Sun, 05 Jan 2020 22:45:39 -0000
Subject: [Python-checkins] bpo-39130: Dict reversed was added in v3.8 so
should say in the doc as well (GH-17694)
Message-ID:
https://github.com/python/cpython/commit/89947881ac36324148fab75190af453dc09fd862
commit: 89947881ac36324148fab75190af453dc09fd862
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub
date: 2020-01-05T14:45:35-08:00
summary:
bpo-39130: Dict reversed was added in v3.8 so should say in the doc as well (GH-17694)
To be consistent with document layout, it should say when the feature was added.
Although it's mentioned few other places in the doc but it's not explicitly say that at that place.
https://bugs.python.org/issue39130
(cherry picked from commit 94d9cfc4ed9dd3c4a3a359bc194b4dc3f6ba63eb)
Co-authored-by: Khalid Mammadov
files:
M Doc/library/stdtypes.rst
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index be72695462c7b..d6db9b5411d8a 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -4326,6 +4326,8 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
Return a reverse iterator over the keys of the dictionary. This is a
shortcut for ``reversed(d.keys())``.
+ .. versionadded:: 3.8
+
.. method:: setdefault(key[, default])
If *key* is in the dictionary, return its value. If not, insert *key*
From webhook-mailer at python.org Sun Jan 5 18:51:55 2020
From: webhook-mailer at python.org (Terry Jan Reedy)
Date: Sun, 05 Jan 2020 23:51:55 -0000
Subject: [Python-checkins] Minor formatting improvements and fixes to
idle.rst (GH-17165)
Message-ID:
https://github.com/python/cpython/commit/d6c08db8538d046d783db44fe4e70a60af0fb02e
commit: d6c08db8538d046d783db44fe4e70a60af0fb02e
branch: master
author: Tal Einat
committer: Terry Jan Reedy
date: 2020-01-05T18:51:48-05:00
summary:
Minor formatting improvements and fixes to idle.rst (GH-17165)
files:
M Doc/library/idle.rst
M Lib/idlelib/help.html
diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst
index 273b5830e4293..f15f46b788b36 100644
--- a/Doc/library/idle.rst
+++ b/Doc/library/idle.rst
@@ -370,7 +370,8 @@ Paste
Editor windows also have breakpoint functions. Lines with a breakpoint set are
specially marked. Breakpoints only have an effect when running under the
-debugger. Breakpoints for a file are saved in the user's .idlerc directory.
+debugger. Breakpoints for a file are saved in the user's ``.idlerc``
+directory.
Set Breakpoint
Set a breakpoint on the current line.
@@ -685,14 +686,14 @@ crash or Keyboard Interrupt (control-C) may fail to connect. Dismissing
the error box or Restart Shell on the Shell menu may fix a temporary problem.
When IDLE first starts, it attempts to read user configuration files in
-~/.idlerc/ (~ is one's home directory). If there is a problem, an error
+``~/.idlerc/`` (~ is one's home directory). If there is a problem, an error
message should be displayed. Leaving aside random disk glitches, this can
be prevented by never editing the files by hand, using the configuration
dialog, under Options, instead Options. Once it happens, the solution may
be to delete one or more of the configuration files.
If IDLE quits with no message, and it was not started from a console, try
-starting from a console (``python -m idlelib)`` and see if a message appears.
+starting from a console (``python -m idlelib``) and see if a message appears.
Running user code
^^^^^^^^^^^^^^^^^
@@ -863,13 +864,13 @@ Or click the TOC (Table of Contents) button and select a section
header in the opened box.
Help menu entry "Python Docs" opens the extensive sources of help,
-including tutorials, available at docs.python.org/x.y, where 'x.y'
+including tutorials, available at ``docs.python.org/x.y``, where 'x.y'
is the currently running Python version. If your system
has an off-line copy of the docs (this may be an installation option),
that will be opened instead.
Selected URLs can be added or removed from the help menu at any time using the
-General tab of the Configure IDLE dialog .
+General tab of the Configure IDLE dialog.
.. _preferences:
@@ -878,9 +879,9 @@ Setting preferences
The font preferences, highlighting, keys, and general preferences can be
changed via Configure IDLE on the Option menu.
-Non-default user settings are saved in a .idlerc directory in the user's
+Non-default user settings are saved in a ``.idlerc`` directory in the user's
home directory. Problems caused by bad user configuration files are solved
-by editing or deleting one or more of the files in .idlerc.
+by editing or deleting one or more of the files in ``.idlerc``.
On the Font tab, see the text sample for the effect of font face and size
on multiple characters in multiple languages. Edit the sample to add
diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html
index 09dc4c57bcdc0..0b2bdd2e174cc 100644
--- a/Lib/idlelib/help.html
+++ b/Lib/idlelib/help.html
@@ -382,7 +382,8 @@ Help menu (Shell and Editor)
- Set Breakpoint
Set a breakpoint on the current line.
@@ -638,13 +639,13 @@ Startup failure