Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 4e8b887

Browse files
author
Anselm Kruis
committed
Merge tag v3.6.10rc1 into branch 3.6-slp.
2 parents 3630e3d + 7ea0551 commit 4e8b887

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+4341
-4909
lines changed

Doc/library/asyncio-eventloop.rst

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,23 @@ Creating connections
341341

342342
.. coroutinemethod:: AbstractEventLoop.create_datagram_endpoint(protocol_factory, local_addr=None, remote_addr=None, \*, family=0, proto=0, flags=0, reuse_address=None, reuse_port=None, allow_broadcast=None, sock=None)
343343

344+
.. note::
345+
The parameter *reuse_address* is no longer supported, as using
346+
:py:data:`~sockets.SO_REUSEADDR` poses a significant security concern for
347+
UDP. Explicitly passing ``reuse_address=True`` will raise an exception.
348+
349+
When multiple processes with differing UIDs assign sockets to an
350+
indentical UDP socket address with ``SO_REUSEADDR``, incoming packets can
351+
become randomly distributed among the sockets.
352+
353+
For supported platforms, *reuse_port* can be used as a replacement for
354+
similar functionality. With *reuse_port*,
355+
:py:data:`~sockets.SO_REUSEPORT` is used instead, which specifically
356+
prevents processes with differing UIDs from assigning sockets to the same
357+
socket address.
358+
359+
Create a datagram connection.
360+
344361
Create datagram connection: socket family :py:data:`~socket.AF_INET` or
345362
:py:data:`~socket.AF_INET6` depending on *host* (or *family* if specified),
346363
socket type :py:data:`~socket.SOCK_DGRAM`. *protocol_factory* must be a
@@ -365,11 +382,6 @@ Creating connections
365382
resolution. If given, these should all be integers from the
366383
corresponding :mod:`socket` module constants.
367384

368-
* *reuse_address* tells the kernel to reuse a local socket in
369-
TIME_WAIT state, without waiting for its natural timeout to
370-
expire. If not specified will automatically be set to ``True`` on
371-
UNIX.
372-
373385
* *reuse_port* tells the kernel to allow this endpoint to be bound to the
374386
same port as other existing endpoints are bound to, so long as they all
375387
set this flag when being created. This option is not supported on Windows
@@ -393,6 +405,11 @@ Creating connections
393405
The *family*, *proto*, *flags*, *reuse_address*, *reuse_port,
394406
*allow_broadcast*, and *sock* parameters were added.
395407

408+
.. versionchanged:: 3.6.10
409+
The *reuse_address* parameter is no longer supporter due to security
410+
concerns
411+
412+
396413
.. coroutinemethod:: AbstractEventLoop.create_unix_connection(protocol_factory, path, \*, ssl=None, sock=None, server_hostname=None)
397414

398415
Create UNIX connection: socket family :py:data:`~socket.AF_UNIX`, socket

Doc/library/tkinter.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ installed, so you can read the Tcl/Tk documentation specific to that version.
3131
`TKDocs <http://www.tkdocs.com/>`_
3232
Extensive tutorial plus friendlier widget pages for some of the widgets.
3333

34-
`Tkinter reference: a GUI for Python <https://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html>`_
34+
`Tkinter 8.5 reference: a GUI for Python <https://web.archive.org/web/20190524140835/https://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html>`_
3535
On-line reference material.
3636

3737
`Tkinter docs from effbot <http://effbot.org/tkinterbook/>`_
@@ -41,7 +41,7 @@ installed, so you can read the Tcl/Tk documentation specific to that version.
4141
Book by Mark Lutz, has excellent coverage of Tkinter.
4242

4343
`Modern Tkinter for Busy Python Developers <https://www.amazon.com/Modern-Tkinter-Python-Developers-ebook/dp/B0071QDNLO/>`_
44-
Book by Mark Rozerman about building attractive and modern graphical user interfaces with Python and Tkinter.
44+
Book by Mark Roseman about building attractive and modern graphical user interfaces with Python and Tkinter.
4545

4646
`Python and Tkinter Programming <https://www.manning.com/books/python-and-tkinter-programming>`_
4747
Book by John Grayson (ISBN 1-884777-81-3).

