Skip to content

Commit 572c071

Browse files
authored
Merge branch 'main' into islice_ft
2 parents c2cbffb + 957f9fe commit 572c071

Some content is hidden

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

62 files changed

+2749
-1880
lines changed

Doc/deprecations/pending-removal-in-future.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ although there is currently no date scheduled for their removal.
7878

7979
* :mod:`os`: Calling :func:`os.register_at_fork` in a multi-threaded process.
8080

81+
* :mod:`os.path`: :func:`os.path.commonprefix` is deprecated, use
82+
:func:`os.path.commonpath` for path prefixes. The :func:`os.path.commonprefix`
83+
function is being deprecated due to having a misleading name and module.
84+
The function is not safe to use for path prefixes despite being included in a
85+
module about path manipulation, meaning it is easy to accidentally
86+
introduce path traversal vulnerabilities into Python programs by using this
87+
function.
88+
8189
* :class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is
8290
deprecated, use an exception instance.
8391

Doc/library/base64.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ POST request.
8787

8888
If *ignorechars* is specified, it should be a :term:`bytes-like object`
8989
containing characters to ignore from the input when *validate* is true.
90+
If *ignorechars* contains the pad character ``'='``, the pad characters
91+
presented before the end of the encoded data and the excess pad characters
92+
will be ignored.
9093
The default value of *validate* is ``True`` if *ignorechars* is specified,
9194
``False`` otherwise.
9295

Doc/library/binascii.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ The :mod:`binascii` module defines the following functions:
5656

5757
If *ignorechars* is specified, it should be a :term:`bytes-like object`
5858
containing characters to ignore from the input when *strict_mode* is true.
59+
If *ignorechars* contains the pad character ``'='``, the pad characters
60+
presented before the end of the encoded data and the excess pad characters
61+
will be ignored.
5962
The default value of *strict_mode* is ``True`` if *ignorechars* is specified,
6063
``False`` otherwise.
6164

Doc/library/functools.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ The :mod:`functools` module defines the following functions:
180180
the *maxsize* at its default value of 128::
181181

182182
@lru_cache
183-
def count_vowels(sentence):
184-
return sum(sentence.count(vowel) for vowel in 'AEIOUaeiou')
183+
def count_vowels(word):
184+
return sum(word.count(vowel) for vowel in 'AEIOUaeiou')
185185

186186
If *maxsize* is set to ``None``, the LRU feature is disabled and the cache can
187187
grow without bound.

Doc/library/os.path.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ the :mod:`glob` module.)
120120
.. versionchanged:: 3.6
121121
Accepts a :term:`path-like object`.
122122

123+
.. deprecated:: next
124+
Deprecated in favor of :func:`os.path.commonpath` for path prefixes.
125+
The :func:`os.path.commonprefix` function is being deprecated due to
126+
having a misleading name and module. The function is not safe to use for
127+
path prefixes despite being included in a module about path manipulation,
128+
meaning it is easy to accidentally introduce path traversal
129+
vulnerabilities into Python programs by using this function.
130+
123131

124132
.. function:: dirname(path, /)
125133

Doc/library/shutil.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,9 @@ On Solaris :func:`os.sendfile` is used.
540540

541541
On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB
542542
instead of 64 KiB) and a :func:`memoryview`-based variant of
543-
:func:`shutil.copyfileobj` is used.
543+
:func:`shutil.copyfileobj` is used, which is still reads and writes in a loop.
544+
:func:`shutil.copy2` uses the native ``CopyFile2`` call on Windows, which is the most
545+
efficient method, supports copy-on-write, and preserves metadata.
544546

545547
If the fast-copy operation fails and no data was written in the destination
546548
file then shutil will silently fallback on using less efficient

Doc/library/urllib.parse.rst

Lines changed: 81 additions & 135 deletions
Large diffs are not rendered by default.

Doc/library/venv.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ subclass which installs setuptools and pip into a created virtual environment::
550550
from subprocess import Popen, PIPE
551551
import sys
552552
from threading import Thread
553-
from urllib.parse import urlparse
553+
from urllib.parse import urlsplit
554554
from urllib.request import urlretrieve
555555
import venv
556556

@@ -621,7 +621,7 @@ subclass which installs setuptools and pip into a created virtual environment::
621621
stream.close()
622622

623623
def install_script(self, context, name, url):
624-
_, _, path, _, _, _ = urlparse(url)
624+
_, _, path, _, _ = urlsplit(url)
625625
fn = os.path.split(path)[-1]
626626
binpath = context.bin_path
627627
distpath = os.path.join(binpath, fn)

Doc/library/wsgiref.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111

1212
--------------
1313

14+
.. warning::
15+
16+
:mod:`wsgiref` is a reference implementation and is not recommended for
17+
production. The module only implements basic security checks.
18+
1419
The Web Server Gateway Interface (WSGI) is a standard interface between web
1520
server software and web applications written in Python. Having a standard
1621
interface makes it easy to use an application that supports WSGI with a number

Doc/reference/simple_stmts.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,9 @@ where the :keyword:`import` statement occurs.
831831

832832
The *public names* defined by a module are determined by checking the module's
833833
namespace for a variable named ``__all__``; if defined, it must be a sequence
834-
of strings which are names defined or imported by that module. The names
834+
of strings which are names defined or imported by that module.
835+
Names containing non-ASCII characters must be in the `normalization form`_
836+
NFKC; see :ref:`lexical-names-nonascii` for details. The names
835837
given in ``__all__`` are all considered public and are required to exist. If
836838
``__all__`` is not defined, the set of public names includes all names found
837839
in the module's namespace which do not begin with an underscore character
@@ -865,6 +867,8 @@ determine dynamically the modules to be loaded.
865867

866868
.. audit-event:: import module,filename,sys.path,sys.meta_path,sys.path_hooks import
867869

870+
.. _normalization form: https://www.unicode.org/reports/tr15/#Norm_Forms
871+
868872
.. _future:
869873

870874
Future statements

0 commit comments

Comments
 (0)