Skip to content

Commit cfb2640

Browse files
authored
gh-100734: What's New in 3.x: Add missing detail from 3.x branch (#114689)
1 parent 298bcdc commit cfb2640

File tree

8 files changed

+327
-0
lines changed

8 files changed

+327
-0
lines changed

Diff for: Doc/whatsnew/2.6.rst

+36
Original file line numberDiff line numberDiff line change
@@ -2992,6 +2992,33 @@ Changes to Python's build process and to the C API include:
29922992
architectures (x86, PowerPC), 64-bit (x86-64 and PPC-64), or both.
29932993
(Contributed by Ronald Oussoren.)
29942994

2995+
* A new function added in Python 2.6.6, :c:func:`!PySys_SetArgvEx`, sets
2996+
the value of ``sys.argv`` and can optionally update ``sys.path`` to
2997+
include the directory containing the script named by ``sys.argv[0]``
2998+
depending on the value of an *updatepath* parameter.
2999+
3000+
This function was added to close a security hole for applications
3001+
that embed Python. The old function, :c:func:`!PySys_SetArgv`, would
3002+
always update ``sys.path``, and sometimes it would add the current
3003+
directory. This meant that, if you ran an application embedding
3004+
Python in a directory controlled by someone else, attackers could
3005+
put a Trojan-horse module in the directory (say, a file named
3006+
:file:`os.py`) that your application would then import and run.
3007+
3008+
If you maintain a C/C++ application that embeds Python, check
3009+
whether you're calling :c:func:`!PySys_SetArgv` and carefully consider
3010+
whether the application should be using :c:func:`!PySys_SetArgvEx`
3011+
with *updatepath* set to false. Note that using this function will
3012+
break compatibility with Python versions 2.6.5 and earlier; if you
3013+
have to continue working with earlier versions, you can leave
3014+
the call to :c:func:`!PySys_SetArgv` alone and call
3015+
``PyRun_SimpleString("sys.path.pop(0)\n")`` afterwards to discard
3016+
the first ``sys.path`` component.
3017+
3018+
Security issue reported as `CVE-2008-5983
3019+
<http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-5983>`_;
3020+
discussed in :gh:`50003`, and fixed by Antoine Pitrou.
3021+
29953022
* The BerkeleyDB module now has a C API object, available as
29963023
``bsddb.db.api``. This object can be used by other C extensions
29973024
that wish to use the :mod:`bsddb` module for their own purposes.
@@ -3294,6 +3321,15 @@ that may require changes to your code:
32943321
scoping rules, also cause warnings because such comparisons are forbidden
32953322
entirely in 3.0.
32963323

3324+
For applications that embed Python:
3325+
3326+
* The :c:func:`!PySys_SetArgvEx` function was added in Python 2.6.6,
3327+
letting applications close a security hole when the existing
3328+
:c:func:`!PySys_SetArgv` function was used. Check whether you're
3329+
calling :c:func:`!PySys_SetArgv` and carefully consider whether the
3330+
application should be using :c:func:`!PySys_SetArgvEx` with
3331+
*updatepath* set to false.
3332+
32973333
.. ======================================================================
32983334
32993335

Diff for: Doc/whatsnew/3.1.rst

+22
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,28 @@ Support was also added for third-party tools like `PyYAML <https://pyyaml.org/>`
8080
PEP written by Armin Ronacher and Raymond Hettinger. Implementation
8181
written by Raymond Hettinger.
8282

83+
Since an ordered dictionary remembers its insertion order, it can be used
84+
in conjuction with sorting to make a sorted dictionary::
85+
86+
>>> # regular unsorted dictionary
87+
>>> d = {'banana': 3, 'apple':4, 'pear': 1, 'orange': 2}
88+
89+
>>> # dictionary sorted by key
90+
>>> OrderedDict(sorted(d.items(), key=lambda t: t[0]))
91+
OrderedDict([('apple', 4), ('banana', 3), ('orange', 2), ('pear', 1)])
92+
93+
>>> # dictionary sorted by value
94+
>>> OrderedDict(sorted(d.items(), key=lambda t: t[1]))
95+
OrderedDict([('pear', 1), ('orange', 2), ('banana', 3), ('apple', 4)])
96+
97+
>>> # dictionary sorted by length of the key string
98+
>>> OrderedDict(sorted(d.items(), key=lambda t: len(t[0])))
99+
OrderedDict([('pear', 1), ('apple', 4), ('orange', 2), ('banana', 3)])
100+
101+
The new sorted dictionaries maintain their sort order when entries
102+
are deleted. But when new keys are added, the keys are appended
103+
to the end and the sort is not maintained.
104+
83105

84106
PEP 378: Format Specifier for Thousands Separator
85107
=================================================

Diff for: Doc/whatsnew/3.10.rst