Doc/license.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Virginia where he released several versions of the software.
2222
In May 2000, Guido and the Python core development team moved to BeOpen.com to
2323
form the BeOpen PythonLabs team. In October of the same year, the PythonLabs
2424
team moved to Digital Creations (now Zope Corporation; see
25-
http://www.zope.com/). In 2001, the Python Software Foundation (PSF, see
25+
https://www.zope.org/). In 2001, the Python Software Foundation (PSF, see
2626
https://www.python.org/psf/) was formed, a non-profit organization created
2727
specifically to own Python-related Intellectual Property. Zope Corporation is a
2828
sponsoring member of the PSF.

Doc/tools/extensions/suspicious.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@
5050
from sphinx.builders import Builder
5151
import sphinx.util
5252

53+
try: # sphinx>=1.6
54+
from sphinx.util.logging import getLogger
55+
except ImportError: # sphinx<1.6
56+
from logging import getLogger
57+
58+
5359
detect_all = re.compile(r'''
5460
::(?=[^=])| # two :: (but NOT ::=)
5561
:[a-zA-Z][a-zA-Z0-9]+| # :foo
@@ -86,7 +92,7 @@ class CheckSuspiciousMarkupBuilder(Builder):
8692
Checks for possibly invalid markup that may leak into the output.
8793
"""
8894
name = 'suspicious'
89-
logger = sphinx.util.logging.getLogger("CheckSuspiciousMarkupBuilder")
95+
logger = getLogger("CheckSuspiciousMarkupBuilder")
9096

9197
def init(self):
9298
# create output file

Doc/tools/static/switchers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
var all_versions = {
1313
'3.9': 'dev (3.9)',
14-
'3.8': 'pre (3.8)',
14+
'3.8': '3.8',
1515
'3.7': '3.7',
1616
'3.6': '3.6',
1717
'3.5': '3.5',

Doc/tools/templates/indexsidebar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ <h3>{% trans %}Download{% endtrans %}</h3>
33
<h3>{% trans %}Docs by version{% endtrans %}</h3>
44
<ul>
55
<li><a href="https://docs.python.org/3.9/">{% trans %}Python 3.9 (in development){% endtrans %}</a></li>
6-
<li><a href="https://docs.python.org/3.8/">{% trans %}Python 3.8 (pre-release){% endtrans %}</a></li>
6+
<li><a href="https://docs.python.org/3.8/">{% trans %}Python 3.8 (stable){% endtrans %}</a></li>
77
<li><a href="https://docs.python.org/3.7/">{% trans %}Python 3.7 (stable){% endtrans %}</a></li>
88
<li><a href="https://docs.python.org/3.6/">{% trans %}Python 3.6 (security-fixes){% endtrans %}</a></li>
99
<li><a href="https://docs.python.org/3.5/">{% trans %}Python 3.5 (security-fixes){% endtrans %}</a></li>

Include/patchlevel.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
/*--start constants--*/
1919
#define PY_MAJOR_VERSION 3
2020
#define PY_MINOR_VERSION 6
21-
#define PY_MICRO_VERSION 9
22-
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
23-
#define PY_RELEASE_SERIAL 0
21+
#define PY_MICRO_VERSION 10
22+
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA
23+
#define PY_RELEASE_SERIAL 1
2424

2525
/* Version as a string */
26-
#define PY_VERSION "3.6.9"
26+
#define PY_VERSION "3.6.10rc1"
2727
/*--end constants--*/
2828

2929
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.

Lib/asyncio/base_events.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959
# Maximum timeout passed to select to avoid OS limitations
6060
MAXIMUM_SELECT_TIMEOUT = 24 * 3600
6161

62+
# Used for deprecation and removal of `loop.create_datagram_endpoint()`'s
63+
# *reuse_address* parameter
64+
_unset = object()
65+
6266

6367
def _format_handle(handle):
6468
cb = handle._callback
@@ -854,7 +858,7 @@ def _create_connection_transport(self, sock, protocol_factory, ssl,
854858
def create_datagram_endpoint(self, protocol_factory,
855859
local_addr=None, remote_addr=None, *,
856860
family=0, proto=0, flags=0,
857-
reuse_address=None, reuse_port=None,
861+
reuse_address=_unset, reuse_port=None,
858862
allow_broadcast=None, sock=None):
859863
"""Create datagram connection."""
860864
if sock is not None:
@@ -863,7 +867,7 @@ def create_datagram_endpoint(self, protocol_factory,
863867
'A UDP Socket was expected, got {!r}'.format(sock))
864868
if (local_addr or remote_addr or
865869
family or proto or flags or
866-
reuse_address or reuse_port or allow_broadcast):
870+
reuse_port or allow_broadcast):
867871
# show the problematic kwargs in exception msg
868872
opts = dict(local_addr=local_addr, remote_addr=remote_addr,
869873
family=family, proto=proto, flags=flags,
@@ -912,8 +916,18 @@ def create_datagram_endpoint(self, protocol_factory,
912916

913917
exceptions = []
914918

915-
if reuse_address is None:
916-
reuse_address = os.name == 'posix' and sys.platform != 'cygwin'
919+
# bpo-37228
920+
if reuse_address is not _unset:
921+
if reuse_address:
922+
raise ValueError("Passing `reuse_address=True` is no "
923+
"longer supported, as the usage of "
924+
"SO_REUSEPORT in UDP poses a significant "
925+
"security concern.")
926+
else:
927+
warnings.warn("The *reuse_address* parameter has been "
928+
"deprecated as of 3.6.10 and is scheduled "
929+
"for removal in 3.11.", DeprecationWarning,
930+
stacklevel=2)
917931

918932
for ((family, proto),
919933
(local_address, remote_address)) in addr_pairs_info:
@@ -922,9 +936,6 @@ def create_datagram_endpoint(self, protocol_factory,
922936
try:
923937
sock = socket.socket(
924938
family=family, type=socket.SOCK_DGRAM, proto=proto)
925-
if reuse_address:
926-
sock.setsockopt(
927-
socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
928939
if reuse_port:
929940
_set_reuseport(sock)
930941
if allow_broadcast:

Lib/email/_header_value_parser.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,6 +1561,8 @@ def get_domain(value):
15611561
token, value = get_dot_atom(value)
15621562
except errors.HeaderParseError:
15631563
token, value = get_atom(value)
1564+
if value and value[0] == '@':
1565+
raise errors.HeaderParseError('Invalid Domain')
15641566
if leader is not None:
15651567
token[:0] = [leader]
15661568
___domain.append(token)
@@ -2366,6 +2368,9 @@ def get_parameter(value):
23662368
while value:
23672369
if value[0] in WSP:
23682370
token, value = get_fws(value)
2371+
elif value[0] == '"':
2372+
token = ValueTerminal('"', 'DQUOTE')
2373+
value = value[1:]
23692374
else:
23702375
token, value = get_qcontent(value)
23712376
v.append(token)
@@ -2715,15 +2720,22 @@ def _fold_as_ew(to_encode, lines, maxlen, last_ew, ew_combine_allowed, charset):
27152720
trailing_wsp = to_encode[-1]
27162721
to_encode = to_encode[:-1]
27172722
new_last_ew = len(lines[-1]) if last_ew is None else last_ew
2723+
2724+
encode_as = 'utf-8' if charset == 'us-ascii' else charset
2725+
2726+
# The RFC2047 chrome takes up 7 characters plus the length
2727+
# of the charset name.
2728+
chrome_len = len(encode_as) + 7
2729+
2730+
if (chrome_len + 1) >= maxlen:
2731+
raise errors.HeaderParseError(
2732+
"max_line_length is too small to fit an encoded word")
2733+
27182734
while to_encode:
27192735
remaining_space = maxlen - len(lines[-1])
2720-
# The RFC2047 chrome takes up 7 characters plus the length
2721-
# of the charset name.
2722-
encode_as = 'utf-8' if charset == 'us-ascii' else charset
2723-
text_space = remaining_space - len(encode_as) - 7
2736+
text_space = remaining_space - chrome_len
27242737
if text_space <= 0:
27252738
lines.append(' ')
2726-
# XXX We'll get an infinite loop here if maxlen is <= 7
27272739
continue
27282740

27292741
to_encode_word = to_encode[:text_space]

Lib/email/_parseaddr.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,12 @@ def getaddrspec(self):
379379
aslist.append('@')
380380
self.pos += 1
381381
self.gotonext()
382-
return EMPTYSTRING.join(aslist) + self.getdomain()
382+
___domain = self.getdomain()
383+
if not ___domain:
384+
# Invalid ___domain, return an empty address instead of returning a
385+
# local part to denote failed parsing.
386+
return EMPTYSTRING
387+
return EMPTYSTRING.join(aslist) + ___domain
383388

384389
def getdomain(self):
385390
"""Get the complete ___domain name from an address."""
@@ -394,6 +399,10 @@ def getdomain(self):
394399
elif self.field[self.pos] == '.':
395400
self.pos += 1
396401
sdlist.append('.')
402+
elif self.field[self.pos] == '@':
403+
# bpo-34155: Don't parse domains with two `@` like
404+
# `[email protected]@important.com`.
405+
return EMPTYSTRING
397406
elif self.field[self.pos] in self.atomends:
398407
break
399408
else:

0 commit comments

Comments
 (0)