Skip to content

Commit 8395a75

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Import CPython 3.14.5+ stable branch (2026-05-19)
Summary: Imported python/cpython `3.14.5+` from upstream rev [`8e13025`](https://www.github.com/python/cpython/commit/8e13025747e1ca72e86d1f35637123f9c306f0cb) (committed 2026-05-19 08:43:57+00:00). # Commit Info Base: (`3.14.5+`) - [`dc86a1b`](https://www.github.com/python/cpython/commit/dc86a1bdf3364a25f70452d2f7e52d9aae7d56e5) (commit date: 2026-05-17 10:35:27+00:00) Imported: (`3.14.5+`) - [`8e13025`](https://www.github.com/python/cpython/commit/8e13025747e1ca72e86d1f35637123f9c306f0cb) (commit date: 2026-05-19 08:43:57+00:00) # Noteworthy file changes - Low-signal files (1 added) (NEWS.d, docs, .github) - Other files (1 added) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GPuYySYT87fJMBIPAL7N-VCN9QNwbr0LAAAz Reviewed By: itamaro Differential Revision: D105707458 fbshipit-source-id: 7a74a98b7069b555c800a6ebaf80999c8782d209
1 parent 860480f commit 8395a75

9 files changed

Lines changed: 116 additions & 35 deletions

File tree

.github/workflows/reusable-macos.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ jobs:
3838
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
3939
- name: Install Homebrew dependencies
4040
run: |
41-
brew install pkg-config openssl@3.0 xz gdbm tcl-tk@8 make
41+
brew bundle --file=Misc/Brewfile
42+
brew install make
4243
# Because alternate versions are not symlinked into place by default:
4344
brew link --overwrite tcl-tk@8
4445
- name: Configure CPython

Doc/library/inspect.rst

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,24 +407,63 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
407407

408408
Return ``True`` if the object is a bound method written in Python.
409409

410+
.. note::
410411

411-
.. function:: ispackage(object)
412+
For example, given this class::
412413

413-
Return ``True`` if the object is a :term:`package`.
414+
>>> class Greeter:
415+
... def say_hello(self):
416+
... print('hello!')
414417

415-
.. versionadded:: 3.14
418+
A bound method (also known as an *instance method*) is created when
419+
accessing ``say_hello`` (a :term:`function` defined in the
420+
``Greeter`` namespace) through an instance of the ``Greeter`` class::
421+
422+
>>> instance = Greeter()
423+
424+
>>> instance.say_hello
425+
<bound method Greeter.say_hello of <__main__.Greeter object ...>>
426+
>>> ismethod(instance.say_hello)
427+
True
428+
>>> isfunction(instance.say_hello)
429+
False
430+
431+
Accessing ``say_hello`` through the ``Greeter`` class will return the
432+
function itself. For this function, :func:`ismethod` will return
433+
``False``, but :func:`isfunction` will return ``True``::
434+
435+
>>> Greeter.say_hello
436+
<function Greeter.say_hello at 0x7f7503854a90>
437+
>>> ismethod(Greeter.say_hello)
438+
False
439+
>>> isfunction(Greeter.say_hello)
440+
True
441+
442+
See :ref:`typesmethods` for details.
416443

417444

418445
.. function:: isfunction(object)
419446

420447
Return ``True`` if the object is a Python function, which includes functions
421448
created by a :term:`lambda` expression.
422449

450+
See the note for :func:`~inspect.ismethod` for an example.
451+
452+
453+
.. function:: ispackage(object)
454+
455+
Return ``True`` if the object is a :term:`package`.
456+
457+
.. versionadded:: 3.14
458+
423459

424460
.. function:: isgeneratorfunction(object)
425461

426462
Return ``True`` if the object is a Python generator function.
427463

464+
It also returns ``True`` for bound methods created from Python generator functions
465+
(see :ref:`typesmethods` for more information).
466+
428467
.. versionchanged:: 3.8
429468
Functions wrapped in :func:`functools.partial` now return ``True`` if the
430469
wrapped function is a Python generator function.

Doc/library/shutil.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,8 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
745745

746746
Never extract archives from untrusted sources without prior inspection.
747747
It is possible that files are created outside of the path specified in
748-
the *extract_dir* argument, e.g. members that have absolute filenames
749-
starting with "/" or filenames with two dots "..".
748+
the *extract_dir* argument, for example, members that have absolute filenames
749+
or filenames with ".." components.
750750

751751
Since Python 3.14, the defaults for both built-in formats (zip and tar
752752
files) will prevent the most dangerous of such security issues,

Doc/library/ssl.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,7 +1950,7 @@ to speed up repeated connections from the same clients.
19501950
:attr:`~SSLContext.minimum_version` and
19511951
:attr:`SSLContext.options` all affect the supported SSL
19521952
and TLS versions of the context. The implementation does not prevent
1953-
invalid combination. For example a context with
1953+
invalid combinations. For example a context with
19541954
:attr:`OP_NO_TLSv1_2` in :attr:`~SSLContext.options` and
19551955
:attr:`~SSLContext.maximum_version` set to :attr:`TLSVersion.TLSv1_2`
19561956
will not be able to establish a TLS 1.2 connection.
@@ -2753,11 +2753,11 @@ disabled by default.
27532753
::
27542754

27552755
>>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
2756-
>>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3
2756+
>>> client_context.minimum_version = ssl.TLSVersion.TLSv1_2
27572757
>>> client_context.maximum_version = ssl.TLSVersion.TLSv1_3
27582758

27592759

2760-
The SSL context created above will only allow TLSv1.3 and later (if
2760+
The SSL client context created above will only allow TLSv1.2 and TLSv1.3 (if
27612761
supported by your system) connections to a server. :const:`PROTOCOL_TLS_CLIENT`
27622762
implies certificate validation and hostname checks by default. You have to
27632763
load certificates into the context.

Doc/library/zipfile.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,9 @@ ZipFile objects
414414
.. warning::
415415

416416
Never extract archives from untrusted sources without prior inspection.
417-
It is possible that files are created outside of *path*, e.g. members
418-
that have absolute filenames starting with ``"/"`` or filenames with two
419-
dots ``".."``. This module attempts to prevent that.
417+
It is possible that files are created outside of *path*, for example, members
418+
that have absolute filenames or filenames with ".." components.
419+
This module attempts to prevent that.
420420
See :meth:`extract` note.
421421

422422
.. versionchanged:: 3.6
@@ -593,7 +593,7 @@ Path objects
593593
The :class:`Path` class does not sanitize filenames within the ZIP archive. Unlike
594594
the :meth:`ZipFile.extract` and :meth:`ZipFile.extractall` methods, it is the
595595
caller's responsibility to validate or sanitize filenames to prevent path traversal
596-
vulnerabilities (e.g., filenames containing ".." or absolute paths). When handling
596+
vulnerabilities (for example, absolute paths or paths with ".." components). When handling
597597
untrusted archives, consider resolving filenames using :func:`os.path.abspath`
598598
and checking against the target directory with :func:`os.path.commonpath`.
599599

Misc/Brewfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
brew "gdbm"
2+
brew "mpdecimal"
3+
brew "openssl@3.0"
4+
brew "pkg-config"
5+
brew "tcl-tk@8"
6+
brew "xz"
7+
brew "zstd"
8+
9+
brew "bzip2" if OS.linux?
10+
brew "expat" if OS.linux?
11+
brew "libedit" if OS.linux?
12+
brew "libffi" if OS.linux?
13+
brew "ncurses" if OS.linux?
14+
brew "unzip" if OS.linux?
15+
brew "zlib-ng-compat" if OS.linux?
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix a race condition in ``_random.Random.__init__`` method in free-threading
2+
mode.

Modules/_randommodule.c

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ typedef struct {
123123

124124
/*[clinic input]
125125
module _random
126-
class _random.Random "RandomObject *" "_randomstate_type(type)->Random_Type"
126+
class _random.Random "RandomObject *" "(PyTypeObject *)_randomstate_type(Py_TYPE(self))->Random_Type"
127127
[clinic start generated code]*/
128-
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=70a2c99619474983]*/
128+
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=f04bcbfba61a322e]*/
129129

130130
/* Random methods */
131131

@@ -549,27 +549,20 @@ _random_Random_getrandbits_impl(RandomObject *self, uint64_t k)
549549
return result;
550550
}
551551

