Skip to content

Commit 51f5997

Browse files
authored
Merge branch 'main' into gh-144316-get_stack_trace
2 parents a1b0590 + 957f9fe commit 51f5997

26 files changed

+364
-71
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/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

Doc/whatsnew/3.15.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,13 @@ os.path
704704
(Contributed by Petr Viktorin for :cve:`2025-4517`.)
705705

706706

707+
pickle
708+
------
709+
710+
* Add support for pickling private methods and nested classes.
711+
(Contributed by Zackery Spytz and Serhiy Storchaka in :gh:`77188`.)
712+
713+
707714
resource
708715
--------
709716

Include/internal/pycore_symtable.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,12 @@ extern int _PySymtable_LookupOptional(struct symtable *, void *, PySTEntryObject
151151
extern void _PySymtable_Free(struct symtable *);
152152

153153
extern PyObject *_Py_MaybeMangle(PyObject *privateobj, PySTEntryObject *ste, PyObject *name);
154-
extern PyObject* _Py_Mangle(PyObject *p, PyObject *name);
154+
155+
// Export for '_pickle' shared extension
156+
PyAPI_FUNC(PyObject *)
157+
_Py_Mangle(PyObject *, PyObject *);
158+
PyAPI_FUNC(int)
159+
_Py_IsPrivateName(PyObject *);
155160

156161
/* Flags for def-use information */
157162

0 commit comments

Comments
 (0)