+47
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,13 @@ functions internally. For more details, please see their respective
15171517
documentation.
15181518
(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)
15191519
1520+
The presence of newline or tab characters in parts of a URL allows for some
1521+
forms of attacks. Following the WHATWG specification that updates :rfc:`3986`,
1522+
ASCII newline ``\n``, ``\r`` and tab ``\t`` characters are stripped from the
1523+
URL by the parser in :mod:`urllib.parse` preventing such attacks. The removal
1524+
characters are controlled by a new module level variable
1525+
``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)
1526+
15201527
xml
15211528
---
15221529
@@ -2315,3 +2322,43 @@ Removed
23152322
23162323
* The ``PyThreadState.use_tracing`` member has been removed to optimize Python.
23172324
(Contributed by Mark Shannon in :issue:`43760`.)
2325+
2326+
2327+
Notable security feature in 3.10.7
2328+
==================================
2329+
2330+
Converting between :class:`int` and :class:`str` in bases other than 2
2331+
(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal)
2332+
now raises a :exc:`ValueError` if the number of digits in string form is
2333+
above a limit to avoid potential denial of service attacks due to the
2334+
algorithmic complexity. This is a mitigation for `CVE-2020-10735
2335+
<https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10735>`_.
2336+
This limit can be configured or disabled by environment variable, command
2337+
line flag, or :mod:`sys` APIs. See the :ref:`integer string conversion
2338+
length limitation <int_max_str_digits>` documentation. The default limit
2339+
is 4300 digits in string form.
2340+
2341+
Notable security feature in 3.10.8
2342+
==================================
2343+
2344+
The deprecated :mod:`!mailcap` module now refuses to inject unsafe text
2345+
(filenames, MIME types, parameters) into shell commands. Instead of using such
2346+
text, it will warn and act as if a match was not found (or for test commands,
2347+
as if the test failed).
2348+
(Contributed by Petr Viktorin in :gh:`98966`.)
2349+
2350+
Notable changes in 3.10.12
2351+
==========================
2352+
2353+
tarfile
2354+
-------
2355+
2356+
* The extraction methods in :mod:`tarfile`, and :func:`shutil.unpack_archive`,
2357+
have a new a *filter* argument that allows limiting tar features than may be
2358+
surprising or dangerous, such as creating files outside the destination
2359+
directory.
2360+
See :ref:`tarfile-extraction-filter` for details.
2361+
In Python 3.12, use without the *filter* argument will show a
2362+
:exc:`DeprecationWarning`.
2363+
In Python 3.14, the default will switch to ``'data'``.
2364+
(Contributed by Petr Viktorin in :pep:`706`.)

Diff for: Doc/whatsnew/3.12.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1956,6 +1956,8 @@ Build Changes
19561956
:file:`!configure`.
19571957
(Contributed by Christian Heimes in :gh:`89886`.)
19581958

1959+
* Windows builds and macOS installers from python.org now use OpenSSL 3.0.
1960+
19591961

19601962
C API Changes
19611963
=============

Diff for: Doc/whatsnew/3.6.rst

+33
Original file line numberDiff line numberDiff line change
@@ -1472,6 +1472,10 @@ Server and client-side specific TLS protocols for :class:`~ssl.SSLContext`
14721472
were added.
14731473
(Contributed by Christian Heimes in :issue:`28085`.)
14741474

1475+
Added :attr:`ssl.SSLContext.post_handshake_auth` to enable and
1476+
:meth:`ssl.SSLSocket.verify_client_post_handshake` to initiate TLS 1.3
1477+
post-handshake authentication.
1478+
(Contributed by Christian Heimes in :gh:`78851`.)
14751479

14761480
statistics
14771481
----------
@@ -2063,6 +2067,15 @@ connected to and thus what Python interpreter will be used by the virtual
20632067
environment. (Contributed by Brett Cannon in :issue:`25154`.)
20642068

20652069

2070+
xml
2071+
---
2072+
2073+
* As mitigation against DTD and external entity retrieval, the
2074+
:mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process
2075+
external entities by default.
2076+
(Contributed by Christian Heimes in :gh:`61441`.)
2077+
2078+
20662079
Deprecated functions and types of the C API
20672080
-------------------------------------------
20682081

@@ -2430,9 +2443,13 @@ The :func:`locale.localeconv` function now sets temporarily the ``LC_CTYPE``
24302443
locale to the ``LC_NUMERIC`` locale in some cases.
24312444
(Contributed by Victor Stinner in :issue:`31900`.)
24322445

2446+
24332447
Notable changes in Python 3.6.7
24342448
===============================
24352449