552-
static int
553-
random_init(PyObject *self, PyObject *args, PyObject *kwds)
554-
{
555-
PyObject *arg = NULL;
556-
_randomstate *state = _randomstate_type(Py_TYPE(self));
557-
558-
if ((Py_IS_TYPE(self, (PyTypeObject *)state->Random_Type) ||
559-
Py_TYPE(self)->tp_init == ((PyTypeObject*)state->Random_Type)->tp_init) &&
560-
!_PyArg_NoKeywords("Random", kwds)) {
561-
return -1;
562-
}
563-
564-
if (PyTuple_GET_SIZE(args) > 1) {
565-
PyErr_SetString(PyExc_TypeError, "Random() requires 0 or 1 argument");
566-
return -1;
567-
}
552+
/*[clinic input]
553+
@critical_section
554+
@text_signature "($self, [seed])"
555+
_random.Random.__init__ as random_init
568556
569-
if (PyTuple_GET_SIZE(args) == 1)
570-
arg = PyTuple_GET_ITEM(args, 0);
557+
seed: object = NULL
558+
/
559+
[clinic start generated code]*/
571560

572-
return random_seed(RandomObject_CAST(self), arg);
561+
static int
562+
random_init_impl(RandomObject *self, PyObject *seed)
563+
/*[clinic end generated code: output=260734a3739c394f input=e516bf32e8a05e28]*/
564+
{
565+
return random_seed(self, seed);
573566
}
574567

575568

Modules/clinic/_randommodule.c.h

Lines changed: 32 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)