2450+
:mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process
2451+
external entities by default. See also :gh:`61441`.
2452+
24362453
In 3.6.7 the :mod:`tokenize` module now implicitly emits a ``NEWLINE`` token
24372454
when provided with input that does not have a trailing new line. This behavior
24382455
now matches what the C tokenizer does internally.
@@ -2460,3 +2477,19 @@ separator key, with ``&`` as the default. This change also affects
24602477
functions internally. For more details, please see their respective
24612478
documentation.
24622479
(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)
2480+
2481+
Notable changes in Python 3.6.14
2482+
================================
2483+
2484+
A security fix alters the :class:`ftplib.FTP` behavior to not trust the
2485+
IPv4 address sent from the remote server when setting up a passive data
2486+
channel. We reuse the ftp server IP address instead. For unusual code
2487+
requiring the old behavior, set a ``trust_server_pasv_ipv4_address``
2488+
attribute on your FTP instance to ``True``. (See :gh:`87451`)
2489+
2490+
The presence of newline or tab characters in parts of a URL allows for some
2491+
forms of attacks. Following the WHATWG specification that updates RFC 3986,
2492+
ASCII newline ``\n``, ``\r`` and tab ``\t`` characters are stripped from the
2493+
URL by the parser :func:`urllib.parse` preventing such attacks. The removal
2494+
characters are controlled by a new module level variable
2495+
``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)

Diff for: Doc/whatsnew/3.7.rst

+44
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,10 @@ Supported protocols are indicated by several new flags, such as
13801380
:data:`~ssl.HAS_TLSv1_1`.
13811381
(Contributed by Christian Heimes in :issue:`32609`.)
13821382

1383+
Added :attr:`ssl.SSLContext.post_handshake_auth` to enable and
1384+
:meth:`ssl.SSLSocket.verify_client_post_handshake` to initiate TLS 1.3
1385+
post-handshake authentication.
1386+
(Contributed by Christian Heimes in :gh:`78851`.)
13831387

13841388
string
13851389
------
@@ -1599,6 +1603,15 @@ at the interactive prompt. See :ref:`whatsnew37-pep565` for details.
15991603
(Contributed by Nick Coghlan in :issue:`31975`.)
16001604

16011605

1606+
xml
1607+
---
1608+
1609+
As mitigation against DTD and external entity retrieval, the
1610+
:mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process
1611+
external entities by default.
1612+
(Contributed by Christian Heimes in :gh:`61441`.)
1613+
1614+
16021615
xml.etree
16031616
---------
16041617

@@ -2571,3 +2584,34 @@ separator key, with ``&`` as the default. This change also affects
25712584
functions internally. For more details, please see their respective
25722585
documentation.
25732586
(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)
2587+
2588+
Notable changes in Python 3.7.11
2589+
================================
2590+
2591+
A security fix alters the :class:`ftplib.FTP` behavior to not trust the
2592+
IPv4 address sent from the remote server when setting up a passive data
2593+
channel. We reuse the ftp server IP address instead. For unusual code
2594+
requiring the old behavior, set a ``trust_server_pasv_ipv4_address``
2595+
attribute on your FTP instance to ``True``. (See :gh:`87451`)
2596+
2597+
2598+
The presence of newline or tab characters in parts of a URL allows for some
2599+
forms of attacks. Following the WHATWG specification that updates RFC 3986,
2600+
ASCII newline ``\n``, ``\r`` and tab ``\t`` characters are stripped from the
2601+
URL by the parser :func:`urllib.parse` preventing such attacks. The removal
2602+
characters are controlled by a new module level variable
2603+
``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)
2604+
2605+
Notable security feature in 3.7.14
2606+
==================================
2607+
2608+
Converting between :class:`int` and :class:`str` in bases other than 2
2609+
(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal)
2610+
now raises a :exc:`ValueError` if the number of digits in string form is
2611+
above a limit to avoid potential denial of service attacks due to the
2612+
algorithmic complexity. This is a mitigation for `CVE-2020-10735
2613+
<https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10735>`_.
2614+
This limit can be configured or disabled by environment variable, command
2615+
line flag, or :mod:`sys` APIs. See the :ref:`integer string conversion
2616+
length limitation <int_max_str_digits>` documentation. The default limit
2617+
is 4300 digits in string form.

Diff for: Doc/whatsnew/3.8.rst

+91
Original file line numberDiff line numberDiff line change
@@ -2243,6 +2243,21 @@ details, see the documentation for ``loop.create_datagram_endpoint()``.
22432243
(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in
22442244
:issue:`37228`.)
22452245

2246+
Notable changes in Python 3.8.2
2247+
===============================
2248+
2249+
Fixed a regression with the ``ignore`` callback of :func:`shutil.copytree`.
2250+
The argument types are now str and List[str] again.
2251+
(Contributed by Manuel Barkhau and Giampaolo Rodola in :gh:`83571`.)
2252+
2253+
Notable changes in Python 3.8.3
2254+
===============================
2255+
2256+
The constant values of future flags in the :mod:`__future__` module
2257+
are updated in order to prevent collision with compiler flags. Previously
2258+
``PyCF_ALLOW_TOP_LEVEL_AWAIT`` was clashing with ``CO_FUTURE_DIVISION``.
2259+
(Contributed by Batuhan Taskaya in :gh:`83743`)
2260+
22462261
Notable changes in Python 3.8.8
22472262
===============================
22482263

@@ -2256,9 +2271,55 @@ functions internally. For more details, please see their respective
22562271
documentation.
22572272
(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)
22582273

2274+
Notable changes in Python 3.8.9
2275+
===============================
2276+
2277+
A security fix alters the :class:`ftplib.FTP` behavior to not trust the
2278+
IPv4 address sent from the remote server when setting up a passive data
2279+
channel. We reuse the ftp server IP address instead. For unusual code
2280+
requiring the old behavior, set a ``trust_server_pasv_ipv4_address``
2281+
attribute on your FTP instance to ``True``. (See :gh:`87451`)
2282+
2283+
Notable changes in Python 3.8.10
2284+
================================
2285+
2286+
macOS 11.0 (Big Sur) and Apple Silicon Mac support
2287+
--------------------------------------------------
2288+
2289+
As of 3.8.10, Python now supports building and running on macOS 11
2290+
(Big Sur) and on Apple Silicon Macs (based on the ``ARM64`` architecture).
2291+
A new universal build variant, ``universal2``, is now available to natively
2292+
support both ``ARM64`` and ``Intel 64`` in one set of executables.
2293+
Note that support for "weaklinking", building binaries targeted for newer
2294+
versions of macOS that will also run correctly on older versions by
2295+
testing at runtime for missing features, is not included in this backport
2296+
from Python 3.9; to support a range of macOS versions, continue to target
2297+
for and build on the oldest version in the range.
2298+
2299+
(Originally contributed by Ronald Oussoren and Lawrence D'Anna in :gh:`85272`,
2300+
with fixes by FX Coudert and Eli Rykoff, and backported to 3.8 by Maxime Bélanger
2301+
and Ned Deily)
2302+
2303+
Notable changes in Python 3.8.10
2304+
================================
2305+
2306+
urllib.parse
2307+
------------
2308+
2309+
The presence of newline or tab characters in parts of a URL allows for some
2310+
forms of attacks. Following the WHATWG specification that updates :rfc:`3986`,
2311+
ASCII newline ``\n``, ``\r`` and tab ``\t`` characters are stripped from the
2312+
URL by the parser in :mod:`urllib.parse` preventing such attacks. The removal
2313+
characters are controlled by a new module level variable
2314+
``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :issue:`43882`)
2315+
2316+
22592317
Notable changes in Python 3.8.12
22602318
================================
22612319

2320+
Changes in the Python API
2321+
-------------------------
2322+
22622323
Starting with Python 3.8.12 the :mod:`ipaddress` module no longer accepts
22632324
any leading zeros in IPv4 address strings. Leading zeros are ambiguous and
22642325
interpreted as octal notation by some libraries. For example the legacy
@@ -2268,3 +2329,33 @@ any leading zeros.
22682329

22692330
(Originally contributed by Christian Heimes in :issue:`36384`, and backported
22702331
to 3.8 by Achraf Merzouki.)
2332+
2333+
Notable security feature in 3.8.14
2334+
==================================
2335+
2336+
Converting between :class:`int` and :class:`str` in bases other than 2
2337+
(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal)
2338+
now raises a :exc:`ValueError` if the number of digits in string form is
2339+
above a limit to avoid potential denial of service attacks due to the
2340+
algorithmic complexity. This is a mitigation for `CVE-2020-10735
2341+
<https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10735>`_.
2342+
This limit can be configured or disabled by environment variable, command
2343+
line flag, or :mod:`sys` APIs. See the :ref:`integer string conversion
2344+
length limitation <int_max_str_digits>` documentation. The default limit
2345+
is 4300 digits in string form.
2346+
2347+
Notable changes in 3.8.17
2348+
=========================
2349+
2350+
tarfile
2351+
-------
2352+
2353+
* The extraction methods in :mod:`tarfile`, and :func:`shutil.unpack_archive`,
2354+
have a new a *filter* argument that allows limiting tar features than may be
2355+
surprising or dangerous, such as creating files outside the destination
2356+
directory.
2357+
See :ref:`tarfile-extraction-filter` for details.
2358+
In Python 3.12, use without the *filter* argument will show a
2359+
:exc:`DeprecationWarning`.
2360+
In Python 3.14, the default will switch to ``'data'``.
2361+
(Contributed by Petr Viktorin in :pep:`706`.)

0 commit comments

Comments
 (0)