Compare commits

...

1538 commits

Author SHA1 Message Date
Hugo van Kemenade
57e0d177c2 Python 3.14.1 2025-12-02 14:51:37 +02:00
Hugo van Kemenade
49fe7574d9
[3.14] Revert "gh-119452: Fix a potential virtual memory allocation denial of service in http.server (GH-119455)" (#142184)
Fix a potential virtual memory allocation denial of service in http.server (GH-119455)"
2025-12-02 12:06:25 +00:00
Petr Viktorin
82274c491a
[3.14] Document None for timeout argument of select.select (GH-142177) (#142182) 2025-12-02 13:45:07 +02:00
Miss Islington (bot)
b053c2abf0
[3.14] gh-140281: Update free threading Python HOWTO for 3.14 (gh-140566) (gh-142173)
(cherry picked from commit 2dc28eb8b0)

Co-authored-by: Krishna-web-hub <masterkiran27@gmail.com>
Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-12-02 01:06:15 -05:00
Miss Islington (bot)
15a25f44ee
[3.14] gh-59000: Fix pdb breakpoint resolution for class methods when module not imported (GH-141949) (#142171)
gh-59000: Fix pdb breakpoint resolution for class methods when module not imported (GH-141949)
(cherry picked from commit 5e58548ebe)

Co-authored-by: LloydZ <35182391+cocolato@users.noreply.github.com>
2025-12-02 05:06:26 +00:00
Miss Islington (bot)
5c5670eb45
[3.14] gh-142048: Fix quadratically increasing GC delays (gh-142051) (gh-142166)
The GC for the free threaded build would get slower with each collection due
to effectively double counting objects freed by the GC.
(cherry picked from commit eb892868b3)

Co-authored-by: Kevin Wang <kevmo314@gmail.com>
2025-12-02 00:30:11 +00:00
Hugo van Kemenade
7642070807
[3.14] Revert "GH-91636: Clear weakrefs created by finalizers. (GH-136401) (#141993)" (#142152) 2025-12-01 20:34:37 +02:00
Miss Islington (bot)
4ce27904b5
[3.14] gh-119451: Fix a potential denial of service in http.client (GH-119454) (#142138)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-12-01 20:34:09 +02:00
Miss Islington (bot)
afce34fbf0
[3.14] gh-141930: Use the regular IO stack to write .pyc files for a better error message on failure (GH-141931) (#142021)
Co-authored-by: Stefano Rivera <stefano@rivera.za.net>
2025-12-01 18:43:50 +02:00
Miss Islington (bot)
521fb36561
[3.14] gh-141004: Document descriptor and dict proxy type objects (GH-141803) (GH142147)
gh-141004: Document descriptor and dict proxy type objects (GH-141803)
(cherry picked from commit 52f9b5f580)

Co-authored-by: Yashraj <yashrajpala8@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-12-01 15:57:31 +00:00
Miss Islington (bot)
b64441e485
[3.14] gh-119342: Fix a potential denial of service in plistlib (GH-119343) (GH-142143)
Reading a specially prepared small Plist file could cause OOM because file's
read(n) preallocates a bytes object for reading the specified amount of
data. Now plistlib reads large data by chunks, therefore the upper limit of
consumed memory is proportional to the size of the input file.
(cherry picked from commit 694922cf40)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-12-01 15:54:58 +00:00
Serhiy Storchaka
29c657a1f2
[3.14] gh-119452: Fix a potential virtual memory allocation denial of service in http.server (GH-119455)
The CGI server on Windows could consume the amount of memory specified
in the Content-Length header of the request even if the client does not
send such much data. Now it reads the POST request body by chunks,
so that the memory consumption is proportional to the amount of sent
data.
2025-12-01 12:59:09 +00:00
Miss Islington (bot)
c4054f7aa8
[3.14] Docs: Upgrade Sphinx to 9.0 (GH-142114) (#142128)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-12-01 11:22:05 +00:00
Miss Islington (bot)
9cb5a93e07
[3.14] gh-141473: Document not calling Popen.wait after Popen.communicate times out. (GH-142101) (#142124)
gh-141473: Document not calling Popen.wait after Popen.communicate times out. (GH-142101)

Document not calling Popen.wait after Popen.communicate times out.

Closes GH-141473
(cherry picked from commit 3e2c557493)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-12-01 02:55:28 +00:00
Miss Islington (bot)
8899ed52f2
[3.14] gh-142066: Fix grammar in multiprocessing Pipes and Queues (GH-142121) (#142122)
gh-142066: Fix grammar in multiprocessing Pipes and Queues (GH-142121)
(cherry picked from commit 981ce0cf3a)


docs: Fix grammar in multiprocessing Pipes and Queues (gh-142066)

Co-authored-by: Tadej Magajna <tmagajna@gmail.com>
2025-12-01 02:19:48 +00:00
Miss Islington (bot)
4dbf8e14ba
[3.14] gh-142067: Add missing default value for param in multiprocessing.Pipe's doc (GH-142109) (#142120)
gh-142067: Add missing default value for param in `multiprocessing.Pipe`'s doc (GH-142109)
(cherry picked from commit 229ed3dd1f)

Co-authored-by: flovent <flbven@protonmail.com>
2025-11-30 21:15:39 +00:00
Hugo van Kemenade
b95d16a338
[3.14] gh-133146: Add the old public get_value method to documentation and refactor code. (GH-133301) (#142110)
also uses it within the internals in a few places.
(cherry picked from commit db098a475a)

Co-authored-by: Duprat <yduprat@gmail.com>
2025-11-30 13:06:56 -08:00
Miss Islington (bot)
3824ad0286
[3.14] Improve clarity in tutorial introduction (GH-140669) (#142112)
Co-authored-by: Thierry Martos <81799048+ThierryMT@users.noreply.github.com>
2025-11-30 12:53:05 +00:00
Miss Islington (bot)
52731c4e62
[3.14] gh-140373: Correctly emit PY_UNWIND event when generator is closed (GH-140767) (#140816)
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2025-11-30 14:35:14 +02:00
Miss Islington (bot)
58c0af9984
[3.14] gh-139741: Make dist-pdf docs archive build work for macOS (GH-140837) (#141229)
Co-authored-by: Naitree Zhu <Naitreey@gmail.com>
2025-11-30 12:34:12 +00:00
Miss Islington (bot)
212b096b2a
[3.14] gh-140042: Removing unsafe call to sqlite3_shutdown (GH-141690) (#141793)
Co-authored-by: Prithviraj Chaudhuri <p.chaudhuri1993@gmail.com>
2025-11-30 14:32:11 +02:00
Miss Islington (bot)
848a2ebe53
[3.14] gh-136063: fix quadratic-complexity parsing in email.message._parseparam (GH-136072) (#140827)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-30 14:30:56 +02:00
Miss Islington (bot)
1011c0c38f
[3.14] gh-132795: Add docs for multiprocessing.Semaphore.locked (GH-133299) (#142111)
Co-authored-by: Duprat <yduprat@gmail.com>
2025-11-30 12:19:30 +00:00
Miss Islington (bot)
3d448061a1
[3.14] GH-141808: Do not generate the jit stencils twice in case of PGO builds on Windows. (GH-142043) (#142100)
GH-141808: Do not generate the jit stencils twice in case of PGO builds on Windows. (GH-142043)

* do not build the jit stencils twice in case of PGO builds on Windows

* blurb it
(cherry picked from commit f2ca1581ca)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-11-29 21:09:19 +00:00
Miss Islington (bot)
85591009d1
[3.14] Docs: Prepare for Sphinx 9 (GH-142057) (#142091)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-11-29 17:15:25 +02:00
Miss Islington (bot)
612213c0f4
[3.14] GH-121970: Remove Docutils list monkeypatch (GH-142056) (#142088) 2025-11-29 14:56:29 +00:00
Miss Islington (bot)
fed2af6f9e
[3.14] GH-91636: Clear weakrefs created by finalizers. (GH-136401) (#141993)
GH-91636: Clear weakrefs created by finalizers. (GH-136401)

Weakrefs to unreachable garbage that are created during running of
finalizers need to be cleared.  This avoids exposing objects that
have `tp_clear` called on them to Python-level code.
(cherry picked from commit b6b99bf7f1)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2025-11-28 23:34:36 -08:00
Itamar Oren
f7d17ac9f8
[3.14] gh-140011: Delete importdl assertion that prevents importing embedded modules from packages (GH-141605) (#141986)
gh-140011: Delete importdl assertion that prevents importing embedded modules from packages (GH-141605)

(cherry picked from commit 27f62eb711)
2025-11-28 23:30:57 -08:00
Miss Islington (bot)
d8a72b4c5e
[3.14] GH-141963: Clarify argparse documentation (GH-141964) (#142076)
GH-141963: Clarify argparse documentation (GH-141964)

Clarify argparse documentation

Tightens the phrasing for several argparse actions.
(cherry picked from commit cfcd52490d)

Co-authored-by: Moshe Kaplan <mosheekaplan@gmail.com>
2025-11-29 07:28:50 +00:00
Miss Islington (bot)
20b910ca8b
[3.14] Fix multiprocessing queue test_get() (GH-142024) (#142070)
Fix multiprocessing queue test_get() (GH-142024)

* Replace sleep() with support.sleeping_retry().
* Test get_nowait() first.
* Restore previously disabled test.

Fix the failure:

FAIL: test_get (test.test_multiprocessing_spawn.test_processes.WithProcessesTestQueue.test_get)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/_test_multiprocessing.py", line 1208, in test_get
    self.assertEqual(queue_empty(queue), False)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: True != False
(cherry picked from commit 5e749d3743)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-29 07:25:46 +00:00
Miss Islington (bot)
23d771a5de
[3.14] Docs: multi-disk ZIP files -> multipart ZIP files (GH-141962) (#142074)
Docs: multi-disk ZIP files -> multipart ZIP files (GH-141962)

* Remove some old currentlies
* multi-disk -> multipart
* Sentence case headings
(cherry picked from commit 890fe5aad5)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-11-29 07:17:39 +00:00
Miss Islington (bot)
3d8ad2d366
[3.14] gh-141994: Warn of XXE vulnerability in documentation of SAX feature xml.sax.handler.feature_external_ges (GH-141996) (#142072)
gh-141994: Warn of XXE vulnerability in documentation of SAX feature `xml.sax.handler.feature_external_ges` (GH-141996)

Doc/library/xml.sax.handler.rst: Warn of XXE with feature_external_ges

Related to commit baa9f33897
(cherry picked from commit 440bcb9456)

Co-authored-by: Sebastian Pipping <sebastian@pipping.org>
2025-11-29 07:14:02 +00:00
Miss Islington (bot)
6b799e1591
[3.14] gh-74389: gh-70560: subprocess.Popen.communicate() now ignores stdin.flush error when closed (GH-142061) (#142064)
gh-74389: gh-70560: subprocess.Popen.communicate() now ignores stdin.flush error when closed (GH-142061)

gh-70560: gh-74389: subprocess.Popen.communicate() now ignores stdin.flush error when closed

with a unittest and news entry.
(cherry picked from commit 923056b2d4)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-11-28 23:03:05 -08:00
Miss Islington (bot)
c7f741100b
[3.14] gh-87512: Fix subprocess using timeout= on Windows blocking with a large input= (GH-142058) (#142068)
gh-87512: Fix `subprocess` using `timeout=` on Windows blocking with a large `input=` (GH-142058)

On Windows, Popen._communicate() previously wrote to stdin synchronously, which could block indefinitely if the subprocess didn't consume input= quickly and the pipe buffer filled up. The timeout= parameter was only checked when joining the reader threads, not during the stdin write.

This change moves the Windows stdin writing to a background thread (similar to how stdout/stderr are read in threads), allowing the timeout to be properly enforced. If timeout expires, TimeoutExpired is raised promptly and the writer thread continues in the background. Subsequent calls to communicate() will join the existing writer thread.

Adds test_communicate_timeout_large_input to verify that TimeoutExpired is raised promptly when communicate() is called with large input and a timeout, even when the subprocess doesn't consume stdin quickly.

This test already passed on POSIX (where select() is used) but failed on Windows where the stdin write blocks without checking the timeout.
(cherry picked from commit 5b1862bdd8)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-11-29 06:47:04 +00:00
Miss Islington (bot)
476089479d
[3.14] gh-141473: Fix subprocess.Popen.communicate to send input to stdin upon a subsequent post-timeout call (GH-141477) (#142059)
gh-141473: Fix subprocess.Popen.communicate to send input to stdin upon a subsequent post-timeout call (GH-141477)

* gh-141473: Fix subprocess.Popen.communicate to send input to stdin
* Docs: Clarify that `input` is one time only on `communicate()`
* NEWS entry
* Add a regression test.

---------
(cherry picked from commit 526d7a8bb4)

Co-authored-by: Artur Jamro <artur.jamro@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-11-28 22:21:43 -08:00
Miss Islington (bot)
c1d3e2523b
[3.14] GH-134453: Fix subprocess memoryview input handling on POSIX (GH-134949) (#142062)
GH-134453: Fix subprocess memoryview input handling on POSIX (GH-134949)

Fix inconsistent subprocess.Popen.communicate() behavior between Windows
and POSIX when using memoryview objects with non-byte elements as input.

On POSIX systems, the code was incorrectly comparing bytes written against
element count instead of byte count, causing data truncation for large
inputs with non-byte element types.

Changes:
- Cast memoryview inputs to byte view when input is already a memoryview
- Fix progress tracking to use len(input_view) instead of len(self._input)
- Add comprehensive test coverage for memoryview inputs

🤖 Generated with [Claude Code](https://claude.ai/code)



* old-man-yells-at-ReST
* Update 2025-05-30-18-37-44.gh-issue-134453.kxkA-o.rst
* assertIsNone review feedback
* fix memoryview_nonbytes test to fail without our fix on main, and have a nicer error.

Thanks to Peter Bierma @ZeroIntensity for the code review.
(cherry picked from commit cc6bc4c97f)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-11-29 04:52:14 +00:00
Miss Islington (bot)
a1dd248022
[3.14] gh-116008: Detect freed thread state in faulthandler (GH-141988) (#142013)
gh-116008: Detect freed thread state in faulthandler (GH-141988)

Add _PyMem_IsULongFreed() function.
(cherry picked from commit d5d9e89dde)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-27 20:34:00 +00:00
Stan Ulbrych
64d6bde38f
[3.14] gh-98896: resource_tracker: use json&base64 to allow arbitrary shared memory names (GH-138473) (GH-141922)
Co-authored-by: Rani Pinchuk <33353578+rani-pinchuk@users.noreply.github.com>
2025-11-27 13:17:39 +01:00
Victor Stinner
ad60d8963e
[3.14] gh-125434: Display thread name in faulthandler on Windows (#142011)
* gh-125434: Display thread name in faulthandler on Windows (#140675)

(cherry picked from commit 313145eab5)

* gh-125434: Fix non-ASCII thread names in faulthandler on Windows (#140700)

Add _Py_DumpWideString() function to dump a wide string as ASCII. It
supports surrogate pairs.

Replace _Py_EncodeLocaleRaw() with _Py_DumpWideString()
in write_thread_name().

(cherry picked from commit 80f20f58b2)
2025-11-27 12:05:37 +00:00
Miss Islington (bot)
f47e928574
[3.14] gh-116738: Fix thread-safety issue in re module for free threading (gh-141923) (gh-141990)
Added atomic operations to `scanner_begin()` and `scanner_end()` to prevent
race conditions on the `executing` flag in free-threaded builds. Also added
tests for concurrent usage of the `re` module.

Without the atomic operations, `test_scanner_concurrent_access()` triggers
`assert(self->executing)` failures, or a thread sanitizer run emits errors.
(cherry picked from commit bc9e63dd9d)

Co-authored-by: Alper <alperyoney@fb.com>
2025-11-26 21:08:39 +00:00
Petr Viktorin
96bc021d7c
[3.14] gh-141909: Add PyModuleDef_Slot and earlier Py_mod_* constants to stable ABI manifest (#141910) (GH-141978)
These were added to the limited API in 3.5-3.13.
Not including them in `Misc/stable_abi.toml` was a bug.

(cherry picked from commit 202fce0dbd)
2025-11-26 15:35:04 +01:00
Petr Viktorin
69021e9acf
[3.14] GH-139653: Only raise an exception (or fatal error) when the stack pointer is about to overflow the stack. (GH-141711) (GH-141944)
Only raises if the stack pointer is both below the limit *and* above the stack base.
This prevents false positives for user-space threads, as the stack pointer will be outside those bounds
if the stack has been swapped.

Cherry-picked from commit c25a070759

Co-authored-by: Mark Shannon <mark@hotpy.org>
2025-11-26 12:54:56 +01:00
Miss Islington (bot)
20a677d75a
[3.14] gh-141004: Document missing PyThread* APIs (GH-141810) (GH-141954)
gh-141004: Document missing `PyThread*` APIs (GH-141810)
(cherry picked from commit a89ee4b9c2)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-25 17:58:44 +00:00
Miss Islington (bot)
9969c4280f
[3.14] gh-140911: Ensure that UserString.index() and UserString.rindex() accept UserString as argument (GH-140945) (GH-141946)
(cherry picked from commit e6174ee981)

Co-authored-by: Krishna Chaitanya <141550576+XChaitanyaX@users.noreply.github.com>
2025-11-25 13:56:05 +00:00
Miss Islington (bot)
630074b7ce
[3.14] gh-141004: Document PyOS_mystr(n)icmp (GH-141760) (#141947)
gh-141004: Document `PyOS_mystr(n)icmp` (GH-141760)
(cherry picked from commit f445c452ea)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-11-25 13:51:02 +00:00
Petr Viktorin
32a38a2523
[3.14] gh-139653: Add PyUnstable_ThreadState_SetStackProtection() (GH-139668) (#141661)
Co-authored-by: Rok Mandeljc <rok.mandeljc@gmail.com>
Co-authored-by: Mark Shannon <mark@hotpy.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-25 14:21:53 +01:00
Alexander Nordin
11e3fc9636
[3.14] gh-138199: Address potential confusion re: threading (GH-138200) (GH-141928)
gh-138199: Address potential confusion regarding threading in the `asyncio` HOWTO (GH-138200)

(cherry picked from commit a4f4225213)
2025-11-25 06:52:47 -05:00
Miss Islington (bot)
add73fdda0
[3.14] gh-141907: Better handle support for SHA3 for test_hashlib (GH-141908) (#141918)
gh-141907: Better handle support for SHA3 for test_hashlib (GH-141908)

* test_hashlib: better handle support for SHA3

It's possible that the SSL library supports only SHA3 algo and doesn't
have SHAKE one.

The current test wrongly detect this and set both HASH and HASHXOF to
None expecting to have the extra SHA3 attributes present but this should
only be true for SHAKE algo.

To better handle this, move the HASH condition to a dedicated try-expect
condition and check if HASHXOF is None in the relevant code effectively
checking if SHA3 is supported by the SSL library but SHAKE algo needs to
use the sha3module one.

---------
(cherry picked from commit fee7782650)

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Co-authored-by: Christian Marangi <ansuelsmth@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-11-25 02:20:35 +01:00
Miss Islington (bot)
7ccdbbd04e
[3.14] Fix implicit import in test_monitoring.py (gh-141795) (gh-141920)
(cherry picked from commit 369ce2b139)

Co-authored-by: SubbaraoGarlapati <53627478+SubbaraoGarlapati@users.noreply.github.com>
2025-11-24 20:19:20 +00:00
Miss Islington (bot)
0f2f4c0e60
[3.14] gh-141004: Document stack effect C APIs (GH-141843) (GH-141916)
gh-141004: Document stack effect C APIs (GH-141843)
(cherry picked from commit e1f1df4082)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-24 17:24:41 +00:00
Miss Islington (bot)
9e309c140f
[3.14] gh-141004: Document PyImport_Inittab (GH-141844) (GH-141915)
gh-141004: Document `PyImport_Inittab` (GH-141844)
(cherry picked from commit 5f35702bb6)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Stan Ulbrych <stan@ulbrych.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-24 12:16:31 -05:00
Miss Islington (bot)
f8b0c90208
[3.14] gh-129441: Fix some flakiness in test_instrumentation (gh-141881) (gh-141913)
Most of the `self.assertTrue(self.called)` checks are flaky because
the worker threads may sometimes finish before the main thread calls
`self.during_threads()`.
(cherry picked from commit 71126ab19c)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-11-24 16:44:54 +00:00
Miss Islington (bot)
cabaa47668
[3.14] gh-116749: Fix code comment for _PyConfig_GIL_DEFAULT (gh-141804) (gh-141911)
(cherry picked from commit c490ffb7ac)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-11-24 16:10:59 +00:00
Miss Islington (bot)
7b8fb9072d
[3.14] gh-106318: Add examples for str.join() (GH-140315) (#141906)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-24 14:59:22 +00:00
Miss Islington (bot)
3edc944ec4
[3.14] gh-106318: Add example for str.format() (GH-137018) (#141904)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
2025-11-24 14:56:59 +00:00
Hugo van Kemenade
9e46e1b05c
[3.14] gh-106318: Add example for str.isalpha() (GH-137557) (#141901)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-24 14:28:49 +00:00
Miss Islington (bot)
a47ed2e904
[3.14] gh-106318: Add example for str.isascii() (GH-137558) (#141898)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-11-24 14:07:58 +00:00
Miss Islington (bot)
17c5d6d58d
[3.14] gh-141004: Document Py_ARRAY_LENGTH (GH-141601) (GH-141895)
gh-141004: Document `Py_ARRAY_LENGTH` (GH-141601)
(cherry picked from commit e0773eacb7)

Co-authored-by: Yashraj <yashrajpala8@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-24 13:40:01 +00:00
Miss Islington (bot)
6511eb0f06
[3.14] gh-106318: Add example for str.isdecimal() (GH-137559) (#141893)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-11-24 15:20:02 +02:00
Miss Islington (bot)
40fd66bab8
[3.14] gh-135335: Simplify preload regression test using __main__ (GH-138686) (#141886)
gh-135335: Simplify preload regression test using __main__ (GH-138686)

Simplify preload regression test using `__main__`

With the fix for gh-126631 `__main__` modules can be preloaded and the regression
test for gh-135335 can be simplified to just use a self-contained script rather
than requiring a module.

Note this assumes and implicitly tests that `__main__` is preloaded by default.
(cherry picked from commit 425f24e4fa)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
2025-11-23 19:09:34 -08:00
Stefano Rivera
394db662a5
[3.14] GH-139914: Handle stack growth direction on HPPA (GH-140028) (#141404)
* [3.14] GH-139914: Handle stack growth direction on HPPA (GH-140028)

Adapted from a patch for Python 3.14 submitted to the Debian BTS by John David Anglin https://bugs.debian.org/1105111#20

* Forgot to update test_call

* WTF typo
2025-11-23 15:55:33 -08:00
Miss Islington (bot)
73c9870366
[3.14] gh-141865: Fix translation of strings in changes.py extension (GH-141882) (#141883)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-23 17:34:01 +00:00
Miss Islington (bot)
1a798d30d8
[3.14] gh-120158: Fix inconsistent monitoring state when setting events too frequently (gh-141845) (gh-141879)
If we overflowed the global version counter (i.e., after 2*24 calls to
`_PyMonitoring_SetEvents`), we bailed out after setting global monitoring
events but before instrumenting code objects, which led to assertion errors
later on.

Also add a `time.sleep()` to `test_free_threading.test_monitoring` to avoid
overflowing the global version counter.
(cherry picked from commit e457d60daa)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-11-23 15:31:56 +00:00
Miss Islington (bot)
59ab1edb00
[3.14] gh-98552: Revert (unneeded, already done elsewhere) "flush std streams in the multiprocessing forkserver before fork (GH-141849)" (GH-141871) (#141872)
gh-98552: Revert (unneeded, already done elsewhere) "flush std streams in the multiprocessing forkserver before fork (GH-141849)" (GH-141871)

Revert (unneeded, already done elsewhere) "gh-98552: flush std streams in the multiprocessing forkserver before fork (GH-141849)"

This reverts commit 58badb1711.
(cherry picked from commit 614a28b3da)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-11-23 10:17:20 +00:00
Miss Islington (bot)
061965c584
[3.14] gh-98552: flush std streams in the multiprocessing forkserver before fork (GH-141849) (#141851)
gh-98552: flush std streams in the multiprocessing forkserver before fork (GH-141849)

* flush std streams in the multiprocessing forkserver before fork

* NEWS
(cherry picked from commit 58badb1711)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-11-22 12:23:22 -08:00
Miss Islington (bot)
adc2cc21eb
[3.14] GH-101100: Resolve reference warnings in library/stdtypes.rst (GH-138420) (#141855)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-11-22 21:33:09 +02:00
Miss Islington (bot)
5755ce0a87
[3.14] gh-101100: Fix sphinx warnings in library/unittest.rst (GH-140109) (#141853)
Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-11-22 21:23:59 +02:00
Miss Islington (bot)
972aa93692
[3.14] gh-141801: Use accessors for ASN1_STRING fields in libssl (GH-141802) (#141847)
gh-141801: Use accessors for ASN1_STRING fields in libssl (GH-141802)

* gh-141801: Use accessors for ASN1_STRING fields

While ASN1_STRING is currently exposed, it is better to use the
accessors. See https://github.com/openssl/openssl/issues/29117 where, if
the type were opaque, OpenSSL's X509 objects could be much more
memory-efficient.

* Update Modules/_ssl.c



* Update Modules/_ssl.c



---------
(cherry picked from commit c41fce08a5)

Co-authored-by: David Benjamin <davidben@davidben.net>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-22 10:53:06 -08:00
Miss Islington (bot)
c9a4a3d502
[3.14] gh-141600: Fix musl version detection on Void Linux (GH-141850)
(cherry picked from commit 08477dbf30)

Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
2025-11-22 18:47:47 +00:00
Miss Islington (bot)
43d8b7f1ac
[3.14] gh-141612: improve test_trampoline_works_with_forks coverage (GH-141613) (#141824)
gh-141612: improve `test_trampoline_works_with_forks` coverage (GH-141613)
(cherry picked from commit f15f6d0ba3)

Co-authored-by: Paresh Joshi <rahulj9223@gmail.com>
2025-11-22 10:38:52 +01:00
Cody Maloney
cfcf7652f6
[3.14] gh-129559: add bytearray.resize thread safety test for free-threading (GH-141739) (#141835)
[3.14] gh-129559: add `bytearray.resize` thread safety test for free-threading  (GH-141739)
(cherry picked from commit 019c315a8e)
2025-11-22 09:41:20 +05:30
Miss Islington (bot)
8d5cf98e45
[3.14] gh-141729: Doc PyTypeObject.tp_vectorcall grammar fix (GH-141730) (#141815)
gh-141729: Doc PyTypeObject.tp_vectorcall grammar fix (GH-141730)

[3.14] Doc PyTypeObject.tp_vectorcall grammar fix
(cherry picked from commit 20b69aac0d)

Co-authored-by: Michael Kiper <77862413+michaelkiper@users.noreply.github.com>
Co-authored-by: makiper <michael.kiper@jpl.nasa.gov>
2025-11-21 23:14:43 +03:00
Miss Islington (bot)
5bca7f4d7a
[3.14] gh-137422: Fix race condition in PyImport_AddModuleRef (gh-141822) (gh-141830)
(cherry picked from commit 2d50dd242e)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-11-21 18:57:30 +00:00
Miss Islington (bot)
af586d8d26
[3.14] gh-116738: Make csv module thread-safe (gh-141365) (gh-141825)
Added a critical section to protect the states of `ReaderObj` and `WriterObj` in the free-threading build. Without the critical sections, both new free-threading tests were crashing.
(cherry picked from commit fb26d9c2ef)

Co-authored-by: Alper <alperyoney@fb.com>
2025-11-21 16:47:13 +00:00
Victor Stinner
5398d088f4
[3.14] gh-141784: Fix _remote_debugging_module.c compilation on 32-bit Linux (#141796) (#141800)
gh-141784: Fix _remote_debugging_module.c compilation on 32-bit Linux (#141796)

Include Python.h before system headers to make sure that
_remote_debugging_module.c uses the same types (ABI) than Python.

(cherry picked from commit 722f4bb8c9)
2025-11-20 18:13:03 +01:00
Miss Islington (bot)
730ff82bdf
[3.14] Docs: Fix typo in socketserver documentation (GH-140956) (#141799)
Co-authored-by: Thomas Ballard <thomasballard0503@gmail.com>
2025-11-20 16:35:09 +00:00
Miss Islington (bot)
1253a8b2df
[3.14] GH-137841: Open tzdata/zones file with UTF-8 encoding (GH-137872) (#141607)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-11-20 18:23:40 +02:00
Miss Islington (bot)
f1bed5baf0
[3.14] gh-141004: Document missing PyDateTime* APIs (GH-141543) (GH-141791)
gh-141004: Document missing `PyDateTime*` APIs (GH-141543)
(cherry picked from commit 4273616ebf)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-20 13:54:48 +00:00
Miss Islington (bot)
fa40aab2aa
[3.14] gh-141004: Document missing generator APIs (GH-141409) (GH-141789)
gh-141004: Document missing generator APIs (GH-141409)
(cherry picked from commit 2da7ecc680)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-20 13:52:07 +00:00
Miss Islington (bot)
59fa59e381
[3.14] gh-141004: Document Py_MakePendingCalls (GH-141137) (GH-141787)
gh-141004: Document `Py_MakePendingCalls` (GH-141137)
(cherry picked from commit ce701032a3)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-20 13:48:11 +00:00
Miss Islington (bot)
daf98fe5bd
[3.14] gh-141757: Comply with pickle protocol in test_reduce_5tuple (GH-141759) (GH-141782)
The 5th element of the __reduce__ tuple should be an iterator.
(cherry picked from commit 41b9ad5b38)

Co-authored-by: Arseny Boykov <36469655+Bobronium@users.noreply.github.com>
2025-11-20 09:22:52 +00:00
Miss Islington (bot)
83cfd87568
[3.14] gh-141489: Simplify closure/freevar iteration in annotationlib._build_closure() (GH-141490) (#141776)
gh-141489: Simplify closure/freevar iteration in `annotationlib._build_closure()` (GH-141490)
(cherry picked from commit a35c683da5)

Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
2025-11-20 04:33:18 +00:00
Miss Islington (bot)
072eeaf84c
[3.14] gh-132657: optimize PySet_Contains for frozenset (GH-141183) (gh-141773)
(cherry picked from commit 7211a34fe1)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-11-19 17:01:49 -08:00
Miss Islington (bot)
c05e71f61e
[3.14] gh-132657: avoid locks and refcounting in frozenset lookups (GH-136107) (gh-141772)
gh-132657: avoid locks and refcounting in `frozenset` lookups (GH-136107)
(cherry picked from commit f58a7c7175)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2025-11-19 17:00:42 -08:00
Miss Islington (bot)
f6552d2c58
[3.14] Remove GvR from '_stdauthor' in Doc/conf.py (GH-141765) (#141767)
Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Guido van Rossum <gvanrossum@microsoft.com>
2025-11-19 20:36:24 +00:00
Miss Islington (bot)
8eed63e973
[3.14] Move the NEWS entry for gh-141659 to the correct section (GH-141744) (GH-141766)
(cherry picked from commit fbc31d14ff)

Co-authored-by: Ayappan Perumal <ayappap2@in.ibm.com>
2025-11-19 20:17:51 +00:00
Miss Islington (bot)
d05be32758
[3.14] gh-141004: Document Py_LOCAL and Py_LOCAL_INLINE (GH-141725) (GH-141761)
gh-141004: Document `Py_LOCAL` and `Py_LOCAL_INLINE` (GH-141725)
(cherry picked from commit 3149d64c93)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-19 18:38:09 +00:00
Sam Gross
b7c25eabd6
[3.14] gh-139103: fix free-threading dataclass.__init__ perf issue (gh-141596) (gh-141750)
The dataclasses `__init__` function is generated dynamically by a call to `exec()` and so doesn't have deferred reference counting enabled. Enable deferred reference counting on functions when assigned as an attribute to type objects to avoid reference count contention when creating dataclass instances.
(cherry picked from commit ce79154176)

Co-authored-by: Edward Xu <xuxiangad@gmail.com>
2025-11-19 15:00:51 +00:00
Miss Islington (bot)
8c796889ff
[3.14] gh-141570: can_colorize: Expect fileno() to raise OSError, as documented (GH-141716) (#141747)
gh-141570: can_colorize: Expect fileno() to raise OSError, as documented (GH-141716)

In Fedora, we've been given a slightly incomplete reproducer for a problematic
Python 3.14 color-related change in argparse that leads to an exception when
Python is used from mod_wsgi: https://bugzilla.redhat.com/2414940

mod_wsgi replaces sys.stdout with a custom object that raises OSError on .fileno():

8460dbfcd5/src/server/wsgi_logger.c (L434-L440)

This should be supported, as the documentation of fileno explicitly says:

> An OSError is raised if the IO object does not use a file descriptor.

https://docs.python.org/3.14/library/io.html#io.IOBase.fileno

The previously expected exception inherits from OSError,
so it is still expected.

Fixes https://github.com/python/cpython/issues/141570
(cherry picked from commit 96f496a949)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-19 14:29:15 +00:00
Miss Islington (bot)
562e23f9d5
[3.14] gh-140875: Fix handling of unclosed charrefs before EOF in HTMLParser (GH-140904) (GH-141745)
(cherry picked from commit 95296a9d40)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-11-19 12:43:24 +00:00
Miss Islington (bot)
36ad4be1d9
[3.14] Correct class name from PullDom to PullDOM (GH-141207) (#141743)
Co-authored-by: Guo Ci <zguoci@gmail.com>
2025-11-19 13:07:01 +02:00
Miss Islington (bot)
ff8829892a
[3.14] gh-138189: Link references to type slots (GH-141410) (GH-141718)
(cherry picked from commit 4695ec109d)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-11-19 10:30:11 +01:00
Miss Islington (bot)
7cb15f93fe
[3.14] gh-141659: Fix bad file descriptor error in subprocess on AIX (GH-141660) (GH-141738)
/proc/self does not exist on AIX.
(cherry picked from commit 92c5de73b8)

Co-authored-by: Ayappan Perumal <ayappap2@in.ibm.com>
2025-11-19 08:05:01 +00:00
Miss Islington (bot)
daff2a9c3c
[3.14] gh-141692: Add a slice-specific lib folder to iOS XCframeworks. (GH-141693) (#141733)
Modifies the iOS XCframework to include a lib folder for each slice that
contains a symlinked version of the libPython dynamic library.
(cherry picked from commit 7b0b708675)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2025-11-19 02:25:34 +00:00
Miss Islington (bot)
9543c2efc3
[3.14] gh-141691: Apply ruff rules to Apple folder. (GH-141694) (#141728)
Add ruff configuration to run over the Apple build tooling and testbed script.
(cherry picked from commit 17636ba48c)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2025-11-18 23:14:31 +00:00
Sergey B Kirpichev
ed5c854c6a
[3.14] gh-141004: Document Py_HUGE_VAL/IS_FINITE/IS_INFINITE/IS_NAN (GH-141544) (#141698)
(cherry picked from commit 630cd37bfa)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-18 14:32:44 +01:00
Serhiy Storchaka
d89eb2f984
[3.14] gh-140873: Fix the singledispatchmethod documentation (GH-141523)
It does not support non-descriptor callables yet.
2025-11-18 13:16:39 +02:00
Miss Islington (bot)
3388413fc5
[3.14] Add missing backticks in os and decimal docs (GH-141699) (#141705)
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2025-11-18 10:37:49 +00:00
Miss Islington (bot)
cf2524f2b7
[3.14] gh-141004: Document Py_MEMCPY (GH-141676) (GH-141685)
gh-141004: Document `Py_MEMCPY` (GH-141676)
(cherry picked from commit 16ea9505ce)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-17 22:57:47 +00:00
Miss Islington (bot)
aa887aa2a8
[3.14] gh-141004: Document PyODict* APIs (GH-141136) (GH-141677)
gh-141004: Document `PyODict*` APIs (GH-141136)
(cherry picked from commit b3626321b6)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-17 19:46:23 +00:00
Miss Islington (bot)
060118ae91
[3.14] gh-141497: Make ipaddress.IP{v4,v6}Network.hosts() always returning an iterator (GH-141547) (GH-141673)
(cherry picked from commit 6b1bdf6c7a)

Co-authored-by: Krishna Chaitanya <141550576+XChaitanyaX@users.noreply.github.com>
2025-11-17 17:56:55 +00:00
Serhiy Storchaka
8db1aadd65
[3.14] gh-130693: Add more tests for tkinter.Text.search() (GH-130848) (GH-141669) 2025-11-17 16:26:30 +00:00
Miss Islington (bot)
cc315dc6d4
[3.14] gh-130160: Add anchors to CLI Usage section for cmdline (GH-133182) (#141664)
Co-authored-by: Semyon Moroz <donbarbos@proton.me>
2025-11-17 14:57:26 +00:00
Miss Islington (bot)
cf141ab1b8
[3.14] fix memory order of _Py_atomic_store_uint_release (GH-141562) (GH-141663)
(cherry picked from commit 7800b78067)

Co-authored-by: SubbaraoGarlapati <53627478+SubbaraoGarlapati@users.noreply.github.com>
2025-11-17 14:38:00 +00:00
Miss Islington (bot)
eeb5fbf5f7
[3.14] gh-141650: Fix typo in xml.sax.saxutils.unescape documentation (GH-141652) (#141654)
Co-authored-by: Tamzin Hadasa Kelly <tk.infinity@gmail.com>
2025-11-17 13:02:03 +00:00
Miss Islington (bot)
eead7b43bc
[3.14] gh-136057: Allow step and next to step over for loops (GH-136160) (#141640)
gh-136057: Allow step and next to step over for loops (GH-136160)
(cherry picked from commit 8be3b2f479)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2025-11-16 22:22:11 +00:00
Gregory P. Smith
0d8fb0b852
[3.14] gh-137109: refactor warning about threads when forking (GH-141438) (GH-141614)
This splits the OS API specific functionality to get the number of threads out
from the fallback Python method and warning raising code itself.  This way the
OS APIs can be queried before we've run
`os.register_at_fork(after_in_parent=...)` registered functions which
themselves may (re)start threads that would otherwise be detected.

This is best effort.  If the OS APIs are either unavailable or fail, the
warning generating code still falls back to looking at the Python threading
state after the CPython interpreter world has been restarted and the
after_in_parent calls have been made.  The common case for most Linux and macOS
environments should work today.

This also lines up with the existing TODO refactoring, we may choose to expose
this API to get the number of OS threads in the `os` module in the future.

Note: This is a simplified backport that maintains the void return type
for warn_about_fork_with_threads() and keeps PyErr_Clear() in the warning path,
as the error handling changes from fd8f42d3d1 are not needed in 3.14.
2025-11-16 19:45:29 +00:00
Tian Gao
58c9d25675
[3.14] gh-125115 : Refactor the pdb parsing issue so positional arguments can pass through (GH-140933) (#141635)
(cherry-picked from commit 5348c200f5)
2025-11-16 19:35:42 +00:00
Miss Islington (bot)
c9eb5cb1c0
[3.14] gh-141004: Document missing PyCFunction* and PyCMethod* APIs (GH-141253) (GH-141637)
gh-141004: Document missing `PyCFunction*` and `PyCMethod*` APIs (GH-141253)
(cherry picked from commit be699d6c7c)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-16 19:31:25 +00:00
Miss Islington (bot)
10db8ee968
[3.14] gh-141004: Document the PyPickleBuffer_* C API (GH-141630) (GH-141632)
gh-141004: Document the `PyPickleBuffer_*` C API (GH-141630)
(cherry picked from commit e33afa7ddb)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-16 18:56:41 +00:00
Miss Islington (bot)
79c136f87b
[3.14] GH-141312: Allow only integers to longrangeiter_setstate state (GH-141317) (GH-141559)
This fixes an assertion error when the new computed start is not an integer.
(cherry picked from commit 10bec7c1eb)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
2025-11-15 21:30:25 +02:00
Sergey Miryanov
21e43d5e83
[3.14] GH-141509: Fix warning about remaining subinterpreters (GH-141528) (GH-141566)
(cherry picked from commit fa245df4a0)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-15 13:56:52 -05:00
Miss Islington (bot)
8a67e3c2b0
[3.14] gh-140938: Raise ValueError for infinite inputs to stdev/pstdev (GH-141531) (#141575)
gh-140938: Raise ValueError for infinite inputs to stdev/pstdev (GH-141531)

Raise ValueError for infinite inputs to stdev/pstdev
(cherry picked from commit f0a8bc737a)



---

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-14 18:58:40 -08:00
Miss Islington (bot)
17e7aad5e3
[3.14] gh-141579: Fix perf_jit backend in sys.activate_stack_trampoline() (GH-141580) (#141581)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-11-15 02:49:54 +00:00
Miss Islington (bot)
d582b6f1ab
[3.14] gh-136442: Fix unittest to return exit code 5 when setUpClass raises an exception (GH-136487) (#141576)
gh-136442: Fix unittest to return exit code 5 when setUpClass raises an exception (GH-136487)
(cherry picked from commit 53d65c840e)

Co-authored-by: Takuya UESHIN <ueshin@happy-camper.st>
2025-11-15 01:25:19 +00:00
Gregory P. Smith
a2442fda6e
[3.14] GH-139596: Cease caching config.cache & ccache in GH Actions (#141429)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-11-14 21:25:33 +02:00
Miss Islington (bot)
1cde019ecd
[3.14] gh-114203: skip locking if object is already locked by two-mutex critical section (GH-141476) (#141564)
gh-114203: skip locking if object is already locked by two-mutex critical section (GH-141476)
(cherry picked from commit f26ed455d5)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-11-14 18:38:30 +00:00
Miss Islington (bot)
959578e5d1
[3.14] gh-140691: urllib.request: Close FTP control socket if data socket can't connect (GH-140835) (GH-141555)
(cherry picked from commit f2bce51b98)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: codenamenam <bluetire27@gmail.com>
2025-11-14 17:27:33 +01:00
Miss Islington (bot)
2f23c88243
[3.14] gh-139344: Remove pending removal notice for undeprecated importlib.resources API (GH-141507) (GH-141558)
(cherry picked from commit 49e74210cb)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-11-14 16:32:05 +01:00
Miss Islington (bot)
dbe64ee95f
Add PyManager troubleshooting steps for direct launch of script files (GH-141530)
(cherry picked from commit b101e9d36b)

Co-authored-by: Steve Dower <steve.dower@python.org>
2025-11-14 15:29:39 +00:00
Miss Islington (bot)
72a8ea773b
[3.14] gh-141004: Document PyOS_InterruptOccurred (GH-141526) (GH-141549)
gh-141004: Document `PyOS_InterruptOccurred` (GH-141526)
(cherry picked from commit ef90261be5)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-14 11:26:37 +00:00
Miss Islington (bot)
dd28db664b
[3.14] gh-137969: Fix double evaluation of ForwardRefs which rely on globals (GH-140974) (#141527)
gh-137969: Fix double evaluation of `ForwardRef`s which rely on globals (GH-140974)
(cherry picked from commit 209eaff68c)

Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
2025-11-13 13:26:58 -08:00
Mikhail Efimov
af20b880fc
[3.14] gh-140104: Set next_instr properly in the JIT during exceptions (GH-140233) (GH-141495) 2025-11-13 18:47:25 +00:00
Miss Islington (bot)
c5e0ce73f9
[3.14] gh-141004: Document PyErr_RangedSyntaxLocationObject (GH-141521) (#141525)
gh-141004: Document `PyErr_RangedSyntaxLocationObject` (GH-141521)

PyErr_RangedSyntaxLocationObject
(cherry picked from commit 196f1519cd)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-13 18:05:09 +00:00
Mikhail Efimov
48b7d75aaf
[3.14] gh-140936: Fix JIT assertion crash at finalization if some generator is alive (GH-140969) (GH-141494)
gh-140936: Fix JIT assertion crash at finalization if some generator is alive (GH-140969)
2025-11-13 16:11:57 +00:00
Miss Islington (bot)
425e423f9f
[3.14] gh-141004: Document PyCode_Optimize (GH-141378) (GH-141514)
gh-141004: Document `PyCode_Optimize` (GH-141378)
(cherry picked from commit d7862e9b1b)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-13 15:15:27 +00:00
Miss Islington (bot)
f43e5955eb
[3.14] gh-141004: Document C APIs for dictionary keys, values, and items (GH-141009) (GH-141512)
gh-141004: Document C APIs for dictionary keys, values, and items (GH-141009)
(cherry picked from commit f72768f30e)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-11-13 15:08:35 +00:00
Miss Islington (bot)
55cf97d8dd
[3.14] gh-140748: socket_helper.transient_internet: Unwrap UrlError.__cause__ (GH-140749) (GH-141505)
(cherry picked from commit 75a1cbdd38)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-11-13 13:58:37 +01:00
Miss Islington (bot)
7b8c257933
[3.14] gh-140601: Refactor ElementTree.iterparse() tests (GH-141499) (GH-141502)
Split existing tests on smaller methods and move them to separate class.
Rename variable "content" to "it".
Use BytesIO instead of StringIO.
Add few more tests.
(cherry picked from commit 2fbd396666)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-11-13 12:03:09 +00:00
Miss Islington (bot)
79195df23c
[3.14] gh-140260: fix data race in _struct module initialization with subinterpreters (GH-140909) (#141501)
gh-140260: fix data race in `_struct` module initialization with subinterpreters (GH-140909)
(cherry picked from commit 63548b3699)

Co-authored-by: Shamil <ashm.tech@proton.me>
2025-11-13 17:23:22 +05:30
Miss Islington (bot)
7e9400c3e6
[3.14] gh-103847: fix cancellation safety of asyncio.create_subprocess_exec (GH-140805) (#141446)
gh-103847: fix cancellation safety of `asyncio.create_subprocess_exec` (GH-140805)
(cherry picked from commit ef474cfafb)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-11-13 17:03:04 +05:30
Miss Islington (bot)
42e0468209
[3.14] gh-141004: Document PyRun_InteractiveOneObject (GH-141405) (GH-141485)
gh-141004: Document `PyRun_InteractiveOneObject` (GH-141405)
(cherry picked from commit 26b7df2430)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-12 22:58:52 +00:00
Miss Islington (bot)
0b44bc3379
[3.14] gh-124111: Fix TCL 9 thread detection (GH-141482)
(cherry picked from commit dc0987080e)

Co-authored-by: Michael Cho <michael@michaelcho.dev>
2025-11-12 22:43:31 +00:00
Miss Islington (bot)
4316180426
[3.14] gh-141442: Add escaping to iOS testbed arguments (GH-141443) (#141479)
Xcode concatenates the test argument array, losing quoting in the process.
(cherry picked from commit 558936bec1)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2025-11-12 22:15:34 +00:00
Miss Islington (bot)
996c00384d
[3.14] gh-141412: Use reliable target URL for urllib example (GH-141474)
The endpoint used for demonstrating reading URLs is no longer
stable. This change substitutes a target over which we have more
control.
(cherry picked from commit fbcac79951)

Co-authored-by: Bob Kline <bkline@users.noreply.github.com>
2025-11-12 18:40:20 +00:00
Miss Islington (bot)
fe3826cbaf
[3.14] gh-141004: Document Py_MATH_{E, PI, TAU} constants (GH-141373) (#141471)
gh-141004: Document `Py_MATH_{E, PI, TAU}` constants (GH-141373)
(cherry picked from commit f1330b35b8)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-12 17:02:38 +00:00
Miss Islington (bot)
24bf09b42c
[3.14] gh-141004: Document PyType_SUPPORTS_WEAKREFS (GH-141408) (GH-141470)
gh-141004: Document `PyType_SUPPORTS_WEAKREFS` (GH-141408)
(cherry picked from commit 9cd5427d96)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-12 16:44:17 +00:00
Miss Islington (bot)
ba73decce1
[3.14] gh-132657: add regression test for PySet_Contains with unhashable type (GH-141411) (#141468)
gh-132657: add regression test for `PySet_Contains` with unhashable type (GH-141411)
(cherry picked from commit 2ac738d325)

Co-authored-by: M Bussonnier <bussonniermatthias@gmail.com>
2025-11-12 15:49:09 +00:00
Mohsin Mehmood
92c14a91d2
[3.14] gh-141314: Fix TextIOWrapper.tell() assertion failure with standalone carriage return (GH-141331) (GH-141453)
The assertion was checking wrong variable (skip_back vs skip_bytes).
(cherry picked from commit af80fac425)
2025-11-12 12:40:02 +02:00
Miss Islington (bot)
e9c11b7495
[3.14] gh-141042: fix sNaN's packing for mixed floating-point formats (GH-141107) (#141459)
gh-141042: fix sNaN's packing for mixed floating-point formats (GH-141107)
(cherry picked from commit 23d85a2a3f)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-11-12 10:33:34 +00:00
Miss Islington (bot)
75b5157e84
[3.14] gh-141311: Avoid assertion in BytesIO.readinto() (GH-141333) (GH-141457)
Fix error in assertion which causes failure if pos is equal to PY_SSIZE_T_MAX.
Fix undefined behavior in read() and readinto() if pos is larger that the size
of the underlying buffer.
(cherry picked from commit 7d54374f9c)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2025-11-12 10:23:26 +00:00
Miss Islington (bot)
b883ad17cd
[3.14] gh-141370: document undefined behavior of Py_ABS() (GH-141439) (GH-141454)
(cherry picked from commit 20f53df07d)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-11-12 09:56:47 +00:00
Peter Bierma
604a5a6a11
[3.14] gh-141004: Document PyBytes_Repr and PyBytes_DecodeEscape (GH-141407) (GH-141440)
* gh-141004: Document `PyBytes_Repr` and `PyBytes_DecodeEscape` (GH-141407)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
(cherry picked from commit 37e2762ee1)
2025-11-12 02:06:36 +00:00
Miss Islington (bot)
df045716e0
[3.14] GH-137618: Require Python 3.10 to Python 3.15 for PYTHON_FOR_REGEN (GH-137619) (#141437)
GH-137618: Require Python 3.10 to Python 3.15 for PYTHON_FOR_REGEN (GH-137619)

* Require Python 3.11 to Python 3.15 for PYTHON_FOR_REGEN

* NEWS

* keep allowing python 3.10

---------
(cherry picked from commit 9ce99c6c19)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-11-11 17:33:49 -08:00
Miss Islington (bot)
947354e338
[3.14] gh-138621: Increase test coverage for csv.DictReader and csv.Sniffer (GH-138622) (#141436)
gh-138621: Increase test coverage for csv.DictReader and csv.Sniffer (GH-138622)

* Increase test coverage for csv.DictReader and csv.Sniffer

Previously there were no tests for the DictReader fieldnames
setter, the case where a StopIteration was encountered when trying
to determine the fieldnames from the content or the case where
Sniffer could not find a delimiter.

* Revert whitespace change to comment

* Add a test that csv.Sniffer.has_header checks up to 20 rows

* Replace name and age with letter and offset



* Address review comment

---------
(cherry picked from commit 0e88be6f55)

Co-authored-by: Jan-Eric Nitschke <47750513+JanEricNitschke@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-11-12 00:58:15 +00:00
Miss Islington (bot)
21c9c919aa
[3.14] gh-137952: update csv.Sniffer().has_header() docs to describe the actual off-by-onish behavior (GH-137953) (#141434)
gh-137952: update `csv.Sniffer().has_header()` docs to describe the actual off-by-onish behavior (GH-137953)

* checks 21, not 20
* Say "header" instead of "first row" to disambiguate per review.

---------
(cherry picked from commit 0d7b48a8f5)

Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-11 16:13:10 -08:00
Miss Islington (bot)
83c3eae099
[3.14] gh-138775: fix handle python -m base64 stdin correct with EOF signal (GH-138776) (#141432)
gh-138775: fix handle `python -m base64` stdin correct with EOF signal (GH-138776)

* fix: handle  stdin correct with EOF single.
* fix: flollow the comments when pipe stdin use buffer
* Apply suggestions from code review
* fix: apply review comments in Lib/base64.py
* fix: address comments
* Reword comment and NEWS entry.

---------
(cherry picked from commit f5c2a41f9a)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong <zouzou0208@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-11-12 00:12:57 +00:00
Miss Islington (bot)
91f33ef3c8
[3.14] gh-141004: Document PyFile_OpenCode and PyFile_OpenCodeObject (GH-141413) (GH-141425)
gh-141004: Document `PyFile_OpenCode` and `PyFile_OpenCodeObject` (GH-141413)
(cherry picked from commit 2befce86e6)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-11 16:48:29 -05:00
Miss Islington (bot)
03fca07f83
Add documentation for Python install manager's install_dir, global_dir and download_dir (GH-140223)
(cherry picked from commit 336154f4b0)

Co-authored-by: Steve Dower <steve.dower@python.org>
2025-11-11 20:08:52 +00:00
Miss Islington (bot)
dc00dcfe88
[3.14] gh-140193: Forward port test_exec_set_nomemory_hang from 3.13 (GH-140187) (#141420)
gh-140193: Forward port test_exec_set_nomemory_hang from 3.13 (GH-140187)

* chore: test_exec_set_nomemory_hang from 3.13
* fix: apply comments
* Update Lib/test/test_exceptions.py
* Update Lib/test/test_exceptions.py
* fix: windows too long name 60 times is enough

---------
(cherry picked from commit 0f09bda643)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong <zouzou0208@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-11 19:53:31 +00:00
Miss Islington (bot)
7618a40a17
[3.14] gh-139533: fix refs to code without proper markups on turtledemo doc (GH-139534) (#141421)
gh-139533: fix refs to code without proper markups on turtledemo doc (GH-139534)
(cherry picked from commit c903d76832)


gh-139533: fix refs to code without proper markups on turtledemo documentation

Co-authored-by: Marco Barbosa <aureliobarbosa@gmail.com>
2025-11-11 19:42:13 +00:00
Miss Islington (bot)
068bddce88
[3.14] gh-141004: Document PyType_Unwatch (GH-141414) (GH-141418)
gh-141004: Document `PyType_Unwatch` (GH-141414)
(cherry picked from commit 759a048d4b)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-11 17:28:14 +00:00
Sergey B Kirpichev
8b9494099a
[3.14] gh-141004: document Py_INFINITY and Py_NAN macros (GH-141145) (#141399)
(cherry picked from commit d69447445c)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-11 14:52:37 +01:00
Miss Islington (bot)
a468ba0a9d
[3.14] gh-140379: add hyperlinks to list and set (GH-140399) (#141386)
gh-140379: add hyperlinks to list and set (GH-140399)

add hyperlinks to list and set
(cherry picked from commit 92741c59f8)

Co-authored-by: Krishna Chaitanya <141550576+XChaitanyaX@users.noreply.github.com>
2025-11-11 06:08:45 +00:00
Miss Islington (bot)
ec836f2ad6
[3.14] gh-140485: Catch ChildProcessError in multiprocessing resource tracker (GH-141132) (#141384)
gh-140485: Catch ChildProcessError in multiprocessing resource tracker (GH-141132)
(cherry picked from commit 9cb8c52d5e)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-11 05:24:24 +00:00
Miss Islington (bot)
6d31d085f0
[3.14] gh-140578: Doc: Remove sencence implying that concurrent.futures.ThreadPoolExecutor does not exist (GH-140689) (#141382)
gh-140578: Doc: Remove sencence implying that concurrent.futures.ThreadPoolExecutor does not exist (GH-140689)

* Doc: Remove sencence implying that concurrent.futures.ThreadPoolExecutor does not exist

Closes GH-140578

* Add NEWS.d entry for gh-140578

---------
(cherry picked from commit 46b58e1bb9)

Co-authored-by: Louis <paternal@users.noreply.github.com>
Co-authored-by: Louis Paternault <spalax@gresille.org>
2025-11-11 04:56:07 +00:00
Miss Islington (bot)
462e2255ef
[3.14] gh-141174: Improve annotationlib._Stringifier test coverage (GH-141220) (#141358)
gh-141174: Improve `annotationlib._Stringifier` test coverage (GH-141220)

* Test `_Stringifier.__convert_to_ast()` for containers

* Test partial evaluation of `ForwardRef`s in `_Stringifier`
(cherry picked from commit 55ea132313)

Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
2025-11-10 21:44:05 +00:00
Miss Islington (bot)
9a5cf6f62c
[3.14] gh-141004: Document missing frame APIs (GH-141189) (GH-141379)
gh-141004: Document missing frame APIs (GH-141189)
(cherry picked from commit 86513f6c2e)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-10 21:42:10 +00:00
Miss Islington (bot)
96820d872f
[3.14] gh-141004: Document PyType_FastSubclass (GH-141313) (GH-141368)
gh-141004: Document `PyType_FastSubclass` (GH-141313)
(cherry picked from commit ed0a5fd8ca)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-10 17:52:15 +00:00
Miss Islington (bot)
9f42519431
[3.14] GH-141212: Fix possible memory leak in gc_mark_span_push (gh-141213) (gh-141364)
(cherry picked from commit f835552946)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
2025-11-10 16:55:01 +00:00
Miss Islington (bot)
63a3737ce7
[3.14] gh-139707: Specify winreg, msvcrt and winsound module availability in docs (GH-140429) (GH-141351)
(cherry picked from commit 13fa313beb)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-10 17:40:46 +01:00
Miss Islington (bot)
a1889959d3
[3.14] gh-141174: Improve ForwardRef test coverage (GH-141175) (#141354)
gh-141174: Improve `ForwardRef` test coverage (GH-141175)

* Test unsupported format in ForwardRef.evaluate()

* Test dict cell closure with multiple variables

* Test all options in ForwardRef repr

* Test ForwardRef being a final class
(cherry picked from commit 19b573025e)

Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
2025-11-10 15:19:54 +00:00
Miss Islington (bot)
4b9ed4e642
[3.14] gh-141174: Improve annotationlib.call_annotate_function() test coverage (GH-141176) (#141355)
gh-141174: Improve `annotationlib.call_annotate_function()` test coverage (GH-141176)

* Test passing unsupported Format values to call_annotate_function()

* Test call_evaluate_function with fake globals that raise errors

* Fix typo and comparison in test_fake_global_evaluation
(cherry picked from commit 1110e8f6a4)

Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
2025-11-10 15:19:48 +00:00
Jelle Zijlstra
727cdcba8e
[3.14] gh-137530: generate an __annotate__ function for dataclasses __init__ (GH-137711) (#141352)
(cherry picked from commit 12837c6363)

Co-authored-by: David Ellis <ducksual@gmail.com>
2025-11-10 07:14:32 -08:00
Miss Islington (bot)
9221030909
[3.14] gh-141174: Improve annotationlib.get_annotations() test coverage (GH-141286) (#141353)
gh-141174: Improve `annotationlib.get_annotations()` test coverage (GH-141286)

* Test `get_annotations(format=Format.VALUE)` for stringized annotations on custom objects

* Test `get_annotations(format=Format.VALUE)` for stringized annotations on wrapped partial functions

* Update test_stringized_annotations_with_star_unpack() to actually test stringized annotations

* Test __annotate__ returning a non-dict

* Test passing globals and locals to stringized `get_annotations()`
(cherry picked from commit 06b62282c7)

Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
2025-11-10 15:11:42 +00:00
Miss Islington (bot)
7618754d53
[3.14] gh-141343: Fix swapped words in sorted doc (GH-141357)
(cherry picked from commit 59b793b0dd)

Co-authored-by: Yongzi Li <204532581+Yzi-Li@users.noreply.github.com>
2025-11-10 15:01:30 +00:00
Stan Ulbrych
c12a0bef40
[3.14] gh-139707: Add docs for optional modules (GH-140171) (GH-141204)
(cherry picked from commit d2ce6d708a)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Author: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-10 15:20:00 +01:00
Miss Islington (bot)
44a3d6c69b
[3.14] gh-140500: Update download.html instructions (GH-141320) (#141347)
Co-authored-by: Karina Souza <97332018+KarinaS0uza@users.noreply.github.com>
Co-authored-by: Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
2025-11-10 12:45:48 +00:00
Miss Islington (bot)
c09a65914d
[3.14] gh-141004: Document pyctype.h macros (GH-141272) (GH-141340)
gh-141004: Document `pyctype.h` macros (GH-141272)
(cherry picked from commit df19261621)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-10 10:12:55 +00:00
Miss Islington (bot)
b5ae8082a6
[3.14] gh-141004: Document Py_DTSF_* macros (GH-141310) (GH-141329)
gh-141004: Document `Py_DTSF_*` macros (GH-141310)
(cherry picked from commit 9b0179fa87)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-10 00:48:48 +00:00
Miss Islington (bot)
6cbb8cb1f7
[3.14] gh-62480: De-personalize "Partial mocking" section in unittest.mock examples (GH-141321) (#141326)
gh-62480: De-personalize "Partial mocking" section in `unittest.mock` examples (GH-141321)

* Refine some wording in unittest partial mock doc

Some of the descriptions were addressed in first person,
but have now been changed to address the user reading the documentation instead.
(cherry picked from commit b618731781)

Co-authored-by: KarnbirKhera <166065758+KarnbirKhera@users.noreply.github.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2025-11-09 18:08:30 -06:00
Miss Islington (bot)
5c345ed61a
[3.14] gh-62480: De-personalize "Mocking Unbound Methods" section in unittest.mock examples (GH-141322) (#141324)
gh-62480: De-personalize "Mocking Unbound Methods" section in `unittest.mock` examples (GH-141322)

* Rewrite Mocking Unbound Methods paragraph to second person
(cherry picked from commit ec85d3cbfe)

Co-authored-by: Elena O <31424287+oklena@users.noreply.github.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-09 17:51:07 -06:00
Miss Islington (bot)
6e659bf645
[3.14] gh-141004: Document PySuper_Type (GH-141315) (GH-141318)
gh-141004: Document `PySuper_Type` (GH-141315)
(cherry picked from commit 14c62227f9)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-09 20:01:04 +00:00
Miss Islington (bot)
86c63099ed
[3.14] gh-140980: document SET_FUNCTION_ATTRIBUTE flag for annotate function (GH-141306) (#141316)
gh-140980: document `SET_FUNCTION_ATTRIBUTE` flag for `annotate` function  (GH-141306)
(cherry picked from commit 6f20ea1e2d)

Co-authored-by: Lakshya Upadhyaya <lakshya.upadhyaya05@gmail.com>
2025-11-09 19:04:48 +00:00
Miss Islington (bot)
428f787d58
[3.14] gh-141004: Document PyClassMethod* and PyStaticMethod* APIs (GH-141296) (GH-141308)
gh-141004: Document `PyClassMethod*` and `PyStaticMethod*` APIs (GH-141296)
(cherry picked from commit 807db68ddd)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-09 18:09:39 +00:00
Miss Islington (bot)
86824651bc
[3.14] gh-141004: Document PyFunction_SetKwDefaults (GH-141294) (GH-141304)
gh-141004: Document `PyFunction_SetKwDefaults` (GH-141294)
(cherry picked from commit 18529b580b)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-09 17:55:09 +00:00
Miss Islington (bot)
42878e862a
[3.14] gh-141004: Document PyExceptionInstance* APIs (GH-141301) (GH-141302)
gh-141004: Document `PyExceptionInstance*` APIs (GH-141301)
(cherry picked from commit b5a0c72492)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-09 12:20:24 -05:00
Miss Islington (bot)
a8b27305e8
[3.14] gh-141004: Document Py_func_type_input (GH-141273) (GH-141298)
gh-141004: Document `Py_func_type_input` (GH-141273)
(cherry picked from commit 8dd8498286)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-09 16:27:53 +00:00
Miss Islington (bot)
d7aace78e9
[3.14] gh-140530: fix a reference leak in an error path for raise exc from cause (GH-140908) (#141282)
gh-140530: fix a reference leak in an error path for `raise exc from cause` (GH-140908)

Fix a reference leak in `raise E from T` when `T` is an exception
subtype for which `T.__new__` does not return an exception instance.
(cherry picked from commit 0c77e7c23b)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-09 17:04:26 +01:00
Miss Islington (bot)
cb458715a6
[3.14] gh-141004: document curses C API (GH-141254) (#141292)
gh-141004: document `curses` C API (GH-141254)
(cherry picked from commit dbe40904a7)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-09 15:50:21 +00:00
Miss Islington (bot)
afa52a101e
[3.14] gh-141004: Document PyWeakref_CheckRefExact (GH-141279) (GH-141290)
gh-141004: Document `PyWeakref_CheckRefExact` (GH-141279)
(cherry picked from commit 60155329a0)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-09 15:40:20 +00:00
Miss Islington (bot)
7905374d50
[3.14] gh-141004: Document deprecated aliases for memory allocation (GH-141146) (GH-141288)
gh-141004: Document deprecated aliases for memory allocation (GH-141146)
(cherry picked from commit 1d738dea63)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-09 15:12:52 +00:00
Miss Islington (bot)
d6b4f4b10f
[3.14] gh-100218: correctly set errno when socket.if_{nametoindex,indextoname} raise OSError (GH-140905) (#141284)
gh-100218: correctly set `errno` when `socket.if_{nametoindex,indextoname}` raise `OSError` (GH-140905)

Previously, socket.if_nametoindex() and socket.if_indextoname() could raise
an `OSError` with a `None` errno. Now, the errno from libc is propagated.
(cherry picked from commit 3ce2d57b2f)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-09 13:11:43 +00:00
Miss Islington (bot)
432432bfc8
[3.14] gh-141127: Clarify os.symlink() documentation for argument order (GH-141144) (#141278)
gh-141127: Clarify os.symlink() documentation for argument order (GH-141144)
(cherry picked from commit 7ae440f262)

Co-authored-by: Chilla Kalyan <127284726+chillakalyan@users.noreply.github.com>
2025-11-09 11:19:09 +01:00
Miss Islington (bot)
d8a2b8a4f8
[3.14] gh-141004: Document Py_BUILD_ASSERT* macros (GH-141266) (GH-141269)
gh-141004: Document `Py_BUILD_ASSERT*` macros (GH-141266)
(cherry picked from commit 0ac890bea7)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-08 19:27:41 +00:00
Miss Islington (bot)
f98211852a
[3.14] gh-141004: Document the PyDoc_VAR macro (GH-141263) (GH-141264)
gh-141004: Document the `PyDoc_VAR` macro (GH-141263)
(cherry picked from commit 545299773b)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-08 18:18:04 +00:00
Miss Islington (bot)
ba0b8214ea
[3.14] gh-141004: Document PyBUF_WRITEABLE (GH-141255) (GH-141261)
gh-141004: Document `PyBUF_WRITEABLE` (GH-141255)
(cherry picked from commit 5e5fc0404e)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-08 17:36:00 +00:00
Miss Islington (bot)
6c50a72efe
[3.14] gh-141004: Document PyErr_ProgramTextObject and PyErr_ProgramText (GH-141250) (GH-141256)
gh-141004: Document `PyErr_ProgramTextObject` and `PyErr_ProgramText` (GH-141250)
(cherry picked from commit be1c72a45d)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-08 15:54:06 +00:00
Miss Islington (bot)
7db06be57f
[3.14] gh-141246: Link to correct Windows docs in time.sleep() doc (GH-141248) (#141251)
gh-141246: Link to correct Windows docs in `time.sleep()` doc (GH-141248)
(cherry picked from commit 6545a4e8f8)

Co-authored-by: 莯凛 <1348292515@qq.com>
2025-11-08 15:02:35 +00:00
Miss Islington (bot)
41944be1e1
[3.14] gh-141004: correctly document Py_HASH_* and PyHASH_* as hash_info attributes (GH-141233) (#141234)
gh-141004: correctly document `Py_HASH_*` and `PyHASH_*` as `hash_info` attributes (GH-141233)
(cherry picked from commit 87942d911b)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-08 12:28:01 +00:00
Serhiy Storchaka
1a080199af
[3.14] gh-140615: Update docstrings in the fcntl module (GH-140619) (GH-141231)
* Refer to bytes objects or bytes-like objects instead of strings.
* Remove backticks -- they do not have effect on formatting.
* Re-wrap lines to ensure the pydoc output fits in 80 columns.
(cherry picked from commit 610377056b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-11-08 11:16:45 +00:00
Miss Islington (bot)
24619962e0
[3.14] gh-140793: Improve documentatation and tests for the ensure_ascii option in the json module (GH-140906) (GH-141227)
* Document that ensure_ascii=True forces escaping not only non-ASCII, but also
  non-printable characters (the only affected ASCII character is U+007F).
* Ensure that the help output for the json module does not exceed 80
  columns (except one long line in an example and generated lines).
* Add more tests.
(cherry picked from commit 7e90bac3cc)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-11-08 10:32:44 +00:00
Miss Islington (bot)
de00dde9de
[3.14] gh-141004: Document Py_HASH_* macros (GH-141205) (#141225)
* gh-141004: Document `Py_HASH_*` macros (GH-141205)

(cherry picked from commit 3989e12d39)
(cherry picked from commit 8cec3d3a9d)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-08 09:19:34 +00:00
Miss Islington (bot)
5dc8ecc5bc
[3.14] gh-141004: Document PyTraceBack* APIs (GH-141192) (GH-141210)
gh-141004: Document `PyTraceBack*` APIs (GH-141192)
(cherry picked from commit d13ee0ae18)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-07 18:52:45 +00:00
Hugo van Kemenade
b3377c3b41
[3.14] gh-140826: Update winreg's docstring (GH-141050) (GH-141200)
(cherry picked from commit bea0d3d12b)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2025-11-07 20:38:26 +02:00
Miss Islington (bot)
b59832041a
[3.14] gh-141004: Document PyErr_WarnExplicitFormat (GH-141187) (GH-141202)
gh-141004: Document `PyErr_WarnExplicitFormat` (GH-141187)
(cherry picked from commit 9420795b47)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-07 16:26:40 +00:00
Miss Islington (bot)
9f8ec95bb0
[3.14] gh-141004: Document PyCapsule_Type (GH-141079) (GH-141199)
gh-141004: Document `PyCapsule_Type` (GH-141079)
(cherry picked from commit 7af9b5354d)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-07 14:16:43 +00:00
Miss Islington (bot)
28493a5a62
[3.14] Update NaNs handling description in c-api/float.rst (GH-141179) (#141194)
Update NaNs handling description in `c-api/float.rst` (GH-141179)

Clarified the behavior of NaNs on IEEE platforms regarding signaling and quiet NaNs.
(cherry picked from commit 920286d6b2)

Co-authored-by: W. H. Wang <mattwang44@gmail.com>
2025-11-07 13:40:59 +00:00
Miss Islington (bot)
7c3539bd09
[3.14] Clarify argument/result ownership/validity for PyModule_* functions (GH-141159) (GH-141190)
(cherry picked from commit ffd64737d0)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-07 13:23:29 +00:00
Miss Islington (bot)
d729087c06
[3.14] gh-139246: zero-width word paste can be wrong in default repl (GH-139254) (GH-140796)
gh-139246: zero-width word paste can be wrong in default repl (GH-139254)

(cherry picked from commit 4e6dba0ef7)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong <zouzou0208@gmail.com>
Co-authored-by: grayjk <grayjk@gmail.com>
2025-11-07 13:50:06 +01:00
Miss Islington (bot)
cb8b2bad34
[3.14] gh-141141: Make base64.b85decode() thread safe (GH-141149) (GH-141184)
(cherry picked from commit a7bf27f7f5)

Co-authored-by: Benel Tayar <86257734+beneltayar@users.noreply.github.com>
2025-11-07 11:14:51 +00:00
Miss Islington (bot)
cf48ead02b
[3.14] gh-140734: fix off-by-one error when comparing to _SUN_PATH_MAX (GH-140903) (#141181)
gh-140734: fix off-by-one error when comparing to `_SUN_PATH_MAX` (GH-140903)

The limit includes a NULL terminator.
(cherry picked from commit 9a19900673)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-07 10:27:14 +00:00
Miss Islington (bot)
a49d0ccdb8
[3.14] gh-141125: delete unused import textwrap in interpreter.py (GH-141126) (#141177)
gh-141125: delete unused import textwrap in interpreter.py (GH-141126)
(cherry picked from commit c77441ef1d)

Co-authored-by: yihong <zouzou0208@gmail.com>
2025-11-07 00:29:25 +00:00
Miss Islington (bot)
229846e841
[3.14] Minor documentation improvements (GH-140626) (#141160)
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2025-11-06 17:19:30 +00:00
Miss Islington (bot)
5c2476a4c9
[3.14] gh-141004: Document Py_GetRecursionLimit and Py_SetRecursionLimit (GH-141151) (GH-141156)
gh-141004: Document `Py_GetRecursionLimit` and `Py_SetRecursionLimit` (GH-141151)
(cherry picked from commit 0b260305d3)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-06 16:45:31 +00:00
Stan Ulbrych
ebf54596bf
[3.14] gh-140939: Fix memory leak in _PyBytes_FormatEx error path (GH-140957) (#141154)
(cherry picked from commit d6c89a2df2)
2025-11-06 16:20:03 +00:00
Miss Islington (bot)
5d10409e33
[3.14] gh-141004: Document PyLong_FromPid and PyLong_AsPid (GH-141028) (GH-141142)
gh-141004: Document `PyLong_FromPid` and `PyLong_AsPid` (GH-141028)
(cherry picked from commit bcc524f82d)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-06 14:07:56 +00:00
Miss Islington (bot)
eac7b9fa97
[3.14] gh-141004: Document Py_hexdigits (GH-141059) (GH-141138)
gh-141004: Document `Py_hexdigits` (GH-141059)
(cherry picked from commit 54110e20e0)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-06 13:56:41 +00:00
Miss Islington (bot)
cd5508d322
[3.14] gh-141004: Document built-in iterator types in the C API (GH-141006) (GH-141134)
gh-141004: Document built-in iterator types in the C API (GH-141006)

Adds documentation for each of the following:

- PyEnum_Type
- PyFilter_Type
- PyMap_Type
- PyReversed_Type
- PyZip_Type

In addition, PyRange_Type and PyRange_Check are also documented.
(cherry picked from commit 1697cb5710)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-06 12:35:02 +00:00
Hugo van Kemenade
7168553c00
[3.14] gh-138189: Document type slots, and other constants, as part of Limited API (GH-138190) (GH-141131)
(cherry picked from commit d81e1ef0f3)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-06 12:39:19 +01:00
Serhiy Storchaka
fd17ee026f
[3.14] gh-125346: Add more base64 tests (GH-141061) (GH-141130)
Add more tests for the altchars argument of b64decode() and for the map01
argument of b32decode().
(cherry picked from commit 13360efd38)
2025-11-06 11:03:59 +00:00
Miss Islington (bot)
6d5636c7c6
[3.14] gh-137232: Update free-threading HOWTOs with up-to-date info for 3.14 (GH-140817) (#141129)
(cherry picked from commit 86ab7bb87a)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2025-11-06 10:25:50 +00:00
Hugo van Kemenade
8f0581c077
[3.14] Add FFY00 to CODEOWNERS for generate-build-details (GH-139561) (#141080)
Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
2025-11-06 11:18:46 +02:00
Miss Islington (bot)
47ede24d49
[3.14] Minor fixes to idle.rst and regenerate help.html (GH-140037) (#141121)
Minor fixes to `idle.rst` and regenerate `help.html` (GH-140037)
(cherry picked from commit 4e6e208be9)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-06 08:51:28 +00:00
Miss Islington (bot)
45cc56c588
[3.14] gh-129876: Move misplaced IDLE news item (GH-141118) (#141119)
gh-129876: Move misplaced IDLE news item (GH-141118)
(cherry picked from commit 6a7c969d00)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-11-06 03:34:06 -05:00
Miss Islington (bot)
f2353d60db
[3.14] gh-140569: recommend the new REPL in the asyncio REPL docs (GH-140570) (#141115)
gh-140569: recommend the new REPL in the asyncio REPL docs (GH-140570)
(cherry picked from commit 8822166200)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-11-06 05:46:15 +00:00
Stan Ulbrych
12847bfff7
[3.14] Fix Queue.shutdown docs for condition to unblock a join (gh-137088) (#141073)
(cherry picked from commit ea06ae5b5e)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2025-11-06 11:11:31 +05:30
Miss Islington (bot)
9878611f28
[3.14] gh-118516: clarify that subprocess are automatically killed if transport gets garbage collected (GH-140997) (#141110)
gh-118516: clarify that subprocess are automatically killed if transport gets garbage collected (GH-140997)
(cherry picked from commit 101c9c0a21)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-11-06 10:34:27 +05:30
Miss Islington (bot)
00087dc466
[3.14] GH-108009: Add clarification of parser and argument defaults in argparse docs (GH-124154) (#141084)
GH-108009: Add clarification of parser and argument defaults in argparse docs (GH-124154)
(cherry picked from commit 95f6e1275b)

Co-authored-by: Savannah Ostrowski <savannah@python.org>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2025-11-05 22:52:22 +00:00
Miss Islington (bot)
5561837085
[3.14] gh-141004: Document PyDict_GET_SIZE (GH-141078) (GH-141082)
gh-141004: Document `PyDict_GET_SIZE` (GH-141078)
(cherry picked from commit f0ab07f22c)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-05 22:38:20 +00:00
Miss Islington (bot)
f35a6e14f3
[3.14] gh-76007: remove curses.__version__ doc (GH-141052) (#141076)
Co-authored-by: Zenith <me@arielle.codes>
2025-11-05 22:06:27 +00:00
Miss Islington (bot)
090c0f1403
[3.14] gh-141004: Document Py_RETURN_NAN and Py_RETURN_INF (GH-141029) (GH-141074)
gh-141004: Document `Py_RETURN_NAN` and `Py_RETURN_INF` (GH-141029)
(cherry picked from commit 5b02c6e920)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-11-05 22:05:47 +00:00
Miss Islington (bot)
11eecde7a5
[3.14] Fix typo in Apple/__main__.py (GH-141038) (#141039)
Corrected a typo in a return value docstring.
(cherry picked from commit 335d83ec04)

Co-authored-by: Lê Nam Khánh <55955273+khanhkhanhlele@users.noreply.github.com>
2025-11-06 05:53:11 +08:00
Stan Ulbrych
52f15231f0
[3.14] Docs: replace an esoteric Von Neumann mention (GH-137598) (#141071)
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2025-11-05 23:20:17 +02:00
Victor Stinner
36e9f672f2
[3.14] Fix compiler warnings in remote debugging (#141060) (#141067)
Fix compiler warnings in remote debugging (#141060)

Example of fixed warnings on 32-bit Windows:

    Python\remote_debugging.c(24,53): warning C4244: 'function':
    conversion from 'uint64_t' to 'uintptr_t', possible loss of data

    Modules\_remote_debugging_module.c(789,44): warning C4244:
    'function': conversion from 'uint64_t' to 'size_t', possible loss
    of data

(cherry picked from commit f458ac01ba)
2025-11-05 19:49:39 +00:00
Miss Islington (bot)
8675f55f6a
[3.14] Fix a compiler warning in _randommodule.c (GH-141058) (#141063)
Fix a compiler warning in _randommodule.c (GH-141058)

The test just before the cast ensures that the cast cannot overflow.

Fix the warning on 32-bit Windows:

    Modules\_randommodule.c(525,28): warning C4244: '=': conversion
    from 'uint64_t' to 'Py_ssize_t', possible loss of data
(cherry picked from commit 4ac16dd109)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-05 19:10:32 +00:00
Miss Islington (bot)
fa8f46412f
[3.14] gh-139313: Improve docs on XML security (GH-139460) (GH-141065)
Clarify that:
- it takes parsing for an attack
- that some doors are closed by default
- only Expat version 2.7.2 has all the fixes
- use of the bundle depends on configuration
(cherry picked from commit baa9f33897)

Co-authored-by: Sebastian Pipping <sebastian@pipping.org>
2025-11-05 19:07:03 +00:00
Miss Islington (bot)
19ba59369e
[3.14] Docs: Fix cached calls count in factorial example (gh-140882) (gh-141031)
Co-authored-by: Clifford Gama <cliffygamy@gmail.com>
2025-11-05 12:14:12 -06:00
Miss Islington (bot)
378912975b
[3.14] gh-141004: Document PyMemoryView_Type (GH-141034) (GH-141054)
gh-141004: Document `PyMemoryView_Type` (GH-141034)
(cherry picked from commit 3f6aca1be4)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-05 16:51:34 +00:00
Miss Islington (bot)
39ca786918
[3.14] gh-141004: Document missing iterator types in the C API (GH-141010) (GH-141046)
gh-141004: Document missing iterator types in the C API (GH-141010)

Add documentation for each of the following:

- PyByteArrayIter_Type
- PyBytesIter_Type
- PyListIter_Type
- PyListRevIter_Type
- PySetIter_Type
- PyTupleIter_Type
- PyRangeIter_Type
- PyLongRangeIter_Type
- PyDictIterKey_Type
- PyDictRevIterKey_Type
- PyDictIterValue_Type
- PyDictRevIterValue_Type
- PyDictIterItem_Type
- PyDictRevIterItem_Type

---------
(cherry picked from commit 35528fccdc)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-11-05 14:20:04 +00:00
Hugo van Kemenade
43eaf9984a
[3.14] Omit Python/perf_jit_trampoline.c from the **/*jit* CODEOWNERS rule (GH-136519) (#140987)
Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2025-11-05 14:24:10 +02:00
Miss Islington (bot)
2511fce2ef
[3.14] gh-141007: update string module source code link (GH-141008) (#141030)
gh-141007: update string module source code link (GH-141008)

In 3.14, the former string.py became `__init__.py` within a new `string` directory that also contains a new submodule file, `templatelib.py`.
(cherry picked from commit fa02422918)

Co-authored-by: alex <30386655+alexomics@users.noreply.github.com>
2025-11-05 00:11:42 +00:00
Miss Islington (bot)
7ab08d2c51
[3.14] gh-141004: Document Py_UNICODE_{HIGH, LOW}_SURROGATE functions (GH-141019) (GH-141027)
gh-141004: Document `Py_UNICODE_{HIGH, LOW}_SURROGATE` functions (GH-141019)
(cherry picked from commit bfe54810c4)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-04 21:33:52 +00:00
Filip Łajszczak
dc76de26e5
[3.14] gh-139434: Update selected RFC 2822 references to RFC 5322 (GH-139435) (#141025)
Update selected RFC 2822 references to RFC 5322

RFC 2822 was obsoleted by RFC 5322 in 2008. This updates references
to use the current standard in documentation, docstrings, and comments.

It preserves RFC 2822 references in legacy API components to maintain their
historical context.

RFC 822 → RFC 2822 → RFC 5322 progression is explained where relevant.

In some places specific sections of RFC are referenced where it seems helpful.

Scout rule was applied in some places and RFC mentions format was
normalized in doc strings and comments.
(cherry picked from commit ce1bb85d28)
2025-11-04 16:23:16 -05:00
Chris Eibl
f0eb7d4c9a
[3.14] gh-140513: Fail to compile if _Py_TAIL_CALL_INTERP is set but preserve_none and musttail do not exist (GH-140548) (#140923)
gh-140513: Fail to compile if `_Py_TAIL_CALL_INTERP` is set but `preserve_none` and `musttail` do not exist. (GH-140548)


(cherry picked from commit 2f60b8f02f)

Co-authored-by: Krishna Chaitanya <141550576+XChaitanyaX@users.noreply.github.com>
2025-11-04 20:43:18 +00:00
Miss Islington (bot)
d82d340096
[3.14] Docs: Fix typo in email.headerregistry.rst (GH-140965) (#141020)
Docs: Fix typo in `email.headerregistry.rst` (GH-140965)

Fix missing 'Header' suffix on header class name in `email.headerregistry.rst`
(cherry picked from commit 97d8dda980)

Co-authored-by: Guo Ci <zguoci@gmail.com>
2025-11-04 19:35:20 +00:00
Miss Islington (bot)
4358b8417f
[3.14] gh-134817: Restore accidentally deleted line in documentation. (GH-141013) (GH-141016)
(cherry picked from commit 66c86c6563)
2025-11-04 18:40:12 +00:00
Miss Islington (bot)
52f18790eb
[3.14] Document that returning sys.monitoring.DISABLE in response to a global event raises ValueError (GH-140726) (GH-141014)
Document that returning `sys.monitoring.DISABLE` in response to a global event raises `ValueError` (GH-140726)
(cherry picked from commit 8a7dbb7a68)

Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-04 18:34:04 +00:00
Miss Islington (bot)
267af29832
[3.14] gh-140979: Fix off-by-one error in the RE code validator (GH-140984) (GH-141001)
It was too lenient and allowed MARK opcodes with too large value.
(cherry picked from commit 1326d2a808)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-11-04 18:16:51 +02:00
AN Long
c3f9702f04
[3.14] gh-140826 Remove the wrong documents about comparison behavior on winreg.HKEYType (GH-140999) 2025-11-04 16:14:44 +00:00
Miss Islington (bot)
5b88a6533c
[3.14] Fix minor typo: 'web site' -> 'website' (GH-140561) (GH-140976)
(cherry picked from commit 08115d241a)

Co-authored-by: commitWithTisha <tishaa1010@gmail.com>
2025-11-04 14:11:08 +01:00
Miss Islington (bot)
e5266fcac8
[3.14] gh-140797: Forbid capturing groups in re.Scanner lexicon patterns (GH-140944) (GH-140982)
(cherry picked from commit fa9c3eefd4)

Co-authored-by: Abhishek Tiwari <Abhi210@users.noreply.github.com>
2025-11-04 11:21:33 +00:00
Miss Islington (bot)
331b4b868c
[3.14] gh-140815: Fix faulthandler for invalid/freed frame (GH-140921) (#140981)
gh-140815: Fix faulthandler for invalid/freed frame (GH-140921)

faulthandler now detects if a frame or a code object is invalid or
freed.

Add helper functions:

* _PyCode_SafeAddr2Line()
* _PyFrame_SafeGetCode()
* _PyFrame_SafeGetLasti()

_PyMem_IsPtrFreed() now detects pointers in [-0xff, 0xff] range
as freed.
(cherry picked from commit a84181c31b)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-04 11:18:23 +00:00
Miss Islington (bot)
a9c964f368
[3.14] Docs: Fix a typo in idle.rst (Chitespace -> Whitespace) (GH-140946) (#140953)
Co-authored-by: Yongzi Li <204532581+Yzi-Li@users.noreply.github.com>
2025-11-04 10:02:10 +02:00
Hugo van Kemenade
25a2a60371
[3.14] Fix minor typos and wording in C API docs (GH-140955) (#140966)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-11-04 09:46:08 +02:00
Ken Jin
09c890ec8c
[3.14] gh-140889: Test tailcall and JIT in CI (GH-140891) (GH-140962) 2025-11-03 19:53:10 +00:00
Miss Islington (bot)
894b5287ea
[3.14] gh-133600: Run Tools/wasm/wasi on CI instead of deprecated Tools/wasm/wasi.py (GH-140907) (#140964)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-11-03 19:51:32 +00:00
Miss Islington (bot)
08012a93a8
[3.14] gh-138151: Fix annotationlib handling of multiple nonlocals (GH-138164) (#140949)
gh-138151: Fix annotationlib handling of multiple nonlocals (GH-138164)
(cherry picked from commit b1027d4762)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-11-03 15:52:01 +00:00
Miss Islington (bot)
788104633c
[3.14] gh-140348: Fix using | on unusual objects plus Unions (GH-140383) (#140948)
gh-140348: Fix using | on unusual objects plus Unions (GH-140383)
(cherry picked from commit 7a9437d986)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-11-03 15:16:03 +00:00
Jelle Zijlstra
1b376b82ac
[3.14] Revert "gh-137969: Fix evaluation of ref.evaluate(format=Format.FORWARDREF) objects (GH-138075) (#140929)" (GH-140931)
Revert "[3.14] gh-137969: Fix evaluation of `ref.evaluate(format=Format.FORWARDREF)` objects (GH-138075) (#140929)"

This reverts commit cdb6fe89ae.
2025-11-03 15:07:22 +01:00
Miss Islington (bot)
fa9bb9a092
[3.14] gh-140693: Improve argparse documentation about controlling color (GH-140737) (#140932)
gh-140693: Improve `argparse` documentation about controlling color (GH-140737)
(cherry picked from commit 31de83d5e2)

Co-authored-by: Krishna Chaitanya <141550576+XChaitanyaX@users.noreply.github.com>
2025-11-02 21:08:47 -08:00
Miss Islington (bot)
cdb6fe89ae
[3.14] gh-137969: Fix evaluation of ref.evaluate(format=Format.FORWARDREF) objects (GH-138075) (#140929)
gh-137969: Fix evaluation of `ref.evaluate(format=Format.FORWARDREF)` objects (GH-138075)
(cherry picked from commit 63e01d6bae)

Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-11-03 01:45:44 +00:00
Miss Islington (bot)
23e3771045
[3.14] gh-138425: Correctly partially evaluate global generics with undefined params in ref.evaluate(format=Format.FORWARDREF) (GH-138430) (#140927)
gh-138425: Correctly partially evaluate global generics with undefined params in `ref.evaluate(format=Format.FORWARDREF)` (GH-138430)
(cherry picked from commit e66f87ca73)

Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-11-02 23:41:49 +00:00
Miss Islington (bot)
7e1bac6a1a
[3.14] gh-135307: Fix email error when policy max_line_length is set to 0 or None (GH-135367) (#140915)
gh-135307: Fix email error when policy max_line_length is set to 0 or None (GH-135367)
(cherry picked from commit 6d45cd8dbb)


RDM: Like the change made in a earlier PR to the folder, we can/must use 'maxlen' as a stand in for 'unlimited' when computing line lengths when max_line_length is 0 or None; otherwise the computation results in a traceback.

Co-authored-by: Jiucheng(Oliver) <git.jiucheng@gmail.com>
2025-11-02 10:03:12 -05:00
Miss Islington (bot)
6ab4dfb560
[3.14] Docs: avoid informal formulation in Doc/c-api/conversion.rst (GH-140898) (#140912)
Docs: avoid informal formulation in `Doc/c-api/conversion.rst` (GH-140898)
(cherry picked from commit 173cc53d9f)

Co-authored-by: RayXu <140802139+F18-Maverick@users.noreply.github.com>
2025-11-02 13:57:26 +00:00
Bénédikt Tran
bf2865f80f
[3.14] gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (GH-139234) (#139359)
* [3.14] gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (GH-139234)

Expose the XML Expat 2.7.2 mitigation APIs to disallow use of
disproportional amounts of dynamic memory from within an Expat
parser (see CVE-2025-59375 for instance).

The exposed APIs are available on Expat parsers, that is,
parsers created by `xml.parsers.expat.ParserCreate()`, as:

- `parser.SetAllocTrackerActivationThreshold(threshold)`, and
- `parser.SetAllocTrackerMaximumAmplification(max_factor)`.

(cherry picked from commit f04bea44c3)
(cherry picked from commit 68a1778b77)
2025-11-02 09:33:36 +00:00
Miss Islington (bot)
4d7fab9b15
[3.14] Docs: fix some grammatical errors in Doc/c-api/dict.rst (GH-140899) (#140901)
Docs: fix some grammatical errors in `Doc/c-api/dict.rst` (GH-140899)
(cherry picked from commit d12cbf2865)

Co-authored-by: RayXu <140802139+F18-Maverick@users.noreply.github.com>
2025-11-02 08:38:56 +00:00
Ken Jin
4d68b758fa
[3.14] gh-140104: Revert "Set next_instr properly in the JIT during exceptions (GH-140233) (GH-140687)" (#140890)
Revert "[3.14] gh-140104: Set next_instr properly in the JIT during exceptions (GH-140233) (GH-140687)"

This reverts commit 2e21672803.
2025-11-01 18:41:01 +00:00
Miss Islington (bot)
ab1fdf3d7c
[3.14] gh-140312: Set lltrace on JIT debug builds (GH-140313) (#140887)
gh-140312: Set lltrace on JIT debug builds (GH-140313)
(cherry picked from commit f701f98052)

Co-authored-by: Ken Jin <kenjin@python.org>
Co-authored-by: Mark Shannon <mark@hotpy.org>
2025-11-01 16:49:35 +00:00
Miss Islington (bot)
c7ede76d8e
[3.14] gh-140874: Upgrade bundled pip to 25.3 (GH-140876) (gh-140881)
gh-140874: Upgrade bundled pip to 25.3 (GH-140876)

Upgrade bundled pip to 25.3
(cherry picked from commit d440a0f96c)

Co-authored-by: Damian Shaw <damian.peter.shaw@gmail.com>
2025-11-01 11:21:51 +00:00
Łukasz Langa
631ba3407e
[3.14] gh-136065: Fix quadratic complexity in os.path.expandvars() (GH-134952) (GH-140844)
(cherry picked from commit f029e8db62)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-31 17:43:23 +01:00
Miss Islington (bot)
89818a5939
[3.14] gh-137836: Support more RAWTEXT and PLAINTEXT elements in HTMLParser (GH-137837) (GH-140841)
* the "plaintext" element
* the RAWTEXT elements "xmp", "iframe", "noembed" and "noframes"
* optionally RAWTEXT (if scripting=True) element "noscript"
(cherry picked from commit a17c57eee5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-31 16:13:13 +00:00
Brian Schubert
d0c78a458b
[3.14] gh-138944: Fix SyntaxError message for invalid syntax following valid import-as statement (GH-138945) (#140646)
(cherry picked from commit 3dab11f888)
2025-10-31 11:26:40 +01:00
Miss Islington (bot)
6c025a040d
[3.14] Make printing log lines to the terminal a little cleaner when building WASI (GH-140772) (GH-140804)
Make printing log lines to the terminal a little cleaner when building WASI (GH-140772)
(cherry picked from commit abd19eddee)

Co-authored-by: Brett Cannon <brett@python.org>
2025-10-30 18:02:10 +00:00
Mikhail Efimov
5954b5ba92
[3.14] gh-140551: Fix dict crash if clear is called at lookup stage (GH-140558) (#140743)
gh-140551: Fix `dict` crash if `clear` is called at `lookup` stage (#140558)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2025-10-30 22:33:35 +05:30
Miss Islington (bot)
e595d995c4
[3.14] GH-140768: Warn when the WASI SDK version doesn't match the supported version (GH-140769) (GH-140801)
GH-140768: Warn when the WASI SDK version doesn't match the supported version (GH-140769)
(cherry picked from commit 95a3564869)

Co-authored-by: Brett Cannon <brett@python.org>
2025-10-30 17:01:22 +00:00
Donghee Na
064e989de5
[3.14] gh-137821: Fix wrongly tested json.decoder.scanstring (gh-140782) 2025-10-30 22:51:25 +09:00
Miss Islington (bot)
a7cfe862ba
[3.14] gh-131927: Do not emit PEP 765 warnings in ast.parse() (GH-139642) (GH-140786)
ast.parse() no longer emits syntax warnings for
return/break/continue in finally (see PEP-765) -- they are only
emitted during compilation.
(cherry picked from commit ad0a3f733b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-30 11:25:34 +00:00
Miss Islington (bot)
6bb49ae650
[3.14] gh-138162: Fix logging.LoggerAdapter with merge_extra=True and without the extra argument (GH-140511) (GH-140784)
(cherry picked from commit 327dbbedff)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-30 11:19:27 +00:00
Miss Islington (bot)
6e70c75d1b
[3.14] gh-120057: add os.reload_environ to __all__ (GH-140763) (#140773)
Co-authored-by: Guo Ci <zguoci@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-10-29 22:22:20 +00:00
Miss Islington (bot)
0779ef9a63
[3.14] gh-140082: Forward colorizing from libregrtest to unittest (GH-140083) (#140756)
gh-140082: Forward colorizing from libregrtest to unittest (GH-140083)

libregrtest redirects test output to a file as part of its operation.
When `unittest` checks to see if it should colorize with
`isatty(sys.stdout)` that fails resulting in no colorizing of the
unittest output.

Update `libregrtest` to set `FORCE_COLOR=1` when redirecting test output
so that unittest will do color printing.
(cherry picked from commit 6ff62ac4fb)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-29 18:11:24 +00:00
Miss Islington (bot)
6d0e1c8478
[3.14] gh-140228: Avoid making unnecessary syscalls in linecache for frozen modules (GH-140377) (#140738)
gh-140228: Avoid making unnecessary syscalls in linecache for frozen modules (GH-140377)
(cherry picked from commit c41f84ff61)

Co-authored-by: tconley1428 <tconley1428@gmail.com>
2025-10-29 09:26:38 -07:00
Miss Islington (bot)
c45ab05a3a
[3.14] gh-140576: Fixed crash produced by lexer in case of dedented zero byte (GH-140583) (#140757)
gh-140576: Fixed crash produced by lexer in case of dedented zero byte (GH-140583)
(cherry picked from commit 8706167474)

Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2025-10-29 13:54:37 +00:00
Miss Islington (bot)
e0f54a0bda
[3.14] gh-140702: Log color and GHA env vars in test.pythoninfo (GH-140747) (#140753)
gh-140702: Log color and GHA env vars in test.pythoninfo (GH-140747)
(cherry picked from commit 376559bf54)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-29 12:54:04 +00:00
Cody Maloney
9a7dccd7a1
[3.14] gh-140607: Validate returned byte count in RawIOBase.read (GH-140611) (#140728)
* [3.14] gh-140607: Validate returned byte count in RawIOBase.read (GH-140611)

While `RawIOBase.readinto` should return a count of bytes between 0 and
the length of the given buffer, it is not required to. Add validation
inside RawIOBase.read() that the returned byte count is valid.
(cherry picked from commit 0f0a362768)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
Co-authored-by: Shamil <ashm.tech@proton.me>
Co-authored-by: Victor Stinner <vstinner@python.org>

* fixup: Use older attribute name

---------

Co-authored-by: Shamil <ashm.tech@proton.me>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-29 13:31:48 +01:00
Miss Islington (bot)
7c4a8e5818
[3.14] gh-140702: Add test skip for Unix Datagram tests on iOS when on Github Actions (GH-140740) (#140742)
Exposes the GITHUB_ACTIONS environment variable to iOS simulator test runs, and
uses this variable to skip a Unix Datagram socketserver test that is unreliable
in the iOS GitHub Actions environment.
(cherry picked from commit 9f8d005d29)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-10-29 09:01:39 +00:00
Mikhail Efimov
8f322ad7b9
[3.14] gh-139951: Tests on tuple GC tracking (GH-140575) (#140701) 2025-10-29 07:17:49 +00:00
Miss Islington (bot)
52338ec6cc
[3.14] gh-139588: Increase maximum LaTeX list depth (GH-140709) (#140724)
Co-authored-by: Maciej Olko <maciej.olko@affirm.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-28 20:05:28 +00:00
Miss Islington (bot)
6822b135f2
[3.14] gh-140657: Don't rerun test_import single phase init test (GH-140712) (#140713)
gh-140657: Don't rerun test_import single phase init test (GH-140712)

test_basic_multiple_interpreters_main_no_reset() leaks memory:
import_in_subinterp() is called with postcleanup=False.
(cherry picked from commit c6d4c79c9a)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-28 17:33:34 +00:00
Miss Islington (bot)
02604314ba
[3.14] GH-140590: Fix setstate for functools.partial C-module (GH-140671) (#140698)
GH-140590: Fix setstate for functools.partial C-module (GH-140671)

(cherry picked from commit d26686a7f8)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2025-10-28 18:15:27 +05:30
Miss Islington (bot)
84e01df175
[3.14] gh-134160: Add more comments for the xxlimited module (GH-140214) (GH-140664)
(cherry picked from commit 18e4a89e42)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-28 10:24:11 +01:00
Miss Islington (bot)
3fa7bf4b26
[3.14] gh-140189: Add CI job to test iOS builds. (GH-140190) (#140696)
Adds a CI configuration to test iOS builds on every build.
(cherry picked from commit f4e6370582)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-10-28 06:13:30 +00:00
Mikhail Efimov
2e21672803
[3.14] gh-140104: Set next_instr properly in the JIT during exceptions (GH-140233) (GH-140687)
Co-authored-by: Ken Jin <kenjin@python.org>
Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-10-27 23:49:10 +00:00
Miss Islington (bot)
3bb0eb4ca9
[3.14] gh-140634: Fix a reference counting bug in os.sched_param.__reduce__() (GH-140667) (GH-140685)
(cherry picked from commit 364ae607d8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-27 20:08:57 +00:00
Miss Islington (bot)
c1bfd4cb9c
[3.14] gh-140358: Bring back elapsed time and unreachable count to gc debug output (GH-140359) (#140405)
Co-authored-by: Pål Grønås Drange <paal.drange+pgdr@gmail.com>
2025-10-27 15:29:43 +02:00
Miss Islington (bot)
ce1deb947e
[3.14] gh-140487: Fix Py_RETURN_NOTIMPLEMENTED in limited C API 3.11 (GH-140636) (#140668)
gh-140487: Fix Py_RETURN_NOTIMPLEMENTED in limited C API 3.11 (GH-140636)

Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE have already been
fixed by commit 9258f3da91 (issue gh-134989).
(cherry picked from commit c636477523)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-27 14:15:49 +01:00
Miss Islington (bot)
87afee2312
[3.14] gh-140633: AppleFrameworkLoader: Ignore AttributeError when setting __file__ (GH-140635) (GH-140660)
(cherry picked from commit 3416e7c8dc)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-27 14:08:00 +01:00
Miss Islington (bot)
5ae4612e72
[3.14] Docs: Replace "encoder" with "decoder" in Doc/c-api/codec.rst (GH-140613) (#140661)
Docs: Replace "encoder" with "decoder" in `Doc/c-api/codec.rst` (GH-140613)
(cherry picked from commit d12086e822)

Co-authored-by: RayXu <140802139+F18-Maverick@users.noreply.github.com>
2025-10-27 09:51:14 +00:00
Miss Islington (bot)
97c59f9d61
[3.14] Remove dead stores to 'size' in UTF-8 decoder (unicodeobject.c) (GH-140637) (#140658)
Remove dead stores to 'size' in UTF-8 decoder (unicodeobject.c) (GH-140637)
(cherry picked from commit 7d70a147f5)

Co-authored-by: Shamil <ashm.tech@proton.me>
2025-10-27 09:21:43 +00:00
Sebastian Pipping
842c49b354
[3.14] gh-140593: Fix a memory leak in function my_ElementDeclHandler of pyexpat (GH-140602) (#140629)
[3.14] gh-140593: Fix a memory leak in function `my_ElementDeclHandler` of `pyexpat` (GH-140602)

Ensure that the memory allocated for the content model
passed to `my_ElementDeclHandler` is freed in all error
paths.

(cherry picked from commit e34a5e3304)
2025-10-26 15:19:18 +00:00
Miss Islington (bot)
30ee67b2e4
[3.14] gh-137568: Ignore startup file in test_dumb_terminal_exits_cleanly (GH-140295) (GH-140628)
gh-137568: Ignore startup file in `test_dumb_terminal_exits_cleanly` (GH-140295)
(cherry picked from commit 06c779474c)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-10-26 15:15:49 +00:00
Miss Islington (bot)
46a3fd2da5
[3.14] gh-133346: add tests for _colorize.Theme (GH-139687) (#140622)
* gh-133346: add tests for `_colorize.Theme` (GH-139687)
(cherry picked from commit 37827c1752)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-26 13:49:20 +01:00
Miss Islington (bot)
d664102a45
[3.14] gh-133346: make _colorize.Argparse kw-only constructible (GH-140620) (#140621)
gh-133346: make `_colorize.Argparse` kw-only constructible (GH-140620)

Other themes are kw-only constructible.
(cherry picked from commit 387ac2d2f3)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-26 12:00:10 +00:00
Miss Islington (bot)
57ba6aedf6
[3.14] Docs: Fix a grammatical error in Doc/c-api/codec.rst (GH-140612) (#140616)
Docs: Fix a grammatical error in `Doc/c-api/codec.rst` (GH-140612)
(cherry picked from commit 33b2ca80bb)

Co-authored-by: RayXu <140802139+F18-Maverick@users.noreply.github.com>
2025-10-26 09:45:34 +00:00
Miss Islington (bot)
596111546d
[3.14] gh-124694: Add versionadded note to InterpreterPoolExecutor (GH-140605)
(cherry picked from commit 421a475c87)

Co-authored-by: Zachary Ware <zach@python.org>
2025-10-25 23:37:24 +00:00
Miss Islington (bot)
62c9d48378
[3.14] Fix typo in Doc/c-api/code.rst (GH-140586) (#140591)
Fix typo in `Doc/c-api/code.rst` (GH-140586)
(cherry picked from commit d74a96366d)

Co-authored-by: RayXu <140802139+F18-Maverick@users.noreply.github.com>
2025-10-25 15:41:04 +00:00
Miss Islington (bot)
96029bc472
[3.14] Remove unreachable break statements in _ctypes_test.c (GH-140585) (#140587)
Remove unreachable break statements in _ctypes_test.c (GH-140585)
(cherry picked from commit 2a1c9bd616)

Co-authored-by: Shamil <ashm.tech@proton.me>
2025-10-25 18:39:42 +03:00
Miss Islington (bot)
568cf8b4af
[3.14] Docs: Fix a grammatical error in Doc/c-api/capsule.rst (GH-140577) (GH-140580)
Docs: Fix a grammatical error in `Doc/c-api/capsule.rst` (GH-140577)

"who" -> "which"
(cherry picked from commit 4ad599501f)

Co-authored-by: RayXu <140802139+F18-Maverick@users.noreply.github.com>
2025-10-25 14:02:20 +00:00
Miss Islington (bot)
4fcc102524
[3.14] gh-140463: Fix typo in xmlrpc.client documentation (GH-140552) (#140568)
gh-140463: Fix typo in xmlrpc.client documentation (GH-140552)

Fix typo in xmlrpc.client documentation
(cherry picked from commit 44b6eead21)

Co-authored-by: Miša Jakovljević <misajakovljevic3@gmail.com>
2025-10-24 20:53:24 +00:00
Miss Islington (bot)
bff0455319
[3.14] Add missing NEWS entry for gh-140517 (GH-140560) (GH-140565)
(cherry picked from commit d78d7a50b0)

Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2025-10-24 20:00:21 +00:00
Miss Islington (bot)
7545ea6b3a
[3.14] gh-140482: Preserve and restore stty echo as a test environment (GH-140519) (#140562)
gh-140482: Preserve and restore `stty echo` as a test environment (GH-140519)
(cherry picked from commit b3c713a0af)


gh-140482: Restore `stty echo` as a test environment

Co-authored-by: Barry Warsaw <barry@python.org>
2025-10-24 19:24:17 +00:00
Miss Islington (bot)
11b5e0b9c2
[3.14] gh-140517: fix leak in map_next in strict mode (GH-140543) (#140554)
gh-140517: fix leak in `map_next` in strict mode (GH-140543)
(cherry picked from commit be5af997f3)

Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2025-10-24 22:00:36 +05:30
Miss Islington (bot)
a975bea9b5
[3.14] Document that PyModule_GetDef can return NULL with or without setting an exception (GH-140529) (GH-140545)
(cherry picked from commit 289360ae63)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-24 13:36:35 +00:00
Miss Islington (bot)
4bb2f1f322
[3.14] Docs: Fix a grammatical error in Doc/c-api/arg.rst (GH-140525) (GH-140538)
Docs: Fix a grammatical error in `Doc/c-api/arg.rst` (GH-140525)

"have" -> "has"
(cherry picked from commit fc2e23c2ed)

Co-authored-by: RayXu <140802139+F18-Maverick@users.noreply.github.com>
2025-10-24 12:24:26 +00:00
Miss Islington (bot)
08f6b3f422
[3.14] gh-136535: Tests: Correct Py_TPFLAGS_MANAGED_DICT in test_class.py (gh-136538) (gh-140532) 2025-10-24 11:45:44 +00:00
Kumar Aditya
6efd78d7ab
[3.14] gh-137093: Fix race condition in test_embed.test_bpo20891 (GH-137094) (#140524)
Use a `PyEvent` instead of a lock to fix a race on the free-threaded build.
(cherry picked from commit 9b451fb457)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-10-24 13:21:44 +05:30
Miss Islington (bot)
8285bc7ea2
[3.14] gh-140471: Fix buffer overflow in AST node initialization with malformed _fields (GH-140506) (#140509)
gh-140471: Fix buffer overflow in AST node initialization with malformed `_fields` (GH-140506)
(cherry picked from commit 95953b692d)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-23 10:20:21 -07:00
Miss Islington (bot)
29c42cc621
[3.14] gh-140438: properly run the asyncio REPL tests (GH-140298) (#140507)
gh-140438: properly run the asyncio REPL tests (GH-140298)
(cherry picked from commit 1a3da2c070)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-10-23 15:48:26 +00:00
Miss Islington (bot)
3944e9b3b2
[3.14] gh-140431: Fix GC crash due to partially initialized coroutines (gh-140470) (gh-140504)
The `make_gen()` function creates and tracks generator/coro objects, but
doesn't fully initialize all the fields. At a minimum, we need to
initialize all the fields that may be accessed by gen_traverse because
the call to `compute_cr_origin()` can trigger a GC.
(cherry picked from commit 574405c19e)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-10-23 14:44:21 +00:00
Miss Islington (bot)
564bb00b27
[3.14] gh-138774: use value to ast.unparse code when str is None in ast.Interpolation (GH-139415) (#140503)
gh-138774: use `value` to `ast.unparse` code when `str` is `None` in `ast.Interpolation` (GH-139415)
(cherry picked from commit 4d0849426f)

Co-authored-by: George Ogden <38294960+George-Ogden@users.noreply.github.com>
2025-10-23 14:39:02 +00:00
Mark Shannon
d1a434f7b2
[3.14] GH-139951: Fix major GC performance regression. Backport of GH-140262 (GH-140447)
* Count number of actually tracked objects, instead of trackable objects. This ensures that untracking tuples has the desired effect of reducing GC overhead
* Do not track most untrackable tuples during creation. This prevents large numbers of small tuples causing execessive GCs.
2025-10-23 15:26:58 +01:00
Miss Islington (bot)
0fdae5f590
[3.14] gh-140474: Fix memory leak in array.array (GH-140478) (GH-140498)
gh-140474: Fix memory leak in `array.array` (GH-140478)
(cherry picked from commit aa9d0a61d5)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-23 10:20:16 +00:00
Miss Islington (bot)
853e5d94eb
[3.14] gh-130317: Fix SNaN broken tests on HP PA RISC (GH-140452) (#140467)
gh-130317: Fix SNaN broken tests on HP PA RISC (GH-140452)

While looking at GH-140028, I found some unrelated test regressions in the
3.14 cycle. These seem to all come from GH-130317. From what I can tell,
that made Python more correct than it was before. According to [0], HP PA
RISC uses 1 for SNaN and thus a 0 for QNaN.

[0]: https://grouper.ieee.org/groups/1788/email/msg03272.html
(cherry picked from commit 76fea5596c)

Co-authored-by: Stefano Rivera <stefano@rivera.za.net>
2025-10-22 17:04:47 +00:00
Miss Islington (bot)
01b52ea5c0
[3.14] gh-116738: Add critical section to dbm/gdbm context manager (gh-140391) (gh-140459)
(cherry picked from commit d51be28876)

Co-authored-by: Alper <alperyoney@fb.com>
2025-10-22 15:44:09 +00:00
Miss Islington (bot)
9d547dab0b
[3.14] gh-132835: Add defensive NULL checks to MRO resolution (GH-134763) (GH-140436)
Currently, there are a few places where tp_mro could theoretically
become NULL, but do not in practice. This commit adds defensive checks for
NULL values to ensure that any changes do not introduce a crash and that
state invariants are upheld.

The assertions added in this commit are all instances where a NULL value would get passed to something not expecting a NULL, so it is better to catch an assertion failure than crash later on.

There are a few cases where it is OK for the return of lookup_tp_mro to be NULL, such as when passed to is_subtype_with_mro, which handles this explicitly.
(cherry picked from commit a8edca62fc)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-10-21 20:45:06 -07:00
Emma Smith
a490d671fa
[3.14] zlib.rst: Link to constants and deduplicate text (GH-140115) (GH-140349)
* Link to compression setting constants from compression functions
* De-duplicate descriptions of the constants
(cherry picked from commit 091e8513bb)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-21 14:44:47 -07:00
Miss Islington (bot)
c7fda9b3d1
[3.14] gh-138764: annotationlib: Make call_annotate_function fallback to using VALUE annotations if both the requested format and VALUE_WITH_FAKE_GLOBALS are not implemented (GH-138803) (#140426)
gh-138764: annotationlib: Make `call_annotate_function` fallback to using `VALUE` annotations if both the requested format and `VALUE_WITH_FAKE_GLOBALS` are not implemented (GH-138803)
(cherry picked from commit 95c257e2e6)

Co-authored-by: David Ellis <ducksual@gmail.com>
2025-10-21 16:22:29 +00:00
Miss Islington (bot)
d9e3d0eec7
[3.14] Use `sphinxext-opengraph` v0.13.0 (GH-140425) (#140427)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-21 16:08:56 +00:00
Miss Islington (bot)
3d4cf3bda3
[3.14] gh-139951: Test on GC collection disabled if threshold is zero (GH-140304) (#140362)
gh-139951: Test on GC collection disabled if threshold is zero (GH-140304)
(cherry picked from commit 5d0abb6971)

Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2025-10-21 08:44:33 -07:00
Miss Islington (bot)
d7dc6bfe2f
[3.14] GH-139436: Remove references to downloadable PDF documentation (GH-140416) (#140419)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-21 16:06:48 +03:00
Miss Islington (bot)
c0f0eca4da
[3.14] gh-140406: Fix memory leak upon __hash__ returning a non-integer (GH-140411) (GH-140417)
gh-140406: Fix memory leak upon `__hash__` returning a non-integer (GH-140411)
(cherry picked from commit 71db05a12d)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-10-21 12:35:31 +00:00
Miss Islington (bot)
98d4c21c09
[3.14] gh-140398: fix memory leaks in readline module when PySys_Audit fails (GH-140400) (#140403)
gh-140398: fix memory leaks in `readline` module when `PySys_Audit` fails (GH-140400)
(cherry picked from commit e8e0f411ba)

Co-authored-by: Shamil <ashm.tech@proton.me>
2025-10-21 08:20:14 +00:00
Miss Islington (bot)
4215f7f519
[3.14] gh-66646: Explain __base__ attribute in the docs (GH-102554) (GH-140365)
(cherry picked from commit faa169afa0)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
Co-authored-by: Éric <merwok@netwok.org>
2025-10-21 09:06:49 +02:00
Miss Islington (bot)
ba6d956eb9
[3.14] [Docs] Add missing note about Required/NotRequired/ReadOnly in get_type_hints() (GH-139565) (#140386)
[Docs] Add missing note about Required/NotRequired/ReadOnly in get_type_hints() (GH-139565)
(cherry picked from commit a752f58d6b)

Co-authored-by: Sam Bull <git@sambull.org>
2025-10-20 13:23:19 -07:00
Miss Islington (bot)
62f44dda1c
[3.14] gh-138891: fix star-unpack in get_annotations (GH-138951) (#140384)
gh-138891: fix star-unpack in get_annotations (GH-138951)
(cherry picked from commit c6be6e4537)

Co-authored-by: Christoph Walcher <christoph-wa@gmx.de>
2025-10-20 20:20:47 +00:00
Miss Islington (bot)
8e93f6e203
[3.14] gh-63161: Fix tokenize.detect_encoding() (GH-139446) (GH-140378)
* Support non-UTF-8 shebang and comments if non-UTF-8 encoding is specified.
* Detect decoding error for non-UTF-8 encoding.
* Detect null bytes in source code.
(cherry picked from commit 38d4b436ca)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-20 17:34:56 +00:00
Serhiy Storchaka
abb3b3142b
[3.14] gh-63161: Fix test_source_encoding when stderr is StringIO (GH-140361) 2025-10-20 20:05:42 +03:00
Miss Islington (bot)
6493a6aaf3
[3.14] gh-140263: Fix data race in test_lock_two_threads (gh-140264) (gh-140369)
Clang-20 detects a data race between the unlock and the non-atomic
read of the lock state. Use a relaxed load for the assertion to avoid
the race.
(cherry picked from commit f11ec6e643)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-10-20 14:25:42 +00:00
Miss Islington (bot)
d7fe4e99a2
[3.14] gh-140301: Fix memory leak in subinterpreter PyConfig cleanup (GH-140303) (#140360)
gh-140301: Fix memory leak in subinterpreter `PyConfig` cleanup (GH-140303)
(cherry picked from commit a615fb49c9)

Co-authored-by: Shamil <ashm.tech@proton.me>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-20 09:54:41 +00:00
Miss Islington (bot)
357284edb5
[3.14] gh-101100: Fix sphinx warnings in library/resource.rst (GH-140023) (#140352)
Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
2025-10-20 07:21:31 +00:00
Miss Islington (bot)
2699643d71
[3.14] docs: be clearer that glob results are unordered (GH-140184) (#140339)
(cherry picked from commit ed672f7a8a)

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2025-10-20 07:31:05 +03:00
Miss Islington (bot)
13e1642845
[3.14] Standardize translation of Doc/bugs.rst (GH-137449) (#140275)
Standardize translation of `Doc/bugs.rst` (GH-137449)
(cherry picked from commit 869bb6948e)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-19 23:13:48 +02:00
Miss Islington (bot)
6cee144d3a
[3.14] gh-140306: Fix memory leaks in cross-interpreter data handling (GH-140307) (GH-140338)
(cherry picked from commit f9323213c9)

Co-authored-by: Shamil <ashm.tech@proton.me>
2025-10-19 19:53:36 +00:00
Miss Islington (bot)
9ff705c6c5
[3.14] gh-63161: Fix PEP 263 support (GH-139481) (GH-139898)
* Support non-UTF-8 shebang and comments if non-UTF-8 encoding is specified.
* Detect decoding error in comments for UTF-8 encoding.
* Include the decoding error position for default encoding in SyntaxError.
(cherry picked from commit 5c942f11cd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-19 19:16:33 +00:00
Miss Islington (bot)
69d263cfe1
[3.14] Lib/idlelib/idle_test/__init__.py: remove commented out duplicate code (GH-140259) (#140322)
`Lib/idlelib/idle_test/__init__.py`: remove commented out duplicate code (GH-140259)
(cherry picked from commit 790cdae5a0)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-19 04:49:48 -04:00
Miss Islington (bot)
a4b977cfe2
[3.14] gh-138997: Remove false justify fill option from Tkinter docs (GH-139023) (#140319)
gh-138997: Remove false justify `fill` option from Tkinter docs (GH-139023)
(cherry picked from commit 115a04b802)

Co-authored-by: Marat Khagazheev <marathagazeev@gmail.com>
Co-authored-by: marat <khagazheev@artlebedev.ru>
2025-10-19 03:52:59 +00:00
Miss Islington (bot)
7be317fea6
[3.14] gh-128571: Document UTF-16/32 native byte order (GH-139974) (#140309)
Closes GH-128571
(cherry picked from commit 920de7ccdc)

Co-authored-by: Parham MohammadAlizadeh <prhmma@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-18 18:59:37 +00:00
Kumar Aditya
1d11627ba5
[3.14] gh-140067: Fix memory leak in sub-interpreter creation (GH-140111) (#140118)
* [3.14] gh-140067: Fix memory leak in sub-interpreter creation  (GH-140111)

Fix memory leak in sub-interpreter creation caused by overwriting of the previously used `_malloced` field. Now the pointer is stored in the first word of the memory block to avoid it being overwritten accidentally.
(cherry picked from commit 59547a251f)

Co-authored-by: Shamil <ashm.tech@proton.me>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-18 19:40:43 +05:30
Miss Islington (bot)
3ca7ea1f8f
[3.14] gh-140257: fix data race on eval_breaker during finalization (GH-140265) (#140294)
gh-140257: fix data race on eval_breaker during finalization (GH-140265)
(cherry picked from commit c8729c9909)

Co-authored-by: Shamil <ashm.tech@proton.me>
2025-10-18 11:28:53 +00:00
Miss Islington (bot)
c70f409da0
[3.14] gh-140241: Fix documentation for the registry parameter of warnings.warn_explicit() (GH-140242) (GH-140292)
(cherry picked from commit 78e1d65a4d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-18 11:02:09 +00:00
Miss Islington (bot)
b2d3957511
[3.14] Move the NEWS entry for gh-140272 to the correct place (GH-140290) (GH-140291)
(cherry picked from commit 936de256a9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-18 11:00:28 +00:00
Miss Islington (bot)
128f48fd2d
[3.14] gh-140272: Fix memory leak in _gdbm.gdbm.clear() (GH-140274) (GH-140285)
(cherry picked from commit f937468e7c)

Co-authored-by: Shamil <ashm.tech@proton.me>
2025-10-18 13:17:42 +03:00
Miss Islington (bot)
f59236b746
[3.14] GH-133789: Fix unpickling of pathlib objects pickled in Python 3.13 (GH-133831) (#140276)
GH-133789: Fix unpickling of pathlib objects pickled in Python 3.13 (GH-133831)

In Python 3.13 (but not 3.12 or 3.14), pathlib classes are defined in
`pathlib._local` rather than `pathlib`. In hindsight this was a mistake,
but it was difficult to predict how the abstract/local split would pan out.

In this patch we re-introduce `pathlib._local` as a stub module that
re-exports the classes from `pathlib`. This allows path objects pickled in
3.13 to be unpicked in 3.14+
(cherry picked from commit f4e51f253a)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2025-10-17 22:23:01 +00:00
Miss Islington (bot)
e07b78c01a
[3.14] gh-116738: test uuid module thread safety in free-threading (GH-140068) (#140229)
gh-116738: test `uuid` module thread safety in free-threading (GH-140068)
(cherry picked from commit 9a87ce8b57)

Co-authored-by: Alper <alperyoney@fb.com>
2025-10-17 20:59:15 +05:30
Miss Islington (bot)
889e9184bf
[3.14] gh-135801: Add tests for filtering warnings by module (GH-140240) (GH-140246)
(cherry picked from commit fbf0843e39)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-17 11:48:03 +00:00
Miss Islington (bot)
5513f6a99d
[3.14] gh-131788: make resource_tracker re-entrant safe (GH-131787) (#137737)
gh-131788: make resource_tracker re-entrant safe (GH-131787)

* make resource_tracker re-entrant safe
* Update Lib/multiprocessing/resource_tracker.py
* trim trailing whitespace
* use f-string and args = [x, *y, z]
* raise self._reentrant_call_error

---------
(cherry picked from commit f24a012350)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-10-16 21:25:14 -07:00
Miss Islington (bot)
32e60fa220
[3.14] gh-140120: Refresh HACL* to fix an hmac memory leak (GH-140188) (#140192)
gh-140120: Refresh HACL* to fix an hmac memory leak (GH-140188)

This pulls an updated version of HACL* that fixes the memory leak reported in GH-140120, via an upstream fix.
(cherry picked from commit 3a81313019)

Co-authored-by: Jonathan Protzenko <jonathan.protzenko+github@gmail.com>
2025-10-16 20:53:12 -07:00
Miss Islington (bot)
54261b6782
[3.14] gh-138859: Account for ParamSpec defaults that are not lists … (GH-138868) (#140207)
gh-138859: Account for `ParamSpec` defaults that are not lists … (GH-138868)
(cherry picked from commit 379fd020a0)

Co-authored-by: bzoracler <50305397+bzoracler@users.noreply.github.com>
2025-10-16 13:26:29 -07:00
Tan Long
12903c098b
[3.14] Remove duplicate words in the documentation (GH-140221) (GH-140225)
(cherry picked from commit 2ebd0cdb16)
2025-10-16 20:10:15 +02:00
Miss Islington (bot)
48b60495b7
[3.14] gh-140078: fix typo in tkinter docs (GH-140081) (#140217)
gh-140078: fix typo in tkinter docs (GH-140081)

Remove extraneous word.
(cherry picked from commit 5f357f3b0d)

Co-authored-by: wangxiaolei <fatelei@gmail.com>
2025-10-16 15:22:57 +00:00
Miss Islington (bot)
e69fb2008e
[3.14] gh-140170: Fix test_site with -s flag (GH-140179) (#140198)
gh-140170: Fix test_site with -s flag (GH-140179)

Commit
(cherry picked from commit 7ac94fcb1d)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-16 12:31:59 +02:00
Miss Islington (bot)
231552c6f7
[3.14] gh-140065: Lexical analysis: Correct note about leading zeros in floating point numbers (GH-140066) (GH-140167)
(cherry picked from commit 1624c646b0)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-16 09:50:01 +02:00
Miss Islington (bot)
504bf76dd2
[3.14] gh-140041: Fix import of ctypes on Android and Cygwin when ABI flags are present (GH-140178) (#140180)
Use sysconfig to determine the full name of libpython, rather than hardcoding
a library name that doesn't have ABI flags.
(cherry picked from commit 7f371ed84b)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
2025-10-15 22:08:35 +00:00
yihong
5caf64335c
[3.14] gh-140080: Add test for executing atexit callbacks under no memory (GH-140161) 2025-10-15 11:25:06 -04:00
Miss Islington (bot)
95c03d018d
[3.14] gh-140153: Fix Py_REFCNT() definition on limited C API 3.11-3.13 (GH-140158) (#140164)
gh-140153: Fix Py_REFCNT() definition on limited C API 3.11-3.13 (GH-140158)
(cherry picked from commit 728d239e57)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-15 15:02:03 +00:00
Miss Islington (bot)
045e34964a
[3.14] gh-140061: Use _PyObject_IsUniquelyReferenced() to check if objects are uniquely referenced (gh-140062) (gh-140157)
The previous `Py_REFCNT(x) == 1` checks can have data races in the free
threaded build. `_PyObject_IsUniquelyReferenced(x)` is a more conservative
check that is safe in the free threaded build and is identical to
`Py_REFCNT(x) == 1` in the default GIL-enabled build.
(cherry picked from commit 32c264982e)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
2025-10-15 14:49:17 +00:00
Miss Islington (bot)
6b94c7ceeb
[3.14] gh-129559: Remove extra dot in bytearray.resize AC (GH-140134) (#140143)
Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2025-10-15 14:06:18 +03:00
Miss Islington (bot)
9e235ffb21
[3.14] gh-138993: Dedent credits text (GH-138994) (#140088)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-15 14:05:47 +03:00
Miss Islington (bot)
af28efd8b4
[3.14] gh-139640: Fix swallowing syntax warnings in different modules (GH-139755) (GH-140117)
Revert GH-131993.

Fix swallowing some syntax warnings in different modules if they accidentally
have the same message and are emitted from the same line.

Fix duplicated warnings in the "finally" block.

(cherry picked from commit 279db6bede)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

* Update 2025-10-06-10-03-37.gh-issue-139640.gY5oTb.rst

---------

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-14 15:56:01 +00:00
Miss Islington (bot)
99e42ab49c
[3.14] gh-101828: Fix jisx0213 codecs removing null characters (gh-139340) (gh-140110)
gh-101828: Fix `jisx0213` codecs removing null characters (gh-139340)
(cherry picked from commit 87eadce3e0)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-14 14:36:05 +00:00
Miss Islington (bot)
6a467d3eda
[3.14] gh-106318: Add examples for str.istitle() (GH-140046) (#140113)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
2025-10-14 14:27:37 +00:00
Miss Islington (bot)
525f7c23b9
[3.14] gh-114827: clarify threading.Event.wait timeout behavior (GH-114834) (#140100)
Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-14 14:13:33 +00:00
Sergey B Kirpichev
1c55b9163b
[3.14] gh-102431: Clarify constraints on operands of Decimal logical operations (GH-102836) (#140105)
* [3.14] gh-102431: Clarify constraints on operands of Decimal logical operations (GH-102836)

Sync C/Python implementation of the decimal: logical_ops for contexts.
(cherry picked from commit 6ecf77dbde)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-10-14 15:44:30 +02:00
Miss Islington (bot)
2142f4efcf
[3.14] GH-140058: Clear key and value if PyTuple_New fails in dictiter_iternextitem (GH-140059) (#140107)
GH-140058: Clear key and value if `PyTuple_New` fails in `dictiter_iternextitem` (GH-140059)
(cherry picked from commit ded59f7e8e)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
2025-10-14 19:10:30 +05:30
Miss Islington (bot)
45577c93de
[3.14] gh-70765: Remove unnecessary extra backtick from Changelog entry (GH-140071) (#140102)
gh-70765: Remove unnecessary extra backtick from Changelog entry (GH-140071)
(cherry picked from commit f70082b477)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2025-10-14 11:15:36 +00:00
Miss Islington (bot)
af9b8970ef
[3.14] gh-82575: Adjust time.get_clock_info *adjustable* attribute doc (GH-135920) (#140097)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-14 08:36:39 +00:00
Miss Islington (bot)
2695844d26
[3.14] gh-137871: Clarify cmath.nan documentation by linking to math module (GH-137876) (#140095)
Co-authored-by: Aziz <azizbenothman76@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-10-14 08:32:27 +00:00
Miss Islington (bot)
b24b656a4e
[3.14] gh-97914: Reword misleading sentence on conditional expressions (GH-139064) (#140093)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Gilles Peiffer <gilles.peiffer.yt@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-14 08:28:12 +00:00
Miss Islington (bot)
b0c92e4b33
[3.14] gh-138072: Fix typos and grammatical errors and improve clarity in asyncio howto document (GH-138895) (#140091)
Co-authored-by: Morteza24 <mortezia4444.mz@gmail.com>
2025-10-14 08:27:21 +00:00
Miss Islington (bot)
e1caa1e6fa
[3.14] gh-102247: Improve documentation of http.HTTPStatus members update (GH-133190) (#140089)
Co-authored-by: Loïc Simon <loic.simon@napta.io>
2025-10-14 08:26:00 +00:00
Miss Islington (bot)
4c0dab9807
[3.14] gh-101100: Fix sphinx warnings in library/smtplib.rst (GH-139991) (#140084)
Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-14 08:19:29 +00:00
Miss Islington (bot)
5848d80536
[3.14] gh-139590: Stricter ruff rules for Tools/wasm (GH-139752) (#139811)
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-10-14 10:29:32 +03:00
Miss Islington (bot)
7a13953bc3
[3.14] gh-140000: Traverse name attribute for TypeVar, TypeVarTuple, TypeAliasType, ParamSpec (GH-140016) (#140063)
gh-140000: Traverse `name` attribute for `TypeVar`, `TypeVarTuple`, `TypeAliasType`, `ParamSpec` (GH-140016)
(cherry picked from commit be60e4b4f3)

Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2025-10-13 20:36:24 +00:00
Miss Islington (bot)
c5edf7d6f4
gh-139810: Always generate -dev tags for PyManager packages (GH-139814)
(cherry picked from commit c46265d94a)

Co-authored-by: Steve Dower <steve.dower@python.org>
2025-10-13 20:08:42 +00:00
Kumar Aditya
511078099a
[3.14] gh-125996: fix thread safety of collections.OrderedDict (GH-133734) (#140053)
(cherry picked from commit 6481539a6d)
2025-10-13 23:25:24 +05:30
Miss Islington (bot)
17d9f7169a
[3.14] gh-138772: Fix and improve documentation for turtle color functions (GH-139325) (GH-140047)
Use multiple signatures for clarity.
Explain different forms of bgcolor() in details.
Fix outdated docstrings.
(cherry picked from commit 525dcfe523)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-13 15:56:26 +00:00
Miss Islington (bot)
a5bf8a9a29
[3.14] Using Python on Windows: Free-threaded is supported from 3.14 (GH-139992) (#140045)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-10-13 14:25:49 +00:00
Miss Islington (bot)
3cef7801dd
[3.14] gh-107073: fix relevant typo in PyObject_ClearManagedDict (GH-140032) (#140033)
gh-107073: fix relevant typo in `PyObject_ClearManagedDict` (GH-140032)
(cherry picked from commit 52996aaa78)

Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2025-10-13 11:30:27 +00:00
Miss Islington (bot)
0b84334e52
[3.14] gh-131189: Remove curses mention from PYTHON_BASIC_REPL docs (GH-140022) (#140027)
gh-131189: Remove `curses` mention from `PYTHON_BASIC_REPL` docs (GH-140022)

The `curses` dependency for the default REPL has been removed
in 031645a884 (backport of
09dfb50f1b).

(cherry picked from commit 0344db8d60)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-10-13 08:48:28 +00:00
Miss Islington (bot)
11ac373d7c
[3.14] GH-139979: Add @force_not_colorized_test_class to TestOptionalHelpVersionActions (GH-139980) (#140005)
GH-139979: Add @force_not_colorized_test_class to TestOptionalHelpVersionActions (GH-139980)
(cherry picked from commit 0fc5c56815)

Co-authored-by: Savannah Ostrowski <savannah@python.org>
2025-10-12 17:16:21 +00:00
Miss Islington (bot)
7e8f107106
[3.14] gh-139155: Remove "dictionaries are sorted by key" note in pprint docs (GH-139159) (GH-140003)
gh-139155: Remove "dictionaries are sorted by key" note in `pprint` docs (GH-139159)
(cherry picked from commit 68622be935)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-10-12 16:55:49 +00:00
Miss Islington (bot)
6d6d02a982
[3.14] gh-116738: test dbm.gnu module on FT Python build (GH-138467) (#139987)
gh-116738: test `dbm.gnu` module on FT Python build (GH-138467)
(cherry picked from commit a18843dbfb)

Co-authored-by: Alper <alperyoney@fb.com>
2025-10-12 12:51:42 +00:00
Miss Islington (bot)
07eb67b859
[3.14] gh-127081: add critical sections to dbm objects (gh-132749) (#139996)
gh-127081: add critical sections to `dbm` objects (gh-132749)
(cherry picked from commit ffaeb3dddf)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
2025-10-12 17:56:29 +05:30
Miss Islington (bot)
3b9694a8e6
[3.14] gh-139988: fix a leak when failing to create a Union type (GH-139990) (#139993)
gh-139988: fix a leak when failing to create a Union type (GH-139990)
(cherry picked from commit 6710156bd2)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-12 11:16:43 +00:00
Miss Islington (bot)
ae91b4bcd0
[3.14] gh-101100: Fix Sphinx warnings in Doc/library/signal.rst (GH-139930) (GH-139966)
gh-101100: Fix Sphinx warnings in `Doc/library/signal.rst` (GH-139930)
(cherry picked from commit 447c7a89fb)

Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
2025-10-11 18:34:30 +00:00
Miss Islington (bot)
187588e675
[3.14] gh-139929: fix incorrect OpenSSL version-based guard in _ssl.c (GH-139945) (#139964)
gh-139929: fix incorrect OpenSSL version-based guard in `_ssl.c` (GH-139945)

fix OpenSSL version-based guards
(cherry picked from commit cdd3eee7fc)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-11 17:59:55 +00:00
Miss Islington (bot)
46148d18a2
[3.14] gh-139905: Provide suggestion in error message if Generic.__init_subclass__ was not called (GH-139943) (#139955)
gh-139905: Provide suggestion in error message if `Generic.__init_subclass__` was not called (GH-139943)
(cherry picked from commit 5776d0d2e0)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-11 15:40:23 +00:00
Miss Islington (bot)
1a355d7366
[3.14] gh-96491: Deduplicate version in IDLE shell title (GH-139841) (#139931)
gh-96491: Deduplicate version in IDLE shell title (GH-139841)

Saving to a file added both the filename and repeated the version.
---------
(cherry picked from commit d4e5802588)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-10-11 02:02:34 +00:00
Miss Islington (bot)
2660e98b30
[3.14] gh-139001: Fix thread-safety issue in pathlib.Path (gh-139066) (gh-139926)
Don't cache the joined path in `_raw_path` because the caching isn't thread safe.
(cherry picked from commit d9b4eef71e)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-10-10 21:47:47 +00:00
Miss Islington (bot)
7ea79f6342
[3.14] gh-138843: Removing "Unpacking" section from Download page (GH-139921)
(cherry picked from commit aa840f500c)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-10 14:31:38 -05:00
Kumar Aditya
72f25a8d9a
[3.14] gh-139894: fix incorrect sharing of current task while forking in asyncio (GH-139897) (#139913)
* [3.14] gh-139894: fix incorrect sharing of current task while forking in `asyncio`  (GH-139897)

Fix incorrect sharing of current task with the forked child process by clearing thread state's current task and current loop in `PyOS_AfterFork_Child`.
(cherry picked from commit b881df47ff)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>

* Update Lib/test/test_asyncio/test_unix_events.py
2025-10-10 22:36:02 +05:30
Miss Islington (bot)
60d15e1717
[3.14] gh-101100: Document zlib public constants to fix reference warnings (GH-139835) (#139910)
gh-101100: Document `zlib` public constants to fix reference warnings (GH-139835)
(cherry picked from commit c7f1da97eb)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-10 17:38:35 +02:00
Miss Islington (bot)
f8eb754dab
[3.14] gh-139843: Document signals (SIGSTOP, SIGVTALRM, SIGPROF) to fix sphinx references (GH-139896) (GH-139908)
gh-139843: Document signals (SIGSTOP, SIGVTALRM, SIGPROF) to fix sphinx references (GH-139896)
(cherry picked from commit 302f19d1f1)

Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
2025-10-10 15:36:01 +00:00
Miss Islington (bot)
51b1043029
[3.14] gh-138860: Lazy import rlcompleter in pdb to avoid deadlock in subprocess (GH-139185) (GH-139305) (GH-139280)
* gh-138860: Lazy import rlcompleter in pdb to avoid deadlock in subprocess (GH-139185)
(cherry picked from commit c8624cd367)

* gh-139289: Lazy import rlcompleter to fix the refleak (GH-139305)
(cherry picked from commit 8288f3693f)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2025-10-10 16:23:52 +02:00
Miss Islington (bot)
ade6dea24b
[3.14] gh-139065: Fix trailing space before long word in textwrap (GH-139070) (GH-139902)
Fix trailing space before a wrapped long word if the line length with
a space is exactly "width".
(cherry picked from commit 1c598e0436)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-10 13:54:46 +00:00
Miss Islington (bot)
08738ce521
[3.14] gh-139783: Fix inspect.getsourcelines() for the case when a decorator is followed by a comment or an empty line (GH-139836) (GH-139889)
(cherry picked from commit f4104f5d74)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-10 08:18:32 +00:00
Miss Islington (bot)
5d34830f4d
[3.14] gh-139823: Extend list of optional dependencies in configure.rst (GH-139826) (#139887)
gh-139823: Extend list of optional dependencies in `configure.rst` (GH-139826)
(cherry picked from commit 8f14bddeae)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-10 06:56:05 +00:00
Miss Islington (bot)
321dfb2ff5
[3.14] gh-139843: Document signal.SIGQUIT to fix Sphinx references (GH-139844) (#139885)
gh-139843: Document `signal.SIGQUIT` to fix Sphinx references (GH-139844)
(cherry picked from commit 1f87d528a1)

Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
2025-10-10 06:30:53 +00:00
Miss Islington (bot)
60732d7397
[3.14] gh-139842: Clarify __module__ description in typing.rst (GH-139863) (#139869)
Co-authored-by: Timothée Mazzucotelli <dev@pawamoy.fr>
2025-10-09 18:01:53 +00:00
Miss Islington (bot)
af1cb1cdb8
[3.14] GH-139809: Fix argparse subcommand prog not respecting color environment variables (GH-139818) (#139866)
GH-139809: Fix argparse subcommand prog not respecting color environment variables (GH-139818)
(cherry picked from commit 9fc4366f09)

Co-authored-by: Savannah Ostrowski <savannah@python.org>
2025-10-09 17:19:54 +00:00
Miss Islington (bot)
2cc13ff304
[3.14] gh-139672: Remove references to passlib (GH-139673) (#139867)
gh-139672: Remove references to `passlib` (GH-139673)
(cherry picked from commit 04461510fb)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2025-10-09 17:19:35 +00:00
Miss Islington (bot)
925625447f
[3.14] gh-139845: do not print twice in default asyncio REPL (GH-139846) (#139859)
gh-139845: do not print twice in default asyncio REPL (GH-139846)
(cherry picked from commit a310b3a99d)

Co-authored-by: yihong <zouzou0208@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-09 16:13:11 +00:00
Miss Islington (bot)
8761d6e644
[3.14] gh-139391: properly handle signal.signal() in UnixConsole when called from a non-main thread (GH-139392) (#139858)
gh-139391: properly handle `signal.signal()` in `UnixConsole` when called from a non-main thread (GH-139392)
(cherry picked from commit b8c8b8f1d3)

Co-authored-by: yihong <zouzou0208@gmail.com>
2025-10-09 16:10:51 +00:00
Łukasz Langa
de87549eb8
[3.14] gh-133400: Fixed Ctrl+D (^D) behavior in :mod:_pyrepl module (GH-133883) (GH-139850)
(cherry picked from commit 81959a0364)

Co-authored-by: DeepWzh <wzh2012@outlook.com>
Co-authored-by: adam j hartz <adam@smatz.net>
2025-10-09 17:38:25 +02:00
Kumar Aditya
926d734840
[3.14] gh-116738: make mmap module thread-safe (GH-139237) (#139825)
* [3.14] gh-116738: make `mmap` module thread-safe (GH-139237)
(cherry picked from commit 7f155f9c46)

Co-authored-by: Alper <alperyoney@fb.com>
2025-10-09 20:19:03 +05:30
Miss Islington (bot)
7c03e9078d
[3.14] GH-129805: Clean up some changes from GH-129806 (GH-133540) (#138972)
Co-authored-by: Brandt Bucher <brandt@python.org>
2025-10-09 14:12:25 +03:00
Miss Islington (bot)
342b644bd2
[3.14] gh-139742: Add support for Python 3.14 t-string prefixes in IDLE colorizer and tests (GH-139756) (#139831)
gh-139742: Add support for Python 3.14 t-string prefixes in IDLE colorizer and tests (GH-139756)

Add 't' prefix to colorizer.py stringprefix regex to support Python 3.14 template strings.
Add t prefixes to test_colorizer.py source test text and adjust line numbers on test methods.
---------
(cherry picked from commit 6fd1418341)

Co-authored-by: Anuradha Agrawal <paysur2111@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-09 09:51:58 +00:00
Miss Islington (bot)
08faef865c
[3.14] gh-101100: Fix reference warnings in c-api/init.rst documenting PyGILState_STATE (GH-139572) (#139832)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-09 09:41:57 +00:00
Miss Islington (bot)
17873b9b9c
[3.14] gh-139743: Avoid import-time print in test_sqlite3 (GH-139746) (GH-139828)
(cherry picked from commit 65089406a5)

Co-authored-by: Peter <peter86225@gmail.com>
2025-10-09 08:25:38 +00:00
Miss Islington (bot)
56072f9c05
[3.14] gh-139805: Bump test_repl_eio timeout for slow builtbots (GH-139807) (#139812)
gh-139805: Bump `test_repl_eio` timeout for slow builtbots (GH-139807)
(cherry picked from commit e7e3d1d4a8)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-08 23:00:20 +00:00
Miss Islington (bot)
824c1bce48
[3.14] Remove Cirrus macOS runners from CI (GH-139799) (#139802)
Co-authored-by: Jacob Coffee <jacob@z7x.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-10-08 19:38:38 +00:00
Kumar Aditya
90cd009209
[3.14] gh-139748: fix leaks in AC error paths when using unicode FS-b… (#139789)
* [3.14] gh-139748: fix leaks in AC error paths when using unicode FS-based converters (GH-139765)
(cherry picked from commit b04a57deef)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-08 22:16:21 +05:30
Miss Islington (bot)
077652b44f
[3.14] gh-138843: Clean up downloads page (GH-138844) (#139796)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-10-08 16:21:50 +00:00
Dino Viehland
81dc8b12f0
[3.14] gh-139525: Don't specialize functions which have a modified vectorcall (GH-139524) (#139709)
Don't specialize functions which have a modified vectorcall
2025-10-08 09:13:34 -07:00
Miss Islington (bot)
1c1a0bdfdc
[3.14] gh-135676: Add a summary of source characters (GH-138194) (GH-139781)
(cherry picked from commit 59a6f9d8c5)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Micha Albert <info@micha.zone>
Co-authored-by: KeithTheEE <kmurrayis@gmail.com>
2025-10-08 18:07:05 +02:00
Miss Islington (bot)
14c923cc85
[3.14] gh-139736: Fix argparse indentation overshoot (GH-139738) (#139793)
gh-139736: Fix argparse indentation overshoot (GH-139738)
(cherry picked from commit 72e370c910)

Co-authored-by: ed <s@ocv.me>
Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
2025-10-08 16:02:08 +00:00
Miss Islington (bot)
4e3fc92c40
[3.14] gh-101100: Fix all Sphinx warnings in Doc/library/subprocess.rst (GH-139576) (#139787)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-08 18:45:37 +03:00
Miss Islington (bot)
ea1ed82fed
[3.14] gh-139774: use relaxed atomics for datetime hashes (GH-139775) (#139780)
gh-139774: use relaxed atomics for datetime hashes (GH-139775)
(cherry picked from commit 49fb46f555)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-08 21:09:09 +05:30
Miss Islington (bot)
f10dc2666c
gh-139769: Update PCBuild/find_python.bat to allow discovery of Python 3.14 (GH-139770)
Enable 3.14 py.exe can be use on PCBuild
(cherry picked from commit 570d17259f)

Co-authored-by: Wulian233 <1055917385@qq.com>
2025-10-08 15:26:22 +00:00
Miss Islington (bot)
d8898e1fbe
Adds support for building with VisualStudioVersion = 18.0 (GH-138980)
(cherry picked from commit 6920fa4bcd)

Co-authored-by: Steve Dower <steve.dower@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-08 16:13:13 +01:00
Miss Islington (bot)
c5ab1b7661
[3.14] GH-139590: Run ruff format on pre-commit for Tools/wasm (GH-139591) (#139744)
Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-10-08 08:11:09 -07:00
Miss Islington (bot)
a96cde9f80
[3.14] gh-133210: Fix test_pydoc without docstrings (GH-139654) (#139777)
gh-133210: Fix `test_pydoc` without docstrings (GH-139654)
(cherry picked from commit 708de26e31)

Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2025-10-08 14:15:52 +00:00
Miss Islington (bot)
d8bdc1e6f7
[3.14] gh-133210: Fix test_inspect without docstrings (GH-139651) (#139776)
gh-133210: Fix `test_inspect` without docstrings (GH-139651)
(cherry picked from commit 7c70cc5c23)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-10-08 14:14:19 +00:00
Miss Islington (bot)
b5230d73a9
[3.14] gh-83424: Allow empty name if handle is non-null when create ctypes.CDLL on Windows (GH-136878) (#138546)
gh-83424: Allow empty name if handle is non-null when create ctypes.CDLL on Windows (GH-136878)
(cherry picked from commit ed522ed211)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-08 15:56:13 +02:00
Miss Islington (bot)
d729fcf6e3
[3.14] gh-137589: Zipfile tests: close file objects (GH-138080) (#139766)
gh-137589: Zipfile tests: close file objects (GH-138080)

Zipfile tests: close file objects
(cherry picked from commit 5cea843594)

Co-authored-by: Rogdham <3994389+Rogdham@users.noreply.github.com>
2025-10-08 15:52:08 +02:00
Miss Islington (bot)
7e23d36770
[3.14] gh-137317: Fix inspect.signature() for class with wrapped __init__ or __new__ (GH-137862) (#138224)
gh-137317: Fix inspect.signature() for class with wrapped __init__ or __new__ (GH-137862)

Fixed several cases where __init__, __new__ or metaclass` __call__ is a descriptor
that returns a wrapped function.
(cherry picked from commit 025a2135ef)

Co-authored-by: Ju4tCode <42488585+yanyongyu@users.noreply.github.com>
2025-10-08 15:48:06 +02:00
Miss Islington (bot)
c05053589f
[3.14] gh-101100: Fix some Sphinx reference warnings in `whatsnew/2.6.rst` (GH-139236) (GH-139568)
(cherry picked from commit 04a2f80a60)

Co-authored-by: rowanbudge <rowanbudge@gmail.com>
Co-authored-by: rowanvil <rowan@anvil.works>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-10-08 14:46:41 +02:00
Miss Islington (bot)
fb223e691e
[3.14] GH-137573: Add test to check that the margin used for overflow protection is larger than the stack space used by the interpreter (GH-137724) (GH-139295)
(cherry picked from commit 16eae6d90d)

Co-authored-by: Mark Shannon <mark@hotpy.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-08 14:44:16 +02:00
Miss Islington (bot)
5579708b1c
[3.14] gh-60462: Fix locale.strxfrm() on Solaris (GH-138242) (GH-138448)
It should interpret the result of wcsxfrm() as a sequence of abstract
integers, not a sequence of Unicode code points or using other encoding
scheme that does not preserve ordering.
(cherry picked from commit 482fd0c811)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-08 14:34:51 +02:00
Miss Islington (bot)
4e8f5e65eb
[3.14] gh-137490: Fix signal.sigwaitinfo() on NetBSD (GH-137523) (GH-138935)
Handle ECANCELED in the same way as EINTR to work around the Posix
violation in the NetBSD's implementation.
(cherry picked from commit 07d0b95b05)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-08 14:33:30 +02:00
Miss Islington (bot)
cbd532f2e8
[3.14] gh-137056: Fix DTrace build support on NetBSD (GH-137057) (GH-137444)
(cherry picked from commit 54a5fdffc8)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
2025-10-08 14:31:26 +02:00
Miss Islington (bot)
7ed5419604
[3.14] gh-137463: Update validate_abstract_methods in test_collections.py (GH-137464) (GH-137503)
Update `validate_abstract_methods` in `test_collections.py`

The test for missing abstract methods in `validate_abstract_methods` incorrectly attempted to instantiate the generated class `C` with an argument (`C(name)`), which always raises a `TypeError: C() takes no arguments`. Although the test originally passes, it passes for the wrong reason.

This change makes the test correctly validate the enforcement of abstract methods in ABCs.
(cherry picked from commit 5be872350d)

Co-authored-by: Guilherme Leobas <guilhermeleobas@gmail.com>
2025-10-08 14:30:54 +02:00
Miss Islington (bot)
333cab0da7
[3.14] gh-137754: Fix import of zoneinfo if _datetime is not available (GH-137845) (GH-138084)
Both modules should use the Python implementation in that case.
(cherry picked from commit 6620ef0ff6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-08 14:28:41 +02:00
Miss Islington (bot)
0188e0fd38
[3.14] gh-137986: Fix and improve the csv functions docstrings (GH-137987) (GH-138107)
The csv.register_dialect() docstring no longer imply that it returns a dialect.
All functions have now signatures.
(cherry picked from commit aa1dbd4dde)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: maurycy <5383+maurycy@users.noreply.github.com>
2025-10-08 14:27:57 +02:00
Miss Islington (bot)
ebbce6b0f9
[3.14] gh-71679: Improve tests for repr() of bytes and bytearray (GH-138180) (GH-138182)
* Merge existing tests test_repr_str and test_to_str.
* Add more tests for non-printable and non-ASCII bytes.
* Add tests for special escape sequences ('\t\n\r').
* Add tests for slashes.
* Add more tests for quotes.
* Add tests for subclasses.
* Add test for non-ASCII class name.
* Only apply @check_bytes_warnings for str() tests.
(cherry picked from commit 0dbbf61cc2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-08 14:27:28 +02:00
Miss Islington (bot)
d424344ce9
[3.14] bpo-41839: Fix error checking in sched_get_priority_ functions (GH-22374) (GH-138201)
(cherry picked from commit bbcb75c986)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2025-10-08 14:26:59 +02:00
Miss Islington (bot)
669253fde5
[3.14] gh-138204: Forbid expansion of a shared anonymous mmap on Linux (GH-138220) (GH-138386)
This is a Linux kernel bug which caused a bus error.
https://bugzilla.kernel.org/show_bug.cgi?id=8691
(cherry picked from commit 33fcb0c4a0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-08 14:26:09 +02:00
Miss Islington (bot)
8da7c7e1f3
[3.14] gh-88375, gh-111788: Fix parsing errors and normalization in robotparser (GH-138502) (GH-138548)
* Don't fail trying to parse weird patterns.
* Don't fail trying to decode non-UTF-8 "robots.txt" files.
* No longer ignore trailing "?" in patterns and URLs.
* Distinguish raw special characters "?", "=" and "&" from the
  percent-encoded ones.
* Remove tests that do nothing.
(cherry picked from commit cb7ef18d70)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-08 14:22:44 +02:00
Miss Islington (bot)
3013683e99
[3.14] gh-118981: multiprocessing.popen_spawn_posix, fix potential hang (gh-118982) (GH-138605)
fix potential hang.

It can happen that the child crashes right in the beginning for whatever reason. In this case, the parent will hang when writing into the pipe, because the child fd is not closed yet.

The normal pattern is to close the child fds right after the child proc is forked/executed/spawned, so when the child dies, then also the pipes will be closed, and there will be no hang (the parent gets SIGPIPE instead).
(cherry picked from commit 8ed5a2b56c)

Co-authored-by: Albert Zeyer <albzey@gmail.com>
2025-10-08 14:22:05 +02:00
Miss Islington (bot)
32233d68d8
[3.14] gh-70765: avoid waiting for HTTP headers when parsing HTTP/0.9 requests (GH-139514) (#139600)
(cherry picked from commit 13dc2fde8c)
(cherry picked from commit 1fe89d324e)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-08 10:39:59 +00:00
Miss Islington (bot)
297157d968
[3.14] gh-92266: Update pre-commit (GH-139411) (#139466)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-10-08 13:25:17 +03:00
Bénédikt Tran
8ad6eda483
[3.14] gh-136912: fix handling of OverflowError in hmac.digest (GH-136917) (#137116)
The OpenSSL and HACL* implementations of HMAC single-shot
digest computation reject keys whose length exceeds `INT_MAX`
and `UINT32_MAX` respectively. The OpenSSL implementation
also rejects messages whose length exceed `INT_MAX`.

Using such keys in `hmac.digest` previously raised an `OverflowError`
which was propagated to the caller. This commit mitigates this case by
making `hmac.digest` fall back to HMAC's pure Python implementation
which accepts arbitrary large keys or messages.

This change only affects the top-level entrypoint `hmac.digest`, leaving
`_hashopenssl.hmac_digest` and `_hmac.compute_digest` untouched.

(cherry picked from commit d658b9053b)
2025-10-08 12:09:45 +02:00
Miss Islington (bot)
c625839237
[3.14] gh-91214: Skip tests failing on Solaris (GH-31978) (GH-138450)
(cherry picked from commit 34ed03875a)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2025-10-08 11:42:42 +03:00
Miss Islington (bot)
8ab7081015
[3.14] gh-135386: Fix "unable to open database file" errors on readonly DB (GH-135566) (GH-138056)
Add immutable=1 flag for read-only SQLite access to avoid WAL/SHM errors on readonly DB.
(cherry picked from commit c0ae92b7c0)

Co-authored-by: General_K1ng <generak1ng0@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-08 11:41:09 +03:00
Miss Islington (bot)
51dfc67092
[3.14] gh-138010: Fix __init_subclass__ forwarding by warnings.deprecated (GH-138210) (#138561)
gh-138010: Fix `__init_subclass__` forwarding by `warnings.deprecated` (GH-138210)
(cherry picked from commit e2c038f5be)

Co-authored-by: Brian Schubert <brianm.schubert@g
2025-10-07 21:29:28 -07:00
Miss Islington (bot)
e104aadcaf
[3.14] gh-127647: Fix and enable I/O protocol tests (GH-138369) (#138376)
gh-127647: Fix and enable I/O protocol tests (GH-138369)
(cherry picked from commit 3f23888fd7)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2025-10-07 21:29:02 -07:00
Miss Islington (bot)
dd5d86c7d5
[3.14] gh-137706: make typing._is_unpacked_typevartuple check for True instead of truthy (GH-137712) (#138574)
gh-137706: make typing._is_unpacked_typevartuple check for `True` instead of truthy (GH-137712)
(cherry picked from commit 7e652f402f)

Co-authored-by: David Ellis <ducksual@gmail.com>
2025-10-07 21:23:47 -07:00
Miss Islington (bot)
ed0e63fd0a
[3.14] gh-138558: Improve handling of Template annotations in annotationlib (GH-139072) (#139272)
gh-138558: Improve handling of Template annotations in annotationlib (GH-139072)
(cherry picked from commit 6ec058a1f7)

Co-authored-by: Dave Peck <davepeck@gmail.com>
2025-10-07 21:23:22 -07:00
Miss Islington (bot)
9e0b7d0866
[3.14] GH-137484: Have Tools/wasm/wasi use the build triple instead of "build" (GH-137485) (#137487)
GH-137484: Have `Tools/wasm/wasi` use the build triple instead of "build" (GH-37485)

This should help prevent issuse where something like a container is used to do one build and then someone tries to build again locally.
(cherry picked from commit 0953200b13)

Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-08 02:11:31 +00:00
Miss Islington (bot)
6b26e62f37
[3.14] gh-138813: Fix mutable default kwargs={} in multiprocessing BaseProcess and DummyProcess to use None (GH-138814) (#139084)
gh-138813: Fix mutable default kwargs={} in multiprocessing BaseProcess and DummyProcess to use None (GH-138814)

* gh-138813: Default `BaseProcess` `kwargs` to `None` (GH-138814)

Set `BaseProcess.__init__(..., kwargs=None)` and initialize `kwargs` with
`dict(kwargs) if kwargs else {}`. This avoids a shared mutable default and
matches threading.Thread behavior.



* DummyProcess kwargs=None (which threading.Thread accepts properly)
(cherry picked from commit 5a15e73789)

Co-authored-by: Denis Sergeev <newjimbatler00@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-10-08 00:37:30 +00:00
Miss Islington (bot)
64f0e2d6fa
[3.14] gh-126631: gh-137996: fix pre-loading of __main__ (GH-135295) (#138607)
gh-126631: gh-137996: fix pre-loading of `__main__` (GH-135295)

gh-126631: gh-137996: fix pre-loading of `__main__`

The `main_path` parameter was renamed `init_main_from_name`, update the
forkserver code accordingly.  This was leading to slower startup times when people
were trying to preload the main module.

---------
(cherry picked from commit 0912b3a6db)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-10-08 00:37:04 +00:00
Miss Islington (bot)
6b090c9272
[3.14] GH-137248: Add a --logdir option to Tools/wasm/wasi (GH-137249) (GH-137252)
GH-137248: Add a `--logdir` option to `Tools/wasm/wasi` (GH-137249)
(cherry picked from commit 94498a53f3)

Co-authored-by: Brett Cannon <brett@python.org>
2025-10-07 23:51:19 +00:00
Miss Islington (bot)
9f97fa30f8
[3.14] GH-137243: Have Tools/wasm/wasi detect WASI SDK installs in /opt when the release tarball is extracted (GH-137244) (GH-137250)
GH-137243: Have `Tools/wasm/wasi` detect WASI SDK installs in `/opt` when the release tarball is extracted (GH-137244)
(cherry picked from commit 2f1a9f2ed4)

Co-authored-by: Brett Cannon <brett@python.org>
2025-10-07 23:13:35 +00:00
Miss Islington (bot)
357618266b
[3.14] Drop explicit tool installation in the dev container (GH-138211) (GH-138212)
Drop explicit tool installation in the dev container (GH-138211)

This is now handled upstream in the dev container image itself.
(cherry picked from commit d910b93f78)

Co-authored-by: Brett Cannon <brett@python.org>
2025-10-07 21:38:31 +00:00
Miss Islington (bot)
d11e69d620
[3.14] gh-139700: Check consistency of the zip64 end of central directory record (GH-139702) (GH-139706)
Support records with "zip64 extensible data" if there are no bytes
prepended to the ZIP file.
(cherry picked from commit 162997bb70)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 23:16:26 +02:00
Miss Islington (bot)
09fdd219a5
[3.14] gh-105487: Fix __dir__ entries of GenericAlias (GH-138578) (GH-138629)
(cherry picked from commit b0420b505e)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-10-07 23:12:13 +02:00
Miss Islington (bot)
63bd8cfcdb
[3.14] gh-138729: Cover inspect.formatannotationrelativeto with tests (GH-138730) (GH-138747)
(cherry picked from commit f5fa336579)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-10-07 23:10:49 +02:00
Miss Islington (bot)
dfdda53e67
[3.14] gh-138432: Improved invalid path checking in zoneinfo.reset_tzpath() (GH-138433) (GH-138777)
* Improve error messages for path-like relative paths and path-like bytes paths.
* TZPATH is now always a tuple of strings.
(cherry picked from commit 859aecc33b)

Co-authored-by: Stephen Morton <git@tungol.org>
2025-10-07 23:06:37 +02:00
Miss Islington (bot)
61d49a5d37
[3.14] gh-138239: Fix incorrect highlighting of "type" in type statements in the REPL (GH-138241) (GH-138937)
(cherry picked from commit 26cfb17942)

Co-authored-by: 00ll00 <40747228+00ll00@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-07 23:02:32 +02:00
Miss Islington (bot)
e953cead61
[3.14] Touch up Setup.local handling in Tools/wasm/wasi (GH-137051) (GH-137053)
Touch up `Setup.local` handling in `Tools/wasm/wasi` (GH-137051)

The comment in the generated file is now more self-explanatory. The checks for unexpected file contents are also strengthened.
(cherry picked from commit ec7fad79d2)

Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Zachary Ware <zach@python.org>
2025-10-07 20:58:53 +00:00
Miss Islington (bot)
a869796927
[3.14] gh-63161: Add more tests for source encoding (GH-139440) (GH-139442)
(cherry picked from commit b2f5ad0c6d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 22:51:14 +02:00
Miss Islington (bot)
2fc69e88e6
[3.14] gh-123441: Correct the supported languages of the iso-8859-4 codec (GH-137034) (GH-137419)
(cherry picked from commit 525784aa65)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-07 22:38:47 +02:00
Miss Islington (bot)
827c90b8b2
[3.14] Add test for opening an SQLite with bytes path (GH-136331) (GH-137632)
(cherry picked from commit 1bde13b0e9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 22:35:06 +02:00
Miss Islington (bot)
181cecc5c0
[3.14] gh-126008: Improve docstrings for Tkinter cget and configure methods (GH-133303) (GH-137660)
* Explain the behavior of Widget.configure() depending on arguments.
* Unify descriptions.
* Replace "resource" with "option".
(cherry picked from commit 027cacb67c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 22:34:36 +02:00
Serhiy Storchaka
9ec4e3838a
[3.14] gh-138264: Fix gcc 14 compiler warnings (GH-138265) (GH-138426)
(cherry picked from commit 4a33077fdb)
2025-10-07 22:26:05 +02:00
Stan Ulbrych
537b558ce9
[3.14] gh-137920: Fix semantically relevant typo in curses.window.attron (#137940) (GH-138506)
Originally authored by: vict-Yang

(cherry picked from commit ce70a57bc0)
2025-10-07 22:21:41 +02:00
Miss Islington (bot)
9853bbb1dc
[3.14] gh-134466: Don't run when termios is inaccessible (GH-138911) (GH-139029)
Without the ability to set required capabilities, the REPL cannot
function properly (syntax highlighting and multiline editing can't
work).
We refuse to work in this degraded state.

(cherry picked from commit 2fc7004d54)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-10-07 22:15:56 +02:00
Miss Islington (bot)
89a7b05f23
[3.14] gh-78319: Fix implementation of IMAP APPEND UTF8 (GH-9436) (GH-139406)
Make UTF8 support for the IMAP APPEND command RFC 6855 compliant.
(cherry picked from commit 408154d64a)

Co-authored-by: Gordon Messmer <gordon.messmer@gmail.com>
2025-10-07 22:12:30 +02:00
Miss Islington (bot)
f0f0566292
[3.14] gh-130567: Enable previously skipped locale tests on FreeBSD and macOS (GH-138652) (GH-139421)
(cherry picked from commit 1b8dcdacc7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 22:11:34 +02:00
Miss Islington (bot)
103766528f
[3.14] gh-139076: Fix regression in pydoc not showing extension functions (GH-139077) (GH-139160)
Fix a bug in the pydoc module that was hiding functions in a Python
module if they were implemented in an extension module and the module did
not have __all__.
(cherry picked from commit 7257b24140)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 21:57:28 +02:00
Miss Islington (bot)
b53f46a7b7
[3.14] Doc: Improve clarity for subinterpreters in What's New in 3.14 (GH-139221) (GH-139722)
(cherry picked from commit 25edfa7cf1)

Co-authored-by: Cornelius Roemer <cornelius.roemer@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-07 21:55:52 +02:00
Miss Islington (bot)
fff26500e5
[3.14] gh-130567: Fix possible crash in locale.strxfrm() (GH-138940) (GH-139265)
On some macOS versions there was an off-by-one error in wcsxfrm() which
caused writing past the end of the array if its size was not calculated
by running wcsxfrm() first.

(cherry picked from commit 5854cf38a2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 21:54:04 +02:00
Miss Islington (bot)
d912e9a852
[3.14] gh-69605: Hardcode some stdlib submodules in PyREPL module completion (os.path, collections.abc...) (GH-138268) (GH-138943)
(cherry picked from commit 537133d2b6)

Co-authored-by: Loïc Simon <loic.simon@napta.io>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-10-07 21:24:01 +02:00
Miss Islington (bot)
cde02ae782
[3.14] gh-139283: correctly handle size limit in cursor.fetchmany() (GH-139296) (GH-139441)
Passing a negative or zero size to `cursor.fetchmany()` made it fetch all rows
instead of none.

While this could be considered a security vulnerability, it was decided to treat
this issue as a regular bug as passing a non-sanitized *size* value in the first
place is not recommended.
(cherry picked from commit bc172ee830)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 21:23:08 +02:00
Miss Islington (bot)
cd8fc3aad3
[3.14] gh-95844: Move help_url code to a help module function (GH-129971) (#138484)
gh-95844: Move help_url code to a help module function (GH-129971)

---------
(cherry picked from commit 3b4cd88563)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-10-07 15:14:54 -04:00
Miss Islington (bot)
2f14d23013
[3.14] gh-139210: Fix use-after-free in xml.etree.ElementTree.iterparse() (GH-139211) (GH-139455)
(cherry picked from commit c86eb4d3ac)

Co-authored-by: Ken Jin <kenjin@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 21:13:27 +02:00
Miss Islington (bot)
df739f33d3
[3.14] gh-131178: Add tests for site command-line interface (GH-133582) (GH-137832)
gh-131178: Add tests for `site` command-line interface  (GH-133582)
(cherry picked from commit 03f5519d77)

Co-authored-by: ggqlq <124190229+ggqlq@users.noreply.github.com>
2025-10-07 19:11:43 +00:00
Brett Cannon
c7326813f5
[3.14] Always use the latest dev container image in devcontainer.json (GH-138003)
This is a manual backport of 14319a99e5 .
2025-10-07 12:07:36 -07:00
Miss Islington (bot)
ffc67b3505
[3.14] gh-138004: Fix setting a thread name on OpenIndiana (GH-138017) (#138384)
gh-138004: Fix setting a thread name on OpenIndiana (GH-138017)

Encode Solaris/Illumos thread names to ASCII, since
OpenIndiana does not support non-ASCII names.

Add tests for setting non-ASCII name for the main thread.
(cherry picked from commit c19db1d2b8)

Co-authored-by: jadonduff <jadon_duff@icloud.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 20:58:35 +02:00
Stan Ulbrych
a893270c6d
[3.14] gh-71648: Optimize PNG files (GH-138842) (GH-138851)
* Only keep > 1 kb savings
(cherry picked from commit 2e8f64c931)
2025-10-07 20:52:12 +02:00
Miss Islington (bot)
4429554223
[3.14] gh-116738: make cProfile module thread-safe (GH-138229) (#138575)
gh-116738: make `cProfile` module thread-safe (GH-138229)
(cherry picked from commit 8554c0917e)

Co-authored-by: Alper <alperyoney@fb.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-07 18:51:22 +00:00
Gregory P. Smith
e51acb3fa6
[3.14] gh-134698: Hold a lock when the thread state is detached in ssl (GH-134724) (GH-137107)
* [3.14] gh-134698: Hold a lock when the thread state is detached in `ssl` (GH-134724)

Lock when the thread state is detached.
(cherry picked from commit e047a35b23)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>

* Only lock the SSL context, not the SSL socket.

This solves a deadlock when a socket is blocked while waiting on data,
which ended up causing a major regression in 3.13.6 (see gh-137583).

---------

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-10-07 18:49:22 +00:00
Miss Islington (bot)
ed9c0c3cbe
[3.14] gh-137477: Fix inspect.getblock() for generator expressions (GH-137488) (#137993)
gh-137477: Fix inspect.getblock() for generator expressions (GH-137488)

This fixes also inspect.getsourcelines() and inspect.getsource().
(cherry picked from commit eae9d7de1c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 20:48:40 +02:00
Miss Islington (bot)
137c784fbf
[3.14] gh-136914: Fix support of cached functions and properties in DocTest's lineno computation (GH-136930) (#137616)
gh-136914: Fix support of cached functions and properties in DocTest's lineno computation (GH-136930)

Previously, DocTest's lineno of functions and methods decorated with
functools.cache(), functools.lru_cache() and functools.cached_property()
was not properly returned (None was returned) because the
computation relied on inspect.isfunction() which does not consider the
decorated result as a function.

We now use the more generic inspect.isroutine(), as elsewhere
in doctest's logic.

Also, added a special case for functools.cached_property().
(cherry picked from commit fece15d29f)

Co-authored-by: Denis Laxalde <denis@laxalde.org>
2025-10-07 20:48:10 +02:00
Miss Islington (bot)
ac147be05f
[3.14] gh-137440: Update comment in Python/hamt.c on importing for testing (GH-137441) (#137519)
gh-137440: Update comment in Python/hamt.c on importing for testing (GH-137441)

Switch from `_testcapi` to `_testinternalcapi`.
(cherry picked from commit 7ab68cd506)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-10-07 20:47:26 +02:00
Miss Islington (bot)
e09f33e5bf
[3.14] gh-137433: Fix deadlock with stop-the-world and daemon threads (gh-137735) (GH-138965)
There was a deadlock originally seen by Memray when a daemon thread
enabled or disabled profiling while the interpreter was shutting down.
I think this could also happen with garbage collection, but I haven't
seen that in practice.

The daemon thread could be hung while trying acquire the global rwmutex
that prevents overlapping global and per-interpreter stop-the-world events.
Since it already held the main interpreter's stop-the-world lock, it
also deadlocked the main thread, which is trying to perform interpreter
finalization.

Swap the order of lock acquisition to prevent this deadlock.
Additionally, refactor `_PyParkingLot_Park` so that the global buckets
hashtable is left in a clean state if the thread is hung in
`PyEval_AcquireThread`.

(cherry picked from commit 90fe3250f8)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-10-07 20:46:52 +02:00
Miss Islington (bot)
db8b943259
[3.14] GH-92266: Remove embedded tabs from `c-analyzer/cpython/_parser.py` (GH-137622) (#139718)
GH-92266: Remove embedded tabs from ``c-analyzer/cpython/_parser.py`` (GH-137622)
(cherry picked from commit 2212ae5557)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-07 18:45:49 +00:00
Miss Islington (bot)
c4be405fe9
[3.14] gh-137044: Support large limit values in getrlimit() and setrlimit() (GH-137338) (#137506)
gh-137044: Support large limit values in getrlimit() and setrlimit() (GH-137338)

* Return large limit values as positive integers instead of negative integers
  in resource.getrlimit().
* Accept large values and reject negative values (except RLIM_INFINITY)
  for limits in resource.setrlimit().
(cherry picked from commit baefaa6cba)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 20:43:12 +02:00
Miss Islington (bot)
b414ad1043
[3.14] gh-81325: Support path-like objects with streaming TarFile (GH-137188) (#137365)
gh-81325: Support path-like objects with streaming TarFile (GH-137188)
(cherry picked from commit 3ec3d05345)

Co-authored-by: Alexander Urieles <aeurielesn@users.noreply.github.com>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-10-07 20:40:42 +02:00
Miss Islington (bot)
a868c6a70d
[3.14] gh-136520: Clarify docs for _pack_ & _align_ (GH-137036) (#137381)
gh-136520: Clarify docs for _pack_ & _align_ (GH-137036)

Move docs to the reference section & reduce the “tutorial” part to a quick intro & link.

Clarify what values are accepted.

Add macro/attribute equivalents.

Discourage _align_ values that aren't powers of two.
(cherry picked from commit 8943bb722f)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 20:39:57 +02:00
Miss Islington (bot)
14e8decde7
[3.14] gh-137273: Fix debug assertion failure in locale.setlocale() on Windows (GH-137300) (#137305)
gh-137273: Fix debug assertion failure in locale.setlocale() on Windows (GH-137300)

It happened when there were at least 16 characters after dot in the
locale name.
(cherry picked from commit 718e0c89ba)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 20:39:13 +02:00
Erlend E. Aasland
ebbfd8f51a
[3.14] gh-138736: Fix sqlite3.Connection.blobopen 'row' parameter type and naming (#138738) (GH-139062)
(cherry picked from commit 8eb106240f)

Co-authored-by: chiri <chirizxc@proton.me>
2025-10-07 20:38:26 +02:00
Miss Islington (bot)
4bb33ff1c1
[3.14] gh-138779: Use the dev_t converter for st_rdev (GH-138780) (#138926)
gh-138779: Use the dev_t converter for st_rdev (GH-138780)

This allows to support device numbers larger than 2**63-1.
(cherry picked from commit 43013f72f0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-08 00:06:55 +05:30
Miss Islington (bot)
77b4ed2a37
[3.14] gh-138489: Add missing build-details.json step for building wasm (GH-139302) (GH-139557)
(cherry picked from commit db53ca30d7)

Signed-off-by: Ho Kim <ho.kim@ulagbulag.io>
Co-authored-by: Ho Kim <ho.kim@ulagbulag.io>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-07 20:35:38 +02:00
Miss Islington (bot)
29cffb1c02
[3.14] fix comment reference from man 7 signal to man 7 signal-safety (GH-138554) (#138594)
fix comment reference from man 7 signal to man 7 signal-safety (GH-138554)
(cherry picked from commit 2f5ace780b)


docs: fix comment reference from man 7 signal to man 7 signal-safety

Co-authored-by: mqudah <mohghq@gmail.com>
2025-10-07 19:34:15 +01:00
Miss Islington (bot)
0a517786af
[3.14] Bump mypy to 1.17.1 (GH-137542) (#137543)
Bump mypy to 1.17.1 (GH-137542)
(cherry picked from commit fb1cb00030)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-10-07 19:32:55 +01:00
Miss Islington (bot)
e2c901782d
[3.14] gh-138952: Document platform.machine() output casing inconsistency across platforms (GH-138962) (#139045)
gh-138952:  Document platform.machine() output casing inconsistency across platforms (GH-138962)
(cherry picked from commit dd15a2e11e)

Co-authored-by: Aniket <148300120+Aniketsy@users.noreply.github.com>
Co-authored-by: AN Long <aisk@users.noreply.github.com>
2025-10-07 19:30:21 +01:00
Miss Islington (bot)
8db6615886
[3.14] gh-129368: In PyRun C API docs, clarify what a "start token" is (GH-129935) (#139042)
gh-129368: In PyRun C API docs, clarify what a "start token" is (GH-129935)
(cherry picked from commit e1eca8b308)

Co-authored-by: Rajhans Jadhao <rajhans.jadhao@gmail.com>
2025-10-07 19:30:05 +01:00
Serhiy Storchaka
700d425564
[3.14] Update the dbm documentation (GH-137919) (#137962)
Unify documentation for all backends, enumerate all not implemented mapping
methods, document particularities of implemented mapping methods.
(cherry picked from commit 8700404f86)
2025-10-07 19:26:00 +01:00
Serhiy Storchaka
b4d8faa221
[3.14] Update the availability info in the resource docs (#137939)
Update the availability info in the resource docs
2025-10-07 19:25:34 +01:00
Miss Islington (bot)
99c1d09016
[3.14] gh-130102: drop "require numeric arguments" from pow() docs (GH-137456) (#137536)
gh-130102: drop "require numeric arguments" from pow() docs (GH-137456)
(cherry picked from commit 37b5a0d671)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Senthil Kumaran <senthil@python.org>
2025-10-07 19:25:25 +01:00
Miss Islington (bot)
2de18f251a
[3.14] gh-138772: Add tests for Turtle.dot() signature (GH-138773) (GH-139326)
(cherry picked from commit 2462807b70)

Co-authored-by: Jan-Eric Nitschke <47750513+JanEricNitschke@users.noreply.github.com>
2025-10-07 20:24:59 +02:00
Miss Islington (bot)
f899c849d4
[3.14] Remove unmatched closing parenthesis (GH-139082) (#139099)
Remove unmatched closing parenthesis (GH-139082)
(cherry picked from commit d22b25081b)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2025-10-07 19:24:17 +01:00
Miss Islington (bot)
08673d8a51
[3.14] gh-116738: add multi-threaded tests for resource module on free-threading builds (GH-138504) (#138793)
gh-116738: add multi-threaded tests for `resource` module on free-threading builds (GH-138504)
(cherry picked from commit 32e1e0699f)

Co-authored-by: Alper <alperyoney@fb.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-07 18:23:58 +00:00
Miss Islington (bot)
898be571a2
[3.14] Doc/library/zoneinfo.rst: Fix typo (GH-139190) (#139229)
(cherry picked from commit 4fb338d844)
2025-10-07 19:23:39 +01:00
Miss Islington (bot)
7c26f0fe4e
[3.14] gh-115119: Defer --with-system-libmpdec removal to 3.16 (GH-139318) (#139347)
gh-115119: Defer `--with-system-libmpdec` removal to 3.16 (GH-139318)
(cherry picked from commit 0aab07ccf7)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-10-07 19:23:18 +01:00
Miss Islington (bot)
6d94af4b98
[3.14] gh-139327: fix some reference leaks in sqlite3 error branches (GH-139328) (GH-139471)
(cherry picked from commit d0a3eff9d6)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-07 20:22:20 +02:00
Miss Islington (bot)
b4c3c0f4bf
[3.14] gh-139308: Skip test_special_chars_csh on NetBSD due to csh variable expansion issue (GH-139341) (GH-139559)
(cherry picked from commit ae6e7f572c)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
2025-10-07 20:20:57 +02:00
Miss Islington (bot)
3a880241c6
[3.14] Replace ambiguous word "pound" by "hash" in difflib docs (GH-139601) (GH-139616)
(cherry picked from commit dadbb2662a)

Co-authored-by: George Ogden <38294960+George-Ogden@users.noreply.github.com>
2025-10-07 20:19:50 +02:00
Miss Islington (bot)
9eee7fe717
[3.14] gh-135944: Add a "Runtime Components" Section to the Execution Model Docs (gh-135945) (#139509)
gh-135944: Add a "Runtime Components" Section to the Execution Model Docs (gh-135945)

The section provides a brief overview of the Python runtime's execution environment.  It is meant to be implementation agnostic,
(cherry picked from commit 46a1f0a9ff)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-10-07 19:19:42 +01:00
Miss Islington (bot)
85c45571ae
[3.14] gh-139646: fix typo in pickletools error message (GH-139647) (GH-139649)
(cherry picked from commit 36a6c2cdfa)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong <zouzou0208@gmail.com>
2025-10-07 20:19:01 +02:00
Kumar Aditya
23cc8f789d
[3.14] gh-132551: make io.BytesIO thread safe (GH-132616) (#138551)
* [3.14] gh-132551: make `io.BytesIO` thread safe (GH-132616)
(cherry picked from commit 5dd3a3a58c)

Co-authored-by: Tomasz Pytel <tompytel@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-07 23:48:28 +05:30
Miss Islington (bot)
bf397e272c
[3.14] gh-133467: fix data race in type_set_name (GH-137302) (#137303)
gh-133467: fix data race in `type_set_name` (GH-137302)

Fix data race in `type_set_name` by assigning name under stop the world pause making it thread safe in free-threading.
(cherry picked from commit e99bc7fd44)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-07 18:18:23 +00:00
Miss Islington (bot)
070993b8ad
[3.14] gh-135729: Store reference to globals in Interpreter._decref (GH-139104) (GH-139112)
* gh-135729: Store reference to globals in `Interpreter._decref` (GH-139104)
(cherry picked from commit 571210b8f3)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-10-07 14:18:15 -04:00
Miss Islington (bot)
5b64b59618
[3.14] gh-138854: Skip test_script_shadowing_stdlib_cwd_failure on AIX (GH-138855) (GH-139674)
(cherry picked from commit 171f787a29)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
2025-10-07 20:16:55 +02:00
Miss Islington (bot)
f38a015552
[3.14] gh-75989: TarFile.extractall and TarFile.extract now overwrite symlinks when extracting hardlinks (GH-137316) (GH-139705)
(cherry picked from commit 481d5b5455)

Co-authored-by: Alexander Urieles <aeurielesn@users.noreply.github.com>
2025-10-07 20:16:20 +02:00
Miss Islington (bot)
d76a0ce4d0
[3.14] gh-137025: Include `python.worker.mjs` in the Emscripten Web Example (GH-137236) (#137272)
gh-137025: Include ``python.worker.mjs`` in the Emscripten Web Example (GH-137236)
(cherry picked from commit d5191ba99b)

Co-authored-by: adam j hartz <hz@mit.edu>
2025-10-07 19:15:33 +01:00
Sergey B Kirpichev
058c2770a2
[3.14] gh-122450: Expand documentation for `Rational and Fraction` (GH-136800) (#137363)
(cherry picked from commit b266fbc9ec)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 19:15:22 +01:00
Miss Islington (bot)
134586aaf3
[3.14] gh-137390: Add missing line continuation character in configure.ac (GH-137391) (#137394)
gh-137390: Add missing line continuation character in configure.ac (GH-137391)
(cherry picked from commit 001461a292)

Co-authored-by: markmcclain <markmcclain@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2025-10-07 19:15:05 +01:00
Miss Islington (bot)
94f57ac206
[3.14] gh-131885: Use positional-only markers for `max() and min()` (GH-131868) (#137656)
gh-131885: Use positional-only markers for ``max()`` and ``min()`` (GH-131868)
(cherry picked from commit dd079db4b9)

Co-authored-by: Evan Kohilas <ekohilas@users.noreply.github.com>
2025-10-07 19:14:40 +01:00
Miss Islington (bot)
572e4332cf
[3.14] gh-135629: rewrite language reference section on except* to improve clarity (GH-136150) (#139059)
gh-135629: rewrite language reference section on except* to improve clarity (GH-136150)
(cherry picked from commit a651ec9524)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2025-10-07 19:14:16 +01:00
Adam Turner
b1fa3414b3
[3.14] gh-105812: Use the `:deco:` role in place of manual decorator markup (GH-139619) (#139627)
(cherry picked from commit 3195da0b1a)
2025-10-07 19:13:35 +01:00
Miss Islington (bot)
04d75658ac
[3.14] gh-139436: Remove `dist-pdf` from the docs archives rebuild target (GH-139437) (#139692)
gh-139436: Remove ``dist-pdf`` from the docs archives rebuild target (GH-139437)
(cherry picked from commit 0e2cdd313b)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-07 19:12:05 +01:00
Miss Islington (bot)
75de39ba1b
[3.14] gh-137185: Fix _Py_DumpStack() async signal safety (gh-137187) (gh-137206)
Call backtrace() once when installing the signal handler to ensure that
libgcc is dynamically loaded outside the signal handler.

This fixes a "signal-unsafe call inside of a signal" TSan error from
test_faulthandler.test_enable_fd.
(cherry picked from commit 11a8652e25)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-10-07 18:11:46 +00:00
Miss Islington (bot)
93ac6f3472
[3.14] gh-135444: fix asyncio.DatagramTransport.sendto to account for datagram header size when data cannot be sent (GH-135445) (#137245)
gh-135444: fix `asyncio.DatagramTransport.sendto` to account for datagram header size when data cannot be sent (GH-135445)
(cherry picked from commit e3ea861351)

Co-authored-by: Justin Bronder <jsbronder@cold-front.org>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-07 23:40:03 +05:30
Miss Islington (bot)
bfcd5f25a5
[3.14] gh-138661: fix data race in PyCode_Addr2Line (GH-138664) (#138834)
gh-138661: fix data race in `PyCode_Addr2Line` (GH-138664)
(cherry picked from commit ea26f6da39)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-07 18:06:45 +00:00
Miss Islington (bot)
98d33bf19c
[3.14] gh-139624: Skip problematic locales on AIX in test_date_locale2 (GH-139625) (GH-139644)
(cherry picked from commit 6f3dae0dc5)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 20:02:42 +02:00
Miss Islington (bot)
7a1a79d731
[3.14] gh-138163: skip failures if tests are run with SCHED_BATCH on glibc (GH-138576) (GH-138820)
(cherry picked from commit 492941459a)

Co-authored-by: jxes993409 <68891412+jxes993409@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 20:01:51 +02:00
Miss Islington (bot)
d7500f6078
[3.14] gh-138008: Fix segfaults in _ctypes due to invalid argtypes (GH-138285) (GH-138742)
(cherry picked from commit 1ce05537a3)

Signed-off-by: Nguyen Viet Dung <29406816+magnified103@users.noreply.github.com>
Co-authored-by: Yongzi Li <204532581+Yzi-Li@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 20:00:28 +02:00
Miss Islington (bot)
7aab50cd7a
[3.14] gh-136507: Fix mimetypes CLI to handle multiple file parameters (GH-136508) (GH-138140)
(cherry picked from commit 81268a3e2a)

Co-authored-by: Wulian233 <1055917385@qq.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 19:59:52 +02:00
Miss Islington (bot)
93f5e26d97
[3.14] gh-137376: Add note on top-level global declarations (GH-137707) (GH-138023)
(cherry picked from commit 9f05f98730)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2025-10-07 19:59:29 +02:00
Miss Islington (bot)
7d9b2671c6
[3.14] gh-123681: Check NORMALIZE_CENTURY behavior at runtime; require C99 (GH-136022) (GH-137947)
A runtime check is needed to support cross-compiling.

Remove the _Py_NORMALIZE_CENTURY macro.
Remove _pydatetime.py's _can_support_c99.
(cherry picked from commit 719e5c3f71)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 19:59:06 +02:00
Miss Islington (bot)
fad7bfc282
[3.14] gh-138902: Fix generator send arg name (GH-138905) (#138914)
gh-138902: Fix generator send arg name (GH-138905)
(cherry picked from commit cb07bd24ee)

Co-authored-by: Marat Khagazheev <marathagazeev@gmail.com>
Co-authored-by: marat <khagazheev@artlebedev.ru>
2025-10-07 23:27:05 +05:30
Miss Islington (bot)
e3d102ecdc
[3.14] gh-136823: Update documentation on excluded headers in Python.h (GH-136824) (#137437)
gh-136823: Update documentation on excluded headers in Python.h (GH-136824)
(cherry picked from commit c2428ca9ea)

Co-authored-by: Sina Zel taat <111974143+SZeltaat@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-10-07 23:23:33 +05:30
Miss Islington (bot)
a03dd74c94
[3.14] gh-137239: Add *_max functions to heapq.__all__ (gh-137241) (#137256)
gh-137239: Add *_max functions to heapq.__all__ (gh-137241)
(cherry picked from commit 5f35f9b8fa)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-07 23:22:07 +05:30
Miss Islington (bot)
7b203aa2ff
[3.14] gh-136516: Mention installation artifacts as de-facto resources (GH-136419) (#137038)
gh-136516: Mention installation artifacts as de-facto resources (GH-136419)

Files like NUL on windows are, from `importlib.resources` point of
view, an artifact caused by installing to a filesystem directory.
Mention these.
(cherry picked from commit fac4964fdb)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 23:20:13 +05:30
Miss Islington (bot)
33340233d0
[3.14] gh-139698: Fix typo in What's New 3.14 (GH-139699) (#139711)
gh-139698: Fix typo in What's New 3.14 (GH-139699)
(cherry picked from commit d396a32b3d)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-07 17:46:00 +00:00
Sam Gross
fb699effbf
[3.14] gh-137400: Fix thread-safety issues when profiling all threads (gh-137518) (gh-137730)
There were a few thread-safety issues when profiling or tracing all
threads via PyEval_SetProfileAllThreads or PyEval_SetTraceAllThreads:

* The loop over thread states could crash if a thread exits concurrently
  (in both the free threading and default build)
* The modification of `c_profilefunc` and `c_tracefunc` wasn't
  thread-safe on the free threading build.
(cherry picked from commit a10152f8fd)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 13:45:23 -04:00
Miss Islington (bot)
c1cb785ebd
[3.14] gh-126662: naming consistency for signal.ItimerError (GH-126712) (#137122)
gh-126662: naming consistency for `signal.ItimerError` (GH-126712)
(cherry picked from commit d5fa437dfb)

Co-authored-by: Stephen Morton <git@tungol.org>
2025-10-07 19:42:46 +02:00
Miss Islington (bot)
98ca0b3e2b
[3.14] Fix docs for Queue.shutdown (gh-137028) (#137080)
Fix docs for Queue.shutdown (gh-137028)
(cherry picked from commit 245671555b)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Co-authored-by: Zachary Ware <zach@python.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 19:41:03 +02:00
Miss Islington (bot)
08d8dadfc2
[3.14] gh-136278: Document codecs.escape_encode() and codecs.escape_decode() (GH-136314) (#137149)
gh-136278: Document codecs.escape_encode() and codecs.escape_decode() (GH-136314)

Closes GH-136278
(cherry picked from commit 6784ef7da7)

Co-authored-by: Toshaksha <147024929+Toshaksha@users.noreply.github.com>
2025-10-07 19:40:30 +02:00
Miss Islington (bot)
57c8e3eb8e
[3.14] gh-58124: Avoid CP_UTF8 in UnicodeDecodeError (GH-137415) (#137460)
gh-58124: Avoid CP_UTF8 in UnicodeDecodeError (GH-137415)

Fix name of the Python encoding in Unicode errors of the code page
codec: use "cp65000" and "cp65001" instead of "CP_UTF7" and "CP_UTF8"
which are not valid Python code names.
(cherry picked from commit ce1b747ff6)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-07 19:39:31 +02:00
Miss Islington (bot)
e4e8c5a3b0
[3.14] gh-139208: Fix regrtest --fast-ci --verbose (GH-139240) (#139260)
gh-139208: Fix regrtest --fast-ci --verbose (GH-139240)

Don't ignore the --verbose option anymore.
(cherry picked from commit dd683f8f34)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-07 19:39:06 +02:00
Miss Islington (bot)
b343009377
[3.14] gh-71810: Fix _PyLong_AsByteArray() undefined behavior (GH-138873) (#138883)
gh-71810: Fix _PyLong_AsByteArray() undefined behavior (GH-138873)

Don't read p[-1] when p is an empty string: when n==0.
(cherry picked from commit 8b5ce31c2b)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-07 19:38:40 +02:00
Miss Islington (bot)
52e88585b0
[3.14] gh-137179: Fix flaky test_history_survive_crash test (gh-137180) (gh-137216)
Kill the REPL subprocess once it prints the output from the command
immediately before the `time.sleep()`.
(cherry picked from commit 98d462cf4d)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-10-07 17:38:30 +00:00
Miss Islington (bot)
6e9845455e
[3.14] gh-135329: Use longer timeout in pyrepl test_repl_eio() (GH-139503) (#139506)
gh-135329: Use longer timeout in pyrepl test_repl_eio() (GH-139503)

Replace hardcoded 5 seconds with support.SHORT_TIMEOUT.

Fix the following error on slow CI such as GitHub Action UBSan:

test test_pyrepl failed -- Traceback (most recent call last):
  File "Lib/test/test_pyrepl/test_unix_console.py", line 362, in test_repl_eio
    _, err = proc.communicate(timeout=5)  # sleep for pty to settle
             ~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "Lib/subprocess.py", line 1219, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
                     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Lib/subprocess.py", line 2126, in _communicate
    self._check_timeout(endtime, orig_timeout, stdout, stderr)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Lib/subprocess.py", line 1266, in _check_timeout
    raise TimeoutExpired(
    ...<2 lines>...
            stderr=b''.join(stderr_seq) if stderr_seq else None)
subprocess.TimeoutExpired: Command '[...]' timed out after 5 seconds
(cherry picked from commit c985822d86)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-07 19:38:12 +02:00
Miss Islington (bot)
9e13cc2896
[3.14] gh-137017: Ensure Thread.is_alive() only returns False after the underlying OS thread exits (gh-137315) (gh-138916)
(cherry picked from commit aa9ceb1721)

Co-authored-by: Abdul <abdulrasheedibrahim47@gmail.com>
Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-10-07 17:37:31 +00:00
Sam Gross
85dabb9c15
[3.14] gh-137238: Fix data race in _Py_slot_tp_getattr_hook (gh-137240) (#137416)
Replacing the slot isn't thread-safe if the GIL is disabled. Don't
require that the slot has been replaced when specializing.
(cherry picked from commit 485b16b4f7)
2025-10-07 17:36:56 +00:00
Kumar Aditya
5cd6cfe4cf
[3.14] gh-136234: Fix SelectorSocketTransport.writelines to be robust to connection loss (GH-136743) (#138702) 2025-10-07 23:06:04 +05:30
Miss Islington (bot)
de84d09050
[3.14] gh-139516: Fix lambda colon start format spec in f-string in tokenizer (GH-139657) (#139701)
gh-139516: Fix lambda colon start format spec in f-string in tokenizer (GH-139657)
(cherry picked from commit 539461d9ec)

Co-authored-by: Tomasz Pytel <tompytel@gmail.com>
2025-10-07 18:35:17 +01:00
Miss Islington (bot)
cec4ddf23e
[3.14] gh-128639: Don't assume one thread in subinterpreter finalization with fixed daemon thread support (GH-134606) (GH-139050)
gh-128639: Don't assume one thread in subinterpreter finalization with fixed daemon thread support (GH-134606)

This reapplies GH-128640.
(cherry picked from commit a64881363b)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-10-07 13:30:38 -04:00
Miss Islington (bot)
08bea299bf
[3.14] gh-112729: Correctly fail when the process is out of memory during interpreter creation (GH-139164) (GH-139168)
gh-112729: Correctly fail when the process is out of memory during interpreter creation (GH-139164)
(cherry picked from commit d06113c7a7)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-10-07 13:30:23 -04:00
Miss Islington (bot)
a69bdab541
[3.14] gh-123828: Fix data race in _interpchannels._waiting_release (GH-124107) (GH-139517)
gh-123828: Fix data race in `_interpchannels._waiting_release` (GH-124107)
(cherry picked from commit f39dea3bae)

Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
2025-10-07 13:29:37 -04:00
Miss Islington (bot)
9e091dbf02
[3.14] gh-138756: Fix leak of inittab memory in PyInitConfig_Free() (GH-138792) (#139703)
gh-138756: Fix leak of inittab memory in PyInitConfig_Free() (GH-138792)
(cherry picked from commit 3d521a62e7)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-07 17:11:20 +00:00
Miss Islington (bot)
ddd1264469
[3.14] gh-82916: Don't fail when importing from / with sys.pycache_prefix set (GH-30456) (GH-137906)
(cherry picked from commit d8a9466e29)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 18:55:33 +02:00
Miss Islington (bot)
0accda7468
[3.14] gh-138756: Fix memory leak in PyInitConfig_Free() (GH-138759) (#138785)
gh-138756: Fix memory leak in PyInitConfig_Free() (GH-138759)

Clear also memory of PyConfig members.
(cherry picked from commit 96dee64c73)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-07 18:42:50 +02:00
Victor Stinner
6ed9be1a55
[3.14] gh-137058: Sync _Py_NULL macro with the main branch (#137409)
gh-137058: Sync _Py_NULL macro with the main branch

* use __STDC_VERSION__ >= 202311L instead of
  __STDC_VERSION__ > 201710L.
* Check for _MSC_VER.
2025-10-07 18:41:45 +02:00
Hugo van Kemenade
4319884256 Post 3.14.0 2025-10-07 17:15:20 +03:00
Hugo van Kemenade
ebf955df7a Python 3.14.0 2025-10-07 12:34:52 +03:00
Miss Islington (bot)
33f1330bd5
[3.14] GH-123299: Announce final release in What's New in Python 3.14 (GH-139631) (#139685)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-10-07 08:56:02 +00:00
Miss Islington (bot)
433b638af6
[3.14] gh-124111: Update macOS installer to use Tcl/Tk 8.6.17. (GH-139682) (#139683)
gh-124111: Update macOS installer to use Tcl/Tk 8.6.17. (GH-139682)
(cherry picked from commit 6d804e4efb)

Co-authored-by: Ned Deily <nad@python.org>
2025-10-07 05:19:28 +00:00
Miss Islington (bot)
0944953cee
[3.14] gh-139573: Update macOS installer to use OpenSSL 3.0.18 (GH-139575) (#139680)
gh-139573: Update macOS installer to use OpenSSL 3.0.18 (GH-139575)
(cherry picked from commit 23410f0a9e)

Co-authored-by: Zachary Ware <zach@python.org>
2025-10-07 08:01:57 +03:00
Miss Islington (bot)
847474ce5d
[3.14] Add warnings filter suggestions to PEP 765 entry in What's New (GH-139658) (#139676)
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-07 00:30:00 +03:00
Miss Islington (bot)
57c37a4623
[3.14] gh-116488: Mention dict.get in the data structures tutorial (GH-139643) (#139655)
Co-authored-by: Cycloctane <Cycloctane@outlook.com>
2025-10-06 19:04:44 +03:00
Sebastian Pipping
ab89ca06fa
[3.14] gh-139400: Move NEWS item from section "Core and Builtins" to section "Security" (GH-139606) (#139663) 2025-10-06 18:12:43 +03:00
Miss Islington (bot)
f776254080
[3.14] gh-137242: Allow Android testbed to take all Python command-line options (GH-138805) (#139637)
Co-authored-by: Malcolm Smith <smith@chaquo.com>
2025-10-06 15:15:06 +03:00
Miss Islington (bot)
bb212a1a8b
[3.14] GH-123299: Copyedit 3.14 What's New: Trivia (GH-139618) (#139626)
GH-123299: Copyedit 3.14 What's New: Trivia (GH-139618)
(cherry picked from commit 46de475af7)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-05 23:34:05 +03:00
Miss Islington (bot)
3aeee0863a
[3.14] GH-123299: Copyedit 3.14 What's New: New Features (GH-139543) (#139615)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-10-05 21:38:28 +03:00
Miss Islington (bot)
66ca0d9ae6
[3.14] gh-139400: Make sure that parent parsers outlive their subparsers in pyexpat (GH-139403) (#139606)
Co-authored-by: Sebastian Pipping <sebastian@pipping.org>
2025-10-05 16:02:11 +00:00
Miss Islington (bot)
08d289208b
[3.14] gh-138130: Fix return value of libc_ver() on Emscripten (GH-138132) (#138312)
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-10-05 16:03:49 +03:00
Miss Islington (bot)
07e0eb2093
[3.14] gh-118767: Remove `bool(NotImplemented)` from pending-removal document (GH-139526) (#139599)
Co-authored-by: Jost Migenda <jost.migenda@kcl.ac.uk>
2025-10-05 16:01:35 +03:00
Miss Islington (bot)
1ffd62baca
[3.14] gh-139310: skip test_aead_aes_gcm for Linux kernel between 6.16.0 and 6.17.x (GH-139552) (#139594)
gh-139310: skip `test_aead_aes_gcm` for Linux kernel between 6.16.0 and 6.17.x (GH-139552)

Currently, Fedora 42 uses a custom Linux Kernel 6.16.9 that backported an upstream change
from 6.17-rc7 [1,3] but not its subsequent fix [2]. Until the issue is resolved upstream,
we skip the failing test `test_socket.test_aead_aes_gcm` for kernel versions between 6.16
and 6.17.x.

[1] 1b34cbbf4f
[2] d0ca0df179.
[3] 45bcf60fe4
(cherry picked from commit 41712c4e09)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-05 08:53:23 +00:00
Miss Islington (bot)
51f8f44bd0
[3.14] gh-139573: Update OpenSSL version used in iOS builds (GH-139582) (#139589)
gh-139573: Update OpenSSL version used in iOS builds (GH-139582)

Update OpenSSL version used in iOS builds.
(cherry picked from commit 20758f9bb1)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2025-10-05 09:09:09 +03:00
Miss Islington (bot)
a450151642
[3.14] gh-139573: Update Windows builds to use OpenSSL 3.0.18 (GH-139574) (#139586)
gh-139573: Update Windows builds to use OpenSSL 3.0.18 (GH-139574)
(cherry picked from commit 063cef9999)

Co-authored-by: Zachary Ware <zach@python.org>
2025-10-05 08:00:29 +03:00
Miss Islington (bot)
8cb73119c6
[3.14] gh-139573: Update OpenSSL in CI (GH-139577) (#139583)
gh-139573: Update OpenSSL in CI (GH-139577)
(cherry picked from commit 98e748b3a0)

Co-authored-by: Zachary Ware <zach@python.org>
2025-10-05 07:50:26 +03:00
Miss Islington (bot)
bc85a34f8a
[3.14] gh-139573: Update Android to OpenSSL 3.0.18 (GH-139562) (#139581)
gh-139573: Update Android to OpenSSL 3.0.18 (GH-139562)

Update Android to OpenSSL 3.0.18.
(cherry picked from commit 0f0fc5a163)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
2025-10-05 07:49:36 +03:00
Miss Islington (bot)
2f96a40ec0
[3.14] gh-138558: Improve description of `Interpolation.expression` (GH-139187) (#139579)
gh-138558: Improve description of ``Interpolation.expression`` (GH-139187)
(cherry picked from commit 880c9526f9)

Co-authored-by: Dave Peck <davepeck@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-05 07:41:43 +03:00
Miss Islington (bot)
8566ee2507
[3.14] gh-138703: clarify data buffer requirement of asyncio.StreamWriter.write (GH-139564) (#139570)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-04 16:40:21 +00:00
Miss Islington (bot)
6f2635787b
[3.14] Synced docs and docstring for sysconfig.get_platform (GH-135530) (#138976)
Synced docs and docstring  for `sysconfig.get_platform` (GH-135530)
(cherry picked from commit 01cc53295c)

Co-authored-by: ivan <ivandietert@gmail.com>
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
Co-authored-by: Ned Deily <nad@python.org>
Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
2025-10-04 17:55:25 +03:00
Miss Islington (bot)
ec97866567
[3.14] GH-123299: Copyedit 3.14 What's New: New and Improved Modules (GH-139530) (#139555)
GH-123299: Copyedit 3.14 What's New: New and Improved Modules (GH-139530)
(cherry picked from commit c33dc154b4)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-04 16:45:35 +03:00
Miss Islington (bot)
e7ee62b5c8
[3.14] GH-123299: Copyedit 3.14 What's New: Other Language Changes (GH-139425) (#139508)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-03 23:46:29 +03:00
Miss Islington (bot)
a73fc979cd
[3.14] gh-105987: unskip test_issue105987 from test_asyncio.test_eager_task_factory (GH-139538) (#139539)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-03 23:21:28 +03:00
Miss Islington (bot)
292b6cf3e6
[3.14] Document Py_AddPendingCall() change with subinterpreters in 3.12 (GH-139117) (#139118)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-10-03 23:20:35 +03:00
Miss Islington (bot)
a81eeaf582
[3.14] gh-137638: Use macos-15-intel in GitHub Actions (GH-139154) (#139545)
Co-authored-by: Jacob Coffee <jacob@z7x.org>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-10-03 23:16:01 +03:00
Miss Islington (bot)
22c63945c1
[3.14] gh-139495: Fix hashlib.file_digest() versionchanged description of BlockingIOError (GH-139496) (#139522)
Co-authored-by: Alex Willmer <alex@moreati.org.uk>
2025-10-03 00:11:58 +03:00
Miss Islington (bot)
a312dd0f1e
[3.14] gh-139487: add missing imports for standalone doctest Enum examples (GH-139488) (#139493)
gh-139487: add missing imports for standalone doctest `Enum` examples (GH-139488)
(cherry picked from commit f3d7faeafa)

Co-authored-by: Peter <35064951+ttw225@users.noreply.github.com>
2025-10-02 17:37:19 +03:00
Miss Islington (bot)
86bc87b30d
[3.14] gh-132006: Add support for handling XCPrivacy manifests (GH-139163) (#139410)
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2025-10-01 16:50:33 +03:00
Miss Islington (bot)
20f472b629
[3.14] GH-123299: Copyedit 3.14 What's New: Deprecated (GH-139433) (#139457)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-10-01 12:29:07 +03:00
Miss Islington (bot)
1ae1db8056
[3.14] Document that PyInterpreterState_GetDict returns a borrowed reference (GH-139451) (#139463)
Document that `PyInterpreterState_GetDict` returns a borrowed reference (GH-139451)
(cherry picked from commit 80cdf3ef74)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-01 08:39:54 +03:00
Miss Islington (bot)
622f37f9dd
[3.14] Remove link to the PDF downloads (GH-139142) (#139426)
Remove link to the PDF downloads (GH-139142)
(cherry picked from commit 6b5f15698a)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-30 00:12:28 +03:00
Miss Islington (bot)
4372a05ab0
[3.14] gh-134953: Make the True/False/None check more efficient (GH-138931) (#138939) 2025-09-29 21:11:41 +01:00
Miss Islington (bot)
af694375ea
[3.14] GH-123299: Copyedit 3.14 What's New: CPython bytecode changes (GH-139402) (#139420)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-09-29 18:55:26 +03:00
Miss Islington (bot)
146a37b458
[3.14] gh-139146: Check calloc() results in _testembed.c::test_pre_initialization_sys_options (GH-139147) (#139413)
Co-authored-by: Denis Sergeev <zeff@altlinux.org>
2025-09-29 15:04:47 +03:00
Miss Islington (bot)
7a65a47795
[3.14] Make Android streams respect the unbuffered (-u) option (GH-138806) (#139108)
Co-authored-by: Malcolm Smith <smith@chaquo.com>
2025-09-29 11:16:25 +03:00
Miss Islington (bot)
997e4711e9
[3.14] gh-136744: Remove unnecessary chmod from pydoc.apropos() test. (GH-136746) (#139242)
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2025-09-29 11:12:31 +03:00
Russell Keith-Magee
91d86452c3
[3.14] gh-138171: Migrate iOS testbed location and add Apple build script (#138176) (#139204)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-09-29 11:11:59 +03:00
Miss Islington (bot)
c82079e0b4
[3.14] gh-135447: Document the `NOT_TAKEN & POP_ITER` bytecode instructions (GH-135803) (#139399)
Co-authored-by: Yongzi Li <204532581+Yzi-Li@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2025-09-28 22:02:33 +03:00
Shantanu
73a575ffea
[3.14] Link to 3.14 GC design docs (#139387) 2025-09-28 14:47:05 +01:00
Bénédikt Tran
4608a300d5
[3.14] gh-138633: synchronize documented signatures of SSL objects with runtime ones (GH-138639, GH-138648) (#138646)
(cherry picked from commit 3255c0c870)
(cherry picked from commit 4ef51fa75c)
2025-09-27 08:12:11 +02:00
Miss Islington (bot)
57617732af
[3.14] gh-139312: Update bundled libexpat to 2.7.3 (GH-139319) (#139376)
gh-139312: Update bundled libexpat to 2.7.3 (GH-139319)

(cherry picked from commit 48d0d0dd97)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-09-27 08:10:07 +02:00
Miss Islington (bot)
f2b82b3b3b
[3.14] gh-127502: Fix typo in XML security notes (GH-139335) (#139346)
gh-127502: Fix typo in XML security notes (GH-139335)
(cherry picked from commit 6fa1e552e0)

Co-authored-by: Sebastian Pipping <sebastian@pipping.org>
2025-09-26 13:43:00 +01:00
Miss Islington (bot)
7519ac294f
[3.14] gh-139330: Check expat version/checksum in SBOM with refresh.sh
gh-139330: Check expat version/checksum in SBOM with refresh.sh

Check expat version/checksum in SBOM with refresh.sh
(cherry picked from commit 89b5571025)

Co-authored-by: Seth Michael Larson <seth@python.org>
2025-09-25 18:30:14 +00:00
Karolina Surma
c76fd771b5
[3.14] Fix the reference to unicode specification (#139138) (#139286)
Fix the reference to unicode specification (#139138)

(cherry picked from commit b36dee855d)
2025-09-24 18:11:20 +01:00
Miss Islington (bot)
460ad1aa1b
[3.14] Make sure the `:keyword: role works for case` (GH-138878) (#139200)
Make sure the ``:keyword:`` role works for ``case`` (GH-138878)
(cherry picked from commit 848d926786)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-09-22 07:13:05 +01:00
Miss Islington (bot)
cf4573b51e
[3.14] gh-138092: Correct the documented signature of `mmap.flush` (GH-138671) (#139202)
gh-138092: Correct the documented signature of ``mmap.flush`` (GH-138671)
(cherry picked from commit e101f907dc)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2025-09-21 21:24:10 +01:00
Miss Islington (bot)
ccdc0c9992
[3.14] Doc/library/os.rst: Remove spurious parenthesis (GH-139205) (#139217)
`Doc/library/os.rst`: Remove spurious parenthesis (GH-139205)
(cherry picked from commit 9c3d09b984)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-09-21 20:56:06 +01:00
Miss Islington (bot)
665a3495bf
[3.14] gh-118803: Improve documentation around ByteString deprecation (GH-139115) (#139136)
gh-118803: Improve documentation around `ByteString` deprecation (GH-139115)
(cherry picked from commit 4305cc3ef3)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-09-18 17:54:43 +00:00
Miss Islington (bot)
e560865120
[3.14] gh-137242: Mention Android binary releases in documentation (GH-138305) (#139124)
gh-137242: Mention Android binary releases in documentation (GH-138305)

Adds a mention of binary releases to the Android documentation.

---------


(cherry picked from commit 594bdde9df)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
2025-09-18 15:47:36 +01:00
Hugo van Kemenade
869f1d8f6a Post 3.14.0rc3 2025-09-18 12:49:45 +01:00
Hugo van Kemenade
1c5b28405a Python 3.14.0rc3 2025-09-18 09:45:38 +01:00
Miss Islington (bot)
a20395b899
[3.14] GH-139067: Add example for argparse's append action (GH-131389) (#139068)
GH-139067: Add example for `argparse`'s `append` action (GH-131389)
(cherry picked from commit 101fd33065)

Co-authored-by: Moshe Kaplan <mosheekaplan@gmail.com>
2025-09-17 23:27:53 +01:00
Miss Islington (bot)
0e4e608f03
[3.14] gh-128627: Use __builtin_wasm_test_function_pointer_signature for Emscripten trampoline (GH-137470) (#139039)
gh-128627: Use __builtin_wasm_test_function_pointer_signature for Emscripten trampoline (GH-137470)

With https://github.com/llvm/llvm-project/pull/150201 being merged, there is
now a better way to generate the Emscripten trampoline, instead of including
hand-generated binary WASM content. Requires Emscripten 4.0.12.
(cherry picked from commit 2629ee4eb0)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-09-17 17:21:01 +01:00
Miss Islington (bot)
7a2854eb12
[3.14] gh-132558: Improve argparse docs on combining type and choices (GH-133827) (#139057)
gh-132558: Improve `argparse` docs on combining `type` and `choices` (GH-133827)
(cherry picked from commit dd0840bf67)

Co-authored-by: Hans Then <hans.then@gmail.com>
Co-authored-by: Savannah Bailey <savannahostrowski@gmail.com>
2025-09-17 17:19:33 +01:00
Miss Islington (bot)
9d0ca237af
[3.14] gh-137988: Fix const description in argparse.add_argument() docs (GH-138315) (#139051)
Co-authored-by: PrinceNaroliya <naroliyaprince@gmail.com>
Co-authored-by: Savannah Bailey <savannahostrowski@gmail.com>
2025-09-17 18:51:30 +03:00
Miss Islington (bot)
9741cfc73a
[3.14] gh-99948: Support ctypes.util.find_library in emscripten environment (GH-138519) (#139022)
Co-authored-by: Gyeongjae Choi <def6488@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2025-09-17 17:24:46 +03:00
Miss Islington (bot)
c1154943b1
[3.14] gh-138896: Fix error installing C runtime on non-updated Windows machines (GH-138932) (#139034)
Co-authored-by: adang1345 <adang1345@gmail.com>
2025-09-17 17:22:41 +03:00
Miss Islington (bot)
f8ee2d404d
[3.14] GH-123299: Copyedit 3.14 What's New: C API (GH-138987) (#139021)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-17 17:21:06 +03:00
Miss Islington (bot)
37f8a63e39
[3.14] gh-138514: getpass: restrict echo_char to a single ASCII character (GH-138591) (#138988)
Co-authored-by: Benjamin Johnson <benjohnson2040@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2025-09-17 17:20:45 +03:00
Miss Islington (bot)
ce48f4c845
[3.14] gh-139006: Doc: Clarify html.escape function description (GH-139016) (#139036)
gh-139006: Doc: Clarify html.escape function description (GH-139016)
(cherry picked from commit 81c975bcfc)


Doc: Clarify html.escape function description (GH-139006)

Co-authored-by: PrinceNaroliya <naroliyaprince@gmail.com>
2025-09-17 21:58:17 +08:00
Miss Islington (bot)
97f4ac28cb
[3.14] gh-138998: Upgrade vendored expat to 2.7.2 (GH-138999) (#139024)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-09-17 15:41:02 +03:00
Jelle Zijlstra
6038447d99
[3.14] gh-137226: Fix get_type_hints() on generic TypedDict with stringified annotations (GH-138953) (#138989) 2025-09-17 12:22:16 +03:00
Miss Islington (bot)
82fce8271c
[3.14] gh-138966: Add description for gi_suspended attribute (GH-139008) (#139020)
Co-authored-by: Donghoon Nam <54799053+codenamenam@users.noreply.github.com>
2025-09-17 12:09:15 +03:00
Miss Islington (bot)
7bba99c611
[3.14] Revert "gh-118803: Remove ByteString from typing and collections.abc (GH-118804)" (GH-138990) (#138995)
Revert "gh-118803: Remove `ByteString` from `typing` and `collections.abc` (GH-118804)" (GH-138990)
(cherry picked from commit 530ddd3e06)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-09-17 09:08:15 +01:00
Miss Islington (bot)
284ab76d4e
[3.14] gh-110936: Reorder string literal definition in Lexical Analysis (GH-138063) (#138373)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-09-16 16:56:17 +03:00
Miss Islington (bot)
62294eb4fc
[3.14] gh-54874: Expand unicodedata module documentation (GH-138301) (#138346)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Alexander Belopolsky <abalkin@users.noreply.github.com>
2025-09-16 16:55:59 +03:00
Miss Islington (bot)
35ce9a2867
[3.14] gh-137985: Correct description of Formatter's datefmt param in logging documentation (GH-138530) (#138565)
Co-authored-by: W. H. Wang <mattwang44@gmail.com>
2025-09-16 16:55:29 +03:00
Miss Islington (bot)
5ddd72afd8
[3.14] gh-138871: Clarify NameError exception in 'del' (GH-138881) (#138903)
Co-authored-by: Kian Eliasi <kian.elbo@gmail.com>
2025-09-16 16:54:37 +03:00
Miss Islington (bot)
c0d490d9c4
[3.14] gh-135755: Make Py_MAX_SCRIPT_PATH_SIZE private (GH-138350) (#138356)
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-09-16 15:49:35 +03:00
Miss Islington (bot)
7f293a615d
[3.14] gh-135329: prevent infinite traceback loop on Ctrl-C for strace (GH-138133) (#138973)
gh-135329: prevent infinite traceback loop on Ctrl-C  for strace (GH-138133)
(cherry picked from commit b9dbf6acb3)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong <zouzou0208@gmail.com>
Co-authored-by: dura0ok <slpmcf@gmail.com>
Co-authored-by: graymon <greyschwinger@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-09-16 11:04:49 +00:00
Miss Islington (bot)
1c901860e6
[3.14] gh-128636: Fix crash in PyREPL when os.environ is overwritten with an invalid value for macOS (GH-138089) (#138938)
Co-authored-by: yihong <zouzou0208@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-09-16 12:10:53 +03:00
Miss Islington (bot)
dc4d016e7e
[3.14] gh-134953: Expand theming for True/False/None (GH-135000) (#138928)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-09-15 19:02:40 +03:00
Miss Islington (bot)
19a8670d7a
[3.14] gh-138801: re-enable pyrepl tests on Windows (GH-138802) (GH-138815)
gh-138801: re-enable `pyrepl` tests on Windows (GH-138802)
(cherry picked from commit 4f3cab96c1)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-09-15 16:42:36 +02:00
Miss Islington (bot)
80e59a8d7e
[3.14] gh-138669: Increase test coverage for difflib (GH-138670) (#138817)
Co-authored-by: Jan-Eric Nitschke <47750513+JanEricNitschke@users.noreply.github.com>
2025-09-15 00:20:32 +03:00
Miss Islington (bot)
18dfc1d6c4
[3.14] gh-138804: Check type in shlex.quote (GH-138809) (#138846)
Co-authored-by: Christoph Walcher <christoph-wa@gmx.de>
2025-09-13 21:29:50 +03:00
Miss Islington (bot)
fbfbfdf33c
[3.14] gh-138479: Ensure that __typing_subst__ returns a tuple (GH-138482) (#138784)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-09-12 16:23:03 +03:00
Miss Islington (bot)
440b83f838
[3.14] gh-71810: Fix corner case (length==0) for int.to_bytes() (GH-138739) (#138782)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-09-12 16:22:43 +03:00
Bénédikt Tran
c8cc39d938
[3.14] gh-116946: fully implement GC protocol for zlib objects (GH-138290) (#138327) 2025-09-12 16:22:33 +03:00
Miss Islington (bot)
664d17f97a
[3.14] Improve permission error messages in pdb and asyncio.tools (GH-134290) (#138826)
Improve permission error messages in pdb and asyncio.tools (GH-134290)
(cherry picked from commit 419441a6e1)

Co-authored-by: ivonastojanovic <80911834+ivonastojanovic@users.noreply.github.com>
2025-09-12 12:20:20 +00:00
Miss Islington (bot)
5210e307ae
[3.14] gh-138005: Document that CSV skipinitialspace=True and delimiter=' ' require quotation for empty fields (GH-138006) (#138798)
Co-authored-by: Maurycy Pawłowski-Wieroński <5383+maurycy@users.noreply.github.com>
2025-09-11 15:18:25 +00:00
Miss Islington (bot)
8a767fbcb3
[3.14] gh-138081: fix some dead links in InternalDocs (GH-138082) (#138781)
Co-authored-by: yihong <zouzou0208@gmail.com>
2025-09-11 12:38:14 +03:00
Miss Islington (bot)
09b7e87646
[3.14] gh-138081: Fix/remove incorrect links in idlelib/HISTORY.txt (GH-138091) (#138124)
Co-authored-by: Yongzi Li <204532581+Yzi-Li@users.noreply.github.com>
2025-09-11 12:27:23 +03:00
Miss Islington (bot)
a36981598c
[3.14] GH-138562: Remove `sort()` from the common sequence methods in the data model (GH-138563) (#138760)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-11 12:23:53 +03:00
Miss Islington (bot)
5eb7cd3e38
[3.14] Add impl-detail block for PyLong_FromLong docs (GH-126422) (#138694)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2025-09-11 12:23:36 +03:00
Miss Islington (bot)
47441f0874
[3.14] gh-138644: Update c-api docs of PyInterpreterState about PEP-684 (GH-138651) (#138657)
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-09-11 12:23:24 +03:00
Miss Islington (bot)
15ca9c6816
[3.14] gh-135676: Reword the Operators & Delimiters section(s) (GH-137713) (#138457)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-11 12:22:56 +03:00
Miss Islington (bot)
dd930baf45
[3.14] gh-138307: Update the Ellipsis documentation (GH-138306) (#138440)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2025-09-11 12:22:37 +03:00
Miss Islington (bot)
4ce4b82d35
[3.14] Docs: Fix typo in shutil.make_archive example (GH-138188) (#138195)
Co-authored-by: Andreas Pelme <andreas@pelme.se>
2025-09-11 12:20:28 +03:00
Miss Islington (bot)
7e0232895a
[3.14] gh-133125: Clarify ZipInfo.date_time attribute documentation (GH-136082) (#138077)
Co-authored-by: Kentaro Jay Takahashi <64148935+KentaroJay@users.noreply.github.com>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-09-11 12:19:35 +03:00
Miss Islington (bot)
34afba4747
[3.14] Fix typo in logging docs (GH-137981) (#137983)
Co-authored-by: Maximilian Linhoff <maximilian.linhoff@cta-observatory.org>
2025-09-11 12:19:05 +03:00
Miss Islington (bot)
30588d5f91
[3.14] [docs] minor, fix grammar in ssl.SSLContect.sslsocket_class docstring (GH-137935) (#137950)
Co-authored-by: PrinceNaroliya <naroliyaprince@gmail.com>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-09-11 12:18:43 +03:00
Miss Islington (bot)
39e024df8e
[3.14] gh-131885: Use positional-only markers for the `decimal` module (GH-131990) (#137902)
Co-authored-by: Semyon Moroz <donbarbos@proton.me>
2025-09-11 12:18:17 +03:00
Miss Islington (bot)
928d8027b2
[3.14] gh-131591: fix formatting of remote debugger docs (GH-137225) (#137874)
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2025-09-11 12:17:46 +03:00
Miss Islington (bot)
dcadc539fd
[3.14] Mention the "context manager" keyword in concurrent.futures documentation (GH-130976) (#137810)
Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
2025-09-11 12:17:25 +03:00
Miss Islington (bot)
374b242efa
[3.14] gh-87281: Improve documentation for locale.setlocale() and locale.getlocale() (GH-137313) (#137722)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-09-11 12:16:18 +03:00
Miss Islington (bot)
4b093e1796
[3.14] gh-136672: Docs: Move Enum functions and add examples (GH-136791) (#137688)
Co-authored-by: RafaelWO <38643099+RafaelWO@users.noreply.github.com>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2025-09-11 12:15:55 +03:00
Miss Islington (bot)
735ac97e16
[3.14] gh-125897: Mark range function parameters as positional only (GH-125945) (#137652)
Co-authored-by: Konstantin Baikov <konstantin.baikov@gmail.com>
2025-09-11 12:15:24 +03:00
Miss Islington (bot)
4bba1a294b
[3.14] Fix documentation of hash in PyHash_FuncDef (GH-137595) (#137642)
Co-authored-by: da-woods <dw-git@d-woods.co.uk>
2025-09-11 12:15:06 +03:00
Miss Islington (bot)
7b4e0dc36a
[3.14] Replace "ordered arguments" with "positional arguments" in unittest.mock documentation (GH-137552) (#137553)
Co-authored-by: Tom Forbes <tom@tomforb.es>
2025-09-11 12:14:45 +03:00
Miss Islington (bot)
500abc41e8
[3.14] Docs: Small clarity change for `except*` (GH-121073) (#137494)
Co-authored-by: Greg Stein <gstein@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-11 12:14:33 +03:00
Miss Islington (bot)
2bea4f0995
[3.14] Docs: Use the correct example module in warnings.rst (GH-137402) (#137492)
Co-authored-by: Mendel Feygelson <mfeygelson@gmail.com>
2025-09-11 12:14:21 +03:00
Miss Islington (bot)
7f5319dd54
[3.14] gh-137368: document __index__() support for PyLong_AsInt32/64() (GH-137369) (#137380)
gh-137368: document __index__() support for PyLong_AsInt32/64() (GH-137369)
(cherry picked from commit 4dd85b347f)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-09-11 12:14:03 +03:00
Brian Schubert
dc20c1a47e
[3.14] Fix typo in Doc/extending/extending.rst (GH-136890) (#137355)
Co-authored-by: Cornelius Roemer <cornelius.roemer@gmail.com>
2025-09-11 11:51:42 +03:00
Miss Islington (bot)
badab2c1a9
[3.14] Docs: Fix typo in os.fwalk() example (GH-138486) (#138500)
Co-authored-by: William Andrea <22385371+wjandrea@users.noreply.github.com>
2025-09-11 11:50:32 +03:00
Miss Islington (bot)
7fba07a7a9
[3.14] Fix Windows path in venv docs (GH-138476) (#138477)
Co-authored-by: Zachary Ware <zach@python.org>
2025-09-11 11:50:01 +03:00
Victor Stinner
3643a26a01
[3.14] gh-138349: Fix crash when combining module-level annotation and listcomp (#138363) (#138749)
* gh-138349: Fix crash when combining module-level annotation and listcomp (#138363)

(cherry picked from commit 7a6fd4a45d)

---------

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-09-11 08:43:57 +03:00
Miss Islington (bot)
38cd031111
[3.14] gh-136599: Add tests for long_hash (GH-138335) (#138390)
gh-136599: Add tests for long_hash (GH-138335)
(cherry picked from commit 2d3711dc06)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-09-10 23:54:07 +03:00
Miss Islington (bot)
a963843f43
[3.14] gh-138744: GitHub Actions: pin to windows-2022 (GH-138743) (#138752)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-09-10 14:58:31 +00:00
Miss Islington (bot)
389450399a
[3.14] gh-136264: Fix `--relative-paths` for PEP 739's build-details.json (GH-138510) (#138638)
* gh-136264: Fix ``--relative-paths`` for PEP 739's build-details.json (GH-138510)

* KeyError is not raised for defaultdict
* Fix relative paths on different drives on Windows
* Add a round-trip test
(cherry picked from commit 057ee17410)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Itamar Oren <itamarost@gmail.com>

* Update test_build_details.py

* Update Lib/test/test_build_details.py

---------

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Itamar Oren <itamarost@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-09-09 19:15:40 +03:00
Miss Islington (bot)
829c81ae21
[3.14] GH-101100: Remove some entries from `nitpick_ignore` (GH-138464) (#138683)
* GH-101100: Remove some entries from ``nitpick_ignore`` (GH-138464)
(cherry picked from commit 22cb9ba8f9)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>

* Update check-warnings.py

---------

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-09 19:12:40 +03:00
Miss Islington (bot)
dee3428120
[3.14] gh-101100: Resolve reference warnings in reference/ (GH-138418) (#138680)
gh-101100: Resolve reference warnings in reference/ (GH-138418)
(cherry picked from commit 6831634eb7)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-09 19:11:09 +03:00
Miss Islington (bot)
2162fcc51a
[3.14] gh-138577: Mention Unix-specific limitations of getpass.getpass(echo_char=...) (GH-138677) (#138696)
Co-authored-by: yagggi <fakepoet0101@gmail.com>
2025-09-09 13:00:36 +03:00
Miss Islington (bot)
6f665902d1
[3.14] gh-137242: Add a --no-randomize option, and use it in Android CI (GH-138649) (#138684)
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Malcolm Smith <smith@chaquo.com>
2025-09-09 11:51:48 +03:00
Miss Islington (bot)
161543f4f1
[3.14] annotationlib: add note on security to docs (GH-138508) (#138550)
annotationlib: add note on security to docs (GH-138508)
(cherry picked from commit 9158bcf86b)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-09-08 23:15:57 +03:00
Miss Islington (bot)
68e0abe8c1
[3.14] gh-138665: Move platform.invalidate_caches docs (GH-138667) (#138668)
Co-authored-by: Shamil <ashm.tech@proton.me>
2025-09-08 19:06:27 +03:00
Miss Islington (bot)
0f94b186a5
[3.14] gh-138253: Fix compatibility of sub-interpreters queues with queue.Queue (GH-138256) (#138367)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-09-08 18:37:39 +03:00
Miss Islington (bot)
61f7156965
[3.14] gh-135661: Fix CDATA section parsing in HTMLParser (GH-135665) (#137772)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-09-08 18:31:41 +03:00
Miss Islington (bot)
75c2d9f7c4
[3.14] gh-138297 Point link in docs for finally to try/else, instead of if/else (GH-138298) (#138381)
Co-authored-by: James Parrott <80779630+JamesParrott@users.noreply.github.com>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-09-08 18:09:31 +03:00
Miss Islington (bot)
769f7a51fe
[3.14] gh-89905: Correct -R option doc (GH-137608) (#138353)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-09-08 18:08:12 +03:00
Miss Islington (bot)
925c75211d
[3.14] gh-129033: Remove dead code in test.support.has_no_debug_ranges() (GH-137379) (#137382)
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-09-08 18:03:23 +03:00
Miss Islington (bot)
d29c38eeb9
[3.14] gh-138295: Fix a grammar issue in the descriptor HOWTO (GH-138296) (#138299)
Co-authored-by: Fangyi Zhou <me@fangyi.io>
2025-09-08 18:00:06 +03:00
Miss Islington (bot)
efac05a135
[3.14] gh-91116: Add hyperlink from sys.settrace to frame objects (GH-138062) (#138068)
Co-authored-by: Krishna Chaitanya <141550576+XChaitanyaX@users.noreply.github.com>
2025-09-08 17:59:24 +03:00
Miss Islington (bot)
0cf8ac2973
[3.14] gh-137668: Document that ord() supports also bytes and bytearray (GH-137669) (#137703)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-09-08 17:59:10 +03:00
Miss Islington (bot)
226915dd2c
[3.14] gh-137397: Skip test_os_open on NetBSD due to indefinite hang (GH-137398) (#137406)
Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
2025-09-08 17:58:44 +03:00
Miss Islington (bot)
1cb1c2c03b
[3.14] gh-138659: Typo in the gc module docstring (GH-138660) (#138662)
gh-138659: Typo in the gc module docstring (GH-138660)

docs(gc): fix typo in get_threshold() docstring

Removes a duplicate "the" from the docstring for the `gc.get_threshold()` function.
(cherry picked from commit c006a623e7)

Co-authored-by: Aalaap Dey <65075436+axdeyy@users.noreply.github.com>
2025-09-08 14:41:34 +00:00
Miss Islington (bot)
655ad1c63e
[3.14] gh-138318, PyREPL: builtins should not be highlighted when used as attribute names (GH-138319) (#138654)
gh-138318, PyREPL: builtins should not be highlighted when used as attribute names (GH-138319)
(cherry picked from commit 7a3bca50e0)

Co-authored-by: yihong <zouzou0208@gmail.com>
2025-09-08 13:29:53 +00:00
Miss Islington (bot)
5074241f3d
[3.14] Use test.support.is_wasm32 flag for is_emscripten or is_wasi for generic checks (GH-136815) (#138643)
Co-authored-by: Ani <5357586+anistark@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
2025-09-08 16:20:00 +03:00
Miss Islington (bot)
f23e7605b8
[3.14] Docs: Fix typo in test.support.linked_to_musl function name (GH-138406) (#138445)
Docs: Fix typo in test.support.linked_to_musl function name (GH-138406)
(cherry picked from commit 8ce4f28363)

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2025-09-08 14:52:38 +03:00
Miss Islington (bot)
9b398cb3ac
[3.14] GH-123299: Copyedit 3.14 What's New: Build Changes (GH-138488) (#138632)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-08 07:17:14 +00:00
Miss Islington (bot)
78ee486861
[3.14] gh-138584: Increase test coverage for collections.UserList (GH-138590) (#138612)
Co-authored-by: dbXD320 <devanshbaghla320@gmail.com>
Co-authored-by: Devansh Baghla <devanshbaghla34@gmail.com>
2025-09-07 10:42:19 +00:00
Miss Islington (bot)
d36c9a8b50
[3.14] gh-90548: Fix musl version detection with --strip-all (GH-137864) (#138348)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-07 10:51:07 +03:00
Miss Islington (bot)
096fa045fd
[3.14] gh-90548: Allow Alpine/MUSL to pass test_c_locale_coercion. (GH-134454) (#138600)
Co-authored-by: R. David Murray <rdmurray@bitdance.com>
2025-09-07 10:46:37 +03:00
Miss Islington (bot)
95ec2c1ead
[3.14] gh-90548: Skip ctypes test_null_dlsym when linked to musl (GH-138592) (#138601)
Co-authored-by: Zachary Ware <zach@python.org>
2025-09-07 10:46:20 +03:00
Miss Islington (bot)
194fe15c5f
[3.14] gh-90548: Skip NODEV portion of test_makedev when linked to musl (GH-138593) (#138602)
Co-authored-by: Zachary Ware <zach@python.org>
2025-09-07 10:46:11 +03:00
Bénédikt Tran
9cc2b25101
[3.14] gh-116946: fully implement GC protocol for _curses_panel.panel (GH-138333) (#138427) 2025-09-06 21:20:35 +03:00
Miss Islington (bot)
1e1bfe7bbe
[3.14] gh-138191: Document `frame.f_generator` in the data model (GH-138540) (#138553)
Co-authored-by: dbXD320 <devanshbaghla320@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-06 19:59:36 +03:00
Miss Islington (bot)
f153e32cba
[3.14] GH-138465: Improve documentation for common sequence methods (GH-138474) (#138560)
GH-138465: Improve documentation for common sequence methods (GH-138474)
(cherry picked from commit 8ed1d53e62)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-09-06 08:51:48 +03:00
Miss Islington (bot)
cddb7e6a7a
[3.14] gh-138192: Fix Context initialization so that all subinterpreters are assigned the MISSING value. (gh-138503) (#138505)
Co-authored-by: Donghee Na <donghee.na@python.org>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-09-05 15:30:04 +03:00
Miss Islington (bot)
b6fa945ff9
[3.14] gh-138286: Run `ruff on Tools/i18n` (GH-138287) (#138513)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2025-09-05 11:28:56 +00:00
Miss Islington (bot)
09f1eff0df
[3.14] gh-138515: Include email module in Emscripten build (gh-138520) (#138533)
Co-authored-by: Gyeongjae Choi <def6488@gmail.com>
2025-09-05 13:53:39 +03:00
Miss Islington (bot)
a264142ebf
[3.14] docs: add module-level versionadded for annotationlib (GH-138511) (#138512)
docs: add module-level `versionadded` for `annotationlib` (GH-138511)
(cherry picked from commit fc0305a2d8)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2025-09-05 11:03:04 +03:00
Miss Islington (bot)
5086a1e8a0
[3.14] gh-138516: fix typo in OrderedDict exception msg (GH-138517) (#138523)
gh-138516: fix typo in OrderedDict exception msg (GH-138517)
(cherry picked from commit e9c2a357fb)

Co-authored-by: asas1asas200 <asas1asas200@gmail.com>
2025-09-05 11:02:21 +03:00
Miss Islington (bot)
66f256d874
[3.14] gh-107194: Improved language of list.index in tutorial (gh-138518) (#138527)
gh-107194: Improved language of list.index in tutorial (gh-138518)
(cherry picked from commit f19f1d8563)

Co-authored-by: Ric <11750904+ricsatjr@users.noreply.github.com>
2025-09-05 10:51:28 +03:00
Bénédikt Tran
d574f83206
[3.14] gh-136134: imaplib: fix CRAM-MD5 on FIPS-only environments (GH-136615) (#138054) 2025-09-04 17:59:49 +03:00
Bénédikt Tran
bfce393614
[3.14] gh-136134: smtplib: fix CRAM-MD5 on FIPS-only environments (GH-136623) (#138086) 2025-09-04 16:07:59 +03:00
Miss Islington (bot)
460265fe96
[3.14] GH-101100: Resolve reference warnings in using/windows.rst (GH-138416) (#138461)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-04 15:44:14 +03:00
sobolevn
8e1c2fe3d3
[3.14] gh-138281: Run ruff on Tools/peg_generator (GH-138282) (#138469)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-04 11:13:36 +00:00
Miss Islington (bot)
2583646288
[3.14] GH-101100: Resolve reference warnings in whatsnew/3.10.rst (GH-138408) (#138480)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-04 12:56:52 +03:00
Miss Islington (bot)
45a79b4f4b
[3.14] gh-72249: Correct wording of GH-101910 blurb (GH-138468) (#138470)
Co-authored-by: Zachary Ware <zach@python.org>
2025-09-03 21:48:24 +03:00
Miss Islington (bot)
d7c5aa992e
[3.14] GH-101100: Resolve reference warnings in whatsnew/3.5.rst (GH-138412) (#138459)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-09-03 18:46:35 +03:00
Miss Islington (bot)
28fcdda083
[3.14] GH-101100: Resolve reference warnings in whatsnew/3.6.rst (GH-138411) (#138455)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-09-03 15:27:52 +00:00
Miss Islington (bot)
e7593c8676
[3.14] GH-101100: Resolve reference warnings in extending/extending.rst (GH-138417) (#138446)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-03 16:15:36 +03:00
Miss Islington (bot)
44b3940143
[3.14] GH-101100: Resolve reference warnings in whatsnew/3.4.rst (GH-138413) (#138443)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-09-03 15:08:38 +03:00
Miss Islington (bot)
d713788ad1
[3.14] GH-101100: Resolve reference warnings in whatsnew/2.7.rst (GH-138415) (#138441)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-09-03 11:39:02 +00:00
Miss Islington (bot)
1e26fd0c4b
[3.14] GH-101100: Resolve reference warnings in whatsnew/3.8.rst (GH-138409) (#138437)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-09-03 11:31:06 +00:00
Miss Islington (bot)
67b8320cef
[3.14] GH-101100: Resolve reference warnings in whatsnew/3.3.rst (GH-138414) (#138435)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-03 11:27:01 +00:00
Miss Islington (bot)
63fed7b12b
[3.14] GH-123299: Copyedit 3.14 What's New: Move and consolidate Porting (GH-138400) (#138434)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-03 11:15:47 +00:00
Miss Islington (bot)
b0069f14af
[3.14] GH-101100: Resolve reference warnings in whatsnew/3.7.rst (GH-138410) (#138423)
GH-101100: Resolve reference warnings in whatsnew/3.7.rst (GH-138410)

Resolve reference warnings in whatsnew/3.7.rst
(cherry picked from commit dd86fb4ba5)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-03 06:26:29 +00:00
Miss Islington (bot)
da3850cfc2
[3.14] gh-101100: Resolve reference warnings in library/xml.sax.handler.rst (GH-136612) (#138421)
gh-101100: Resolve reference warnings in library/xml.sax.handler.rst (GH-136612)
(cherry picked from commit c22cc8fccd)

Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
2025-09-03 09:17:45 +03:00
Miss Islington (bot)
5c47d72c9b
[3.14] Doc: Track file downloads via plausible (GH-138393) (#138396)
Co-authored-by: Jacob Coffee <jacob@z7x.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-02 23:00:02 +03:00
Miss Islington (bot)
192ae9b86d
[3.14] gh-138372: Fix SyntaxWarning for erroneous t-string subscription (GH-138375) (#138392)
gh-138372: Fix SyntaxWarning for erroneous t-string subscription (GH-138375)
(cherry picked from commit 5493b46462)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2025-09-02 17:39:08 +00:00
Miss Islington (bot)
5ec6d56405
[3.14] gh-138257: Fix internal RuleCollectorVisitor attribute name (GH-138208) (#138259)
Co-authored-by: chemelnucfin <3982092+chemelnucfin@users.noreply.github.com>
2025-08-31 09:54:59 +03:00
Miss Islington (bot)
b79becefb6
[3.14] gh-138158: Use the "data" tarfile extraction filter in Tools/ssl/multissltests.py (GH-138147) (#138262)
Co-authored-by: Tommaso Bona <piergeolo@gmail.com>
2025-08-31 09:53:21 +03:00
Miss Islington (bot)
a37a382f78
[3.14] gh-133829: Remove some specifics from the `zipimport` example (GH-133835) (#138274)
Co-authored-by: R Chintan Meher <meherrihaan@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-08-31 09:44:56 +03:00
Miss Islington (bot)
c35222aae1
[3.14] gh-123858: Improve Doc: SyntaxWarning is emitted during bytecode generation (gh-122844) (#138244)
Co-authored-by: Hang <bebound@gmail.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2025-08-30 00:13:09 +03:00
Miss Islington (bot)
769f58a828
[3.14] gh-101359: clarify docs for asyncio.Event.clear (GH-137849) (#137850)
gh-101359: clarify docs for `asyncio.Event.clear` (GH-137849)
(cherry picked from commit 4b2dbe8e0a)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-08-29 07:37:39 +03:00
Miss Islington (bot)
d3f7bb067c
[3.14] gh-90483: fix docs of SubprocessTransport.get_pipe_transport (GH-137852) (#137853)
gh-90483: fix docs of `SubprocessTransport.get_pipe_transport ` (GH-137852)
(cherry picked from commit 038a6e3b95)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-08-29 07:25:55 +03:00
Miss Islington (bot)
0e46c04994
[3.14] gh-126524: Revert "gh-126524: Run regen-unicodedata as a part of our CI GH-126682" (GH-138197) (#138218)
gh-126524: Revert "gh-126524: Run `regen-unicodedata` as a part of our CI GH-126682" (GH-138197)
(cherry picked from commit 03f8d3b0db)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-08-28 07:58:11 +00:00
Miss Islington (bot)
e3fb55ed2d
[3.14] gh-133403: Run mypy on Tools/build/check_warnings.py (GH-137700) (#137763)
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-08-27 18:37:56 +03:00
Miss Islington (bot)
6d30edbae2
[3.14] gh-137576: Fix for Basic REPL showing incorrect code in tracebacks with PYTHONSTARTUP (GH-137625) (#137771)
Co-authored-by: adam j hartz <hz@mit.edu>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2025-08-27 18:28:20 +03:00
Miss Islington (bot)
5caa6cde58
[3.14] gh-137740: Clarify __del__ invocation mechanism in reference counting (GH-137741) (#138113)
Co-authored-by: Robin Narsingh Ranabhat <robinnarsingha123@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-08-27 18:26:38 +03:00
Miss Islington (bot)
97c6d725e1
[3.14] enhance docs for critical sections (GH-137334) (#138167)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-08-27 17:40:27 +03:00
Miss Islington (bot)
7a6d8d4c95
[3.14] gh-137526: Fix broken link to drdobbs journal in difflib.rst (GH-137527) (#137531)
Co-authored-by: Sebastien Williams-Wynn <s.williamswynn.mail@gmail.com>
2025-08-27 17:02:26 +03:00
Miss Islington (bot)
27a2152a9b
[3.14] gh-44538: Mention nested classes/functions in doctest docs (GH-137870) (#137918)
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-08-27 17:01:55 +03:00
Miss Islington (bot)
9e5ca3a411
[3.14] gh-138011: Clarify tutorial method object example code (GH-138014) (#138025)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-08-27 16:59:47 +03:00
Miss Islington (bot)
cc38a57233
[3.14] gh-137609: Update signatures of builtins in the documentation (GH-137610) (#138137)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-27 16:59:02 +03:00
Miss Islington (bot)
65bf6f549b
[3.14] gh-138098: Clarify strong references in PyDict_Next docs on the free-threaded build (GH-138106) (#138141)
Co-authored-by: PrinceNaroliya <naroliyaprince@gmail.com>
2025-08-27 16:58:07 +03:00
Miss Islington (bot)
86f7bb7ede
[3.14] gh-138148: Fix grammatical error in the asynchronous generator iterator term (GH-138155) (#138159)
Co-authored-by: Krishna Chaitanya <141550576+XChaitanyaX@users.noreply.github.com>
2025-08-27 16:57:36 +03:00
Miss Islington (bot)
6c2d42f3f2
[3.14] GH-132775: Fix argument parsing for `_interpqueues.put()` (GH-137686) (#138034)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-27 16:53:39 +03:00
Miss Islington (bot)
f4af7176c1
[3.14] gh-106318: Add example for str.find() (GH-134529) (#138174)
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-08-27 06:48:49 +00:00
Miss Islington (bot)
01afaccce6
[3.14] gh-135261: bring back CI job for testing OpenSSL 1.1.1w (GH-135262) (#138109)
gh-135261: bring back CI job for testing OpenSSL 1.1.1w (GH-135262)

This partially reverts commit d83e30cadd
by bringing back the CI job for testing OpenSSL 1.1.1w. Despite this
version being upstream EOL, the rationale for keeping it as follows:

- It most resembles other 1.1.1-work-a-like ssl APIs supported by important vendors.
- Python officially requires OpenSSL 1.1.1 or later, although OpenSSL 3.0 or later
  is recommended for cryptographic modules. Since changing the build requirements
  requires a transition period, we need to keep testing the allowed versions.
- The code base still contains calls to OpenSSL functions that are deprecated since
  OpenSSL 3.0 as well as `ifdef` blocks constrained to OpenSSL 1.1.1.

(cherry picked from commit 96b7a2eba4)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-08-26 08:45:08 +03:00
Peter Bierma
8b3f9ae2ca
[3.14] gh-137883: Check the recursion limit for specialized keyword argument calls (GH-137887) (#137945)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-08-25 19:19:39 +03:00
Miss Islington (bot)
9fa74c57fe
[3.14] gh-137973: Add a non-parallel test plan to the iOS testbed project (GH-138018) (#138038)
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2025-08-25 15:00:35 +03:00
Miss Islington (bot)
271823fdaf
[3.14] gh-135862: add C contiguous one-dimensional buffer requirement to asyncio.StreamWriter docs (GH-137910) (#137912)
gh-135862: add C contiguous one-dimensional buffer requirement to `asyncio.StreamWriter` docs (GH-137910)
(cherry picked from commit 1c3950abc1)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-08-23 19:27:51 +03:00
Kumar Aditya
d619015ecd
[3.14] gh-137384: fix crash when accessing warnings state late in runtime shutdown (GH-138027) (#138065) 2025-08-22 17:27:49 +03:00
Miss Islington (bot)
c213eb90a0
[3.14] gh-138042: Fix homebrew for tail-calling macOS CI (GH-138043) (#138060)
Co-authored-by: Ken Jin <kenjin@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-08-22 17:07:38 +03:00
Miss Islington (bot)
57c46013e3
[3.14] gh-123299: Fix typos & grammar and copyedit What's New in 3.14 (GH-138040) (#138041)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-08-22 11:11:38 +03:00
Miss Islington (bot)
132b8664b1
[3.14] gh-137847: Add examples for UUIDv6-8 (GH-137848) (#137901)
Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-08-21 21:36:35 +03:00
Miss Islington (bot)
cf5c170c1b
[3.14] gh-137728 gh-137762: Fix bugs in the JIT with many local variables (GH-137764) (#137999)
Co-authored-by: Ken Jin <kenjin@python.org>
2025-08-21 17:00:05 +03:00
Miss Islington (bot)
bb3c3d4444
[3.14] gh-137964: Remove the "experimental" designation from the Windows installer (GH-137965) (#137971)
Co-authored-by: Itamar Oren <itamarost@gmail.com>
2025-08-20 20:19:45 +03:00
Miss Islington (bot)
5923849855
[3.14] gh-137900: Improve dataclasses frozen parameter documentation (GH-137937) (#137990)
gh-137900: Improve dataclasses frozen parameter documentation (GH-137937)
(cherry picked from commit 7685b8ada8)

Co-authored-by: Tangyuan <47830915@qq.com>
2025-08-20 16:49:43 +03:00
Miss Islington (bot)
3fa5a4beb4
[3.14] gh-127859: Fixed documentation for call_later and call_at for early wakeup in asyncio (GH-137859) (#137908)
Co-authored-by: Bar Harel <bzvi7919@gmail.com>
2025-08-19 14:27:36 +03:00
Miss Islington (bot)
5034b6491a
[3.14] gh-134869: Fix Ctrl+C corrupts REPL autocomplete (GH-134929) (#137926)
gh-134869: Fix Ctrl+C corrupts REPL  autocomplete (GH-134929)
(cherry picked from commit 8750e5ecfc)

Co-authored-by: ggqlq <124190229+ggqlq@users.noreply.github.com>
2025-08-18 22:21:55 +01:00
Miss Islington (bot)
c9e2e15438
[3.14] Emend an error in `string.templatelib` example output (GH-137890) (#137892)
Emend an error in ``string.templatelib`` example output (GH-137890)
(cherry picked from commit 8e3244d39b)

Co-authored-by: Christoph Walcher <christoph-wa@gmx.de>
2025-08-18 14:07:47 +03:00
Miss Islington (bot)
bb4e747654
[3.14] gh-137846: Add missing 'be' to profile doc. (GH-137856) (#137857)
gh-137846: Add missing 'be' to profile doc. (GH-137856)

Insert 'be' into 'will interpreted'.
(cherry picked from commit 3663b2ad54)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-08-16 20:24:17 +03:00
Miss Islington (bot)
cfa5ee5389
[3.14] gh-137777: Disband the 'Program Frameworks' chapter (GH-137796) (#137830)
gh-137777: Disband the 'Program Frameworks' chapter (GH-137796)
(cherry picked from commit eee6589c17)

Co-authored-by: rimchoi <hyerimc858@gmail.com>
2025-08-16 11:04:59 +03:00
Miss Islington (bot)
e817d1aa2b
[3.14] gh-132661: PEP 750 documentation: second pass (GH-137020) (#137392)
gh-132661: PEP 750 documentation: second pass (GH-137020)
(cherry picked from commit 4dae9b1ff1)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-16 09:21:29 +03:00
Miss Islington (bot)
7b56d08219
[3.14] gh-137078: Fix keyword typo recognition when executed over files (GH-137079) (#137826) 2025-08-15 18:22:17 +01:00
Miss Islington (bot)
4cb99bf9e3
[3.14] GH-123299: Copyedit 3.14 What's New: Removed (GH-137794) (#137825)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-08-15 18:09:26 +03:00
Miss Islington (bot)
a4ef631c5e
[3.14] gh-137760: Update REPL constants documentation (gh-137798) (#137822)
Co-authored-by: Chaemin-Lim <antraxmin@naver.com>
2025-08-15 13:59:57 +00:00
Miss Islington (bot)
bbc92b9219
[3.14] GH-123299: Copyedit 3.14 What's New: Optimizations (GH-137789) (#137813)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-15 14:58:12 +03:00
Miss Islington (bot)
3de6ea5d8f
[3.14] gh-109975: Indicate the minimum version for PyREPL in the tutorial (GH-136046) (#137766)
Co-authored-by: Konstantin Morenko <konstantin-morenko@users.noreply.github.com>
2025-08-15 13:15:30 +03:00
Miss Islington (bot)
36a1e1aaf7
[3.14] gh-137026: Add an explainer guide for asyncio (GH-137215) (#137581)
Co-authored-by: Alexander Nordin <alexander.f.nordin@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-08-15 13:14:39 +03:00
Miss Islington (bot)
bab2a7e982
[3.14] gh-137183: Document that array.array typecode w is new in 3.13 (GH-137184) (#137208)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2025-08-15 13:13:27 +03:00
Miss Islington (bot)
0696a7526e
[3.14] gh-136437: Convert more `os.path` functions to positional-only in the docs (GH-136970) (#137000)
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-08-15 13:10:59 +03:00
Miss Islington (bot)
976d028cbb
[3.14] gh-123299: Update What's new in Python 3.14: typos and misplaced item. (GH-136665) (#137769)
Co-authored-by: Hunter Hogan <hunterhogan@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-08-15 12:14:43 +03:00
Hugo van Kemenade
5322260352 Post 3.14.0rc2 2025-08-14 19:10:50 +03:00
Hugo van Kemenade
31967d8de3 Python 3.14.0rc2 2025-08-14 15:19:47 +03:00
Miss Islington (bot)
27e128621c
[3.14] gh-137749: Python 3.14 installer is for macOS 10.15 and later (GH-137753) (#137755)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-08-14 14:12:49 +03:00
Miss Islington (bot)
7c0e6378c1
[3.14] GH-137573: mark _PyOptimizer_Optimize as no inline (GH-137731) (#137751)
Co-authored-by: Sachin Shah <39803835+inventshah@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-08-14 11:51:33 +03:00
Zachary Ware
d8f4d56f83
[3.14] gh-132339: Add support for OpenSSL 3.5 (GH-137720) (#137747)
* Add OpenSSL 3.5.2 definitions to Modules/_ssl_data_35.h (moved from Modules/_ssl_data_34.h)

* Demote OpenSSL 3.1 to "old", remove it from CI

* Update all OpenSSL versions to latest patchlevel in CI config and multissltests defaults

* Add OpenSSL 3.5.2 to CI configuration and multissltests default list

* Fix a typo in the argument parser description of multissltests.py
(cherry picked from commit 7a703c8f19)
2025-08-14 08:58:18 +03:00
Miss Islington (bot)
902de283a8
[3.14] gh-137226: Fix behavior of ForwardRef.evaluate with type_params (GH-137227) (#137709)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-08-13 14:13:14 +00:00
sobolevn
ad9f20dffa
[3.14] gh-133403: Run mypy on Tools/build/mypy.ini changes (GH-137692) (#137698) 2025-08-13 11:10:58 +00:00
Miss Islington (bot)
b7df473260
[3.14] gh-133403: Check generate_stdlib_module_names and check_extension_modules with mypy (GH-137546) (#137679)
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-08-13 13:42:26 +03:00
Miss Islington (bot)
c60289c7f2
[3.14] gh-137450: macOS installer shell path management improvements (GH-137451) (#137453)
Co-authored-by: Ned Deily <nad@python.org>
2025-08-13 13:39:50 +03:00
Ned Deily
2392232ec4
[3.14] GH-134291: Support older macOS deployment targets for JIT builds (GH-137211) (#137701)
Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2025-08-13 13:37:01 +03:00
Hugo van Kemenade
ccb6de37d3
[3.14] gh-137242: Add Android CI job (GH-137186) (#137683)
Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
2025-08-13 12:39:14 +03:00
Miss Islington (bot)
4ebd928b00
[3.14] gh-137400: Fix a crash when disabling profiling across all threads (gh-137471) (#137648)
Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-08-12 17:29:57 +03:00
Miss Islington (bot)
4dda1768be
[3.14] gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (take 2) (GH-137047) (#137666)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-12 17:17:26 +03:00
Miss Islington (bot)
daed07a1f9
[3.14] GH-137426: Remove code deprecation of importlib.abc.ResourceLoader (GH-137567) (#137654)
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-08-12 15:47:28 +03:00
Petr Viktorin
946b226b90
[3.14] gh-137288: Update version in magic number log (GH-137665) (#137667)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-08-12 12:18:20 +00:00
Irit Katriel
0ccf244a19
[3.14] gh-137288: Fix bug where boolean expressions are not associated with the correct exception handler (GH-137310). (#137427)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-08-12 12:56:37 +03:00
Miss Islington (bot)
019238ab18
[3.14] gh-137200: support frame lineno setter with BRANCH_LEFT and BRANCH_RIGHT events (GH-137229) (#137280)
Co-authored-by: Xuanteng Huang <44627253+xuantengh@users.noreply.github.com>
2025-08-11 17:07:19 +03:00
Miss Islington (bot)
1bf7462e34
[3.14] Update pre-commit hooks (GH-137591) (#137621)
Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-11 11:21:45 +03:00
Miss Islington (bot)
1878fe814a
[3.14] gh-131338: Disable computed stack limit checks on non-glibc linux (GH-134336) (#137175)
Co-authored-by: R. David Murray <rdmurray@bitdance.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-08-10 16:55:29 +03:00
Miss Islington (bot)
f180fb956b
[3.14] gh-119711: describe create_datagram_endpoint's behavior in asyncio when local_addr is None (GH-136913) (#137164)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
2025-08-10 16:52:30 +03:00
Miss Islington (bot)
50461821fb
[3.14] gh-137499: Fixed dead link to NIST website (GH-137500) (#137502)
gh-137499: Fixed dead link to NIST website (GH-137500)
(cherry picked from commit 3c1471d971)

Co-authored-by: tobiasjcat <70606111+tobiasjcat@users.noreply.github.com>
2025-08-09 03:31:29 +00:00
Miss Islington (bot)
7dc669f935
[3.14] gh-136155: Docs: check for EPUB fatal errors in CI (GH-134074) (#137539)
Co-authored-by: Maciej Olko <maciej.olko@affirm.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-08 19:05:29 +03:00
Miss Islington (bot)
9e8a9ac11a
[3.14] gh-137282: Fix TypeError in tab completion and dir() of concurrent.futures (GH-137214) (#137284)
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2025-08-08 18:13:22 +03:00
Miss Islington (bot)
f17d77f112
[3.14] gh-137308: Replace a single docstring with pass in -OO mode (GH-137318) (#137322)
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-08-08 18:04:10 +03:00
Miss Islington (bot)
f1248cfac0
[3.14] gh-137412: fix default_builtin_hashes values in test_hashlib.py (GH-137413) (#137534)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-08-08 17:36:21 +03:00
Miss Islington (bot)
3df0842de5
[3.14] [Doc] Remove unnecessary quotes from typing module (GH-137207) (#137541)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-08-08 17:31:32 +03:00
Hugo van Kemenade
ab7ffdcaaa
[3.14] gh-123299: Backport typo fixes in What's New in Python 3.14 (#137525) 2025-08-07 19:06:09 +03:00
Miss Islington (bot)
0fc49bed80
[3.14] gh-132983: Use `Py_UNREACHABLE in _zstd_load_impl()` (GH-137320) (#137360)
Co-authored-by: Rogdham <3994389+Rogdham@users.noreply.github.com>
2025-08-07 18:38:15 +03:00
Miss Islington (bot)
43d8f527c9
[3.14] Doc: remove unused images (GH-137323) (#137324)
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2025-08-06 18:39:52 +03:00
Miss Islington (bot)
9b8826b2c7
[3.14] gh-137134: Update SQLite to 3.50.4 for binary releases (GH-137135) (#137436)
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Ned Deily <nad@python.org>
2025-08-06 15:45:54 +03:00
Miss Islington (bot)
25ae1af55e
[3.14] Docs: add dunder and walrus to the glossary (GH-137430) (#137434)
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2025-08-06 14:58:52 +03:00
Miss Islington (bot)
3a1e5824dd
[3.14] GH-136155: Use `sphinxext-opengraph` v0.12.0 (GH-137393) (#137431)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-05 23:38:48 +03:00
Miss Islington (bot)
7d57316484
[3.14] gh-137194: Fix requires_debug_ranges when _testcpi doesn't exist (GH-137195) (#137274)
Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2025-08-05 20:34:47 +03:00
Miss Islington (bot)
f4870086ba
[3.14] gh-130522: Fix unraisable TypeError in threading at interpreter shutdown (GH-131537) (#137105)
Co-authored-by: Tyler Kennedy <tk@tkte.ch>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-08-04 16:01:39 +03:00
Miss Islington (bot)
134ca903b3
[3.14] Remove Alex Waygood as a codeowner for pre-commit config (GH-137372) (#137373)
Remove Alex Waygood as a codeowner for pre-commit config (GH-137372)
(cherry picked from commit a46ed665ff)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-08-04 13:34:16 +03:00
Miss Islington (bot)
127ec30112
[3.14] gh-137257: Upgrade bundled pip to 25.2 (GH-137258) (#137361)
gh-137257: Upgrade bundled pip to 25.2 (GH-137258)
(cherry picked from commit 506542b596)

Co-authored-by: Richard Si <sichard26@gmail.com>
2025-08-04 08:29:30 +03:00
Miss Islington (bot)
833d883ad4
[3.14] gh-132983: Fix docstrings in `ZstdDict` (GH-137321) (#137343)
Co-authored-by: Rogdham <3994389+Rogdham@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-03 22:37:49 +03:00
Miss Islington (bot)
ecdec64f73
[3.14] GH-136155: Use `sphinxext-opengraph` v0.11.0 (GH-137348) (#137349)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-03 18:39:19 +00:00
Serhiy Storchaka
69fee0c66a
[3.14] gh-137341: Remove more word duplications (GH-137342) (#137346) 2025-08-03 21:26:16 +03:00
Miss Islington (bot)
cf57f4fac3
[3.14] gh-137314: Fix incorrect treatment of format specs in raw fstrings (GH-137328) (#137344)
gh-137314: Fix incorrect treatment of format specs in raw fstrings (GH-137328)
(cherry picked from commit 0153d82a5a)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-08-03 16:36:58 +00:00
Miss Islington (bot)
42b58cfa42
[3.14] gh-119180: Refer to annotationlib.get_annotations() in typing.get_type_hints() documentation (GH-137247) (#137263)
gh-119180: Refer to `annotationlib.get_annotations()` in `typing.get_type_hints()` documentation (GH-137247)
(cherry picked from commit 5e2f0b976a)

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
2025-07-31 07:07:44 +03:00
Miss Islington (bot)
aab9537cf0
[3.14] gh-136992: Add "None" as valid SameSite value as per RFC 6265bis (GH-137040) (#137140)
Co-authored-by: Iqra Khan <iqraakhan2519@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-07-30 22:43:53 +03:00
Miss Islington (bot)
f607515bc5
[3.14] GH-116738: document thread-safety of bisect (GH-136555) (#137221)
Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2025-07-30 22:01:10 +03:00
Miss Islington (bot)
38a42fe32c
[3.14] gh-136976: Emscripten: Add _decimal and libmpdec (GH-136997) (#137066)
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
Co-authored-by: Zachary Ware <zach@python.org>
2025-07-29 23:10:39 +03:00
Miss Islington (bot)
64eb54062d
[3.14] gh-124621: Emscripten: Add smoke test for using pyrepl in Chrome (GH-137004) (#137067)
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
Co-authored-by: Zachary Ware <zach@python.org>
2025-07-29 23:09:47 +03:00
Miss Islington (bot)
40632ad7ba
[3.14] Add a What's New entry for Emscripten (GH-137035) (#137192)
Add a What's New entry for Emscripten (GH-137035)
(cherry picked from commit d7e12a362a)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-29 09:53:34 +03:00
Miss Islington (bot)
9da008da99
[3.14] gh-132898: Add a note in multiprocessing.Process docs about creating a process in a REPL (GH-137118) (#137154)
Co-authored-by: Duprat <yduprat@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-07-28 22:48:58 +03:00
Miss Islington (bot)
aeb55ebb07
[3.14] GH-137059: url2pathname(): fix support for drive letter in netloc (GH-137060) (#137144)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
2025-07-28 22:43:15 +03:00
Miss Islington (bot)
fbc2a0ca9a
[3.14] gh-130577: tarfile now validates archives to ensure member offsets are non-negative (GH-137027) (#137169)
Co-authored-by: Alexander Urieles <aeurielesn@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-07-28 22:40:56 +03:00
Miss Islington (bot)
909a534cb2
[3.14] gh-136870: fix data races in instrumentation of bytecode (GH-136994) (#137082)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Zachary Ware <zach@python.org>
2025-07-28 22:39:44 +03:00
Miss Islington (bot)
47a2109c1a
[3.14] Link to plaintext for "show source" links (GH-137131) (#137132)
Link to plaintext for "show source" links (GH-137131)
(cherry picked from commit 9cbf46d992)

Co-authored-by: ryan-duve <ryan-duve@users.noreply.github.com>
2025-07-27 09:54:41 +03:00
Miss Islington (bot)
fc911a93cb
[3.14] gh-131038: Use text=True in subprocesses in test_perf_profiler (GH-137117) (#137124) 2025-07-26 17:28:40 +00:00
Miss Islington (bot)
5746e067fd
[3.14] gh-137090: Remove redundant statement in `Doc/library/concurrent.interpreters.rst` (GH-137091) (#137108)
gh-137090: Remove redundant statement in ``Doc/library/concurrent.interpreters.rst`` (GH-137091)
(cherry picked from commit 1e69cd1634)

Co-authored-by: soolabettu <17737361+soolabettu@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-25 19:08:28 +03:00
Miss Islington (bot)
87422988f9
[3.14] gh-132983: Add missing references to Zstandard in shutil docstrings (GH-136617) (#137052)
Co-authored-by: Rogdham <3994389+Rogdham@users.noreply.github.com>
Co-authored-by: Zachary Ware <zach@python.org>
2025-07-25 12:30:11 +03:00
Miss Islington (bot)
d996cb6700
[3.14] Exclude _testclinic_depr.c.h from c-analyzer (GH-137086) (#137089)
Exclude _testclinic_depr.c.h from c-analyzer (GH-137086)

_testclinic.c mocks out PY_VERSION_HEX to 3.8 before including
_testclinic_depr.c.h to avoid the errors the preprocessor would
otherwise throw due to the deprecation feature it is testing.

(cherry picked from commit d5e75c0768)

Co-authored-by: Zachary Ware <zach@python.org>
2025-07-25 00:36:11 +03:00
Miss Islington (bot)
b7168d216b
[3.14] GH-136975: Emend a spelling error (algorthm -> algorithm) (GH-136999) (#137003)
GH-136975: Emend a spelling error (algorthm -> algorithm) (GH-136999)
(cherry picked from commit b6d3242244)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-23 23:48:11 +03:00
Miss Islington (bot)
f2981acd6b
[3.14] gh-137043: mention PyList_GET_ITEM as unsafe borrowed API in free-threading docs (GH-137042) (#137045)
Co-authored-by: Guido Imperiale <crusaderky@gmail.com>
2025-07-23 20:45:55 +03:00
Miss Islington (bot)
4832ceaa78
[3.14] gh-135676: Lexical analysis: Reword String literals and related sections (GH-135942) (#137048)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-23 19:23:25 +03:00
Hugo van Kemenade
9f25781bf9 Post 3.14.0rc1 2025-07-22 21:54:14 +03:00
Hugo van Kemenade
48f8831004 Python 3.14.0rc1 2025-07-22 19:42:44 +03:00
Jelle Zijlstra
70990ed5ca
[3.14] Revert "[3.14] gh-135228: When @dataclass(slots=True) replaces… (#137013) 2025-07-22 16:23:53 +00:00
Miss Islington (bot)
715c658bf8
[3.14] Fix tables in 'Using on Windows' for the text writer (GH-137012) (#137015)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-22 16:21:19 +00:00
Serhiy Storchaka
805daa2edb
[3.14] Revert "gh-112068: C API: Add support of nullable arguments in PyArg_Parse (GH-121303)" (GH-136991) (#137006) 2025-07-22 19:16:31 +03:00
Miss Islington (bot)
c328d140eb
[3.14] Fix code example in annotationlib documentation (GH-136972) (#137002)
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
2025-07-22 19:15:27 +03:00
Łukasz Langa
591019e1f2
[3.14] gh-124621: Emscripten: Support pyrepl in browser (GH-136931) (GH-136988)
Basic support for pyrepl in Emscripten. Limitations:
* requires JSPI
* no signal handling implemented

As followup work, it would be nice to implement a webworker variant
for when JSPI is not available and proper signal handling.

Because it requires JSPI, it doesn't work in Safari. Firefox requires
setting an experimental flag. All the Chromiums have full support since
May. Until we make it work without JSPI, let's keep the original web_example
around.
(cherry picked from commit c933a6bb32)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Éric <merwok@netwok.org>
2025-07-22 15:04:11 +02:00
Miss Islington (bot)
8e3c3b5bbc
[3.14] gh-133742: Fix test_sysconfig and test_build_details for relocated directories (GH-136987) (#136990)
gh-133742: Fix test_sysconfig and test_build_details for relocated directories (GH-136987)
(cherry picked from commit aafbdb5df5)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-07-22 12:18:23 +00:00
Miss Islington (bot)
daa2fd7ed2
[3.14] gh-118350: Fix support of elements "textarea" and "title" in HTMLParser (GH-135310) (GH-136984)
(cherry picked from commit 4d02f31cdd)

Co-authored-by: Timon Viola <44016238+timonviola@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-07-22 13:52:34 +02:00
Miss Islington (bot)
4f1f648c3b
[3.14] gh-136251: Improvements to WASM demo REPL (GH-136252) (GH-136977)
(cherry picked from commit d1d526afe7)

Co-authored-by: adam j hartz <adam@smatz.net>
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-22 13:25:35 +02:00
Miss Islington (bot)
c59a60bdb4
[3.14] gh-132661: Document t-strings and templatelib (GH-135229) (#136974)
Co-authored-by: Dave Peck <davepeck@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Loïc Simon <loic.pano@gmail.com>
Co-authored-by: pauleveritt <pauleveritt@me.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2025-07-22 13:32:00 +03:00
Miss Islington (bot)
d118bc061b
[3.14] gh-124621: Emscripten: Add support for async input devices (GH-136822) (GH-136935)
This is useful for implementing proper `input()`. It requires the
JavaScript engine to support the wasm JSPI spec which is now stage 4.
It is supported on Chrome since version 137 and on Firefox and node
behind a flag.

We override the `__wasi_fd_read()` syscall with our own variant that
checks for a readAsync operation. If it has it, we use our own async
variant of `fd_read()`, otherwise we use the original `fd_read()`.
We also add a variant of `FS.createDevice()` called
`FS.createAsyncInputDevice()`.

Finally, if JSPI is available, we wrap the `main()` symbol with
`WebAssembly.promising()` so that we can stack switch from `fd_read()`.
If JSPI is not available, attempting to read from an AsyncInputDevice
will raise an `OSError`.
(cherry picked from commit 7ae4749d06)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-22 11:51:02 +02:00
Hugo van Kemenade
8e43b130f7
[3.14] gh-134009: Expose PyMutex_IsLocked in the public C API (gh-134365) (#136971)
Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-07-22 12:48:08 +03:00
Miss Islington (bot)
11f510167c
[3.14] gh-133296: Publicly expose critical section API that accepts PyMutex (gh-135899) (#136969)
Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-07-22 12:44:59 +03:00
Miss Islington (bot)
ddd3413687
[3.14] gh-136859: Improve StrEnum docs (GH-136864) (#136936)
Co-authored-by: Nacho Caballero <nachocab@gmail.com>
Co-authored-by: Nacho Caballero <nacho.caballero@astrazeneca.com>
Co-authored-by: Antonio Spadaro <ilovelinux@users.noreply.github.com>
2025-07-22 11:32:09 +03:00
Miss Islington (bot)
d5d3adafa7
[3.14] gh-135468: Improve `BaseHandler.http_error_default()` parameter descriptions (GH-136797) (#136825)
Co-authored-by: Valerio Gianella <49408327+valeriogianella@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-07-22 11:29:40 +03:00
Hugo van Kemenade
72b679423d
[3.14] Fix 3 typos in "Next" News items (GH-136892) (#136967)
Co-authored-by: Cornelius Roemer <cornelius.roemer@gmail.com>
2025-07-22 08:29:17 +00:00
Miss Islington (bot)
efa984b7ce
[3.14] gh-131531: Android test fixes (GH-136845) (#136962)
Modifies the test runner script to no longer export the the HOST environment
variable, and to allow for tests that produce no Python output (output from the
Android console is still expected and required). These changes stem from
knowledge gained during developing a PR for Android support in cibuildwheel.
(cherry picked from commit 149bddcc21)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
2025-07-22 16:15:50 +08:00
Miss Islington (bot)
6e1b31b87e
[3.14] gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (GH-136893) (#136960)
gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (GH-136893)

An interesting hack, but more localized in scope than GH-135230.

This may be a breaking change if people intentionally keep the original class around
when using `@dataclass(slots=True)`, and then use `__dict__` or `__weakref__` on the
original class.
(cherry picked from commit 46cbdf967a)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2025-07-22 05:08:15 +00:00
Miss Islington (bot)
caef946a25
[3.14] gh-136170: Revert adding ZipFile.data_offset (GH-136950) (#136955)
gh-136170: Revert adding `ZipFile.data_offset` (GH-136950)

* Revert "gh-84481: Make ZipFile.data_offset more robust (GH-132178)"

This reverts commit 6cd1d6c6b1.

* Revert "gh-84481: Add ZipFile.data_offset attribute (GH-132165)"

This reverts commit 0788948dcb.

---------
(cherry picked from commit 6bf1c0ab34)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-07-21 20:35:41 -07:00
Miss Islington (bot)
4af1b72b31
[3.14] gh-133600: Move config.site-wasm32-emscripten into the emscripten folder (GH-136934) (#136956)
Reorganises the large Emscripten-specific file into the Emscripten folder.
(cherry picked from commit bbe589f93c)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-22 00:22:57 +00:00
Miss Islington (bot)
ecd97caaf5
[3.14] gh-136421: Load _datetime static types during interpreter initialization (GH-136583) (GH-136943)
gh-136421: Load `_datetime` static types during interpreter initialization (GH-136583)

`_datetime` is a special module, because it's the only non-builtin C extension that contains static types. As such, it would initialize static types in the module's execution function, which can run concurrently. Since static type initialization is not thread-safe, this caused crashes. This fixes it by moving the initialization of `_datetime`'s static types to interpreter startup (where all other static types are initialized), which is already properly protected through other locks.
(cherry picked from commit a10960699a)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-07-21 19:23:05 -04:00
Miss Islington (bot)
718fc5b139
[3.14] gh-136870: fix data race in PyThreadState_Clear on sys_tracing_threads (GH-136951) (#136953)
gh-136870: fix data race in `PyThreadState_Clear` on `sys_tracing_threads` (GH-136951)

In free-threading, multiple threads can be cleared concurrently as such the modifications on `sys_tracing_threads` should be done while holding the profile lock, otherwise it can race with other threads setting up profiling.
(cherry picked from commit f183996eb7)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-21 21:01:14 +00:00
Serhiy Storchaka
893707c538
[3.14] gh-135661: Fix parsing attributes with whitespaces around the "=" separator in HTMLParser (GH-136908) (#136927) 2025-07-21 20:34:24 +02:00
Miss Islington (bot)
fa9a369044
[3.14] gh-136437: Document os.path.dirname as accepting only pos-only (GH-136946) (#136947)
gh-136437: Document `os.path.dirname` as accepting only pos-only (GH-136946)
(cherry picked from commit 3224429450)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-21 18:29:22 +00:00
Miss Islington (bot)
81edfb7140
[3.14] GH-136874: url2pathname(): discard query and fragment components (GH-136875) (#136942)
GH-136874: `url2pathname()`: discard query and fragment components (GH-136875)

In `urllib.request.url2pathname()`, ignore any query or fragment components
in the given URL.
(cherry picked from commit 80b2d60a51)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2025-07-21 19:08:07 +01:00
Miss Islington (bot)
aa17c39339
[3.14] gh-136437: Document some os.path functions as requiring pos-only (GH-136812) (#136944)
gh-136437: Document some `os.path` functions as requiring pos-only (GH-136812)
(cherry picked from commit b5428bb0e7)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-21 18:07:56 +00:00
Miss Islington (bot)
f86a59549b
[3.14] Pedantic rewording of why relative importing doesn't work in main modules (GH-136846) (#136940)
Pedantic rewording of why relative importing doesn't work in main modules (GH-136846)

Pedantically reword the section about relative imports and main modules.
(cherry picked from commit 4b68289ca6)

Co-authored-by: Josh Cannon <joshdcannon@gmail.com>
2025-07-21 09:58:27 -07:00
Miss Islington (bot)
11378e1c85
[3.14] gh-135621: Simplify TermInfo (GH-136916) (#136925) 2025-07-21 18:04:13 +02:00
Lysandros Nikolaou
af8d1f56f5
[3.14] gh-132661: Disallow Template/str concatenation after PEP 750 spec update (#135996) (#136901)
Co-authored-by: Dave Peck <davepeck@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-21 17:34:54 +02:00
Miss Islington (bot)
0d87bb66d3
[3.14] gh-121028: Soft-deprecate sys.api_version (GH-136463) (GH-136928)
(cherry picked from commit 658599c15d)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-21 12:29:51 +00:00
Miss Islington (bot)
031645a884
[3.14] gh-135621: Remove dependency on curses from PyREPL (GH-136758) (GH-136915)
(cherry picked from commit 09dfb50f1b)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-07-21 13:02:41 +02:00
Miss Islington (bot)
4f6f3ee8d3
[3.14] gh-136852: Emscripten: Add PYTHON_NODE_VERSION environment variable (GH-136853) (GH-136907)
To choose the node version we use. Together with:
https://github.com/python/buildmaster-config/pull/614
closes GH-136852.
(cherry picked from commit aec7f5f8b2)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-21 11:58:57 +02:00
Miss Islington (bot)
a69472e242
[3.14] gh-134411: assert PyLong_FromLong(x) != NULL when x is known to be small (GH-134415) (#136910)
gh-134411: assert `PyLong_FromLong(x) != NULL` when `x` is known to be small (GH-134415)

Since `PyLong_From Long(PY_MONITORING_DEBUGGER_ID)` falls to `small_int` case and can't return `NULL`. Added `assert`s for extra confidence.
https://github.com/python/cpython/issues/134411#issuecomment-2897653868
(cherry picked from commit cf19b6435d)

Co-authored-by: Sergey Muraviov <smurav@mail.ru>
2025-07-21 09:23:33 +00:00
Miss Islington (bot)
163f532530
[3.14] gh-136882: Update stale link in the basic logging tutorial. (GH-136885) (#136905)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-21 12:04:39 +03:00
Miss Islington (bot)
d0623cbbf5
[3.14] gh-136428: amend UUIDv8 performance improvements (GH-136903) (#136904)
gh-136428: amend UUIDv8 performance improvements (GH-136903)

UUIDv8 has been added in Python 3.14.0a2 and its construction time
has been improved in Python 3.14.0a4, but since those changes will
not be visible when comparing the latest Python 3.13 and 3.14 together,
we do not document them on the What's New page to avoid confusion.
(cherry picked from commit 5798348a07)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-07-21 08:29:52 +00:00
Miss Islington (bot)
9663f93a50
[3.14] gh-136470: Correct InterpreterPoolExecutor's default thread name (GH-136472) (GH-136889)
gh-136470: Correct InterpreterPoolExecutor's default thread name (GH-136472)

The OS thread name is now correctly prefixed with `InterpreterPoolExecutor` instead of `ThreadPoolExecutor`.
(cherry picked from commit 246be21de1)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2025-07-21 00:00:19 +00:00
Miss Islington (bot)
17c5959aa3
[3.14] GH-130645: Default to color help in argparse (GH-136809) (#136886)
GH-130645: Default to color help in argparse (GH-136809)
(cherry picked from commit acbe896cb1)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-07-20 15:22:53 -07:00
Miss Islington (bot)
2f7684ceee
[3.14] GH-111758: Merge TSan and UBSan reusable GHA workflows (GH-136820) (#136883)
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Sviatoslav Sydorenko <webknjaz@redhat.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-07-20 20:28:28 +00:00
Miss Islington (bot)
2caae152b9
[3.14] gh-86608: Improve and restructure tarfile examples (GH-121771) (#136866)
gh-86608: Improve and restructure tarfile examples (GH-121771)

Add an example on how to write a tarfile to stdout; general improvements.
(cherry picked from commit cc81b4e501)

Co-authored-by: Dominic H <dom@dominic.sk>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-20 14:16:19 +01:00
Miss Islington (bot)
c537b98e48
[3.14] gh-130655: gettext: Add fallback testcase (GH-136857) (#136862)
gh-130655: gettext: Add fallback testcase (GH-136857)
(cherry picked from commit c6e6fe92cd)

Co-authored-by: Dominic H <dom@dominic.sk>
2025-07-20 12:32:58 +00:00
Miss Islington (bot)
ee37365e0d
[3.14] gh-136854: Exit on error in make venv (GH-136856) (#136860)
Co-authored-by: Nacho Caballero <nachocab@gmail.com>
Co-authored-by: Nacho Caballero <nacho.caballero@astrazeneca.com>
2025-07-20 12:13:48 +00:00
Olga Pustovalova
0e909267f6
[3.14] gh-136438: Make sure test_remote_pdb pass with all optimization levels (GH-136788) (GH-136855)
(cherry picked from commit 588d9fb84a)
2025-07-20 13:51:59 +02:00
Miss Islington (bot)
2cb3b534e7
[3.14] gh-108362: Retarget incremental GC changes to 3.14 (GH-125453) (#136851)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-07-20 14:28:17 +03:00
Miss Islington (bot)
cce38eefd4
[3.14] Doc/c-api/memory.rst: extend --without-pymalloc doc with ASan information (GH-136790) (GH-136798)
Extend the documentation for disabling pymalloc with the `--without-pymalloc` flag regarding why it is worth to use it when enabling AddressSanitizer for Python build (which is done, e.g., in CPython's CI builds).

I have tested the CPython latest main build with both ASan and pymalloc enabled and it seems to work just fine. I did run the `python -m test` suite which didn't uncover any ASan crashes (though, it detected some memory leaks, which I believe are irrelevant here).

I have discussed ASan and this flag with @encukou on the CPython Core sprint on EuroPython 2025. We initially thought that the `--without-pymalloc` flag is needed for ASan builds due to the fact pymalloc must hit the begining of page when determining if the memory to be freed comes from pymalloc or was allocated by the system malloc. In other words, we thought, that ASan would crash CPython during free of big objects (allocated by system malloc). It may be that this was the case in the past, but it is not the case anymore as the `address_in_range` function used by pymalloc is annotated to be skipped from the ASan instrumentation.


(cherry picked from commit d19bb44713)

Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-20 10:55:06 +02:00
Miss Islington (bot)
197f3eca2a
[3.14] gh-136764: improve comment in enum.verify.__call__ (GH-136774) (GH-136841)
gh-136764: improve comment in enum.verify.__call__ (GH-136774)
(cherry picked from commit 6a1c93af80)

Co-authored-by: Saurav Singh <sauravsinghshakya@yahoo.com>
2025-07-19 11:00:15 -07:00
Miss Islington (bot)
4606b4089d
[3.14] gh-136839: Refactor simple dict.update calls (GH-136811) (#136840)
gh-136839: Refactor simple dict.update calls (GH-136811)

Refactor simple dict.update calls

This commit refactors simple `dict.update({key: value})` calls which can
be done via `dict[key] = value` instead.

I found those cases with the [semgrep](https://semgrep.dev/) tool:

```
$ semgrep --lang python --pattern '$DICT.update({$A: ...})'

┌─────────────────┐
│ 5 Code Findings │
└─────────────────┘

    Lib/dataclasses.py
         1268┆ slots.update({slot: doc})

    Lib/multiprocessing/resource_tracker.py
           50┆ _CLEANUP_FUNCS.update({
           51┆     'semaphore': _multiprocessing.sem_unlink,
           52┆ })
            ⋮┆----------------------------------------
           53┆ _CLEANUP_FUNCS.update({
           54┆     'shared_memory': _posixshmem.shm_unlink,
           55┆ })

    Lib/tkinter/scrolledtext.py
           26┆ kw.update({'yscrollcommand': self.vbar.set})

    Lib/xmlrpc/server.py
          242┆ self.funcs.update({'system.multicall' : self.system_multicall})
```
(cherry picked from commit 69ea1b3a8f)

Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
2025-07-19 17:36:31 +00:00
Miss Islington (bot)
f8af7cb723
[3.14] gh-136752: Clarify documentation for `IPv{N}Address.is_reserved` (GH-136794) (#136827)
gh-136752: Clarify documentation for ``IPv{N}Address.is_reserved`` (GH-136794)
(cherry picked from commit 6293d8a1a6)

Co-authored-by: Matthieu Lienart <50069805+mlnrt@users.noreply.github.com>
Co-authored-by: Matthieu Lienart <matthieu.lienart@axians.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-19 14:50:30 +00:00
Miss Islington (bot)
8d063f3d92
[3.14] gh-54732: Make argparse error caused by empty rows in option files explicit (GH-136795) (#136818)
gh-54732: Make argparse error caused by empty rows in option files explicit (GH-136795)
(cherry picked from commit 8ffc3ef01e)

Co-authored-by: jdunter <2ve@mailbox.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-19 14:28:52 +00:00
Miss Islington (bot)
2a9aeb0f57
[3.14] gh-136801: Fix PyREPL syntax highlightning on match cases after multi-line case (GH-136804) (GH-136813)
(cherry picked from commit 3a64844533)

Co-authored-by: Olga Matoula <olgamatoula@gmail.com>
2025-07-19 15:56:40 +02:00
Miss Islington (bot)
03457ca2ac
[3.14] gh-135730: Clarify multiprocessing.Queue close() documentation (GH-136803) (GH-136806)
gh-135730: Clarify multiprocessing.Queue close() documentation (GH-136803)

Add a copy of the text from SimpleQueue.close()

---------
(cherry picked from commit f575588ccf)

Co-authored-by: aggshruti99 <aggshruti99@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-19 14:57:52 +02:00
Miss Islington (bot)
8b4275c99a
[3.14] gh-136769: Include fixed-width integers in the fundamental data types table (GH-136784) (#136785)
gh-136769: Include fixed-width integers in the fundamental data types table (GH-136784)

Fixed-sized types, like ``c_int32``, are currently missing from the fundamental data types table
in the ``ctypes`` documentation. This commit adds them, and  notes that ``c_[u]int8`` is an alias
of ``c_[u]byte``.
(cherry picked from commit acefb978dc)

Co-authored-by: Sina Zel taat <111974143+SZeltaat@users.noreply.github.com>
2025-07-19 10:26:22 +00:00
Miss Islington (bot)
a91e2bc440
[3.14] Fix typo in Lib/test/test_ast/test_ast.py (GH-136767) (#136783)
Fix typo in `Lib/test/test_ast/test_ast.py` (GH-136767)

`ASTOptimiziationTests` -> `ASTOptimizationTests`
(cherry picked from commit 60146f4f6f)

Co-authored-by: Hunter Hogan <hunterhogan@users.noreply.github.com>
2025-07-19 10:23:52 +00:00
Miss Islington (bot)
ba6ea7c53d
[3.14] gh-74598: document that fnmatch.filterfalse is affected by cache limitation (GH-136781) (#136782)
gh-74598: document that `fnmatch.filterfalse` is affected by cache limitation (GH-136781)
(cherry picked from commit 263e451c41)

Co-authored-by: Gergely Elias <gergely.elias@gmail.com>
2025-07-19 09:56:55 +00:00
Miss Islington (bot)
aeeacdb8b5
[3.14] Docs: Improve example for `itertools.batched()` (GH-136775) (#136778)
Docs: Improve example for ``itertools.batched()`` (GH-136775)

The current example `batched('ABCDEFG', n=3) → ABC DEF G` can confuse readers because both, the size of the tuples and the number of tuples are 3.
By using a batch size of n=2, it is clearer that the `n` argument refers to the size of the resulting tuples.
I.e. the new example is: `batched('ABCDEFG', n=2) → AB CD EF G`
(cherry picked from commit 3eecc72ac7)

Co-authored-by: RafaelWO <38643099+RafaelWO@users.noreply.github.com>
2025-07-19 09:36:35 +00:00
Miss Islington (bot)
81aab6d51c
[3.14] parser_generator.py typo - keywods -> keywords (GH-135014) (#136772)
Co-authored-by: chemelnucfin <3982092+chemelnucfin@users.noreply.github.com>
2025-07-19 09:18:55 +00:00
Miss Islington (bot)
201c765d76
[3.14] Fix typo: "occured" =>"occurred" (GH-134928) (#136771)
Co-authored-by: Roman <121314722+GameRoMan@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-19 09:13:51 +00:00
Miss Islington (bot)
2ea3b75200
[3.14] gh-136697: Use the standard audit event format for sys.monitoring docs (GH-136747) (#136749)
gh-136697: Use the standard audit event format for sys.monitoring docs (GH-136747)
(cherry picked from commit 28937d3a21)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2025-07-17 12:00:09 -07:00
Miss Islington (bot)
76d4a43bd8
[3.14] gh-127146: Emscripten: Set umask to zero in python.sh (GH-136740) (#136745)
Clears the umask used during a test of pydoc.apropos when testing on
Emscripten. This is to work around a known issue in Emscripten; but it's not
clear if the chmod call that is causing the problem is actually testing
anything of significance.
(cherry picked from commit 22af5d35a6)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-17 16:05:40 +00:00
Miss Islington (bot)
2ce207108c
[3.14] Improved venv docs to indicate that isolation is the default. (GH-136698) (GH-136705)
(cherry picked from commit 8e2f4b4483)
Co-authored-by: Facundo Batista <facundo@taniquetil.com.ar>
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2025-07-17 11:24:54 +01:00
Miss Islington (bot)
9bf3464852
[3.14] gh-135148: Correctly handle f/t strings with comments and debug expressions (GH-135198) (#136720) 2025-07-17 00:10:46 +02:00
Zachary Ware
5f1d46f7d0
[3.14] gh-136710: Fix bad indentation in os.chdir docstring (GH-136719)
(cherry picked from commit bde808ad6b)

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
2025-07-16 17:15:50 +00:00
Miss Islington (bot)
6943d8ef27
[3.14] gh-126548: Add a thread-unsafety warning for importlib.reload() (GH-136704) (GH-136723)
gh-126548: Add a thread-unsafety warning for `importlib.reload()` (GH-136704)
(cherry picked from commit 69d8fe50dd)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-07-16 16:40:11 +00:00
Miss Islington (bot)
9b7c4183cd
[3.14] gh-127146: Emscripten: Don't need to avoid unpaired surrogate anymore (GH-136707) (#136717)
This might have been fixed by gh-136624, or by some Emscripten change.
In any case, it no longer seems to be needed.
(cherry picked from commit dcd27aace1)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-16 16:24:15 +00:00
Miss Islington (bot)
4eee754091
[3.14] gh-127146: Emscripten: Make os.umask() actually work (GH-136706) (#136711)
Provide a stub implementation of umask that is enough to get some tests passing.
More work is needed upstream in Emscripten to make all umask tests to pass.
(cherry picked from commit 12e52cad71)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-16 16:12:36 +00:00
Miss Islington (bot)
ca6db4fdae
[3.14] gh-127146: Emscripten: more regular stack overflow skips (GH-136708) (#136712)
Makes the Emscripten stack overflow skip message consistent with WASI,
and replaces some ad-hoc skips.
(cherry picked from commit c730952aa6)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-16 17:54:04 +02:00
Miss Islington (bot)
9ab29cac19
[3.14] Add .gram file to the .editorconfig (GH-136680) (#136714)
Add `.gram` file to the `.editorconfig` (GH-136680)
(cherry picked from commit 2f0db9b05f)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-16 15:01:44 +00:00
Miss Islington (bot)
677b0e314c
[3.14] gh-136523: Fix wave.Wave_write emitting an unraisable when open raises (GH-136529) (GH-136606)
(cherry picked from commit 171de05b48)

Co-authored-by: Sachin Shah <39803835+inventshah@users.noreply.github.com>
2025-07-16 07:26:52 +00:00
Miss Islington (bot)
cdf98c3b7e
[3.14] gh-127146: Report uid in Emscripten + node as native uid (GH-136509) (#136699)
Corrects the handling of getuid on emscripten, which was consistently reporting as 0.
(cherry picked from commit e81c4e84b3)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-16 06:50:51 +02:00
Miss Islington (bot)
d888f46fba
[3.14] Fix the doctest.testmod() docstring (GH-136675) (GH-136690)
__test__ = None is not supported since Python 2.4.
(cherry picked from commit cb59eaefed)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-15 17:07:01 +00:00
Miss Islington (bot)
323974295d
[3.14] Fix index entry and anchor for module.__test__ (GH-136674) (GH-136688)
It was "doctest.module attribute". Now it is "module attribute".
(cherry picked from commit 7689407fa4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-15 15:58:52 +00:00
Miss Islington (bot)
9ae74e94a0
[3.14] gh-136396: Include instrumentation when creating new copies of the bytecode (GH-136525) (GH-136657)
Previously, we assumed that instrumentation would happen for all copies of
the bytecode if the instrumentation version on the code object didn't match
the per-interpreter instrumentation version. That assumption was incorrect:
instrumentation will exit early if there are no new "events," even if there
is an instrumentation version mismatch.

To fix this, include the instrumented opcodes when creating new copies of
the bytecode, rather than replacing them with their uninstrumented variants.
I don't think we have to worry about races between instrumentation and creating
new copies of the bytecode: instrumentation and new bytecode creation cannot happen
concurrently. Instrumentation requires that either the world is stopped or the
code object's per-object lock is held and new bytecode creation requires holding
the code object's per-object lock.
(cherry picked from commit d995922198)

Co-authored-by: mpage <mpage@meta.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-15 11:10:37 -04:00
Miss Islington (bot)
c939963b53
[3.14] gh-136682: Remove incorrect statement that os.path.samestat accepts file-like objects (GH-136683) (#136684)
gh-136682: Remove incorrect statement that `os.path.samestat` accepts file-like objects (GH-136683)
(cherry picked from commit 7e10a103df)

Co-authored-by: Ran Benita <ran@unusedvar.com>
2025-07-15 12:59:38 +00:00
Miss Islington (bot)
45b72c447c
[3.14] gh-72570: mention the incompatibility of XOFs with HMAC (GH-136676) (#136678)
gh-72570: mention the incompatibility of XOFs with HMAC (GH-136676)
(cherry picked from commit a02cf19dee)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-07-15 12:09:54 +00:00
Miss Islington (bot)
2ae0eb1a87
[3.14] GH-132661: Add `string.templatelib.convert()` (GH-135217) (#136671)
GH-132661: Add ``string.templatelib.convert()`` (GH-135217)
(cherry picked from commit 5b969fd645)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-15 10:22:24 +00:00
Miss Islington (bot)
115477399b
[3.14] gh-131189: Fix "msvcrt" import warning on Linux when "_ctypes" is not available. (GH-131201) (GH-136668)
Fix "msvcrt" import warning on Linux when "_ctypes" is not available.

On Linux, compiling without "libffi" causes a
"No module named 'msvcrt'" warning when launching PyREPL.
(cherry picked from commit f320c951c3)

Co-authored-by: Dzmitry Plashchynski <plashchynski@gmail.com>
2025-07-15 10:12:45 +02:00
Miss Islington (bot)
088d79e3ee
[3.14] gh-136663: fix signatures of PyFloat_Pack/Unpack in docs (GH-136664) (#136666)
gh-136663: fix signatures of PyFloat_Pack/Unpack in docs (GH-136664)
(cherry picked from commit e4654e0b3e)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-07-15 05:36:47 +00:00
Miss Islington (bot)
55eaaab8a4
[3.14] gh-116738: Make grp module thread-safe (GH-135434) (#136658)
gh-116738: Make grp module thread-safe (GH-135434)

Make grp module methods getgrgid() and getgrnam() thread-safe when the GIL is disabled and getgrgid_r()/getgrnam_r() C APIs are not available.
---------
(cherry picked from commit 9363703bd3)

Co-authored-by: Alper <alperyoney@fb.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-15 11:03:33 +05:30
Miss Islington (bot)
bbbbb2e2d1
[3.14] Partially revert "gh-101100: Fix sphinx warnings in library/email.parser.rst (GH-136475)" (GH-136629) (#136646)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-07-14 13:19:23 +03:00
Miss Islington (bot)
261818061e
[3.14] gh-127146: Emscripten: Fix test_open_undecodable_uri by setting -sTEXTDECODER=2 (GH-136624) (#136631)
Removes the JS text decoder fallback and gets rid of the bugs due to the differences
in behavior on invalid utf8 strings. See https://github.com/emscripten-core/emscripten/issues/24690.
(cherry picked from commit 283b050523)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-14 04:49:36 +02:00
Miss Islington (bot)
ba070b6b07
[3.14] gh-135256: Simplify parsing parameters in Argument Clinic (GH-135257) (121914136635)
(cherry picked from commit b74fb8e220)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-13 20:52:02 +00:00
Miss Islington (bot)
348e22cf06
[3.14] gh-127971: fix off-by-one read beyond the end of a string during search (GH-132574) (#136628)
gh-127971: fix off-by-one read beyond the end of a string during search (GH-132574)
(cherry picked from commit 85ec3b3b50)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
2025-07-13 13:58:03 +00:00
Miss Islington (bot)
ed1e0cdc58
[3.14] gh-42237: Link to complete list of codec aliases (GH-136625) (#136626)
gh-42237: Link to complete list of codec aliases (GH-136625)

Closes GH-42237
(cherry picked from commit a93d9aaf62)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-13 13:19:23 +00:00
Miss Islington (bot)
9ee72ab266
[3.14] gh-132346: Docs: Clarify that reference counts aren't stable between versions (GH-132352) (GH-136613)
gh-132346: Docs: Clarify that reference counts aren't stable between versions (GH-132352)
(cherry picked from commit 3dbe02ccd3)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-07-13 09:17:48 +00:00
Miss Islington (bot)
e1dc08bd9a
[3.14] gh-134833: improve docs for del s[i:j] in Mutable Sequence Types (GH-134834) (#136608)
gh-134833: improve docs for `del s[i:j]` in `Mutable Sequence Types` (GH-134834)
(cherry picked from commit 609d5adc7c)

Co-authored-by: Yongzi Li <204532581+Yzi-Li@users.noreply.github.com>
2025-07-13 12:28:45 +05:30
Miss Islington (bot)
a1ed132a19
[3.14] Docs: Fix and improve the PyUnstable_Object_EnableDeferredRefcount documentation (GH-135323) (GH-136610)
Docs: Fix and improve the `PyUnstable_Object_EnableDeferredRefcount` documentation (GH-135323)
(cherry picked from commit 0d4fd10fba)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-07-13 06:52:58 +00:00
Miss Islington (bot)
f50cd5bec7
[3.14] gh-134939: Correct concurrent.interpreters source code link (GH-136564) (#136605)
gh-134939: Correct `concurrent.interpreters` source code link (GH-136564)
(cherry picked from commit 42b251bceb)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-13 05:42:51 +00:00
Miss Islington (bot)
d351f29ef0
[3.14] gh-101100: Fix sphinx warnings in Doc/library/platform.rst (GH-136562) (GH-136597)
(cherry picked from commit 47b01da4cc)

Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
2025-07-12 18:22:51 +00:00
Miss Islington (bot)
64df22c190
[3.14] gh-136549: Fix signature of threading.excepthook() (GH-136559) (GH-136589)
(cherry picked from commit be2c3d284e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-12 16:18:23 +00:00
Miss Islington (bot)
d5866a8e84
[3.14] gh-91153: prevent a crash in bytearray.__setitem__(ind, ...) when ind.__index__ has side-effects (GH-132379) (#136581)
gh-91153: prevent a crash in `bytearray.__setitem__(ind, ...)` when `ind.__index__` has side-effects (GH-132379)
(cherry picked from commit 5e1e21dee3)

Co-authored-by: Bast <52266665+bast0006@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-07-12 14:38:57 +00:00
Miss Islington (bot)
c71ecd1418
[3.14] gh-134759: fix UnboundLocalError in email.message.Message.get_payload (GH-136071) (#136579)
gh-134759: fix `UnboundLocalError` in `email.message.Message.get_payload` (GH-136071)
(cherry picked from commit 25335d297b)

Co-authored-by: Kliment Lamonov <klimentlamonov@yandex.ru>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-07-12 13:56:10 +00:00
Miss Islington (bot)
33f561d7be
[3.14] gh-89083: Add CLI tests for UUIDv{6,7,8} (GH-136548) (#136576)
gh-89083: Add CLI tests for `UUIDv{6,7,8}` (GH-136548)
(cherry picked from commit c564847e98)

Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-07-12 12:33:53 +00:00
Miss Islington (bot)
ac807cb3a0
[3.14] gh-101100: Fix sphinx warnings in Doc/library/functools.rst (GH-136424) (GH-136552)
Add index entries and anchors for cache_info, cache_clear and register.
(cherry picked from commit 252e2f710e)

Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
2025-07-11 17:09:22 +00:00
Miss Islington (bot)
e4e86a1b87
[3.14] gh-130160: use .. program:: directive for documenting venv CLI (GH-130699) (#136550)
gh-130160: use `.. program::` directive for documenting `venv` CLI (GH-130699)
(cherry picked from commit fb9f933b8e)

Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com>
Co-authored-by: Semyon Moroz <donbarbos@proton.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-07-11 17:03:11 +00:00
Miss Islington (bot)
3b28b402a5
[3.14] gh-130478: fix HACL* build for macOS Silicon (GH-134188) (#135009)
gh-130478: fix HACL* build for macOS Silicon (GH-134188)
(cherry picked from commit ac7511062b)

Co-authored-by: Sam Ng <hongsheng@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-07-11 16:25:58 +00:00
Miss Islington (bot)
e03db7317f
[3.14] gh-136517: Print uncollectable objects if DEBUG_UNCOLLECTABLE mode was set (GH-136518) (#136522)
gh-136517: Print uncollectable objects if DEBUG_UNCOLLECTABLE mode was set (GH-136518)
(cherry picked from commit c560df9658)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
2025-07-11 15:20:05 +01:00
Miss Islington (bot)
5535482d2a
[3.14] gh-136541: Fix several problems of perf trampolines in x86_64 and aarch64 (GH-136500) (#136544)
gh-136541: Fix several problems of perf trampolines in x86_64 and aarch64 (GH-136500)

This commit fixes the following problems:

* The x86_64 trampolines are not preserving frame pointers
* The hardcoded offsets to the code segment from the FDE only worked properly for x64_64
* The CIE data was not following conventions of aarch64
* The eh_frame for aarch64 was not fully correct
(cherry picked from commit 236f733d8f)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-07-11 14:06:19 +00:00
Miss Islington (bot)
a464c4e2e8
[3.14] gh-136434: Fix docs generation of UnboundItem in subinterpreters (GH-136435) (#136540)
gh-136434: Fix docs generation of `UnboundItem` in subinterpreters (GH-136435)
(cherry picked from commit 3343fce05a)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-11 12:57:52 +00:00
Miss Islington (bot)
fdad31924c
[3.14] gh-76637: Note that undefined Codec is for testing (GH-136531) (#136536)
gh-76637: Note that `undefined` Codec is for testing (GH-136531)

Closes GH-76637
(cherry picked from commit 975b57d945)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-11 10:56:34 +00:00
Miss Islington (bot)
ec15251af5
[3.14] gh-101100: Fix sphinx warnings in library/email.parser.rst (GH-136475) (#136532)
Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
2025-07-11 09:43:52 +00:00
Miss Islington (bot)
183b020cb5
[3.14] gh-52876: Implement missing parameter in codecs.StreamReaderWriter functions (GH-136498) (#136514)
gh-52876: Implement missing parameter in `codecs.StreamReaderWriter` functions (GH-136498)

Closes GH-52876
(cherry picked from commit 35e2c35970)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-10 16:09:45 +00:00
Miss Islington (bot)
326fe0df66
[3.14] gh-82663: Clarify codecs.iterdecode/encode docs (GH-136497) (#136513)
gh-82663: Clarify `codecs.iterdecode/encode` docs (GH-136497)

Closes GH-82663
(cherry picked from commit 4b41b2043b)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-10 17:41:31 +02:00
Miss Islington (bot)
95baa28d9f
[3.14] gh-132661: Add default value (of "") for Interpolation.expression (GH-136441) (#136511)
Co-authored-by: Dave Peck <davepeck@gmail.com>
2025-07-10 14:52:18 +00:00
Miss Islington (bot)
da8bcfd949
[3.14] gh-136394: Fix race condition in test_zstd (GH-136432) (GH-136506)
gh-136394: Fix race condition in test_zstd (GH-136432)
(cherry picked from commit f519918ec6)

Co-authored-by: Rogdham <3994389+Rogdham@users.noreply.github.com>
2025-07-10 09:13:34 -04:00
Miss Islington (bot)
1346049782
[3.14] gh-136209: Add .. c:var:: declarations for C exception types (GH-136210) (GH-136504)
(cherry picked from commit 85bc89f35f)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-07-10 15:10:43 +02:00
Miss Islington (bot)
2de82bcc62
[3.14] gh-136438: Make sure test_builtins pass with all optimization levels (GH-136474) (#136496)
gh-136438: Make sure `test_builtins` pass with all optimization levels (GH-136474)
(cherry picked from commit c176543349)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-10 12:30:07 +03:00
Miss Islington (bot)
7880421983
[3.14] gh-136476: Remove creation of unused list (GH-136494) (GH-136495)
(cherry picked from commit b44316a097)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-10 08:36:48 +00:00
Miss Islington (bot)
7937f16ade
[3.14] gh-135846: Add zstd dependency to Android build script (GH-136253) (#136491)
Adds zstd to the Android build process.
(cherry picked from commit 61dd9fdad7)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Malcolm Smith <smith@chaquo.com>
2025-07-10 08:51:09 +08:00
Miss Islington (bot)
4d025a2318
[3.14] gh-136476: Show the full stack in get_async_stack_trace in _remote_debugging (GH-136483) (#136490)
gh-136476: Show the full stack in get_async_stack_trace in _remote_debugging (GH-136483)
(cherry picked from commit ea45a2f97c)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-07-10 00:57:40 +01:00
Miss Islington (bot)
b733bf7437
[3.14] gh-102740: Clarify time.monotonic() "system-wide" in the doc (GH-136431) (#136488)
gh-102740: Clarify time.monotonic() "system-wide" in the doc (GH-136431)
(cherry picked from commit 9c4d287775)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-07-09 23:13:29 +00:00
Miss Islington (bot)
4db567546a
[3.14] gh-136145: Define 'standard library' and 'stdlib' in the glossary (GH-136485)
(cherry picked from commit 92f392ad9e)

Co-authored-by: Zachary Ware <zach@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Éric <merwok@netwok.org>
2025-07-09 21:39:33 +00:00
Miss Islington (bot)
78359403c5
[3.14] gh-81520: Document unexpected os.path.ismount behaviour with btrfs subvolumes (GH-136058) (GH-136471)
gh-81520: Document unexpected `os.path.ismount` behaviour with btrfs subvolumes (GH-136058)
(cherry picked from commit 591abcc01f)

Co-authored-by: Oskar Roesler <o.roesler@oscloud.info>
2025-07-09 16:00:54 +00:00
Miss Islington (bot)
75640d4b1f
[3.14] gh-131825: Fix sqlite3 timezone-naive adapter recipe (GH-136270) (GH-136467)
gh-131825: Fix `sqlite3` timezone-naive adapter recipe (GH-136270)
(cherry picked from commit 6a6cd3c07c)

Co-authored-by: NekrodNIK <60639354+NekrodNIK@users.noreply.github.com>
2025-07-09 14:12:47 +00:00
Miss Islington (bot)
90717c2cec
[3.14] Docs: unittest.enterModuleContext is not a classmethod (GH-136464) (#136465)
Co-authored-by: Geoffrey Thomas <geofft@ldpreload.com>
2025-07-09 13:59:40 +00:00
Miss Islington (bot)
19518a4205
[3.14] gh-136447: Use self.loop instead of global loop variable in asyncio REPL (GH-136448) (#136458)
gh-136447: Use `self.loop` instead of global `loop` variable in asyncio REPL (GH-136448)
(cherry picked from commit 77fa7a4dcc)

Co-authored-by: Justin Su <injustsu@gmail.com>
2025-07-09 09:23:43 +00:00
Miss Islington (bot)
c29fce05f3
[3.14] gh-134657: Remove newly added private names from asyncio.__all__ (GH-134665) (#136455)
gh-134657: Remove newly added private names from asyncio.__all__ (GH-134665)
(cherry picked from commit 797abd1f7f)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-07-09 08:34:19 +00:00
Miss Islington (bot)
a9d2f08b57
[3.14] gh-136162: Document encodings package functions (GH-136164) (#136454)
gh-136162: Document `encodings` package functions (GH-136164)

Closes GH-136162.
(cherry picked from commit ffd7f2f231)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-09 10:07:34 +02:00
Miss Islington (bot)
85df16b7fa
[3.14] gh-53243: Document codecs.readbuffer_encode() (GH-136284) (#136452)
gh-53243: Document `codecs.readbuffer_encode()` (GH-136284)

Closes GH-53243
(cherry picked from commit f1dcf3c7bf)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-09 10:07:18 +02:00
Miss Islington (bot)
2cb5792836
[3.14] gh-94503: Update logging cookbook example with info on addressing log injection. (GH-136446) (GH-136449)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-09 09:00:30 +01:00
Miss Islington (bot)
e0b9f0721c
[3.14] gh-136229: Remove Platform Emscripten is not supported warning (GH-136230) (#136445)
Updates configure script to identify Emscripten as Tier 3.
(cherry picked from commit 6ea4258285)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-09 02:42:49 +00:00
Miss Islington (bot)
9a79c5128f
[3.14] gh-91048: Revert the memory cache removal for remote debugging (GH-136440) (#136443)
gh-91048: Revert the memory cache removal for remote debugging (GH-136440)
(cherry picked from commit 77d25e5b16)


gh-91048: Reintroduce the memory cache for remote debugging

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-07-09 02:21:56 +01:00
Miss Islington (bot)
6a2a2906f8
[3.14] GH-133136: Revise QSBR to reduce excess memory held (gh-135473) (#135912)
The free threading build uses QSBR to delay the freeing of dictionary
keys and list arrays when the objects are accessed by multiple threads
in order to allow concurrent reads to proceed with holding the object
lock. The requests are processed in batches to reduce execution
overhead, but for large memory blocks this can lead to excess memory
usage.

Take into account the size of the memory block when deciding when to
process QSBR requests.

Also track the amount of memory being held by QSBR for mimalloc pages.  Advance the write sequence if this memory exceeds a limit.  Advancing the sequence will allow it to be freed more quickly.

Process the held QSBR items from the "eval breaker", rather than from `_PyMem_FreeDelayed()`.  This gives a higher chance that the global read sequence has advanced enough so that items can be freed.

(cherry picked from commit 113de8545f)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-07-08 10:58:01 -07:00
Miss Islington (bot)
66f85f4be8
[3.14] Update bytecode magic number in tests for the 3.14 release candidate (GH-136427) (#136429)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-07-08 17:38:37 +00:00
Miss Islington (bot)
f937b9fffb
[3.14] gh-136380: Fix import behavior for concurrent.futures.InterpreterPoolExecutor (GH-136381) (#136420)
gh-136380: Fix import behavior for `concurrent.futures.InterpreterPoolExecutor` (GH-136381)
(cherry picked from commit 490eea0281)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-08 19:11:48 +03:00
Hugo van Kemenade
0a15ae71ad Merge branch '3.14' of https://github.com/python/cpython into 3.14 2025-07-08 17:35:22 +03:00
Hugo van Kemenade
72358614d2 Post 3.14.0b4 2025-07-08 17:31:34 +03:00
Miss Islington (bot)
78c1227381
[3.14] gh-136186: Fix race condition in test_external_inspection.test_only_active_thread (GH-136347) (#136416) 2025-07-08 12:48:03 +00:00
Miss Islington (bot)
f0e603412b
[3.14] gh-101100: Fix sphinx warnings in Doc/library/exceptions.rst (GH-136309) (#136414)
Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-07-08 12:11:28 +00:00
Hugo van Kemenade
7ec1faba0c Python 3.14.0b4 2025-07-08 11:57:23 +03:00
Miss Islington (bot)
376e037ecc
[3.14] gh-120713: Make _Py_NORMALIZE_CENTURY private (GH-135933) (#136387)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-08 11:43:57 +03:00
Miss Islington (bot)
145c08629b
[3.14] gh-136297: Fix hypothesis and subTest usage in test_zoneinfo_property.py (GH-136384) (#136407)
gh-136297: Fix `hypothesis` and `subTest` usage in `test_zoneinfo_property.py` (GH-136384)
(cherry picked from commit db699db99d)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-08 08:16:51 +00:00
Miss Islington (bot)
3296d9bcfd
[3.14] gh-136155: Docs: only add custom OpenGraph protocol meta tags for HTML builds (GH-136187) (#136382)
Co-authored-by: Maciej Olko <maciej.olko@affirm.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2025-07-08 10:03:40 +03:00
Miss Islington (bot)
2733b290ea
[3.14] gh-101100: Fix sphinx warnings in whatsnew/3.11.rst (GH-136402) (#136405)
Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
2025-07-08 06:47:17 +00:00
Miss Islington (bot)
cdeaa64214
[3.14] gh-102567: Add missing newline to --help-all (GH-136391) (GH-136403)
gh-102567: Add missing newline to `--help-all` (GH-136391)
(cherry picked from commit fbef0c1d6a)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-07-08 06:24:08 +00:00
Miss Islington (bot)
78e5d109f5
[3.14] gh-135913: Document ob_refcnt, ob_type, ob_size (GH-135914) (GH-136377)
gh-135913: Document ob_refcnt, ob_type, ob_size (GH-135914)

* gh-135913: Document ob_refcnt, ob_type, ob_size

In `typeobj.rst`, instead of `:c:member:` it would be better to
use `.. c:member::` with a `:no-index:` option, see:

See ref. https://www.sphinx-doc.org/en/master/usage/domains/index.html#basic-markup

However, `c:member` currently does not support `:no-index:`.
(cherry picked from commit 73e1207a4e)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-08 08:03:03 +02:00
Miss Islington (bot)
e1e9d95352
[3.14] gh-136032: Fix argparse.BooleanOptionalAction doc (GH-136133) (#136329)
gh-136032: Fix `argparse.BooleanOptionalAction` doc (GH-136133)
(cherry picked from commit 1953713d0d)

Co-authored-by: W. H. Wang <mattwang44@gmail.com>
2025-07-07 19:34:18 -07:00
Miss Islington (bot)
c72699086f
[3.14] gh-135906: Use _PyObject_CAST in internal headers (GH-135892) (GH-136392)
gh-135906: Use `_PyObject_CAST` in internal headers (GH-135892)

Fixes build errors encountered in python-greenlet/greenlet#450 when building greenlet on the free-threaded build.

---------
(cherry picked from commit fe187fae8d)

Co-authored-by: Charlie Lin <tuug@gmx.us>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-07-07 17:21:28 +00:00
Miss Islington (bot)
5a7d266fcb
[3.14] gh-101100: Fix Sphinx warnings in library/email.compat32-message.rst (GH-136323) (#136389)
Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
2025-07-07 19:50:56 +03:00
Miss Islington (bot)
e25531331b
[3.14] gh-87790: support thousands separators for formatting fractional part of Decimal (GH-132202) (#136365)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-07 19:24:30 +03:00
Miss Islington (bot)
442b781cfc
[3.14] gh-87790: support thousands separators for formatting fractional part of Fraction (GH-132204) (#136364)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-07-07 19:24:24 +03:00
Miss Islington (bot)
d9c36a7aa6
[3.14] gh-124486: Fix test_whichdb_ndbm in test_dbm on NetBSD (GH-136335) (GH-136378)
On NetBSD, ndbm.open() does not fail for empty file.
(cherry picked from commit b7aa2a4b4d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-07 12:57:37 +00:00
Miss Islington (bot)
a7dd48acba
[3.14] gh-86682: Add versionadded for sys._getframemodulename (GH-136325) (#136375)
gh-86682: Add versionadded for sys._getframemodulename (GH-136325)

add versionadded for sys._getframemodulename
(cherry picked from commit 11f074b243)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
2025-07-07 11:27:54 +00:00
Miss Islington (bot)
236498c845
[3.14] gh-131591: Document Py_REMOTE_DEBUG (GH-135929) (GH-136374)
gh-131591: Document Py_REMOTE_DEBUG (GH-135929)
(cherry picked from commit 9aac5a3d44)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-07 13:07:23 +02:00
Miss Islington (bot)
5df4f353ad
[3.14] gh-135755: Document __future__.* and CO_* as proper Sphinx objects (GH-135980) (GH-136370)
* Turn the __future__ table to list-table.
  This'll make it easier to add entries that need longer markup
* Semantic markup for __future__ feature descriptions.
* Document CO_* C macros.

(cherry picked from commit 2468aafe98)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-07 12:55:20 +02:00
Miss Islington (bot)
f02be2dfe8
[3.14] gh-101100: Fix sphinx warnings in whatsnew/3.9 (GH-136163) (#136372)
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-07 10:48:04 +00:00
Miss Islington (bot)
f87578f831
[3.14] gh-130662: Accept leading zeros in precision/width for Decimal's formatting (GH-132549) (#136362)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-07-07 09:55:35 +00:00
Miss Islington (bot)
b2a2f032dc
[3.14] gh-130662: Accept leading zeros in precision/width for Fraction's formatting (GH-130663) (#136361)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-07-07 09:50:02 +00:00
Miss Islington (bot)
57d6db529b
[3.14] gh-136289: Fix test_sqlite3 on platforms with strict UTF-8 filesystem (GH-136326) (GH-136350)
(cherry picked from commit 85b817da94)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-07 12:43:44 +03:00
Miss Islington (bot)
41d1683e05
[3.14] GH-133932: Tagged ints are heap safe (GH-134244) (#134494)
Co-authored-by: Mark Shannon <mark@hotpy.org>
2025-07-07 12:33:55 +03:00
Miss Islington (bot)
46a7981f45
[3.14] GH-135106: Restrict trashcan to GC'ed objects (GH-135682) (#135876)
Co-authored-by: Mark Shannon <mark@hotpy.org>
2025-07-07 12:31:18 +03:00
Miss Islington (bot)
8f06a9c9ce
[3.14] gh-94503: Update logging cookbook with an example of uniformly handling newlines in output. (GH-136217) (GH-136357)
(cherry picked from commit d05423a90c)
2025-07-07 10:18:27 +01:00
Miss Islington (bot)
aa1800b755
[3.14] gh-127502: Remove XML vulnerability table (GH-135294) (#136359)
gh-127502: Remove XML vulnerability table (GH-135294)

* Remove the table
* Replace warnings with notes

Latest releases of Python 3.9-3.15 include expat 2.7.1 which is not vulnerable.

expat 2.6.0 was released in February 2024.
(cherry picked from commit cb99d99277)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-07-07 09:08:41 +00:00
Miss Islington (bot)
22fad16ebc
[3.14] gh-109700: fix interpreter finalization while handling memory error (GH-136342) (#136352)
gh-109700: fix interpreter finalization while handling memory error (GH-136342)
(cherry picked from commit 0c3e3da195)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-07 07:40:13 +00:00
Jelle Zijlstra
3d01565da4
[3.14] gh-136316: Make typing.evaluate_forward_ref better at evaluating nested forwardrefs (GH-136319) (#136346)
(cherry picked from commit 9312702d2e)
2025-07-07 00:10:57 +00:00
Miss Islington (bot)
bd97cb8229
[3.14] gh-109070: Document that get_context in multiprocessing have side effect (GH-136341) (GH-136343)
gh-109070: Document that get_context in multiprocessing have side effect (GH-136341)

Document that get_context in multiprocessing have side effect
(cherry picked from commit 77a8bd29da)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2025-07-06 18:32:03 +00:00
Miss Islington (bot)
5b65df7925
[3.14] gh-109700: fix memory error handling in PyDict_SetDefault (GH-136338) (#136340)
gh-109700: fix memory error handling in `PyDict_SetDefault` (GH-136338)
(cherry picked from commit d22e073d2b)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-06 15:43:16 +00:00
Miss Islington (bot)
3ea7276a8e
[3.14] gh-129824: fix data races in subinterpreters under TSAN (GH-135794) (#136266)
gh-129824: fix data races in subinterpreters under TSAN (GH-135794)

This fixes the data races in typeobject.c in subinterpreters under free-threading. The type flags and slots are only modified in the main interpreter as all static types are first initialised in main interpreter.
(cherry picked from commit b582d751b4)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-06 18:53:55 +05:30
Miss Islington (bot)
d86ca7b610
[3.14] gh-136285: Improve pickle protocol testing in test_interpreters (GH-136286) (#136333)
gh-136285: Improve `pickle` protocol testing in `test_interpreters` (GH-136286)
(cherry picked from commit 06e347b846)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-06 11:13:13 +03:00
Miss Islington (bot)
2b2cf81a6c
[3.14] gh-136315: Fix skipped multithreading test in test_zstd (GH-136320) (#136322)
gh-136315: Fix skipped multithreading test in test_zstd (GH-136320)

Fix skipped test in test_zstd
(cherry picked from commit 5dac137b9f)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-07-05 11:24:19 -07:00
Miss Islington (bot)
53584d307a
[3.14] gh-101100: Fix references in http.cookiejar docs (GH-136238) (GH-136318)
gh-101100: Fix references in `http.cookiejar` docs (GH-136238)
(cherry picked from commit f0c7344a8f)

Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
2025-07-05 13:35:24 +00:00
Miss Islington (bot)
c62c523e03
[3.14] gh-136297: Test all pickle protocols in test_zoneinfo_property.py (GH-136298) (#136311)
gh-136297: Test all `pickle` protocols in `test_zoneinfo_property.py` (GH-136298)
(cherry picked from commit 5de7e3f973)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-05 06:39:48 +00:00
Miss Islington (bot)
6d21cc54ff
[3.14] gh-136288: Fix error message in _testcapi/vectorcall.c (GH-136258) (GH-136294)
gh-136288: Fix error message in `_testcapi/vectorcall.c` (GH-136258)

Use the %N format specifier instead of %s and `PyType_GetName`.
(cherry picked from commit d1d5dce14f)

Co-authored-by: William S Fulton <wsf@fultondesigns.co.uk>
2025-07-04 16:18:32 +00:00
Miss Islington (bot)
1a2898a383
[3.14] Docs: Move "or" outside monospace syntax in tarfile.rst (GH-136263) (GH-136290)
Docs: Move "or" outside monospace syntax in `tarfile.rst` (GH-136263)
(cherry picked from commit ade1988094)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2025-07-04 14:46:57 +00:00
Miss Islington (bot)
f2f3edb8d7
[3.14] gh-135773: have pyvenv.cfg without home key anchor a venv and deduce home (GH-135831) (#136287)
gh-135773: have pyvenv.cfg without home key anchor a venv and deduce home (GH-135831)

This is still formally undefined behaviour, but we may as well
keep the *same* undefined behaviour as previous versions.

PEP 796 proposes a cleaner and more consistent replacement for 3.15+
(cherry picked from commit 93263d4314)

Co-authored-by: Richard Levasseur <rlevasseur@google.com>
2025-07-05 00:36:12 +10:00
Miss Islington (bot)
fa7e76e4dd
[3.14] gh-102555: Fix comment parsing in HTMLParser according to the HTML5 standard (GH-135664) (GH-136271)
* "--!>" now ends the comment.
* "-- >" no longer ends the comment.
* Support abnormally ended empty comments "<-->" and "<--->".

---------
(cherry picked from commit 8ac7613dc8)

Co-author: Kerim Kabirov <the.privat33r+gh@pm.me>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2025-07-04 07:26:03 +00:00
Miss Islington (bot)
2449f77734
[3.14] Clarify some details regarding sys.monitoring (GH-133981) (GH-136259)
Clarify some details regarding `sys.monitoring` (GH-133981)
(cherry picked from commit b4991056f4)

Co-authored-by: Brett Cannon <brett@python.org>
2025-07-03 21:10:27 +00:00
Miss Islington (bot)
03ce4b2617
[3.14] gh-135661: Fix parsing start and end tags in HTMLParser according to the HTML5 standard (GH-135930) (GH-136255)
* Whitespaces no longer accepted between `</` and the tag name.
  E.g. `</ script>` does not end the script section.

* Vertical tabulation (`\v`) and non-ASCII whitespaces no longer recognized
  as whitespaces. The only whitespaces are `\t\n\r\f `.

* Null character (U+0000) no longer ends the tag name.

* Attributes and slashes after the tag name in end tags are now ignored,
  instead of terminating after the first `>` in quoted attribute value.
  E.g. `</script/foo=">"/>`.

* Multiple slashes and whitespaces between the last attribute and closing `>`
  are now ignored in both start and end tags. E.g. `<a foo=bar/ //>`.

* Multiple `=` between attribute name and value are no longer collapsed.
  E.g. `<a foo==bar>` produces attribute "foo" with value "=bar".

* Whitespaces between the `=` separator and attribute name or value are no
  longer ignored. E.g. `<a foo =bar>` produces two attributes "foo" and
  "=bar", both with value None; `<a foo= bar>` produces two attributes:
  "foo" with value "" and "bar" with value None.

---------
(cherry picked from commit 0243f97cba)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2025-07-03 20:57:53 +00:00
Miss Islington (bot)
e39f33259e
[3.14] gh-135252: Document Zstandard integration across zipfile, shutil, and tarfile (GH-135311) (#136254)
gh-135252: Document Zstandard integration across zipfile, shutil, and tarfile (GH-135311)

Document Zstandard integration across zipfile, shutil, and tarfile
(cherry picked from commit 938a5d7e62)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-07-03 20:34:38 +00:00
Miss Islington (bot)
ea84943574
[3.14] gh-115119: Recommend upstream libmpdec in build requirements (GH-136205) (#136244)
gh-115119: Recommend upstream libmpdec in build requirements (GH-136205)
(cherry picked from commit b2e498ac26)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-07-03 12:50:38 +00:00
Miss Islington (bot)
4877f4343c
[3.14] gh-130664: Treat '0' fill character with align '=' as zero-padding for Fraction's (GH-131067) (GH-136241)
(cherry picked from commit c113a8e523)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-07-03 11:22:03 +00:00
Miss Islington (bot)
150262db4c
[3.14] gh-133740: Fix regression in locale.nl_langinfo(ALT_DIGITS) (GH-136237) (GH-136240)
There is no need to temporary switch locale for items ALT_DIGITS and ERA
if the nl_langinfo() result is empty (most locales).
(cherry picked from commit 5c984ae35e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-03 11:04:30 +00:00
Miss Islington (bot)
4bc9c018d1
[3.14] gh-135069: Fix exception message in encodings.idna module (GH-135071) (#136235)
gh-135069: Fix exception message in encodings.idna module (GH-135071)
(cherry picked from commit 8dc3383abe)

Co-authored-by: Daniel Hollas <daniel.hollas@bristol.ac.uk>
2025-07-03 10:18:27 +00:00
Miss Islington (bot)
84cafc7e94
[3.14] Fix comments for heapq.siftup_max (GH-135359) (#136232)
Fix comments for `heapq.siftup_max` (GH-135359)
(cherry picked from commit 8f8bdf251a)

Co-authored-by: Alper <alperyoney@fb.com>
Co-authored-by: mpage <mpage@meta.com>
2025-07-03 10:17:10 +00:00
Miss Islington (bot)
1a4f92b9fb
[3.14] gh-135640: Adds more type checking to ElementTree (GH-135643) (GH-136225)
(cherry picked from commit e0245c789f)

Co-authored-by: Kira <kirawhoprograms@fastmail.com>
2025-07-03 08:15:01 +00:00
Miss Islington (bot)
8dcf3ed304
[3.14] gh-127705: Move Py_INCREF_MORTAL() to the internal C API (GH-136178) (#136206)
gh-127705: Move Py_INCREF_MORTAL() to the internal C API (GH-136178)

Rename Py_INCREF_MORTAL() to _Py_INCREF_MORTAL() and move it to
pycore_object.h internal header.
(cherry picked from commit fa43a1e0f8)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-07-03 06:42:17 +00:00
Miss Islington (bot)
5216a6c547
[3.14] gh-135836: Fix IndexError in asyncio.create_connection() (GH-135875) (#136221)
gh-135836: Fix `IndexError` in `asyncio.create_connection()` (GH-135875)
(cherry picked from commit 9084b15156)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-03 04:34:30 +00:00
Miss Islington (bot)
8810ccfc60
[3.14] gh-135836: Fix IndexError in asyncio.create_connection with empty exceptions list (GH-135845) (#136167)
gh-135836: Fix `IndexError` in `asyncio.create_connection` with empty exceptions list (GH-135845)
(cherry picked from commit 0e19db653d)

Co-authored-by: heliang666s <147408835+heliang666s@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-03 09:37:18 +05:30
Miss Islington (bot)
b86d3f0d69
[3.14] gh-136135: Doc: Fix some broken links (GH-136137) (GH-136220)
gh-136135: Doc: Fix some broken links (GH-136137)
(cherry picked from commit 135ba86212)

Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
2025-07-03 00:57:39 +00:00
Miss Islington (bot)
388e8c3676
[3.14] Replace capi-sig mailing list with discuss.python.org (GH-136211) (#136213)
Replace `capi-sig` mailing list with `discuss.python.org` (GH-136211)
(cherry picked from commit 7afe1adb00)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-07-02 20:55:08 +03:00
Sergey B Kirpichev
23a990d33a
[3.14] gh-115119: Defer removal of bundled libmpdec to 3.16 (GH-133997) (#136199)
Rename libmpdecimal -> libmpdec

see https://www.bytereef.org/mpdecimal/doc/libmpdec/index.html
(cherry picked from commit b19c9da401)
2025-07-02 14:36:15 +02:00
Miss Islington (bot)
8ba024ddf5
[3.14] gh-134280: Disable constant folding for ~ with a boolean argument (GH-134982) (GH-136185)
This moves the deprecation warning from compile time to run time.
(cherry picked from commit 86c3316183)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-02 11:28:09 +03:00
Miss Islington (bot)
3bc42942af
[3.14] GH-134273: Allow setting JIT compiler flags at build time with CFLAGS_JIT (GH-135792)
(cherry picked from commit 2b0c684e07)
Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-07-01 14:34:59 -07:00
Miss Islington (bot)
5e09d1913b
[3.14] gh-87298: Add tests for find_in_strong_cache() bug in _zoneinfo (GH-24829) (GH-136181)
(cherry picked from commit 12ce16bc13)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Paul Ganssle <p.ganssle@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-01 15:20:53 +00:00
Miss Islington (bot)
f152d60b68
[3.14] gh-130396: Move PYOS_LOG2_STACK_MARGIN to internal headers (GH-135928) (#136173)
gh-130396: Move PYOS_LOG2_STACK_MARGIN to internal headers (GH-135928)

Move PYOS_LOG2_STACK_MARGIN, PYOS_STACK_MARGIN,
PYOS_STACK_MARGIN_BYTES and PYOS_STACK_MARGIN_SHIFT macros to
pycore_pythonrun.h internal header. Add underscore (_) prefix to the
names to make them private. Rename _PYOS to _PyOS.
(cherry picked from commit 28940e8e48)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-07-01 13:44:32 +00:00
Miss Islington (bot)
df4e87b153
[3.14] gh-136169: Update parameter name in fractions.from_float method (GH-136172) (#136174)
gh-136169: Update parameter name in fractions.from_float method (GH-136172)

Update parameter name in fractions.from_float method
(cherry picked from commit 9c0cb5beb8)

Co-authored-by: Vladyslav Lazoryk <80263725+lazorikv@users.noreply.github.com>
2025-07-01 13:31:16 +00:00
Miss Islington (bot)
665a682a90
[3.14] gh-135755: Use private names (_Py*) for header file guards new in 3.14 (GH-135921) (GH-135976)
These are private API; let's name new ones accordingly.
(cherry picked from commit 6be17baeb5)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-01 12:37:02 +02:00
Miss Islington (bot)
028901e97f
[3.14] gh-133982: Use implementation-specific open in test_fileio.OtherFileTests (GH-135364) (GH-136148)
gh-133982: Use implementation-specific `open` in `test_fileio.OtherFileTests` (GH-135364)
(cherry picked from commit 23caccf74c)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2025-06-30 22:23:34 +00:00
Miss Islington (bot)
ebab7c80ca
[3.14] gh-134939: Fill Out the concurrent.interpreters Docs (gh-136141)
(cherry picked from commit fc82cb91b, AKA gh-135902)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-06-30 17:00:33 +00:00
Miss Islington (bot)
401032a53a
[3.14] gh-63207: Update time.time documentation after GH-116822 (GH-136068) (#136138)
gh-63207: Update `time.time` documentation after GH-116822 (GH-136068)
(cherry picked from commit 486587da42)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-06-30 16:16:08 +00:00
Miss Islington (bot)
e86ac72995
[3.14] gh-85702: Catch PermissionError in zoneinfo.load_tzdata() (GH-136117) (#136128)
gh-85702: Catch PermissionError in zoneinfo.load_tzdata() (GH-136117)
(cherry picked from commit ee47670e8b)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-06-30 14:58:18 +00:00
Miss Islington (bot)
71bd3d0647
[3.14] gh-136122: Fix video link for math.tau documentation (GH-136129) (#136131)
Co-authored-by: sedram <54665381+sedram@users.noreply.github.com>
2025-06-30 14:49:09 +00:00
Victor Stinner
3267847759
[3.14] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) (#136119)
gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614)

(cherry picked from commit b1056c2a44)

Co-authored-by: Xuanteng Huang <44627253+xuantengh@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-06-30 15:59:22 +02:00
Miss Islington (bot)
729b6747e9
[3.14] gh-48181: Document codecs.charmap_build (GH-135997) (#136123)
gh-48181: Document `codecs.charmap_build` (GH-135997)
(cherry picked from commit 2bdd50309f)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-06-30 15:52:46 +02:00
Miss Islington (bot)
ed7719a08d
[3.14] gh-131885: Update documented signatures for csv.{writer,reader} (GH-136085) (GH-136120)
gh-131885: Update documented signatures for `csv.{writer,reader}` (GH-136085)
(cherry picked from commit 75f40595e5)

Co-authored-by: Adam Dangoor <adamdangoor@gmail.com>
2025-06-30 13:38:57 +00:00
Miss Islington (bot)
130d40aa7b
[3.14] gh-132813: Fix the csv documentation for quoting and escaping (GH-133209) (#136113)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-30 07:47:29 +00:00
Miss Islington (bot)
2e6d3f0a1b
[3.14] gh-136087: Remove \r from documented os.linesep values (GH-136088) (#136111)
gh-136087: Remove `\r` from documented `os.linesep` values (GH-136088)
(cherry picked from commit 980a56843b)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-06-30 10:44:29 +03:00
Miss Islington (bot)
5e65cbbe64
[3.14] Doc: fix duplicated words (GH-136086) (#136108)
Doc: fix duplicated words (GH-136086)

---------
(cherry picked from commit 698bab5a40)

Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-06-29 18:45:26 -04:00
Miss Islington (bot)
eb8ed2ab85
[3.14] gh-123299: Provide replacement for removed sqlite3 attributes in What's New 3.14 (GH-125566) (#136103)
Co-authored-by: fry69 <142489379+fry69@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-06-29 15:40:27 +00:00
Miss Islington (bot)
231d801222
[3.14] gh-127604: Docs: Include a C stack in the faulthandler example (GH-136081) (GH-136102)
* gh-127604: Docs: Include a C stack in the `faulthandler` example (GH-136081)
(cherry picked from commit 3947847914)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-06-29 15:05:40 +00:00
Miss Islington (bot)
ce65956177
[3.14] gh-136053: Check error for TYPE_SLICE in marshal.c (GH-136054) (GH-136092)
Fix a possible crash when deserializing a large marshal data
(at least several GiBs) containing a slice.
(cherry picked from commit 30ba03ea8e)

Co-authored-by: Akshat Gupta <akshat.gupta24@gmail.com>
2025-06-29 07:36:04 +00:00
Miss Islington (bot)
7df3eee645
[3.14] Doc: Fix duplicate words in idlelib (GH-136089) (#136090)
Doc: Fix duplicate words in idlelib (GH-136089)
(cherry picked from commit f04d2b8819)

Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
2025-06-29 07:12:50 +00:00
Pablo Galindo Salgado
c66b54f361
[3.14] gh-91048: Fix external inspection multi-threaded performance (GH-136005) (#136080)
(cherry picked from commit 5334732f9c)
2025-06-28 19:12:54 +01:00
Miss Islington (bot)
42e13b8f8a
[3.14] gh-76595: Add note on PyCapsule_Import behavior (GH-134022) (GH-136074)
gh-76595: Add note on `PyCapsule_Import` behavior (GH-134022)
(cherry picked from commit 579acf4562)

Co-authored-by: Nicolas Trangez <ikke@nicolast.be>
2025-06-28 13:08:15 +00:00
Bénédikt Tran
c9c51bd770
[3.14] gh-135571: Guard _hashlib usage in test_hashlib.py (GH-135572) (#136042)
(cherry picked from commit 065194c1a9)

Co-authored-by: Will Childs-Klein <willck93@gmail.com>
2025-06-28 10:15:39 +02:00
Bénédikt Tran
70280953d2
[3.14] gh-135755: rename undocumented HACL_CAN_COMPILE_SIMD{128,256} macros (GH-135847) (#136045)
Rename undocumented `HACL_CAN_COMPILE_SIMD{128,256}` macros
to `_Py_HACL_CAN_COMPILE_VEC{128,256}`. These macros are private.
(cherry picked from commit 1e975aee28)
2025-06-28 10:05:58 +02:00
Miss Islington (bot)
eff347ccc3
[3.14] gh-108765: fix comment about macro definitions in _stat.c post GH-108854 (GH-136027) (#136043)
gh-108765: fix comment about macro definitions in `_stat.c` post GH-108854 (GH-136027)
(cherry picked from commit 0141e7f9e6)

Co-authored-by: Lee Dogeon <dev.moreal@gmail.com>
2025-06-27 15:40:34 +00:00
Miss Islington (bot)
3bd4a49201
[3.14] gh-136028: Fix parsing month names containing "İ" (U+0130) in strptime() (GH-136029) (GH-136037)
This affects locales az_AZ, ber_DZ, ber_MA and crh_UA.
(cherry picked from commit 731f5b8ab3)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-27 14:12:15 +00:00
Miss Islington (bot)
7e4637e48e
[3.14] gh-92266: Replace tabs with four spaces in Python files (GH-135983) (#136035)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-06-27 16:27:00 +03:00
Miss Islington (bot)
1b218680b7
[3.14] gh-78465: Fix error message for cls.__new__(cls, ...) where cls is not instantiable (GH-135981) (GH-136030)
Previous error message suggested to use cls.__new__(), which
obviously does not work. Now the error message is the same as for
cls(...).
(cherry picked from commit c45f4f3ebe)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-27 12:01:48 +00:00
Miss Islington (bot)
33c83cea07
[3.14] gh-128051: Fix tests if sys.float_repr_style is 'legacy' (GH-135908) (#136025)
gh-128051: Fix tests if sys.float_repr_style is 'legacy' (GH-135908)
(cherry picked from commit f3aec60d7a)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-06-27 10:26:51 +00:00
Miss Islington (bot)
a168c77536
[3.14] gh-53203: Fix strptime() for %c, %x and %X formats on some locales (GH-135971) (GH-136019)
* Add detection of decimal non-ASCII alt digits.
* Add support of non-decimal alt digits on locale lzh_TW.
* Accept only numbers in correct range if alt digits are known.
* Fix bug in detecting the position of the week day name on locales byn_ER and wal_ET.
* Fix support of single-digit hour on locales ar_SA and bg_BG.
* Add support for %T, %R, %r, %C, %OC.
* Prepare code to use nl_langinfo().

(cherry picked from commit 07183ebce3)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-27 08:16:31 +00:00
Miss Islington (bot)
78de34f910
[3.14] gh-135966: Modify iOS testbed to make app_packages a site directory (GH-135967) (#136012)
The iOS testbed now treats the app_packages folder as a site folder. This ensures it is
on the path, but also ensures any .pth files are processed on app startup.
(cherry picked from commit b38810bab7)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2025-06-27 13:30:51 +08:00
Miss Islington (bot)
10211a792e
[3.14] gh-135968: Add iOS binary stubs for strip (GH-135970) (#136014)
Adds iOS binary stubs for invoking `strip`
(cherry picked from commit 0c6c09b737)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2025-06-27 05:24:55 +00:00
Miss Islington (bot)
b99a417a6a
[3.14] Docs: Fix duplicate word typos (GH-135958) (GH-136007)
(cherry picked from commit 34ce1920ca)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2025-06-27 00:05:53 +00:00
Miss Islington (bot)
9798a8de1a
[3.14] gh-135995: Fix missing char in palmos encoding (GH-135990) (#136001)
gh-135995: Fix missing char in palmos encoding (GH-135990)

0x8b correctly encodes to ‹, but 0x9b was mistakenly marked as a control character instead of ›.
---------
(cherry picked from commit 58a42dea97)

Co-authored-by: Nathan Korth <nkorth@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-06-26 23:01:43 +00:00
Miss Islington (bot)
29cb4d670e
[3.14] IDLE: Update NEWS2x.txt with 2.7.0 release date (GH-129908) (#135999)
IDLE: Update NEWS2x.txt with 2.7.0 release date (GH-129908)
(cherry picked from commit 642e5dfc74)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-06-26 20:46:14 +00:00
Brett Cannon
4ba18128f9
[3.14] GH-133600: Backport file reorg of Tools/wasm/wasi (GH-135950)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-06-26 19:24:33 +00:00
Miss Islington (bot)
2045453171
[3.14] gh-129958: New syntax error in format spec applies to both f-strings and t-strings (GH-135570) (#135982)
(cherry picked from commit fb9e292919)

Co-authored-by: Dylan <dylwil3@gmail.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2025-06-26 18:40:09 +02:00
Miss Islington (bot)
8752b0815b
[3.14] gh-91555: add warning to docs about possibility of deadlock/infinite recursion (GH-135954) (GH-135988)
(cherry picked from commit a4625d597f)
2025-06-26 15:25:36 +01:00
Miss Islington (bot)
ad6c90f5ba
[3.14] gh-135110: Fix misleading generator.close() documentation (GH-135152) (GH-135985)
gh-135110: Fix misleading `generator.close()` documentation (GH-135152)

The documentation incorrectly stated that generator.close() 'raises' a
GeneratorExit exception. This was misleading because the method doesn't
raise the exception to the caller - it sends the exception internally
to the generator and returns None.
(cherry picked from commit 0d76dccc3b)

Co-authored-by: Connor Denihan <188690869+cdenihan@users.noreply.github.com>
2025-06-26 13:34:33 +00:00
Miss Islington (bot)
19740b7a7a
[3.14] gh-135965: Delete duplicate word in isolating-extensions howto (GH-135964) (#135977)
gh-135965: Delete duplicate word in isolating-extensions howto (GH-135964)

Change use use to use.
(cherry picked from commit ffb2a02f98)

Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
2025-06-26 11:47:17 +00:00
Miss Islington (bot)
03711fb670
[3.14] gh-125206: Make _Py_FFI_SUPPORT_C_COMPLEX private (GH-135932) (GH-135973)
(cherry picked from commit 9193efdeab)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-06-26 10:13:47 +00:00
Miss Islington (bot)
a797fe180c
[3.14] gh-135755: Move PyFunction_GET_BUILTINS to the private API (GH-135938) (GH-135972)
(cherry picked from commit 10a3d43188)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-06-26 10:08:28 +00:00
Miss Islington (bot)
e5abdbfdba
[3.14] gh-131591: Add Py_ prefix to MAX_SCRIPT_PATH_SIZE; remove unprefixed struct tag (GH-135924) (GH-135969)
Names/macros defined in public headers should have `Py`/`_Py` prefixes.
(cherry picked from commit a1da208eec)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-06-26 10:23:39 +02:00
Miss Islington (bot)
3b5d82a426
[3.14] gh-135956: Remove duplicate word in _pydatetime docstring (GH-135957) (#135962)
gh-135956: Remove duplicate word in _pydatetime docstring (GH-135957)

_pydatetime.isoformat docstring repeats 'giving'.
(cherry picked from commit e3ea6f2b3b)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-06-26 04:09:11 +00:00
Miss Islington (bot)
568f50e182
[3.14] Add whatsnew text for warnings module changes. (gh-135869) (gh-135961)
Add whatsnew text for warnings module changes. (gh-135869)
(cherry picked from commit 1f5e23fd70)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2025-06-26 03:09:09 +00:00
Miss Islington (bot)
c8e914cfb5
[3.14] gh-135721: skip test_trashcan_python_class on wasm buildbots with stack overflow (GH-135766) (GH-135955)
gh-135721: skip `test_trashcan_python_class` on wasm buildbots with stack overflow (GH-135766)
(cherry picked from commit 3fb6cfe7a9)

Co-authored-by: Pastukhov Nikita <diementros@yandex.ru>
2025-06-25 23:02:39 +00:00
Miss Islington (bot)
39bbf59a19
[3.14] Docs: Fix indentation in slice class of functions.rst (GH-134393) (#135948)
Docs: Fix indentation in `slice` class of `functions.rst` (GH-134393)

Paragraph should not be under `slice.step`. It applies to the whole class.

(cherry picked from commit 6227662ff3)

Co-authored-by: Rob Reynolds <13379223+reynoldsnlp@users.noreply.github.com>
2025-06-25 17:52:59 +00:00
Miss Islington (bot)
80fc62f8af
[3.14] gh-135871: Fix needless spinning in _PyMutex_LockTimed with zero timeout (gh-135872) (gh-135946)
The free threading build could spin unnecessarily on `_Py_yield()` if the initial
compare and swap failed.
(cherry picked from commit cbfaf41caf)

Co-authored-by: Joseph Tibbertsma <josephtibbertsma@gmail.com>
2025-06-25 17:07:07 +00:00
Miss Islington (bot)
df1c124240
[3.14] gh-91555: Revert disabling of logger while handling log record. (GH-135858) (GH-135910)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2025-06-25 18:03:13 +01:00
Miss Islington (bot)
6e5350d8b9
[3.14] gh-135839: Fix module_traverse and module_clear in subinterp modules (GH-135937) (#135939)
gh-135839: Fix `module_traverse` and `module_clear` in subinterp modules (GH-135937)
(cherry picked from commit bcc2cbaa7f)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-06-25 17:42:57 +03:00
Miss Islington (bot)
8ef0398238
[3.14] Docs: Add cross-reference for positional_item in the calls productionlist (GH-129977) (GH-135940)
Docs: Add cross-reference for `positional_item` in the `calls` productionlist (GH-129977)

Add missing hyperlink for `positional_item`
(cherry picked from commit d2154912b3)

Co-authored-by: HarryLHW <123lhw321@gmail.com>
2025-06-25 14:30:42 +00:00
Miss Islington (bot)
17c6818bfd
[3.14] gh-131591: Make --without-remote-debug work (GH-135925) (GH-135931)
gh-131591: Make --without-remote-debug work (GH-135925)

The feature is checked using `defined(Py_REMOTE_DEBUG)`; defining
the macro (even as `0`) enables it.
(cherry picked from commit c2f2fd4eca)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-06-25 12:08:27 +00:00
Petr Viktorin
a345fed896
[3.14] gh-135755: Move SPECIAL_ constants to a private header (GH-135922) (GH-135926)
Macros without a `Py`/`_Py` prefix should not be defined in public headers.
(cherry picked from commit 1b1ae82fab)
2025-06-25 13:36:46 +02:00
Miss Islington (bot)
93a31bedd9
[3.14] gh-135839: Fix module_traverse and module_clear in _interpchannelsmodule (GH-135840) (#135918)
gh-135839: Fix `module_traverse` and `module_clear` in `_interpchannelsmodule` (GH-135840)
(cherry picked from commit dd59c786cf)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-06-25 09:20:29 +00:00
Miss Islington (bot)
349f4c24f9
[3.14] gh-135755: Docs: C API: Document missing PyFunction_GET* macros (GH-135762) (GH-135916)
gh-135755: Docs: C API: Document missing `PyFunction_GET*` macros (GH-135762)

(cherry picked from commit ca87a47b3d)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-06-25 10:50:56 +02:00
Miss Islington (bot)
090a42b5eb
[3.14] gh-135855: Raise TypeError When Passing Non-dict Object to _interpreters.set___main___attrs (gh-135900)
(cherry picked from commit 4e6f0d116, AKA gh-135856)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2025-06-24 19:19:31 +00:00
Miss Islington (bot)
fa74331a4c
[3.14] gh-135805: Document the X option and env var for controlling thread-local bytecode (GH-135868) (#135897)
gh-135805: Document the X option and env var for controlling thread-local bytecode (GH-135868)

Document the X option and env var for controlling thread-local bytecode.
(cherry picked from commit fea5ccc55d)

Co-authored-by: mpage <mpage@meta.com>
2025-06-24 10:33:15 -07:00
Miss Islington (bot)
88c55528f5
[3.14] gh-135878: Fix crash in types.SimpleNamespace.__repr__ (GH-135889) (#135896)
gh-135878: Fix crash in `types.SimpleNamespace.__repr__` (GH-135889)
(cherry picked from commit b3ab94acd3)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-06-24 16:58:57 +00:00
Miss Islington (bot)
3cdb659a0c
[3.14] gh-135487: fix reprlib.Repr.repr_int when given very large integers (GH-135506) (#135887)
gh-135487: fix `reprlib.Repr.repr_int` when given very large integers (GH-135506)
(cherry picked from commit e5f03b94b6)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-06-24 12:02:02 +00:00
Miss Islington (bot)
961dd80e0e
[3.14] gh-135494: Fix python -m test --pgo -x test_re (GH-135713) (#135880)
gh-135494: Fix python -m test --pgo -x test_re (GH-135713)

Fix regrtest to support excluding tests from --pgo tests.
(cherry picked from commit 15c6d63fe6)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-06-24 10:48:10 +00:00
Miss Islington (bot)
148f31f2d8
[3.14] gh-135648: Document that shutil.copyfileobj doesn't flush (GH-135737) (#135873)
Adds a note about flush/close on copyfileobj, and updates
the Emscripten build script to follow documented advice.
(cherry picked from commit 34393cbdd4)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2025-06-24 01:22:07 +00:00
Miss Islington (bot)
7227aa4bfa
[3.14] Fix example according to PEP 750 in "What's new in 3.14" (GH-134727) (GH-135870)
Fix example according to PEP 750 in "What's new in 3.14" (GH-134727)

A redundant extra part was written. Added a closing tag, to match the usage in PEP 750.
(cherry picked from commit 2793b68f75)

Co-authored-by: Vincent Poulailleau <vpoulailleau@gmail.com>
2025-06-23 23:42:04 +00:00
Miss Islington (bot)
c9cbe060a2
[3.14] Docs: Use arguments to replace args in argparse.rst (GH-135510) (GH-135866)
Docs: Use `arguments` to replace `args` in `argparse.rst` (GH-135510)
(cherry picked from commit caad163b69)

Co-authored-by: Yongzi Li <204532581+Yzi-Li@users.noreply.github.com>
2025-06-23 22:59:24 +00:00
Miss Islington (bot)
aad47c1e0b
[3.14] Bump mypy to 1.16.1 (GH-135720) (#135848)
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-06-23 13:09:24 +00:00
Miss Islington (bot)
85fbf80ca2
[3.14] gh-134986: Catch PermissionError when trying to call perf in tests (GH-134987) (#135841)
gh-134986: Catch PermissionError when trying to call perf in tests (GH-134987)

Using Ubuntu 24.04 on the Windows Subsystem for Linux, perf will raise a
`PermissionError` instead of `FileNotFoundError`. This commit modifies
the tests to catch that.
(cherry picked from commit 6ab842fce5)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-06-23 10:53:55 +00:00
Miss Islington (bot)
f0a330e5fb
[3.14] gh-89488: Add warning about Py_BuildValue("p") needing exact int (GH-135610) (GH-135843)
(cherry picked from commit 6aa0826ed7)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-06-23 10:41:39 +00:00
Miss Islington (bot)
a843fece61
[3.14] patchcheck: use URL paths to identify upstream remote (GH-135806) (#135808)
Co-authored-by: Kattni <kattni@kattni.com>
2025-06-23 12:56:06 +03:00
Miss Islington (bot)
10f9db9b35
[3.14] gh-135815: skip netrc security checks if os.getuid is missing (GH-135816) (#135825)
gh-135815: skip `netrc` security checks if `os.getuid` is missing (GH-135816)
(cherry picked from commit b57b619e34)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-06-22 20:12:57 +00:00
Miss Islington (bot)
73e2089ed1
[3.14] Docs: Remove unnecessary trailing backslashes (GH-135781) (GH-135791)
Docs: Remove unnecessary trailing backslashes (GH-135781)

This fixes Sphinx's gettext extraction for translations.
(cherry picked from commit 6a16b3c440)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2025-06-21 13:07:51 +00:00
Miss Islington (bot)
2b5c904fbb
[3.14] gh-127146: Skip test_os.test_mode for Emscripten (GH-135764) (#135784)
Temporarily skip test_os.test_mode on Emscripten; this fails consistently
on the buildbot, but not on other test configurations. Reported as GH-135783
for follow up.
(cherry picked from commit f4911258a8)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-06-21 19:13:40 +08:00
Miss Islington (bot)
e388b29a10
[3.14] gh-135557: use atomic stores in heapq operations in free-threading (GH-135601) (#135787)
gh-135557: use atomic stores in `heapq` operations in free-threading (GH-135601)
(cherry picked from commit 13cac83347)

Co-authored-by: Xuanteng Huang <44627253+xuantengh@users.noreply.github.com>
2025-06-21 16:32:27 +05:30
Miss Islington (bot)
fa62dfe888
[3.14] gh-135645: Added supports_isolated_interpreters to sys.implementation (GH-135667) (#135786)
gh-135645: Added `supports_isolated_interpreters` to `sys.implementation` (GH-135667)
(cherry picked from commit 8ca1e4d846)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-06-21 08:21:50 +00:00
Miss Islington (bot)
b1d5e2336e
[3.14] gh-135756: Fix nonexistent parameter in tkinter docs (GH-135770) (#135776)
gh-135756: Fix nonexistent parameter in tkinter docs (GH-135770)

Remove nonexistent color parameter from tkinter.commondialog.Dialog.show() method documentation.
(cherry picked from commit 4ddf505d99)

Co-authored-by: Marcell Perger <102254594+MarcellPerger1@users.noreply.github.com>
2025-06-20 23:35:37 +00:00
Miss Islington (bot)
35b90e8bec
[3.14] gh-135698: Fix Cross-interpreter Queue.full() With Negative/Default max_size (gh-135775)
We weren't handling non-positive maxsize values (including the default) properly
in Queue.full().  This change fixes that and adjusts an associated assert.

(cherry picked from commit c5ea8e8e8, AKA gh-135724)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-06-20 20:51:01 +00:00
Miss Islington (bot)
bd24261728
[3.14] Docs: Document PyExceptionClass functions in the C API (GH-135697) (GH-135757)
Docs: Document `PyExceptionClass` functions in the C API (GH-135697)

* Docs: Document `PyExceptionClass_Name`

`PyExceptionClass_Name` is an undocumented function in the limited API.

* Document `PyExceptionClass_Check`
(cherry picked from commit 59963e866a)

Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
2025-06-20 14:03:46 +00:00
Miss Islington (bot)
1ee0bb81a8
[3.14] gh-89083: add links to RFC 9562 sections in UUID docs (GH-135684) (#135747)
gh-89083: add links to RFC 9562 sections in UUID docs (GH-135684)

We also sync the docs for UUIDv1 and UUIDv6 concerning the node address and clock sequence.

---------
(cherry picked from commit b881e3db1e)

Co-authored-by: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-06-20 11:09:14 +00:00
Miss Islington (bot)
28fc24ebbc
[3.14] gh-135532: update Modules/_hacl/python_hacl_namespaces.h (GH-135741) (#135745)
gh-135532: update `Modules/_hacl/python_hacl_namespaces.h` (GH-135741)
(cherry picked from commit 57dba7c9a5)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-06-20 13:00:37 +02:00
Miss Islington (bot)
d057cb40ff
[3.14] gh-135532: simplify handling of HACL* errors in _hmac (GH-135740) (#135743)
gh-135532: simplify handling of HACL* errors in `_hmac` (GH-135740)
(cherry picked from commit 2dbada179f)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-06-20 09:22:29 +00:00
Ken Jin
60fc42c169
[3.14] gh-135608: Add a null check for attribute promotion to fix a JIT crash (GH-135613) (#135739)
gh-135608: Add a null check for attribute promotion to fix a JIT crash (GH-135613)

Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
2025-06-20 15:24:25 +08:00
Miss Islington (bot)
203753b4bb
[3.14] gh-127146: Add skip_emscripten_stack_overflow in a few places (GH-135722) (#135733)
More tests that hit stack limits on some platforms.
(cherry picked from commit c8c13f8036)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-06-19 21:54:04 +00:00
Miss Islington (bot)
0370cb42da
gh-135543: Emit sys.remote_exec audit event when sys.remote_exec is called (GH-135544)
(cherry picked from commit 1ddfe59320)

Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
2025-06-19 20:51:06 +00:00
Miss Islington (bot)
83e0ab17f6
[3.14] gh-135561: ensure that the GIL is held when handling an HACL* error in _hmac (GH-135562) (#135725)
gh-135561: ensure that the GIL is held when handling an HACL* error in `_hmac` (GH-135562)
(cherry picked from commit c765683398)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-06-19 19:48:29 +00:00
Miss Islington (bot)
8caf3fdacb
[3.14] gh-135709: Fix two compile warnings on WASM buildbot (GH-135712) (#135723)
gh-135709: Fix two compile warnings on WASM buildbot (GH-135712)
(cherry picked from commit 9c3c02019c)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-06-19 16:14:08 +00:00
Miss Islington (bot)
a170086162
[3.14] gh-135273: Unify ZoneInfo.from_file signatures (GH-135274) (#135716)
gh-135273: Unify `ZoneInfo.from_file` signatures (GH-135274)

Align `ZoneInfo.from_file` pure-Python signature with Argument Clinic signature.
(cherry picked from commit 7cc8949692)

Co-authored-by: Andrii Hrimov <andrew.hrimov@gmail.com>
2025-06-19 15:14:14 +00:00
Miss Islington (bot)
a7abb8c8e6
[3.14] Docs: Add missing lines between regex and text (GH-134505) (GH-135718)
Docs: Add missing lines between regex and text (GH-134505)
(cherry picked from commit 754190287e)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2025-06-19 15:07:12 +00:00
Miss Islington (bot)
250bb7fffd
[3.14] Docs: Emphasize parameter name in pkgutil.iter_importers (GH-135597) (GH-135710)
Docs: Emphasize parameter name in `pkgutil.iter_importers` (GH-135597)
(cherry picked from commit ff639af8ee)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2025-06-19 13:02:22 +00:00
Miss Islington (bot)
53b36e04d4
[3.14] gh-126112: Fix test_os.TimerfdTests: use 10 ms resolution (GH-135681) (#135704)
gh-126112: Fix test_os.TimerfdTests: use 10 ms resolution (GH-135681)

Use 10 ms for CLOCK_RES instead of 100 ms to tolerate slow buildbots.
(cherry picked from commit 5c25c884b9)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-06-19 10:06:57 +00:00
Miss Islington (bot)
aee789cf97
[3.14] Document that PyType_GetModuleByDef returns a borrowed reference (GH-135666) (GH-135701)
(cherry picked from commit 140731ff67)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-06-19 09:17:53 +02:00
Miss Islington (bot)
bc8ed42176
[3.14] gh-133485: Use interpreters.Interpreter in InterpreterPoolExecutor (gh-135695)
Most importantly, this resolves the issues with functions and types defined in __main__.
It also expands the number of supported objects and simplifies the implementation.

(cherry picked from commit 725da50520, AKA gh-133957)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-06-19 00:23:12 +00:00
Miss Islington (bot)
c03f94e7fe
[3.14] gh-135450: Remove assertion in _PyCode_CheckNoExternalState (gh-135694)
The assertion reflected a misunderstanding of situations where "hidden" variables might exist,
namely generator expressions and comprehensions.

(cherry picked from commit 15f2bac02c, AKA gh-135466)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-06-18 23:57:18 +00:00
Miss Islington (bot)
47ee2aedf1
gh-134538: Add link to shutil.rmtree example in function docs (GH-135540)
(cherry picked from commit e9b647dd30)

Co-authored-by: alexey semenyuk <alexsemenyuk88@gmail.com>
2025-06-18 21:16:07 +00:00
Miss Islington (bot)
a93ff87375
[3.14] gh-135641: Fix flaky test_capi.test_lock_two_threads test case (gh-135642) (gh-135687)
The mutex may have the `_Py_HAS_PARKED` bit set.
(cherry picked from commit 17ac3933c3)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-06-18 18:49:43 +00:00
Miss Islington (bot)
1734b295b3
[3.14] Docs: Fix markups for emphasis (GH-135598) (GH-135685)
Docs: Fix markups for emphasis (GH-135598)

The word emphasis character `_` is not supported as sphinx markup, so changed to `*`.
(cherry picked from commit 46c60e0d0b)

Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
2025-06-18 17:39:06 +00:00
Miss Islington (bot)
3ae8a5bed3
[3.14] gh-135376: Fix and improve test_random (GH-135377) (GH-135680)
* Remove duplicated code. Tests for Random and SystemRandom now share
  the code.
* Move implementation agnostic tests that was only run for SystemRandom,
  so they are now run for Random too.
* Add tests for __index__() support.
* Add tests for randint().
(cherry picked from commit c55512311b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-18 15:51:47 +00:00
Miss Islington (bot)
bb9927005f
[3.14] gh-135676: lexical analysis: Improve section on Numeric literals (GH-134850) (GH-135677)
gh-135676: lexical analysis: Improve section on Numeric literals (GH-134850)
(cherry picked from commit 21f3d15534)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-06-18 14:40:28 +00:00
Miss Islington (bot)
d4daf4da7e
[3.14] gh-135646: Raise consistent NameError exceptions in ForwardRef.evaluate() (GH-135663) (#135673)
gh-135646: Raise consistent `NameError` exceptions in `ForwardRef.evaluate()` (GH-135663)
(cherry picked from commit 343719d98e)

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
2025-06-18 13:26:58 +00:00
Miss Islington (bot)
9ac369cb73
[3.14] gh-135335: flush stdout/stderr in forkserver after preloading modules (GH-135338) (#135670)
gh-135335: flush stdout/stderr in forkserver after preloading modules (GH-135338)

If a preloaded module writes to stdout or stderr, and the stream is buffered,
child processes will inherit the buffered data after forking. Attempt to
prevent this by flushing the streams after preload.
(cherry picked from commit 9877d191f4)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-06-18 12:42:18 +00:00
Miss Islington (bot)
91914fd448
[3.14] gh-135627: Remove documentation for LOAD_CONST_IMMORTAL opcode (GH-135632) (GH-135649)
gh-135627: Remove documentation for LOAD_CONST_IMMORTAL opcode (GH-135632)

Remove documentation for LOAD_CONST_IMMORTAL opcode
(cherry picked from commit 7117002591)

Co-authored-by: Vladyslav Lazoryk <80263725+lazorikv@users.noreply.github.com>
2025-06-18 15:27:26 +08:00
Miss Islington (bot)
562f6d1639
[3.14] gh-134632: Add iOS/Android test skip for C API check for headers. (GH-135656) (#135657)
iOS and Android don't ship headers in the testbed, so we can't test for their existence.
(cherry picked from commit 1c7efaf58a)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2025-06-18 06:48:03 +00:00
Miss Islington (bot)
52cb287bf9
[3.14] gh-127146: Enable large files on Emscripten (GH-135635) (#135655)
Large files have been fully supported by Emscripten for a long time.
(cherry picked from commit 01c80b2650)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-06-18 04:53:01 +00:00
Miss Islington (bot)
1429eefbff
[3.14] gh-119180: Only fetch globals and locals if necessary in annotationlib.get_annotations() (GH-135644) (#135654)
gh-119180: Only fetch globals and locals if necessary in `annotationlib.get_annotations()` (GH-135644)
(cherry picked from commit 504ae606e1)

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
2025-06-18 04:24:08 +00:00
Miss Islington (bot)
9f63a54aec
[3.14] gh-127146: Emscripten: Fix pathlib glob_dotdot test (GH-135624) (#135653)
The Emscripten path resolver uses the same mechanism for resolving `..`
at a file system root as for resolving symlinks. This is because
roots don't store their mountpoints. If the parent of a node is itself,
it is a root but it might be a mountpoint in some other file system.

If a path has enough `..`'s at the root, it will return ELOOP.
Enough turns out to be 49.
(cherry picked from commit e4ccd46bf7)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-06-18 04:19:43 +00:00
Miss Islington (bot)
a61bd7af6e
[3.14] gh-127146: Emscripten: Fix test failure due to missing os.link (GH-135626) (#135652)
Check for existence of os.link, rather than assuming it exists.
(cherry picked from commit ce58afb400)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-06-18 04:03:32 +00:00
Miss Islington (bot)
bf189d7ab5
[3.14] gh-127146: Emscripten: Skip test_url2pathname_resolve_host (GH-135634) (#135651)
Emscripten currently `gethostbyname_r()` returns an incorrect
IP address for `localhost`. Will be resolved by upstream PR:
https://github.com/emscripten-core/emscripten/pull/24593
(cherry picked from commit 2a49c54ab2)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-06-18 03:23:31 +00:00
Miss Islington (bot)
77e2ac14c6
[3.14] gh-127146: Allow ignored keys to be missing in test_sysconfig (GH-135622) (#135650)
Fixes the test on Emscripten where userbase can be missing.
(cherry picked from commit 28c71ee4b2)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-06-18 03:17:22 +00:00
Miss Islington (bot)
2c29ee835a
[3.14] gh-132775: Fix Interpreter.call() __main__ Visibility (gh-135638)
As noted in the new tests, there are a few situations we must carefully accommodate
for functions that get pickled during interp.call().  We do so by running the script
from the main interpreter's __main__ module in a hidden module in the other
interpreter.  That hidden module is used as the function __globals__.

(cherry picked from commit 269e19e0a7, AKA gh-135595)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-06-17 20:24:08 +00:00
Hugo van Kemenade
8ec4186b25 Post 3.14.0b3 2025-06-17 21:31:06 +03:00
Hugo van Kemenade
26d485d122 Python 3.14.0b3 2025-06-17 18:40:54 +03:00
Miss Islington (bot)
c1735c5b4e
[3.14] gh-132815: Add support for JUMP_BACKWARD in specialization stats (GH-135606) (#135612)
gh-132815: Add support for JUMP_BACKWARD in specialization stats (GH-135606)
(cherry picked from commit a9e66a7c50)

Co-authored-by: PuQing <me@puqing.work>
2025-06-17 12:38:22 +00:00
Miss Islington (bot)
91d9e9e64e
[3.14] gh-134262: Catch both URLError and ConnectionError in retries (GH-135365) (#135611)
Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-06-17 12:16:17 +00:00
Emma Smith
3233cff84e
[3.14] gh-134262: increase retries in Tools/build/generate_sbom.py … (#135596) 2025-06-17 14:50:15 +03:00
Miss Islington (bot)
1bd034de9d
[3.14] gh-134632: Fix build-details.json to use INCLUDEPY path (GH-134633) (#135605)
gh-134632: Fix `build-details.json` to use `INCLUDEPY` path (GH-134633)

* gh-134632: Fix `build-details.json` to use `INCLUDEPY` path

Fix ``build-details.json`` generation to use ``INCLUDEPY``, in order to
reference the ``pythonX.Y`` subdirectory of the include directory, as
required in :pep:`739`, instead of the top-level include directory.

* test_build_details: Add tests for the c_api section

* test_build_details: Expect pkgconfig for CPython unconditionally
(cherry picked from commit 0d582def34)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
2025-06-17 08:31:10 +00:00
Miss Islington (bot)
540fa293ac
[3.14] gh-123299: Add PEP 779 to What's New in Python 3.14 (GH-135555) (#135602)
gh-123299: Add PEP 779 to What's New in Python 3.14 (GH-135555)
(cherry picked from commit c51f241c97)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-06-17 09:10:24 +03:00
Miss Islington (bot)
d2292c29f7
[3.14] gh-135489: Show verbose output for failing tests during PGO profiling step with --enable-optimizations (#135599)
(cherry picked from commit 5b3a826888)

Co-authored-by: PuQing <me@puqing.work>
2025-06-17 01:37:39 -04:00
Miss Islington (bot)
2b1c0a76dc
[3.14] gh-135443: Sometimes Fall Back to __main__.__dict__ For Globals (gh-135593)
For several builtin functions, we now fall back to __main__.__dict__ for the globals
when there is no current frame and _PyInterpreterState_IsRunningMain() returns
true.  This allows those functions to be run with Interpreter.call().

The affected builtins:

* exec()
* eval()
* globals()
* locals()
* vars()
* dir()

We take a similar approach with "stateless" functions, which don't use any
global variables.

(cherry picked from commit a450a0ddec, AKA gh-135491)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-06-16 23:59:30 +00:00
Miss Islington (bot)
7aeddeaf93
[3.14] gh-119132: Update 'Using Python on macOS' documentation. (GH-135591) (#135594)
Remove `experimental` qualification for free-threading in the document text. Note that images included in the document will be updated later in the release cycle.
(cherry picked from commit 7c685894cd)

Co-authored-by: Ned Deily <nad@python.org>
2025-06-16 19:43:24 -04:00
Miss Islington (bot)
d62b73a9d8
[3.14] gh-128627: Emscripten: Add missing semicolon in ios detection code (GH-135590) (#135592)
(cherry picked from commit 68b7e1a667)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-06-16 23:41:46 +00:00
Miss Islington (bot)
a2c4791d99
[3.14] Use replacements to update versions in "Using Python on macOS" (GH-130400) (#135586)
(cherry picked from commit 21bac3aecd)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-06-16 18:15:15 -04:00
Miss Islington (bot)
964c29d281
[3.14] gh-116738: Make _heapq module thread-safe (GH-135036) (gh-135309)
Use critical sections to make heapq methods that update the heap thread-safe when the GIL is disabled.
(cherry picked from commit a58026a5e3)

Co-authored-by: Alper <alperyoney@fb.com>
Co-authored-by: mpage <mpage@meta.com>
2025-06-16 13:27:43 -04:00
Miss Islington (bot)
15f7bd4295
[3.14] gh-132617: Fix dict.update() mutation check (gh-134815) (gh-135581)
Use `ma_used` instead of `ma_keys->dk_nentries` for modification check
so that we only check if the dictionary is modified, not if new keys are
added to a different dictionary that shared the same keys object.
(cherry picked from commit d8994b0a77)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-06-16 17:19:58 +00:00
Miss Islington (bot)
027f58473c
[3.14] gh-135513: Fix unused variable warning in crossinterp.c (GH-135514) (#135577)
gh-135513: Fix unused variable warning in `crossinterp.c` (GH-135514)
(cherry picked from commit 4c15505071)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-06-16 16:37:26 +00:00
Miss Islington (bot)
0e0ad7b8ff
[3.14] gh-134160: Split extension module init from PyModule docs; emphasize multi-phase init (GH-135126) (#135470)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-06-16 18:01:09 +03:00
Miss Islington (bot)
941011374a
[3.14] gh-119132: Remove "experimental" tag from the CPython free-threading. (gh-135550) (gh-135565)
---------
(cherry picked from commit f079979599)

Co-authored-by: Donghee Na <donghee.na@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: T. Wouters <thomas@python.org>
2025-06-16 14:58:14 +00:00
Mikhail Efimov
2ef78a85e4
[3.14] GH-135171: Revert async generator expressions behavior (#135352) 2025-06-16 17:45:42 +03:00
Miss Islington (bot)
0eec8ddac3
[3.14] gh-120608: fix NEWS entry typo (GH-135535) (#135558)
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2025-06-16 10:17:37 +00:00
Miss Islington (bot)
43bf8b30f9
[3.14] gh-127319: Disable port reuse on HTTP, XMLRPC, and logging TCP servers (GH-135405) (GH-135538)
(cherry picked from commit 2bd3895fca)
2025-06-16 08:05:26 +01:00
Miss Islington (bot)
e89c7f1fc0
[3.14] gh-111178: fix UBSan failures for RemoteUnwinderObject (GH-135539) (#135547) 2025-06-15 22:54:23 +02:00
Miss Islington (bot)
1c4f01a160
[3.14] gh-67022: Document bytes/str inconsistency in email.header.decode_header() and suggest email.headerregistry.HeaderRegistry as a sane alternative (GH-92900) (#135548)
gh-67022: Document bytes/str inconsistency in email.header.decode_header() and suggest email.headerregistry.HeaderRegistry as a sane alternative (GH-92900)

* gh-67022: Document bytes/str inconsistency in email.header.decode_header()

This function's possible return types have been surprising and error-prone
for the entirety of its Python 3.x history. It can return either:

1. `typing.List[typing.Tuple[bytes, typing.Optional[str]]]` of length >1
2. or `typing.List[typing.Tuple[str, None]]`, of length exactly 1

This means that any user of this function must be prepared to accept either
`bytes` or `str` for the first member of the 2-tuples it returns, which is a
very surprising behavior in Python 3.x, particularly given that the second
member of the tuple is supposed to represent the charset/encoding of the
first member.

This patch documents the behavior of this function, and adds test cases
to demonstrate it.

As discussed in bpo-22833, this cannot be changed in a backwards-compatible
way, and some users of this function depend precisely on the existing
behavior.

Add warnings about obsolescence of 'email.header.decode_header' and 'email.header.make_header' functions.

Recommend use of `email.headerregistry.HeaderRegistry` instead, as suggested
in https://github.com/python/cpython/pull/92900#discussion_r1112472177
(cherry picked from commit 60181f4ed0)

Co-authored-by: Dan Lenski <dlenski@gmail.com>
2025-06-15 16:02:16 -04:00
Miss Islington (bot)
7fd8857b11
[3.14] gh-135371: Clean tags from pointers in all cases in remote debugging module (GH-135534) (#135545) 2025-06-15 19:05:39 +00:00
Miss Islington (bot)
e00aef6c81
[3.14] gh-135361: update documentation for remote_debugger_script audit event (GH-135362) (#135546) 2025-06-15 18:55:24 +00:00
Miss Islington (bot)
f8f99b1cfc
[3.14] gh-135371: Fix asyncio introspection output to include internal coroutine chains (GH-135436) (#135509)
gh-135371: Fix asyncio introspection output to include internal coroutine chains (GH-135436)
(cherry picked from commit 028309fb47)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-06-15 18:38:56 +00:00
Miss Islington (bot)
6ae54553d4
[3.14] gh-65697: Improved error msg for configparser key validation (GH-135527) (#135541)
gh-65697: Improved error msg for configparser key validation (GH-135527)

* Improved error msg for configparser key validation and added note in 3.14 whatsnew

* Properly added change to configparser

* 📜🤖 Added by blurb_it.

---------
(cherry picked from commit 81237fbcf6)

Co-authored-by: Jacob Austin Lincoln <99031153+lincolnj1@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2025-06-15 16:38:15 +00:00
Miss Islington (bot)
ee141f0277
[3.14] gh-135171: Update documentation for the generator expression (GH-135351) (#135524)
gh-135171: Update documentation for the generator expression (GH-135351)

* gh-135171: Update documentation for the generator expression

Document that the iterator for the leftmost "for" clause is created
immediately.

* Update Doc/reference/expressions.rst



---------
(cherry picked from commit 8979d3afe3)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Brian Skinn <brian.skinn@gmail.com>
2025-06-15 00:38:19 +00:00
Miss Islington (bot)
c5f066ddf7
[3.14] gh-135497: fix MAXLOGNAME detection in configure.ac (GH-135508) (#135516)
gh-135497: fix `MAXLOGNAME` detection in `configure.ac` (GH-135508)
(cherry picked from commit 2e15a50851)

Co-authored-by: Caleb Xu <calebcenter@live.com>
2025-06-14 16:50:48 +00:00
Miss Islington (bot)
f346ba7a02
[3.14] gh-135504: Document LIBZSTD_CFLAGS and LIBZSTD_LIBS config options (GH-135505) (#135515) 2025-06-14 15:13:03 +00:00
Miss Islington (bot)
79df5d1c54
[3.14] gh-135368: Fix mocks on dataclass specs with instance=True (GH-135421) (#135503)
gh-135368: Fix mocks on dataclass specs with `instance=True` (GH-135421)

* gh-135368: Fix mocks on dataclass specs with `instance=True`

* Extend dataclass mock_methods

---------
(cherry picked from commit c8319a3fea)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2025-06-14 09:11:31 +00:00
Miss Islington (bot)
7499bcd530
[3.14] gh-135496: Fix f string exclamation mark error typo (GH-135495) (#135499)
gh-135496: Fix f string exclamation mark error typo (GH-135495)
(cherry picked from commit c2bb3f9843)

Co-authored-by: GiGaGon <107241144+MeGaGiGaGon@users.noreply.github.com>
2025-06-14 05:05:55 +00:00
Miss Islington (bot)
0fe5463877
[3.14] gh-132775: Clean Up Cross-Interpreter Error Handling (gh-135492)
In this refactor we:

* move some code around
* make a couple of typedefs opaque
* decouple errors from session state
* improve tracebacks for propagated exceptions

This change helps simplify several upcoming changes.

(cherry picked from commit c7f4a80079, AKA gh-135369)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-06-14 02:08:25 +00:00
Miss Islington (bot)
f77a911c52
[3.14] gh-135437: Account For Duplicate Names in _PyCode_SetUnboundVarCounts() (gh-135493)
(cherry picked from commit 56eabea, AKA gh-135438)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-06-13 23:14:00 +00:00
Miss Islington (bot)
d851f8e258
[3.14] gh-135462: Fix quadratic complexity in processing special input in HTMLParser (GH-135464) (GH-135481)
End-of-file errors are now handled according to the HTML5 specs --
comments and declarations are automatically closed, tags are ignored.
(cherry picked from commit 6eb6c5dbfb)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-13 17:23:48 +00:00
Miss Islington (bot)
b573a850d6
[3.14] doc: Remove what was essentially duplicate wording. (GH-135431) (GH-135440)
(cherry picked from commit f273fd77d7)
2025-06-13 17:54:20 +01:00
Miss Islington (bot)
5912979975
gh-135455: Fix version and architecture detection in PC/layout script. (GH-135461)
(cherry picked from commit afc5ab6cce)

Co-authored-by: Steve Dower <steve.dower@python.org>
2025-06-13 16:10:29 +00:00
Miss Islington (bot)
a9db299afa
[3.14] gh-106318: Add example for str.expandtabs() (GH-134525) (#135476)
Co-authored-by: Blaise Pabon <blaise@gmail.com>
2025-06-13 15:50:16 +00:00
Miss Islington (bot)
46e7ed7206
[3.14] gh-135244: improve wording of uuid8 docs about CSPRNG (GH-135433) (#135467)
gh-135244: improve wording of `uuid8` docs about CSPRNG (GH-135433)
(cherry picked from commit 394d7985da)

Co-authored-by: LamentXU <108666168+LamentXU123@users.noreply.github.com>
2025-06-13 14:11:51 +00:00
Miss Islington (bot)
6754a507c5
[3.14] gh-132969: Fix error/hang when shutdown(wait=False) and task exited abnormally (GH-133222) (GH-135344)
gh-132969:  Fix error/hang when shutdown(wait=False) and task exited abnormally (GH-133222)

When shutdown is called with wait=False, the executor thread keeps running
even after the ProcessPoolExecutor's state is reset. The executor then tries
to replenish the worker processes pool resulting in an error and a potential hang
when it comes across a worker that has died. Fixed the issue by having
_adjust_process_count() return without doing anything if the ProcessPoolExecutor's
state has been reset.

Added unit tests to validate two scenarios:
max_workers < num_tasks (exception)
max_workers > num_tasks (exception + hang)
(cherry picked from commit 598aa7cc98)

Co-authored-by: Ajay Kamdar <140011370+ogbiggles@users.noreply.github.com>
2025-06-13 15:49:54 +02:00
Miss Islington (bot)
8a78ee6d8d
[3.14] gh-106318: Add example for str.endswith() (GH-134523) (#135459)
gh-106318: Add example for `str.endswith()` (GH-134523)
(cherry picked from commit eed827ed09)

Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-06-13 15:14:21 +03:00
Miss Islington (bot)
f22aae1908
[3.14] gh-106318: Add example for str.encode() (GH-134520) (#135457)
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-06-13 14:46:06 +03:00
Miss Islington (bot)
b3efd3d7d3
[3.14] Revert "gh-135410: use a critical section around StringIO.__next__ (GH-135412)" (GH-135439) (gh-135449)
Revert "gh-135410: use a critical section around `StringIO.__next__` (GH-135412)" (GH-135439)

This reverts commit e6c3039cb3.
(cherry picked from commit 73431356d3)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-06-12 22:58:58 +00:00
Miss Islington (bot)
f885c7d9b9
[3.14] gh-135429: Fix the argument mismatch in lsprof throw event (GH-135442) (#135446)
gh-135429: Fix the argument mismatch in lsprof throw event (GH-135442)
(cherry picked from commit b03309fe5f)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2025-06-12 22:13:36 +00:00
Eric Snow
04273adae0
[3.14] gh-134939: Add the concurrent.interpreters Module (gh-135414)
PEP-734 has been accepted (for 3.14).

(FTR, I'm opposed to putting this under the concurrent package, but
doing so is the SC condition under which the module can land in 3.14.)

(cherry picked from commit 62143736b, AKA gh-133958)
2025-06-12 08:19:26 -06:00
Miss Islington (bot)
8cb7d9a810
[3.14] gh-135410: use a critical section around StringIO.__next__ (GH-135412) (#135425)
gh-135410: use a critical section around `StringIO.__next__` (GH-135412)
(cherry picked from commit e6c3039cb3)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-06-12 11:36:44 +00:00
Miss Islington (bot)
e76dbc87a2
[3.14] gh-128627: Fix iPad detection in wasm-gc (GH-135388) (#135419)
On some iPad versions, Safari reports as "macOS". Modifies the GC trampoline detection
to add a feature-based check to detect this case.
(cherry picked from commit d447129758)

Co-authored-by: Gyeongjae Choi <def6488@gmail.com>
2025-06-12 04:28:47 +00:00
Miss Islington (bot)
4a30154fd2
[3.14] Fix presentation of dataclasses' unsafe_hash default value (GH-116532) (#135416)
Fix presentation of dataclasses' `unsafe_hash` default value (GH-116532)

(cherry picked from commit 71f5fafdfb)

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-06-12 01:36:17 +00:00
Miss Islington (bot)
98136ddb0e
[3.14] gh-133264: Correct documentation of how Py_Main and Py_RunMain handle SystemExit (GH-135337) (#135394)
gh-133264: Correct documentation of how Py_Main and Py_RunMain handle SystemExit (GH-135337)
(cherry picked from commit b706ff003c)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
2025-06-11 15:29:46 +00:00
Miss Islington (bot)
0e969fe843
[3.14] gh-135321: Always raise a correct exception for BINSTRING argument > 0x7fffffff in pickle (GH-135322) (GH-135382)
(cherry picked from commit 2b8b4774d2)

Co-authored-by: Justin Applegate <70449145+Legoclones@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-11 14:01:15 +03:00
Miss Islington (bot)
30494cc72c
[3.14] gh-133967: Do not normalize locale name 'C.UTF-8' to 'en_US.UTF-8' (GH-135347) (GH-135349)
(cherry picked from commit 0f866cbfef)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-11 12:43:20 +03:00
Miss Islington (bot)
9f6c3769e3
[3.14] gh-135326: Test support of __index__ in random.getrandbits() (GH-135356) (#135373)
gh-135326: Test support of __index__ in random.getrandbits() (GH-135356)
(cherry picked from commit 5ae669fc4e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-11 02:17:06 +00:00
Miss Islington (bot)
f303532857
[3.14] gh-91048: Reorder result tuple of parse_code_object (GH-134898) (#134956)
* gh-91048:  Reorder result tuple of parse_code_object (GH-134898)

Reorder result tuple of parse_code_object

The standard followed by APIs like pstat.Stats is to take a file, line,
function triplet. The parse_code_object function (and callers exposing
this in Python like RemoteUnwinder.get_stack_trace) return function,
file, line triplets which requires the caller to reorder these when
using it in classes like pstat.Stats.
(cherry picked from commit 8e8786f898)

Co-authored-by: László Kiss Kollár <kiss.kollar.laszlo@gmail.com>

* Reorder asyncio

---------

Co-authored-by: László Kiss Kollár <kiss.kollar.laszlo@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2025-06-11 01:33:46 +00:00
Miss Islington (bot)
77c4b5d413
[3.14] gh-130077: Properly match full soft keywords in the parser (GH-135317) (#135348)
gh-130077: Properly match full soft keywords in the parser (GH-135317)
(cherry picked from commit ff2b5f40c2)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-06-11 02:01:37 +01:00
stratakis
4b96a34978
[3.14] gh-128605: Add branch protections for x86_64 in asm_trampoline.S (#128606) (#135345)
Apply Intel Control-flow Technology for x86-64 on asm_trampoline.S.

Required for mitigation against return-oriented programming (ROP)
and Call or Jump Oriented Programming (COP/JOP) attacks.

Manual application is required for the assembly files.

See also: https://sourceware.org/annobin/annobin.html/Test-cf-protection.html
2025-06-10 17:41:39 +02:00
Miss Islington (bot)
081421a00e
[3.14] gh-118928: Amend sqlite3 execute*() deprecation notes (GH-135163) (#135342)
(cherry picked from commit ee7345d507)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2025-06-10 11:30:19 +00:00
Miss Islington (bot)
88d8a2e9f0
[3.14] Docs: fix docstring of email.message.Message.add_header (GH-134355) (#135339)
Docs: fix docstring of `email.message.Message.add_header` (GH-134355)
(cherry picked from commit c23eec2960)

Co-authored-by: Alexander Shadchin <shadchin@yandex-team.com>
2025-06-10 11:00:25 +00:00
Miss Islington (bot)
904685f90f
[3.14] gh-133157: remove usage of _Py_NO_SANITIZE_UNDEFINED in Parser/pegen.c (GH-134048) (#135320)
gh-133157: remove usage of `_Py_NO_SANITIZE_UNDEFINED` in `Parser/pegen.c` (GH-134048)
(cherry picked from commit 754e7c9b51)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-06-10 00:34:49 +00:00
Miss Islington (bot)
84c6fe6ac6
[3.14] Fix warnings set but not used [-Wunused-but-set-variable] in remote_debug.h (GH-135290) (#135319)
Fix warnings `set but not used [-Wunused-but-set-variable]` in remote_debug.h (GH-135290)
(cherry picked from commit 49fc1f215a)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-06-10 00:29:28 +00:00
Miss Islington (bot)
79c86b118c
[3.14] Fix definition of _Py_RemoteDebug_ symbols for static linking (GH-135146) (#135318)
Fix definition of `_Py_RemoteDebug_` symbols for static linking (GH-135146)
(cherry picked from commit 2e1ad6eb26)

Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-06-10 00:28:42 +00:00
Miss Islington (bot)
e5a154786b
[3.14] Heavily comment Python/perf_jit_trampoline.c to improve maintainability (GH-134527) (#135299) 2025-06-09 22:09:48 +01:00
Miss Islington (bot)
8b35651853
[3.14] gh-127833: Reword and expand the Notation section (GH-134443) (GH-135301)
Prepare the docs for using the notation used in the `python.gram`
file. If we want to sync the two, the meta-syntax should be the same.

Link the Full Grammar docs here; keep only a few extras.

Also, remove the distinction between lexical and syntactic rules,
except for whitespace handling.
With f- and t-strings, the line between the two is blurry.
(cherry picked from commit 28d91d06f1)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Colin Marquardt <cmarqu42@gmail.com>
2025-06-09 13:56:24 +00:00
Miss Islington (bot)
725ec53032
[3.14] bpo-45210: Document that error indicator may be set in tp_dealloc (GH-28358) (#135298)
bpo-45210: Document that error indicator may be set in tp_dealloc (GH-28358)
(cherry picked from commit 8441b263af)

Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Co-authored-by: Edward Z. Yang <ezyang@mit.edu>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-06-09 13:01:33 +00:00
Victor Stinner
3d69d18322
[3.14] gh-133968: Add PyUnicodeWriter_WriteASCII() function (#133973) (#134974)
gh-133968: Add PyUnicodeWriter_WriteASCII() function (#133973)

Replace most PyUnicodeWriter_WriteUTF8() calls with
PyUnicodeWriter_WriteASCII().

(cherry picked from commit f49a07b531)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-06-09 14:37:26 +02:00
Miss Islington (bot)
dba307a757
[3.14] GH-135287: clang-cl PGO builds on Windows fail with could not open '/GENPROFILE' (GH-135289)
GH-135287: clang-cl PGO builds on Windows fail with `could not open '/GENPROFILE'` (GH-135289)
(cherry picked from commit 0045100ccb)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-06-09 12:18:51 +00:00
Mark Shannon
a5274cd215
[3.14] GH-135171: Fix generator expressions one last time (hopefully) (GH-135225)
* Add NULL check to FOR_ITER

* Move GET_ITER back to genexpr creation
2025-06-09 11:04:23 +01:00
Miss Islington (bot)
1497866198
[3.14] Use f-strings in csv docs example (GH-135245) (#135285)
Use f-strings in csv docs example (GH-135245)
(cherry picked from commit 2677dd017a)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2025-06-09 06:37:15 +00:00
Miss Islington (bot)
7bb999d431
[3.14] gh-135263: Fix typo in token.NAME documentation (GH-135275) (#135280)
gh-135263: Fix typo in token.NAME documentation (GH-135275)
(cherry picked from commit 8d17a412da)

Co-authored-by: Vladyslav Lazoryk <80263725+lazorikv@users.noreply.github.com>
2025-06-08 17:55:04 -04:00
Miss Islington (bot)
00f824dc5a
[3.14] gh-135276: Refresh zipfile.Path from zipp 3.23 (GH-135277) (#135278)
* gh-135276: Refresh `zipfile.Path` from zipp 3.23 (GH-135277)

Apply changes from zipp 3.23
(cherry picked from commit 8d6eb0c262)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

* Removed features slated for Python 3.15 only.

---------

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2025-06-08 20:12:25 +00:00
Miss Islington (bot)
cf2209f5b9
[3.14] Update tutorial for new "Copy" button (GH-135007) (#135270)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-06-08 16:40:07 +00:00
Miss Islington (bot)
483a462580
[3.14] gh-134976: document the exception type that can be raised by s[i] (GH-134977) (#135258)
gh-134976: document the exception type that can be raised by `s[i]` (GH-134977)
(cherry picked from commit 158e5162bf)

Co-authored-by: Yongzi Li <204532581+Yzi-Li@users.noreply.github.com>
2025-06-08 14:37:29 +02:00
Miss Islington (bot)
949248d6db
[3.14] gh-135244: generate UUID random Node ID with a CSPRNG as per RFC 9562, §6.10.3 (GH-135226) (#135255)
gh-135244: generate UUID random Node ID with a CSPRNG as per RFC 9562, §6.10.3 (GH-135226)

This aligns with the recommendations of RFC 9562, Section 6.10, paragraph 3 [1].

[1]: https://www.rfc-editor.org/rfc/rfc9562.html#section-6.10-3.

---------
(cherry picked from commit 1cb7163872)

Co-authored-by: LamentXU <108666168+LamentXU123@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-06-08 12:13:04 +00:00
Miss Islington (bot)
85efa77e35
[3.14] gh-134151 Fix TypeError in email.utils.decode_params when sorting RFC 2231 continuations (GH-134687) (#135247)
gh-134151 Fix `TypeError` in `email.utils.decode_params` when sorting RFC 2231 continuations (GH-134687)

- Fix sorting logic in `email.utils.decode_params` to handle None values.
- Update tests for RFC 2231 continuation sorting.
(cherry picked from commit bcb6b45cb8)

Co-authored-by: Jiucheng(Oliver) <git.jiucheng@gmail.com>
2025-06-08 07:38:39 +00:00
Miss Islington (bot)
ef539654e6
[3.14] gh-134876: Add fallback for when process_vm_readv fails with ENOSYS (GH-134878) (#135240)
gh-134876: Add fallback for when process_vm_readv fails with ENOSYS (GH-134878)
(cherry picked from commit ac9c3431cc)

Co-authored-by: Daniel Golding <goldingd89@gmail.com>
2025-06-07 18:56:38 +00:00
Miss Islington (bot)
3faf00e003
[3.14] gh-134155: fix AttributeError in email._header_value_parser.get_address (GH-134194) (#135191)
gh-134155: fix AttributeError in email._header_value_parser.get_address (GH-134194)

Append the defect to defects instead of to the parse tree.
(cherry picked from commit d9cad074d5)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-06-06 14:13:30 -04:00
Miss Islington (bot)
88b5784fc0
[3.14] Docs: Update PyExc_* tables in the c-api documentation (GH-131640) (GH-135220)
Docs: Update `PyExc_*` tables in the c-api documentation (GH-131640)

Add `PyExc_BaseExceptionGroup` and `PyExc_EncodingWarning`
(cherry picked from commit f00512db20)

Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
2025-06-06 15:57:37 +00:00
Miss Islington (bot)
dd4a819a82
[3.14] gh-134160: Use PyModuleDef.m_free in the example module xxlimited (GH-135174) (GH-135213)
gh-134160: Use PyModuleDef.m_free in the example module xxlimited (GH-135174)
(cherry picked from commit 1adca08d65)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
2025-06-06 17:08:45 +02:00
Miss Islington (bot)
f32c7b9100
[3.14] gh-57089: Note _layout_ in the bitfield docs (GH-134148) (GH-135216)
(cherry picked from commit b22b964a5c)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Meador Inge <meadori@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-06-06 14:58:48 +00:00
Miss Islington (bot)
23552b3d8f
[3.14] feat(docs): type fix - apply pep8 by using docstring instead of comment in the doc. (GH-135181) (#135212)
feat(docs): type fix - apply pep8 by using docstring instead of comment in the doc. (GH-135181)

Giving the right example incitates the tutorial readers to do the same in the future.
(cherry picked from commit 343182853f)

Co-authored-by: Jean-Louis GUENEGO <jlguenego@gmail.com>
2025-06-06 13:22:50 +00:00
Serhiy Storchaka
5b38af57e0
[3.14] gh-135120: Add test.support.subTests() (GH-135121) (GH-135208)
(cherry picked from commit 6ef06fad84)
2025-06-06 13:03:28 +00:00
Miss Islington (bot)
4e2e02eec9
[3.14] gh-134993: Add os.lstat() to os.supports_dir_fd (GH-135188) (#135205)
gh-134993: Add os.lstat() to os.supports_dir_fd (GH-135188)
(cherry picked from commit e004cf8fd5)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-06-06 12:38:59 +00:00
Miss Islington (bot)
daf11fca03
[3.14] Fix versionadded directive rendering in c-api/arg.rst (GH-135199) (#135207)
Fix versionadded directive rendering in c-api/arg.rst (GH-135199)
(cherry picked from commit 39859fcac5)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2025-06-06 12:30:33 +00:00
Petr Viktorin
b477e21d5c
[3.14] gh-128605: Revert "Add branch protections for x86_64 in asm_tr…ampoline.S (#128606) (#135077)" (GH-135175)
This reverts commit 899cca6dbf,
which broke buildbots.
2025-06-06 13:55:26 +02:00
Miss Islington (bot)
897b81500c
[3.14] gh-135155: Added dependencies required for compiling the _zstd module (GH-135156) (#135197)
gh-135155: Added dependencies required for compiling the _zstd module (GH-135156)
(cherry picked from commit a7d41e8aab)

Co-authored-by: Weipeng Hong <hongweichen8888@sina.com>
2025-06-06 01:09:08 +00:00
mpage
be2f32e60f
[3.14] gh-134889: Fix handling of a few opcodes when optimizing LOAD_FAST (#134958) (#135187)
We were incorrectly handling a few opcodes that leave their operands on the stack. Treat all of these conservatively; assume that they always leave operands on the stack.

(cherry picked from commit 6b77af257c)
2025-06-05 13:06:51 -07:00
Miss Islington (bot)
945af60f04
[3.14] gh-135166: Fix exception type expected by test.test_zstd (GH-135167)
gh-135166: Fix exception type expected by test.test_zstd (GH-135167)
(cherry picked from commit 1b55e12766)

Co-authored-by: Weipeng Hong <hongweichen8888@sina.com>
2025-06-05 18:41:51 +01:00
Miss Islington (bot)
5b39741a09
[3.14] gh-134938: Add set_pledged_input_size() to ZstdCompressor (GH-135010) (GH-135173)
(cherry picked from commit 4b44b3409a)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-06-05 14:51:11 +00:00
Miss Islington (bot)
97822b8199
[3.14] gh-131884: Fix incorrect formatting in json.dumps() when using indent and skipkeys=True (GH-132200) (GH-135060)
(cherry picked from commit ec12559eba)

Co-authored-by: Roei Ben Artzi <155478676+roeibenartzi@users.noreply.github.com>
2025-06-05 14:38:09 +00:00
Miss Islington (bot)
e11d4a18e1
[3.14] gh-134989: Fix Py_RETURN_NONE in the limited C API (GH-135165) (#135178)
gh-134989: Fix Py_RETURN_NONE in the limited C API (GH-135165)

Fix Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE macros in the
limited C API 3.11 and older:
Don't treat Py_None, Py_True and Py_False as immortal.
(cherry picked from commit 9258f3da91)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-06-05 15:35:54 +02:00
Miss Islington (bot)
285c69ea38
[3.14] gh-135124: Change stdout errors in regrtest worker process (GH-135138) (#135168)
gh-135124: Change stdout errors in regrtest worker process (GH-135138)

Set sys.stdout encoder error handler to backslashreplace in regrtest
workers to avoid UnicodeEncodeError when printing a traceback
or any other non-encodable character.

Move the code from the Regrtest class to setup_process().

Call setup_process() earlier, before displaying regrtest headers.
(cherry picked from commit 3d396ab759)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-06-05 09:42:38 +00:00
Miss Islington (bot)
07921d4169
[3.14] gh-131531: android.py enhancements to support cibuildwheel (GH-132870) (#135158)
Modifies the environment handling and execution arguments of the Android management
script to support the compilation of third-party binaries, and the use of the testbed to
invoke third-party test code.
(cherry picked from commit 2e1544fd2b)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2025-06-05 14:24:52 +08:00
Miss Islington (bot)
169cdfefce
[3.14] gh-135144: Add _remote_debugging to the MSI (legacy) Windows installers. (GH-135145) (#135150)
(cherry picked from commit e598eecf4c)

Co-authored-by: T. Wouters <thomas@python.org>
2025-06-04 20:08:52 +00:00
Miss Islington (bot)
02bcd1b142
[3.14] gh-129876: Update IDLE News3.txt to May 2025 (GH-135139) (#135140)
gh-129876: Update IDLE News3.txt to May 2025 (GH-135139)
(cherry picked from commit 0df15d0d4d)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-06-04 15:52:53 +00:00
Miss Islington (bot)
da1bbce4ce
[3.14] gh-134989: Implement PyObject_DelAttr() as a macro in the limited C API (GH-135021) (#135133)
gh-134989: Implement PyObject_DelAttr() as a macro in the limited C API (GH-135021)
(cherry picked from commit c21113072c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-06-04 13:33:20 +00:00
Miss Islington (bot)
3b01be24e7
[3.14] gh-126483: disable warnings filters mutation in concurrent test (GH-132694) (GH-135131)
The `test_ssl_in_multiple_threads` test failed because `test_check_hostname_idn()`
modified the global warnings filters via `warnings_helper.check_no_resource_warning()`.
Only check for warnings when the context aware warnings feature is enabled, which makes
the warnings filter context-local and thread-safe.
(cherry picked from commit 40c8be0008)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2025-06-04 13:25:47 +00:00
Miss Islington (bot)
5008317dcd
[3.14] gh-135074: Fix exception messages in test.support module (GH-135076) (GH-135129)
(cherry picked from commit bc00ce941e)

Co-authored-by: Daniel Hollas <daniel.hollas@bristol.ac.uk>
2025-06-04 13:25:15 +00:00
Miss Islington (bot)
afe244d694
[3.14] gh-135108: Fix utmp.h inclusion in posixmodule.c on NetBSD (GH-135109) (GH-135127)
(cherry picked from commit 5b3865418c)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
2025-06-04 13:16:39 +00:00
Miss Islington (bot)
b2b9aaa93d
[3.14] gh-135099: Only wait on _PyOS_SigintEvent() in main thread (GH-135100) (GH-135116)
On Windows, the `_PyOS_SigintEvent()` event handle is used to interrupt
the main thread when Ctrl-C is pressed. Previously, we also waited on
the event from other threads, but ignored the result. However, this can
race with interpreter shutdown because the main thread closes the handle
in `_PySignal_Fini` and threads may still be running and using mutexes
during interpreter shtudown.

Only use `_PyOS_SigintEvent()` in the main thread in parking_lot.c, like
we do in other places in the CPython codebase.
(cherry picked from commit cc581f32bf)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-06-04 08:44:35 -04:00
Miss Islington (bot)
f5b438517d
[3.14] Use a more clear example for the PEP 758 what's new section (GH-135118) (#135119)
Use a more clear example for the PEP 758 what's new section (GH-135118)
(cherry picked from commit 1f51510444)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-06-04 09:28:59 +00:00
Miss Islington (bot)
5b3983b1a3
[3.14] gh-135101: When choosing the default simulator device, don't use simctl --set testing (GH-135102) (#135113)
On a fresh Xcode install (including some CI provider configurations), there is
no pre-existing testing set that can be used to identify simulator models. Use
the default device set to detect available models instead. Live testing
simulators are still created in the testing set.
(cherry picked from commit dba9de731b)

Co-authored-by: Joe Rickerby <joerick@mac.com>
2025-06-04 00:57:45 +00:00
Miss Islington (bot)
d8c2bfac1f
[3.14] gh-127081: use getlogin_r if available (gh-132751) (gh-135097)
The `getlogin` function is not thread-safe: replace with `getlogin_r` where
available.
(cherry picked from commit 1ffe913c20)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
2025-06-03 14:41:47 -04:00
Miss Islington (bot)
81999f157f
[3.14] gh-134248 test_getallocatedblocks pre-check to ignore immortalized strings (GH-134871) (#135095)
gh-134248 test_getallocatedblocks pre-check to ignore immortalized strings (GH-134871)

When sanity checking against gettotalrefcount(), we exclude the blocks for
immortalized strings since their references are not tracked/reported. This
now matches refleak.py's book-keeping using the same functions.
(cherry picked from commit 54ca55978e)

Co-authored-by: tpburns <trevorpburns@gmail.com>
2025-06-03 16:26:32 +00:00
stratakis
899cca6dbf
[3.14] gh-128605: Add branch protections for x86_64 in asm_trampoline.S (#128606) (#135077)
Apply Intel Control-flow Technology for x86-64 on asm_trampoline.S.

Required for mitigation against return-oriented programming (ROP)
and Call or Jump Oriented Programming (COP/JOP) attacks.

Manual application is required for the assembly files.

See also: https://sourceware.org/annobin/annobin.html/Test-cf-protection.html
2025-06-03 15:31:06 +02:00
Miss Islington (bot)
89df01bd27
[3.14] gh-135028: Increase parser MAXSTACK for nested parenthesis (GH-135031) (#135059)
gh-135028: Increase parser MAXSTACK for nested parenthesis (GH-135031)
(cherry picked from commit 6e80f11eb5)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-06-03 12:23:06 +00:00
Łukasz Langa
9e0ac76d96
[3.14] gh-135034: Normalize link targets in tarfile, add os.path.realpath(strict='allow_missing') (gh-135037) (gh-135065)
Addresses CVEs 2024-12718, 2025-4138, 2025-4330, and 2025-4517.

(cherry picked from commit 3612d8f517)

Signed-off-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-03 14:05:00 +02:00
Miss Islington (bot)
78fd7ce3d2
[3.14] gh-134875: Fix mimallc build error for the old compilers (gh-134994) (gh-135053)
gh-134875: Fix mimallc build error for the old compilers (gh-134994)
(cherry picked from commit b525e31b7f)

Co-authored-by: Donghee Na <donghee.na@python.org>
2025-06-03 17:03:36 +09:00
Miss Islington (bot)
d420d82c63
[3.14] gh-134830: Fix reference in Doc/extending/windows.rst (GH-134831) (GH-135058)
(cherry picked from commit 0ac9e17fb4)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2025-06-03 06:33:04 +00:00
Miss Islington (bot)
94306f73f0
[3.14] gh-132813: Improve error messages for incorrect types and values of csv.Dialog attributes (GH-133241) (GH-135050)
Make them similar to PyArg_Parse error messages, mention None as
a possible value, show a wrong type and the string length.
(cherry picked from commit df98a47a61)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-02 21:01:18 +00:00
Miss Islington (bot)
9bbb0c5df8
[3.14] gh-133454: Mark test_queue tests with many threads as bigmem (gh-134575) (GH-135046)
50 producer and 50 consumer threads need more than 5GB of memory.
(cherry picked from commit 7a79f52d83)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-02 20:50:43 +00:00
Miss Islington (bot)
bf0d4127b0
[3.14] gh-74232: Add a note about roundtrip of non-float numerics in CSV (GH-134963) (GH-135048)
(cherry picked from commit e814f43f2c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-02 20:43:45 +00:00
Miss Islington (bot)
428b0ca114
[3.14] gh-134908: Protect textiowrapper_iternext with critical section (gh-134910) (gh-135039)
The `textiowrapper_iternext` function called `_textiowrapper_writeflush`, but did not
use a critical section, making it racy in free-threaded builds.
(cherry picked from commit 44fb7c361c)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
2025-06-02 19:16:54 +00:00
Miss Islington (bot)
7ac461883d
[3.14] Remove newline in Doc/c-api/lifecycle.rst for gettext builder (GH-135013) (GH-135038)
(cherry picked from commit c7051a3669)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2025-06-02 18:19:54 +00:00
Miss Islington (bot)
7775d93e2d
[3.14] gh-130999: Avoid exiting the new REPL when there are non-string candidates for suggestions (gh-131001) (gh-135019)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-06-02 16:58:03 +02:00
Bénédikt Tran
0947773528
[3.14] gh-122153: indicate that Windows does not support socket.{send,recv}_fds (GH-134960) (#135018)
This amends commit e3b6ff19aa.
(cherry picked from commit 128195e12e)

Co-authored-by: GalaxySnail <me@glxys.nl>
2025-06-02 10:44:30 +00:00
Miss Islington (bot)
16d5bdd6e5
[3.14] gh-134449: fix grammar for precision_with_grouping in format description (GH-134608) (#135015)
gh-134449: fix grammar for `precision_with_grouping` in format description (GH-134608)

This amends commit f39a07be47.
(cherry picked from commit 7828d52680)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-06-02 09:51:45 +00:00
Miss Islington (bot)
035c4d6238
[3.14] gh-132983: Minor fixes and clean up for the _zstd module (GH-134930) (GH-134998)
(cherry picked from commit b595237166)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-01 08:46:51 +00:00
Bénédikt Tran
777fd4979c
[3.14] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) (#134961)
OpenSSL and HACL*-based hash functions constructors now support both `data` and `string` parameters.
Previously these constructor functions inconsistently supported sometimes `data` and sometimes `string`,
while the documentation expected `data` to be given in all cases.

(cherry picked from commit c6e63d9d35)
(cherry picked from commit 379d0bc956)
2025-06-01 10:26:56 +02:00
Miss Islington (bot)
5d07d16d45
[3.14] gh-133503: clarify compileall -s/-p docs (GH-134756) (#134997)
gh-133503: clarify `compileall -s/-p` docs (GH-134756)
(cherry picked from commit fe6f8a3619)

Co-authored-by: Rihaan Meher <meherrihaan@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-06-01 08:24:41 +00:00
Miss Islington (bot)
df7247a380
[3.14] gh-134970: Fix exception message in argparse module (GH-134971) (GH-134991)
Fix the "unknown action" exception in argparse.ArgumentParser.add_argument_group()
to correctly replace the action class.
(cherry picked from commit 965c480566)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
2025-06-01 06:21:34 +00:00
Miss Islington (bot)
7c1dfd9c98
[3.14] gh-133489: Remove size restrictions on getrandbits() and randbytes() (GH-133658) (#134964)
gh-133489: Remove size restrictions on getrandbits() and randbytes() (GH-133658)

random.getrandbits() can now generate more that 2**31 bits.
random.randbytes() can now generate more that 256 MiB.
(cherry picked from commit 68784fed78)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-31 20:02:38 -07:00
Miss Islington (bot)
a8708f7320
[3.14] gh-133891: Add missing error check to SET_COUNT macro in _testinternalcapi.c (GH-133892) (#134988)
gh-133891: Add missing error check to `SET_COUNT` macro in `_testinternalcapi.c` (GH-133892)
(cherry picked from commit cebae977a6)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-31 21:57:52 +00:00
Miss Islington (bot)
890607fa05
[3.14] gh-134835: Remove outdated list from howto/urllib2.rst (GH-134844) (#134984)
gh-134835: Remove outdated list from `howto/urllib2.rst` (GH-134844)

🫖
(cherry picked from commit 3704171415)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-05-31 17:55:48 +00:00
Miss Islington (bot)
f734531bbe
[3.14] gh-134160: Improve multi-phase init note on isolation & subinterpreters (GH-134775) (#134932)
gh-134160: Improve multi-phase init note on isolation & subinterpreters (GH-134775)

(cherry picked from commit eb145fabbd)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-31 18:41:07 +01:00
Miss Islington (bot)
d6f356e1ab
[3.14] gh-134954: Hard-cap max file descriptors in subprocess test fd_status (GH-134955) (#134980)
gh-134954: Hard-cap max file descriptors in subprocess test fd_status (GH-134955)

* Hard-cap max file descriptors in subprocess test fd_status

On some systems, `SC_OPEN_MAX` may return a very large value (i.e. 10**30), leading to the subprocess test timing out (or run forever).
Prevent this situation by applying a hard cap on how many file descriptors are checked.

* Fix typo in usage docstring

s/fd_stats/fd_status/
(cherry picked from commit f58873e4b2)

Co-authored-by: Itamar Oren <itamarost@gmail.com>
2025-05-31 14:55:03 +00:00
Miss Islington (bot)
0df99207b3
[3.14] Improve format of InternalDocs/exception_handling.md (GH-134969) (#134975)
Improve format of `InternalDocs/exception_handling.md` (GH-134969)
(cherry picked from commit 5507eff19c)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-31 12:02:20 +00:00
Miss Islington (bot)
aceb5041d2
[3.14] gh-134918: Fix and improve doctest's documentation (GH-134919) (GH-134966)
(cherry picked from commit 3c66e59766)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-31 09:09:00 +00:00
Miss Islington (bot)
2912fcc2e4
[3.14] GH-106235: Clarify parse_known_args documentation by removing "remaining" (GH-126921) (#134913)
GH-106235: Clarify `parse_known_args` documentation by removing "remaining" (GH-126921)
(cherry picked from commit a4251411a9)

Co-authored-by: Savannah Bailey <savannahostrowski@gmail.com>
2025-05-30 13:24:08 -07:00
Miss Islington (bot)
32574d4bc0
gh-134923: Use /GENPROFILE and /USEPROFILE for Windows PGO builds (GH-134924)
(cherry picked from commit 8865b4f95b)

Co-authored-by: Steve Dower <steve.dower@python.org>
2025-05-30 19:04:47 +00:00
Miss Islington (bot)
d45d053267
[3.14] gh-132775: Expand the Capability of Interpreter.call() (gh-134933)
It now supports most callables, full args, and return values.

(cherry picked from commit 52deabe, AKA gh-133484)

Co-authored-by: Eric Snow ericsnowcurrently@gmail.com
2025-05-30 18:28:35 +00:00
Gregory P. Smith
69536093de
[3.14] .gitignore personal Claude Code configs (GH-134942) (#134944)
.gitignore personal Claude Code configs (GH-134942)

https://docs.anthropic.com/en/docs/claude-code/memory

backports 98a5b830d2
2025-05-30 18:26:24 +00:00
Miss Islington (bot)
41fe324d8b
[3.14] gh-134733: Fix documentation for the show_empty option of ast.dump() (GH-134925) (GH-134940)
Optional None values are always omitted.
(cherry picked from commit 1a89991d23)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-30 19:30:13 +03:00
Miss Islington (bot)
ecf11416b6
[3.14] gh-134718: Fix ast.dump() for empty non-default values (GH-134926) (GH-134931)
(cherry picked from commit cc344e8dd0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-30 18:24:59 +03:00
Miss Islington (bot)
f28f9304bf
[3.14] gh-134885: zstd: Use Py_XSETREF (GH-134886) (GH-134922)
(cherry picked from commit 45c6c48afc)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-30 12:50:42 +02:00
Miss Islington (bot)
d7d3e6915f
[3.14] gh-134857: Improve error report for doctests run with unittest (GH-134858) (GH-134903)
Remove doctest module frames from tracebacks and redundant newline
character from a failure message.
(cherry picked from commit cb8a72b301)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-30 13:44:40 +03:00
Miss Islington (bot)
02712fa848
Doc: remove unnecessary section header (GH-134917)
(cherry picked from commit b367e27af9)
2025-05-30 18:13:36 +09:00
Miss Islington (bot)
e0e8f28f27
[3.14] gh-134768: Fix definition of mt_continue_should_break() (GH-134769) (#134916)
gh-134768: Fix definition of `mt_continue_should_break()` (GH-134769)

In 121ed71f4e, mt_continue_should_break
was changed to be guarded by `Py_DEBUG`, but it's used in `compress_mt_continue_lock_held`
with just `assert`, so it needs to be available when `NDEBUG` is undefined
too.

`Py_DEBUG` implies `NDEBUG` is undefined, so we can check just that.
(cherry picked from commit 2f2bee2111)


Fixes: 121ed71f4e

Co-authored-by: Sam James <sam@gentoo.org>
2025-05-30 05:08:43 +00:00
Miss Islington (bot)
370f91b946
[3.14] gh-134906: Document CompressionParameter.content_size_flag (GH-134907) (#134915)
gh-134906: Document CompressionParameter.content_size_flag (GH-134907)

* Document CompressionParameter.content_size_flag
(cherry picked from commit 5f60d0fccc)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-05-30 04:43:33 +00:00
Miss Islington (bot)
4927596c49
[3.14] ast docs: Fix description of ast.Constant (GH-134741) (#134911)
Contrary to the current docs, ast.Constant will never hold containers
such as frozenset or tuple; the Python parser only emits it for simple
literals.

For precision, add the exact list of types that may be contained in an
ast.Constant.
(cherry picked from commit 381020d41f)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-30 04:17:18 +00:00
Miss Islington (bot)
9c2e0febb4
[3.14] gh-132775: Fix _PyFunctIon_VerifyStateless() (gh-134901)
gh-132775: Fix _PyFunctIon_VerifyStateless() ()

The problem we're fixing here is that we were using PyDict_Size() on "defaults",
which it is actually a tuple.  We're also adding some explicit type checks.

This is a follow-up to gh-133221/gh-133528.

(cherry picked from commit dafd14146f, AKA gh-134900)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-05-29 20:55:42 +00:00
Miss Islington (bot)
4670dddbf6
[3.14] GH-133912: Fix PyObject_GenericSetDict to handle inline values (GH-134725) (#134859) 2025-05-29 11:19:58 -07:00
Miss Islington (bot)
2d40dd01fa
[3.14] gh-133260: Remove claim that PyUnicode_InternFromString immortalizes (GH-134213) (GH-134883)
(cherry picked from commit 4109a9c6b3)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-05-29 13:43:27 +00:00
Miss Islington (bot)
da4f37596f
[3.14] gh-69011: clarify & deduplicate ctypes.create_*_buffer docs (GH-132858) (GH-134881)
This adds a warning about the possibly-missing NUL terminator, but in a way
that doesn't make it sound like a bug/wart.
(cherry picked from commit b783e1791b)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-05-29 13:23:19 +00:00
Miss Islington (bot)
7dc4496655
[3.14] gh-134262: Add retries to generate_sbom.py (GH-134460)
(cherry picked from commit 0c5a8b0b55)

Includes fix for off-by-one error from GH-134867
(cherry-picked from commit e64395e8eb)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Semyon Moroz <donbarbos@proton.me>
2025-05-28 23:52:31 +00:00
Miss Islington (bot)
34b451532b
[3.14] gh-134262: Add retries to downloads in PCbuild\get_external.py (GH-134865)
(cherry picked from commit e9d845b41d)

Includes fix for off-by-one error from GH-134867
(cherry-picked from commit e64395e8eb)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-05-28 23:47:26 +00:00
Miss Islington (bot)
52bae918c3
[3.14] gh-108885: Imporove tests for doctest (GH-134832) (GH-134855)
Test the error and failure report in more detail.
(cherry picked from commit f6324bc7ee)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-28 17:41:07 +00:00
Miss Islington (bot)
381144f043
[3.14] GH-134848: Use a set to store `AuditEvents.sources` (GH-134849) (#134853)
GH-134848: Use a set to store ``AuditEvents.sources`` (GH-134849)
(cherry picked from commit b265a7ddeb)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-28 16:37:57 +00:00
Miss Islington (bot)
4841201666
[3.14] gh-132983: Convert dict_content to take Py_buffer in `ZstdDict()` (GH-133924) (#134723)
gh-132983: Convert dict_content to take Py_buffer in ``ZstdDict()`` (GH-133924)
(cherry picked from commit f2ce4bbdfd)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-28 17:25:35 +01:00
Miss Islington (bot)
117bb29f6b
[3.14] gh-132983: Split `_zstd_set_c_parameters` (GH-133921) (#134838)
gh-132983: Split ``_zstd_set_c_parameters`` (GH-133921)
(cherry picked from commit 11f7a939de)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-28 17:25:06 +01:00
Miss Islington (bot)
072d03352c
[3.14] gh-133711: Fix test_readline.test_nonascii() for UTF-8 Mode (GH-134841) (#134851)
gh-133711: Fix test_readline.test_nonascii() for UTF-8 Mode (GH-134841)

Skip the test if the Python UTF-8 Mode is enabled and the LC_CTYPE
encoding is not UTF-8.
(cherry picked from commit 4635115c3f)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-05-28 16:10:37 +00:00
Miss Islington (bot)
24404494fb
[3.14] gh-128840: Fix parsing long IPv6 addresses with embedded IPv4 address (GH-134836) (#134845)
gh-128840: Fix parsing long IPv6 addresses with embedded IPv4 address (GH-134836)
(cherry picked from commit d83576bf48)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-28 15:50:40 +00:00
Miss Islington (bot)
afb5221b3d
[3.14] gh-133711: Fix test_regrtest for PYTHONUTF8=1 (GH-134839) (#134842)
gh-133711: Fix test_regrtest for PYTHONUTF8=1 (GH-134839)

Use "backslashreplace" error handler to decode stdout and stderr.
Example:

    vstinner@WIN C:\victor\python\main\build\test_python_worker_8360\x91>
    "C:\victor\python\main\PCbuild\amd64\python_d.exe"  -m test
    --fast-ci --slow-ci --testdir
    C:\Users\vstinner\AppData\Local\Temp\tmp0t59e8da
    test_regrtest_noop1 test_regrtest_noop2 test_regrtest_noop3
    test_regrtest_noop4

Notice the "\x91" byte at the end of the first line: it's the
non-ASCII U+00E6 character encoded to the OEM cp437 code page.
(cherry picked from commit 91618278e7)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-05-28 15:48:03 +00:00
Miss Islington (bot)
7515384974
[3.14] gh-134817: Document [Timed]RotatingFileHandler shouldRollover method (GH-134818) (GH-134823)
(cherry picked from commit 7be5916f6d)
2025-05-28 12:32:59 +00:00
Miss Islington (bot)
998cedb9bc
[3.14] gh-134160: Block multiple module initialization (GH-134773) (#134827)
gh-134160: Block multiple module initialization (GH-134773)
(cherry picked from commit 469a56470b)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-28 07:58:49 +00:00
Miss Islington (bot)
2194729f3a
[3.14] Update outdated statement from math about C standard (GH-134621) (#134825)
Update outdated statement from `math` about C standard (GH-134621)
(cherry picked from commit 21672b694b)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-05-28 07:36:40 +00:00
Miss Islington (bot)
0aa0b9b05f
[3.14] Fix typing.TYPE_CHECKING docs to reflect PEP 649. (GH-134813) (#134822)
Fix typing.TYPE_CHECKING docs to reflect PEP 649. (GH-134813)

typing.TYPE_CHECKING should no longer steer users towards
manual or automatic stringization (and PEP 563); PEP 649
makes all that unnecessary.
(cherry picked from commit d7256ae4d7)

Co-authored-by: larryhastings <larry@hastings.org>
2025-05-27 23:15:17 -07:00
Miss Islington (bot)
3681e3a831
[3.14] gh-134679: Fix assertion failure in QSBR (gh-134811) (gh-134814)
This is the same underlying bug as gh-130519. The destructor may call
arbitrary code, changing the `tstate->qsbr pointer` and invalidating the
old `struct _qsbr_thread_state`.
(cherry picked from commit a4d37f88b6)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-05-27 20:46:02 +00:00
Chris Eibl
6c74700dd8
[3.14] gh-134774: Remove additional Py_DEBUG definition (GH-134791) 2025-05-27 20:08:41 +01:00
Miss Islington (bot)
0ea41f8464
[3.14] gh-134789: Document del s[i] operation for mutable sequences (GH-134804) (#134808)
gh-134789: Document del s[i] operation for mutable sequences (GH-134804)

[main] Update stdtypes.rst

- Added explicit mention of `del s[i]` (item deletion by index) to the Mutable Sequence Types section.
- Clarified that this operation removes the item at the specified index from the sequence.
- Addresses issue GH-134789.
(cherry picked from commit 967f361993)

Co-authored-by: Rishabh Singh <67859818+rishabh11336@users.noreply.github.com>
2025-05-27 18:53:52 +00:00
Miss Islington (bot)
cc81b63a75
[3.14] gh-132917: fix data race on last_mem in free-threading gc (GH-134692) (#134802)
gh-132917: fix data race on `last_mem` in free-threading gc  (GH-134692)
(cherry picked from commit ac539e7e0d)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-27 18:00:19 +00:00
Victor Stinner
8a6a6f39c8
[3.14] gh-134744: Fix fcntl error handling (#134748) (#134795)
gh-134744: Fix fcntl error handling (#134748)

Fix also reference leak on buffer overflow.

(cherry picked from commit 9300a596d3)
2025-05-27 16:13:20 +00:00
Miss Islington (bot)
6493395f4b
[3.14] gh-132775: Always Set __builtins__ In _PyFunction_FromXIData() (gh-134794)
This is a small follow-up to gh-133481.  There's a corner case
in the behavior of PyImport_ImportModuleAttrString(), where
it expects __builtins__ to be set if __globals__ is set.

(cherry picked from commit 9b5e80000, AKA gh-134758)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-05-27 16:07:44 +00:00
Miss Islington (bot)
a1b6252c88
[3.14] gh-133678: Document C API third party tools (GH-134526) (#134793)
gh-133678: Document C API third party tools (GH-134526)
(cherry picked from commit c3c88064f5)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Steve Dower <steve.dower@python.org>
2025-05-27 15:45:08 +00:00
Mark Shannon
00122c8b2a
[3.14] GH-128161: Remove redundant GET_ITER from list comprehension code (GH-134778) 2025-05-27 12:29:48 +01:00
Miss Islington (bot)
266b541cc6
[3.14] gh-62824: Adjust test_alias_modules_exist test to use imports instead of file checks (GH-134777) (GH-134781)
gh-62824: Adjust test_alias_modules_exist test to use imports instead of file checks (GH-134777)
(cherry picked from commit 8704d6b391)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2025-05-27 11:28:30 +02:00
Miss Islington (bot)
58549cfd49
[3.14] gh-134210: handle signals in _curses.window.getch (GH-134326) (#134783)
gh-134210: handle signals in `_curses.window.getch` (GH-134326)
(cherry picked from commit 51762b6cad)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-05-27 09:16:50 +00:00
Miss Islington (bot)
452d098c0b
[3.14] gh-134752: Improve speed of test_tokenize.StringPrefixTest.test_prefixes. (GH-134766) (#134782)
gh-134752: Improve speed of test_tokenize.StringPrefixTest.test_prefixes. (GH-134766)
(cherry picked from commit 579686d9fb)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2025-05-27 09:16:23 +00:00
Miss Islington (bot)
0f93b2f862
[3.14] gh-134664: document cleanup_socket parameter in asyncio.start_unix_server (GH-134750) (#134779)
gh-134664: document `cleanup_socket` parameter in `asyncio.start_unix_server` (GH-134750)
(cherry picked from commit 92ea1eb38f)

Co-authored-by: Shamil <ashm.tech@proton.me>
2025-05-27 14:04:43 +05:30
Miss Islington (bot)
b6e624a3fc
[3.14] gh-134160: Use multi-phase init in documentation examples (GH-134296) (#134753)
gh-134160: Use multi-phase init in documentation examples (GH-134296)
(cherry picked from commit 96905bdd27)

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-26 21:50:18 +00:00
Eric Snow
e86efabaee
[3.14] gh-132775: Unrevert "Use _PyCode GetScriptXIData()" (gh-134736)
This reverts commit 7476f90af2, AKA gh-134600.

This effectively unreverts commit bbf8048c0f (gh-134515).
2025-05-26 19:41:14 +00:00
Miss Islington (bot)
74f5667bd9
[3.14] gh-134675: Add t-string prefixes to tokenizer module, lexical analysis doc, and add a test to make sure we catch this error in the future. (GH-134734) (#134739)
gh-134675: Add t-string prefixes to tokenizer module, lexical analysis doc, and add a test to make sure we catch this error in the future. (GH-134734)

* Add t-string prefixes to _all_string_prefixes, and add a test to make sure we catch this error in the future.

* Update lexical analysis docs for t-string prefixes.
(cherry picked from commit 08c78e02fa)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2025-05-26 15:24:24 -04:00
Miss Islington (bot)
c6cc28299e
[3.14] gh-134557: Suppress immortalization in _PyCode_GetScriptXIData under free-threading (gh134738)
Disable immortalization around Py_CompileString*().

The same approach as 332356b that fixed the refleaks in compile() and eval().

E: 09e72cf can pass test_capi, test_sys and test__interpchannels with this patch for me.

(cherry picked from commit c60f39ada6, AKA gh-134686)

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
2025-05-26 13:14:58 -06:00
Hugo van Kemenade
bc3d892113 Merge branch '3.14' of https://github.com/python/cpython into 3.14 2025-05-26 21:51:15 +03:00
Miss Islington (bot)
8c699015c5
[3.14] gh-134637: Fix performance regression in calling ctypes function pointer in free threading. (GH-134702) (#134742)
gh-134637: Fix performance regression in calling `ctypes` function pointer in `free threading`. (GH-134702)

Fix performance regression in calling `ctypes` function pointer in `free threading`.
(cherry picked from commit 3c0525126e)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-26 18:51:13 +00:00
Hugo van Kemenade
cde768cd63 Post 3.14.0b2 2025-05-26 21:50:01 +03:00
Miss Islington (bot)
b187e9403c
[3.14] Add CODEOWNERS and YAML to end-of-file-fixer and trailing-whitespace (GH-134730) (#134737) 2025-05-26 18:08:37 +00:00
Miss Islington (bot)
9ddc7c548d
[3.14] gh-119180: Updates to PEP 649/749 docs (GH-134640) (#134731)
gh-119180: Updates to PEP 649/749 docs (GH-134640)

- Mention (again) that `type.__annotations__` is unsafe. It is now safe
  when using only classes defined under PEP 649 semantics, but not with
  classes defined using `from __future__ import annotations`.
- Mention that annotations on instances no longer work. There was already
  an issue about this.
- Mention the general changes in the "Porting to Python 3.14" section.
- `annotationlib` was proposed by PEP-749, not PEP-649.
(cherry picked from commit 7291eaba8b)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2025-05-26 15:40:43 +00:00
Miss Islington (bot)
2a089244f0
[3.14] gh-134693: Fix [-Wmaybe-uninitialized] warning in _remote_debugging_module.c (GH-134694) (#134726)
gh-134693: Fix `[-Wmaybe-uninitialized]` warning in `_remote_debugging_module.c` (GH-134694)
(cherry picked from commit 806107d7a2)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-26 15:32:52 +00:00
Miss Islington (bot)
aded785b8c
[3.14] gh-91048: Add better error messages for remote debugging for CI builds (GH-134682) (#134719) 2025-05-26 15:04:36 +00:00
Miss Islington (bot)
01ccc824ca
[3.14] Add CODEOWNERS for remote debugging (GH-134720) (#134721) 2025-05-26 15:46:51 +01:00
Hugo van Kemenade
12d3f883ae Python 3.14.0b2 2025-05-26 16:26:47 +03:00
Miss Islington (bot)
6c917cb11c
[3.14] gh-91048: Correct Apple platform includes for iOS. (GH-134712) (#134714)
Correct Apple platform includes for iOS.
(cherry picked from commit 965662ee4a)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2025-05-26 13:10:37 +00:00
Miss Islington (bot)
da3d55403a
[3.14] gh-132710: add missing NEWS entry for GH-134697 (GH-134705) (#134707)
gh-132710: add missing NEWS entry for GH-134697 (GH-134705)
(cherry picked from commit 9eb84d83e0)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-05-26 12:46:29 +02:00
Bénédikt Tran
072f50fc12
[3.14] gh-132710: only use stable _uuid.generate_time_safe() to deduce MAC address (GH-132901) (#134697)
(cherry picked from commit 3bffada467)
2025-05-26 10:45:36 +00:00
Miss Islington (bot)
c8379c7edf
[3.14] gh-134559: Add versionadded for `object.__replace__()` (GH-134672) (#134699)
gh-134559: Add versionadded for ``object.__replace__()`` (GH-134672)
(cherry picked from commit 71290a6fbe)

Co-authored-by: tmlnv <108088921+tmlnv@users.noreply.github.com>
2025-05-26 10:29:51 +00:00
Bénédikt Tran
ed52549c37
[3.14] gh-134208: remove dead AC directives for _curses.window.{chgat,getstr,instr} (GH-134325) (#134701)
(cherry picked from commit 29e8115964)
2025-05-26 10:09:02 +00:00
Miss Islington (bot)
dc441efbd0
[3.14] gh-132493: Remove __annotations__ usage in inspect._signature_is_functionlike (GH-133415) (#133796)
gh-132493: Remove __annotations__ usage in inspect._signature_is_functionlike (GH-133415)

This check is potentially problematic because it could force evaluation of
annotations unnecessarily. This doesn't trigger for builtin objects (functions,
classes, or modules) with annotations, but it could trigger for third-party objects.

The check was not particularly useful anyway, because it succeeds if ``__annotations__``
is a dict or None, so the only thing this did was guard against objects that have an
``__annotations__`` attribute that is of some other type. That doesn't seem particularly
useful, so I just removed the check.
(cherry picked from commit cb6596c6aa)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-26 08:22:14 +00:00
Miss Islington (bot)
1ce68f6297
[3.14] gh-134152: Fix UnboundLocalError in email._header_value_parser _get_ptext_to_endchars (GH-134233) (#134678)
Co-authored-by: R. David Murray <rdmurray@bitdance.com>
2025-05-26 11:02:52 +03:00
Miss Islington (bot)
ebfd18b3f0
[3.14] gh-127833: lexical analysis: Improve section on Names (GH-131474) (#134423)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
2025-05-26 11:00:17 +03:00
Miss Islington (bot)
16187b58bf
[3.14] gh-132876: workaround broken ldexp() on Windows 10 (GH-133135) (#134684)
gh-132876: workaround broken ldexp() on Windows 10 (GH-133135)

* gh-132876: workaround broken ldexp() on Windows 10

ldexp() fails to round subnormal results before Windows 11,
so hide their bug.
(cherry picked from commit cf8941c603)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Tim Peters <tim.peters@gmail.com>
2025-05-25 22:23:45 -05:00
Miss Islington (bot)
7216f7b59c
[3.14] gh-69605: Disable PyREPL module autocomplete fallback on regular completion (gh-134181) (gh-134680)
(cherry picked from commit 0e3bc962c6)

Co-authored-by: Loïc Simon <loic.simon@napta.io>
2025-05-25 23:33:02 +00:00
Pablo Galindo Salgado
1822f33b1a
[3.14] gh-91048: Refactor and optimize remote debugging module (#134652) (#134673)
gh-91048: Refactor and optimize remote debugging module (#134652)

Completely refactor Modules/_remote_debugging_module.c with improved
code organization, replacing scattered reference counting and error
handling with centralized goto error paths. This cleanup improves
maintainability and reduces code duplication throughout the module while
preserving the same external API.

Implement memory page caching optimization in Python/remote_debug.h to
avoid repeated reads of the same memory regions during debugging
operations. The cache stores previously read memory pages and reuses
them for subsequent reads, significantly reducing system calls and
improving performance.

Add code object caching mechanism with a new code_object_generation
field in the interpreter state that tracks when code object caches need
invalidation. This allows efficient reuse of parsed code object metadata
and eliminates redundant processing of the same code objects across
debugging sessions.

Optimize memory operations by replacing multiple individual structure
copies with single bulk reads for the same data structures. This reduces
the number of memory operations and system calls required to gather
debugging information from the target process.

Update Makefile.pre.in to include Python/remote_debug.h in the headers
list, ensuring that changes to the remote debugging header force proper
recompilation of dependent modules and maintain build consistency across
the codebase.

Also, make the module compatible with the free threading build as an extra :)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>

(cherry picked from commit 42b25ad4d3)
2025-05-25 22:10:20 +00:00
Miss Islington (bot)
f68f05cbe3
[3.14] gh-115999: Add PyCodeObject.co_tlbc to the debug offsets (GH-134286) (#134348)
gh-115999: Add PyCodeObject.co_tlbc to the debug offsets (GH-134286)
(cherry picked from commit dd7f113057)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-05-25 21:16:10 +00:00
Miss Islington (bot)
f5a8bfa335
[3.14] Fix sphinx-lint warnings (default-role used). (GH-134647) (#134670)
Fix sphinx-lint warnings (default-role used). (GH-134647)
(cherry picked from commit 24a47155d2)

Co-authored-by: Julien Palard <julien@palard.fr>
2025-05-25 19:29:04 +00:00
Miss Islington (bot)
6917fbf98f
[3.14] GH-130328: Fix WindowsConsoleGetEventTests after gh-133728 (gh-134660) (gh-134666)
(cherry picked from commit 1000283694)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-05-25 18:43:07 +00:00
Miss Islington (bot)
9c6d2dbe26
[3.14] gh-133960: Improve typing.evaluate_forward_ref (GH-133961) (#134663)
gh-133960: Improve typing.evaluate_forward_ref (GH-133961)

As explained in GH-133960, this removes most of the behavior differences with ForwardRef.evaluate.
The remaining difference is about recursive evaluation of forwardrefs; this is practically useful
in cases where an annotation refers to a type alias that itself is string-valued.

This also improves several edge cases that were previously not handled optimally. For example,
the function now takes advantage of the partial evaluation behavior of ForwardRef.evaluate() to
evaluate more ForwardRefs in the FORWARDREF format.

This also fixes GH-133959 as a side effect, because the buggy behavior in GH-133959 derives from
evaluate_forward_ref().
(cherry picked from commit 57fef27cfc)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-25 17:52:04 +00:00
Miss Islington (bot)
8c6653428f
[3.14] annotationlib docs: note that ForwardRef.evaluate eventually defaults to empty globals (GH-134661) (#134662)
annotationlib docs: note that ForwardRef.evaluate eventually defaults to empty globals (GH-134661)
(cherry picked from commit b51b08a0a5)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-25 10:39:44 -07:00
Miss Islington (bot)
c61fd7c0f2
[3.14] gh-134582: Fix t-strings untokenize() roundtrip removing space between braces (GH-134603) (#134659)
gh-134582: Fix t-strings untokenize() roundtrip removing space between braces (GH-134603)
(cherry picked from commit 52509cc94b)

Co-authored-by: Loïc Simon <loic.pano@gmail.com>
2025-05-25 16:48:19 +00:00
Miss Islington (bot)
cbf4ccf1d0
[3.14] gh-133684: Fix get_annotations() where PEP 563 is involved (GH-133795) (#134656)
gh-133684: Fix get_annotations() where PEP 563 is involved (GH-133795)
(cherry picked from commit 3e562b3942)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-25 16:05:19 +00:00
Miss Islington (bot)
d82d445b18
[3.14] gh-133778: Fix setting __annotations__ under PEP 563 (GH-133794) (#134655)
gh-133778: Fix setting `__annotations__` under PEP 563 (GH-133794)
(cherry picked from commit 4443110c34)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-25 16:04:22 +00:00
Miss Islington (bot)
93aee568c0
[3.14] GH-130328: Speedup pasting in legacy console on Windows (gh-133728) (#134653)
(cherry picked from commit 91b48868a8)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-05-25 15:54:28 +02:00
Miss Islington (bot)
80d70defc2
[3.14] gh-134578: Mark more slow tests (GH-134579) (GH-134590)
(cherry picked from commit 77eade39f9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-24 15:06:54 +00:00
Bénédikt Tran
81f099375e
[3.14] gh-134168: fix http.server CLI support for IPv6 and --directory when serving over HTTPS (GH-134169) (#134630)
[3.14] gh-134168: fix `http.server` CLI support for IPv6 and `--directory` when serving over HTTPS (GH-134169)
(cherry picked from commit 2fd09b0110)

Co-authored-by: ggqlq <124190229+ggqlq@users.noreply.github.com>
2025-05-24 15:34:31 +02:00
Miss Islington (bot)
162e3f3511
[3.14] gh-134595: Update HOWTO to reflect change in CIBW option (GH-134598) (#134622)
Co-authored-by: Jasper Wong <111284156+3willows@users.noreply.github.com>
2025-05-24 07:21:34 +00:00
Miss Islington (bot)
00fd5440f0
[3.14] gh-80334: fix multiprocessing.freeze_support for other spawn platforms (GH-134462) (#134619)
gh-80334: fix multiprocessing.freeze_support for other spawn platforms (GH-134462)

Doc/library/multiprocessing.rst: freeze_support: Change to specify spawn method instead of platform
Have multiprocessing.freeze_support() enable on spawn, not just win32.

---------
(cherry picked from commit 80284b5c5e)

Co-authored-by: Eddy Mulyono <eddymul@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-05-24 04:16:02 +00:00
Miss Islington (bot)
de9444ef94
[3.14] gh-134546: ensure remote pdb script is readable (GH-134552) (#134616)
gh-134546: ensure remote pdb script is readable (GH-134552)
(cherry picked from commit 74a9c60f3e)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
2025-05-24 03:34:17 +00:00
Miss Islington (bot)
576177d4b3
[3.14] gh-128840: Limit the number of parts in IPv6 address parsing (GH-128841) (#134610)
gh-128840: Limit the number of parts in IPv6 address parsing (GH-128841)

GH-128840: Limit the number of parts in IPv6 address parsing
Limit length of IP address string to 39

---------
(cherry picked from commit 47f1161d3a)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-05-23 20:33:35 -07:00
Miss Islington (bot)
38a38243b7
[3.14] gh-132983: Make _zstd C code PEP 7 compliant (GH-134605) (#134609)
gh-132983: Make _zstd C code PEP 7 compliant (GH-134605)

Make _zstd C code PEP 7 compliant
(cherry picked from commit 973b8f69d3)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-05-24 02:28:40 +00:00
Miss Islington (bot)
f301af627e
[3.14] gh-132983: Slightly tweak error messages for _zstd compressor/decompressor options dict (GH-134601) (#134602)
gh-132983: Slightly tweak error messages for _zstd compressor/decompressor options dict (GH-134601)

Slightly tweak error messages for options dict
(cherry picked from commit f478331f98)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-05-23 22:18:08 +00:00
Eric Snow
7476f90af2
[3.14] gh-134557: Revert "[3.14] gh-132775: Use _PyCode GetScriptXIData()" (gh-134600)
This reverts commit bbf8048c0f, AKA gh-134515.

We are reverting due to refleaks on free-threaded builds.
2025-05-23 20:11:38 +00:00
Miss Islington (bot)
09a34f1f65
[3.14] gh-134381: Fix RuntimeError when starting not-yet started Thread after fork (gh-134514) (gh-134596)
(cherry picked from commit 9a2346df86)

Co-authored-by: Jiucheng(Oliver) <git.jiucheng@gmail.com>
2025-05-23 19:49:13 +00:00
Miss Islington (bot)
6e60586175
[3.14] gh-133454: Reduce the number of threads in test_racing_getbuf_and_releasebuf (GH-133458) (GH-134589)
The original reproducer only used 10 threads.
(cherry picked from commit fc0c9c2412)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-23 17:23:47 +00:00
Miss Islington (bot)
adb0794692
[3.14] Further improves Advanced installation docs for PyManager (GH-134541) (GH-134576)
Further improves Advanced installation docs for PyManager (GH-134541)
(cherry picked from commit 99a9ab1c64)

Co-authored-by: Steve Dower <steve.dower@python.org>
2025-05-23 10:23:06 +00:00
Miss Islington (bot)
81675941fb
[3.14] gh-133885: Use locks instead of critical sections for _zstd (gh-134289) (gh-134560)
Move from using critical sections to locks for the (de)compression methods.
Since the methods allow other threads to run, we should use a lock rather
than a critical section.
(cherry picked from commit 8dbc119719)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-05-23 10:00:38 +00:00
Miss Islington (bot)
896b745a7a
[3.14] gh-106318: Add example for str.count() (GH-134519) (#134574)
Co-authored-by: Blaise Pabon <blaise@gmail.com>
2025-05-23 09:53:16 +00:00
Miss Islington (bot)
7efe67ae35
[3.14] gh-106318: Add example for str.center() (GH-134518) (#134571)
Co-authored-by: Blaise Pabon <blaise@gmail.com>
2025-05-23 09:51:17 +00:00
Miss Islington (bot)
73967c4c01
[3.14] gh-134451: Converted asyncio.tools.CycleFoundException from dataclass to a regular exception type. (GH-134513) (#134564)
gh-134451: Converted `asyncio.tools.CycleFoundException` from dataclass to a regular exception type. (GH-134513)
(cherry picked from commit f9324cb3cb)

Co-authored-by: Evgeny Demchenko <v1mpire@icloud.com>
2025-05-23 05:40:56 +00:00
Miss Islington (bot)
c67eb41a3b
[3.14] gh-114177: avoid calling connection lost callbacks when loop is already closed in asyncio subprocess (GH-134508) (#134561)
gh-114177: avoid calling connection lost callbacks when loop is already closed in asyncio subprocess (GH-134508)
(cherry picked from commit 5804ee7b46)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-23 04:58:51 +00:00
Miss Islington (bot)
1cdbb33771
[3.14] gh-128307: Update docs for asyncio.create_task, TaskGroup.create_task, asyncio.create_task (GH-134202) (#134553)
gh-128307: Update docs for asyncio.create_task, TaskGroup.create_task, asyncio.create_task (GH-134202)
(cherry picked from commit a3d0306ca0)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2025-05-23 09:36:19 +05:30
Miss Islington (bot)
ee3a0efc9d
[3.14] Docs: fix link in free-threading-python.rst (GH-134548) (#134555) 2025-05-23 00:42:48 +00:00
Brett Cannon
8f4bf1538d
[3.14] GH-131769: fix detecting a pydebug build of the build Python when building for WASI (GH-133219) 2025-05-22 22:07:21 +00:00
Miss Islington (bot)
15e26eebf7
[3.14] GH-130397: remove special-casing of C stack depth for WASI (GH-134469) (GH-134547)
GH-130397: remove special-casing of C stack depth for WASI (GH-134469)

Removed special-casing for WASI when setting C stack depth limits. Since WASI has its own C stack checking this isn't a security risk.

Also disabled some tests that stopped passing. They all happened to have already been disabled under Emscripten.
(cherry picked from commit ad42dc1909)

Co-authored-by: Brett Cannon <brett@python.org>
2025-05-22 14:42:23 -07:00
Miss Islington (bot)
06a3a85f15
[3.14] Avoid __file__ in hashlib example (GH-134540) (#134549)
Avoid `__file__` in `hashlib` example (GH-134540)
(cherry picked from commit 9b292ff022)

Co-authored-by: Josh Cannon <joshdcannon@gmail.com>
2025-05-22 21:37:52 +00:00
Miss Islington (bot)
37c2c8c9d8
[3.14] Docs: Add note to tutorial clarifying scope (GH-134534) (#134536)
Docs: Add note to tutorial clarifying scope (GH-134534)

* Add note to tutorial

* Update formatting
(cherry picked from commit 742d5b5c5d)

Co-authored-by: Kattni <kattni@kattni.com>
2025-05-22 18:32:49 +00:00
Miss Islington (bot)
7480e50217
[3.14] gh-132775: Fix Recently Introduced Warnings (gh-134532)
(cherry picked from commit ac06b534ee, AKA gh-134530)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-05-22 17:49:05 +00:00
Miss Islington (bot)
04e2dd6513
[3.14] gh-132775: Make _PyXI_session Opaque (gh-134522)
This is mostly a refactor to clean things up a bit, most notably the "XI namespace" code.

Making the session opaque requires adding the following internal-only functions:

* _PyXI_NewSession()
* _PyXI_FreeSession()
* _PyXI_GetMainNamespace()

(cherry picked from commit 4a4ac3ab4d, gh-134452)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-05-22 17:12:52 +00:00
Miss Islington (bot)
068d570be8
[3.14] gh-134322: Fix repr(threading.RLock) (GH-134389) (#134528)
gh-134322: Fix `repr(threading.RLock)` (GH-134389)

Fix the `__repr__` value of `threading.RLock` from `_thread` module, when just created.
(cherry picked from commit fade146cfb)

Co-authored-by: Duprat <yduprat@gmail.com>
2025-05-22 17:12:21 +00:00
Miss Islington (bot)
bbf8048c0f
[3.14] gh-132775: Use _PyCode GetScriptXIData() (gh-134515)
(cherry picked from commit 09e72cf091, AKA gh-134511)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-05-22 15:07:11 +00:00
Miss Islington (bot)
c31b25c705
[3.14] gh-133740: Fix locale.nl_langinfo(ALT_DIGITS) (GH-134468) (#134512)
gh-133740: Fix locale.nl_langinfo(ALT_DIGITS) (GH-134468)

Set the LC_CTYPE locale to the LC_TIME locale even if
nl_langinfo(ALT_DIGITS) result is ASCII. The result is a list
separated by NUL characters and the code only checks the first list
item which can be ASCII whereas following items are non-ASCII.

Fix test__locale for the uk_UA locale on RHEL 7.
(cherry picked from commit 899c7dc283)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-22 14:31:26 +00:00
Miss Islington (bot)
ced49a196f
[3.14] gh-134323: Fix the new threading.RLock.locked method (GH-134368) (#134510)
gh-134323: Fix the new `threading.RLock.locked` method (GH-134368)
(cherry picked from commit 3effede97c)

Co-authored-by: Duprat <yduprat@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-22 14:14:53 +00:00
Miss Islington (bot)
7e7391810f
[3.14] gh-134370: Added clarification on instance annotations (GH-134387) (#134509)
gh-134370: Added clarification on instance annotations (GH-134387)

Instances of classes cannot have annotations,
however sometimes they will erroneously have the
__annotations__ attribute
(cherry picked from commit bd4046f4f8)

Co-authored-by: Alex Kautz <alex@takemobi.com>
2025-05-22 13:52:37 +00:00
Miss Islington (bot)
85c8c0a003
[3.14] gh-132775: Use _PyObject_GetXIData (With Fallback) (gh-134507)
This change includes some semi-related refactoring of queues and channels.

(cherry picked from commit d0eedfa10e, gh-134440)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-05-22 07:21:05 -06:00
Miss Islington (bot)
59cb829eb9
[3.14] gh-134455: Fix build-details.json to use the `c_api.headers` key (GH-134456) (#134504)
Co-authored-by: Michał Górny <mgorny@gentoo.org>
Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
2025-05-22 15:26:26 +03:00
Miss Islington (bot)
db98e0bb12
[3.14] gh-71339: Use new assertion methods in tests (GH-129046) (GH-134498)
(cherry picked from commit 2602d8ae98)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-22 10:42:50 +00:00
Miss Islington (bot)
d5f7e80d44
[3.14] Consistent sentence case in docs template files (GH-134412) (#134495)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-05-22 12:57:42 +03:00
Miss Islington (bot)
64c265a638
[3.14] gh-131357: Add some extra tests for empty bytes and bytearray (GH-134458) (#134489)
gh-131357: Add some extra tests for empty bytes and bytearray (GH-134458)
(cherry picked from commit 7309eb60c0)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
2025-05-22 08:34:46 +00:00
Miss Islington (bot)
9cef5c1f65
[3.14] Add notes on nogil & reinitialization to the Opt-Out section in Module Isolation HOWTO (GH-134141) (GH-134492)
Add notes on nogil & reinitialization to the Opt-Out section in Module Isolation HOWTO (GH-134141)
(cherry picked from commit 1f0a294e8c)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-05-22 10:20:11 +02:00
Miss Islington (bot)
03a211290e
[3.14] gh-134309: Add `github.actor` to the GitHub Actions concurrency key (GH-134310) (#134484)
gh-134309: Add ``github.actor`` to the GitHub Actions concurrency key (GH-134310)

When inexperienced users create a PR from their default branch, all of the concurrency keys
collide as there is no namespacing. This becomes an issue at events with many new contributors,
where workflow runs are cancelled on other pull requests.
Disambiguate by adding the username of the relevant 'actor' to the concurrency key.
(cherry picked from commit 979d81a179)





Authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>

Co-authored-by: Kira <coldcaption@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Sviatoslav Sydorenko <sviat@redhat.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2025-05-22 04:15:06 +00:00
Miss Islington (bot)
4e9248f685
[3.14] gh-134062: Fix hash collisions in IPv4Network and IPv6Network (GH-134063) (#134476)
gh-134062: Fix hash collisions in IPv4Network and IPv6Network (GH-134063)
(cherry picked from commit f3fc0c16e0)


gh-134062: Fix hash collisions in IPv4Network and IPv6Network
gh-134062: Add hash collision regression test

Co-authored-by: Mike Salvatore <mike.s.salvatore@gmail.com>
2025-05-22 03:14:10 +00:00
Miss Islington (bot)
998991513b
[3.14] gh-127960 Fix the REPL to set the correct namespace by setting the correct __main__ module (gh-134275) (gh-134473)
The `__main__` module imported in the `_pyrepl` module points to the `_pyrepl` module itself when the interpreter was launched without `-m` option and didn't execute a module,
while it's an unexpected behavior that `__main__` can be `_pyrepl` and relative imports such as `from . import *` works based on the `_pyrepl` module.
(cherry picked from commit b1b8962443)

Co-authored-by: Yuichiro Tachibana (Tsuchiya) <t.yic.yt@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-22 03:33:35 +02:00
Miss Islington (bot)
93ab55bd70
[3.14] gh-132775: Use _PyFunction_VerifyStateless() and _PyCode_VerifyStateless() (gh-134465)
(cherry picked from commit a66bae8bb, AKA gh-134439)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-05-21 20:43:29 +00:00
Miss Islington (bot)
11d77d2112
[3.14] gh-132983: Fix refleak in zstd dictionary functions (gh-134463)
(cherry picked from commit fb68776591, AKA gh-134459)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-05-21 19:35:31 +00:00
Miss Islington (bot)
f8ced87fa3
[3.14] gh-132124: improve safety nets for creating AF_UNIX socket files (GH-134085) (#134447)
gh-132124: improve safety nets for creating AF_UNIX socket files (GH-134085)

* ensure that we can create AF_UNIX socket files
* emit a warning if system-wide temporary directory is used
(cherry picked from commit 1a07a01014)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-05-21 17:36:32 +00:00
Miss Islington (bot)
df6d9e7fbd
[3.14] gh-80050: Update BufferedReader.read docs around non-blocking (GH-130653) (#134444)
gh-80050: Update BufferedReader.read docs around non-blocking (GH-130653)
(cherry picked from commit e1f891414b)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2025-05-21 09:50:02 -07:00
Miss Islington (bot)
6ea83e077e
[3.14] gh-134026: Fix grammar description of for statement (GH-134034) (GH-134424)
gh-134026: Fix grammar description of for statement (GH-134034)
(cherry picked from commit 4eacf3883d)

Co-authored-by: Yash Vijay <yash_vijay@outlook.com>
2025-05-21 18:43:07 +02:00
Miss Islington (bot)
cdc92cd9fc
[3.14] gh-132983: Refactor shared code in train_dict and finalize_dict (GH-134432) (#134442)
gh-132983: Refactor shared code in train_dict and finalize_dict (GH-134432)

Refactor shared code in train_dict and finalize_dict
(cherry picked from commit c64a21454b)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-05-21 16:19:25 +00:00
Miss Islington (bot)
17bf6ab0c1
[3.14] gh-62184: Remove _pyio import of _io.FileIO (gh-134192) (gh-134437)
This was added in the add of `_io`, isn't used since bpo-21859 when a
`_pyio` implementation was added which defines `FileIO` lower down in
the file.
(cherry picked from commit 0a68068bd2)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2025-05-21 17:57:58 +02:00
Miss Islington (bot)
fade04e0f4
[3.14] gh-133982: Run unclosed file test on all io implementations (gh-134165) (gh-134433)
Update `test_io` `_check_warn_on_dealloc` to use `self.` to dispatch to
different I/O implementations.

Update the `_pyio` implementation to match expected behavior, using the
same `_dealloc_warn` design as the C implementation uses to report the
topmost `__del__` object.

The FileIO one now matches all the others, so can use IOBase. There was
a missing check on closing (self._fd must be valid), add that check
(cherry picked from commit 5b0e827521)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2025-05-21 17:22:44 +02:00
Miss Islington (bot)
74dde92903
[3.14] gh-71253: Match _io exception in _pyio (gh-133985) (gh-134430)
Test was only testing _io, expanded to cover _pyio.

(cherry picked from commit 06eaf4055c)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-05-21 17:13:43 +02:00
Miss Islington (bot)
c612a4d2c0
[3.14] gh-133982: Update test_bufio to use self.open (gh-133983) (gh-134428)
(cherry picked from commit 84d5f8d799)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2025-05-21 17:13:13 +02:00
Miss Islington (bot)
2ffc10bd39
[3.14] gh-132775: Support Fallbacks in _PyObject_GetXIData() (gh-134418)
It now supports a "full" fallback to _PyFunction_GetXIData() and then `_PyPickle_GetXIData()`.
There's also room for other fallback modes if that later makes sense.

(cherry picked from commit 88f8102a8f, AKA gh-133482)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-05-21 14:47:56 +00:00
Miss Islington (bot)
cd3395a8b1
[3.14] gh-132246: Add special buffer methods to C API Type Object docs (gh-132247) (gh-134426)
Two special methods, __buffer__ and __release_buffer__ were added to
Python 3.12 by PEP 688. The C API Type Object documentation for slots
includes `tp_as_buffer`, and sub-slots `bf_getbuffer`, `bf_releasebuffer`
but does not refer to the Python Data Model version of those. Add the
missing references.

(cherry picked from commit b529b60fc2)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2025-05-21 16:33:35 +02:00
Miss Islington (bot)
f1a9d89107
[3.14] gh-90871: fix connection backlog offset in asyncio (gh-134392) (gh-134421)
(cherry picked from commit 109f7597d2)

Co-authored-by: Christian Harries <68507104+ChristianHrs@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-21 16:27:13 +02:00
Miss Islington (bot)
9be568eda4
[3.14] gh-132983: Add documentation for compression.zstd (GH-133911) (#134425)
gh-132983: Add documentation for compression.zstd (GH-133911)

Add documentation for compression & compression.zstd.

🎉

---------
(cherry picked from commit d862b6de1b)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Sumana Harihareswara <sh@changeset.nyc>
Co-authored-by: Martin Panter <vadmium@users.noreply.github.com>
2025-05-21 14:24:23 +00:00
Miss Islington (bot)
f7cdee93f4
[3.14] gh-110631: Fix some incorrect indents in the documentation (GH-129312) (#134419)
Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
2025-05-21 13:58:09 +00:00
Miss Islington (bot)
ac27008ccd
[3.14] Fix signature of _curses.assume_default_colors in the docs (GH-134409) (#134417)
Fix signature of `_curses.assume_default_colors` in the docs (GH-134409)
(cherry picked from commit dcfc91e4e5)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-21 13:08:20 +00:00
Miss Islington (bot)
7c3e21540b
[3.14] gh-132542: Only run test_native_id_after_fork if native_id is supported (GH-134408) (GH-134413)
(cherry picked from commit e6dde10a69)

Co-authored-by: Noam Cohen <noam@noam.me>
2025-05-21 11:38:37 +00:00
Miss Islington (bot)
87d7a19ef0
[3.14] gh-133980: use atomic store in PyObject_GenericSetDict (GH-133988) (#134354)
gh-133980: use atomic store in `PyObject_GenericSetDict` (GH-133988)
(cherry picked from commit ec39fd2c20)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-21 15:06:39 +05:30
Miss Islington (bot)
b0bf48a134
[3.14] Add documentation for remote debugging with pdb (GH-134260) (#134398) 2025-05-21 09:29:42 +00:00
Miss Islington (bot)
64047f7e92
[3.14] gh-134360 Add processName attribute to logging.Formatter docstring (GH-134371) (GH-134405)
Co-authored-by: Sofia Toro <sofie.torch@outlook.com>
2025-05-21 06:16:56 +01:00
Miss Islington (bot)
af428a3894
[3.14] gh-72680: Fix false positives when using zipfile.is_zipfile() (GH-134250) (#134401)
gh-72680: Fix false positives when using zipfile.is_zipfile() (GH-134250)

bpo-28494: Improve zipfile.is_zipfile reliability

The zipfile.is_zipfile function would only search for the EndOfZipfile
section header. This failed to correctly identify non-zipfiles that
contained this header. Now the zipfile.is_zipfile function verifies
the first central directory entry.

Changes:
* Extended zipfile.is_zipfile to verify zipfile catalog
* Added tests to validate failure of binary non-zipfiles
* Reuse 'concat' handling for is_zipfile
(cherry picked from commit 1298511b41)

Co-authored-by: Tim Hatch <timhatch@netflix.com>
Co-authored-by: John Jolly <john.jolly@gmail.com>
2025-05-21 01:58:48 +00:00
Miss Islington (bot)
e379a71811
[3.14] gh-91048: Fix error path result in _remote_debugging_module (GH-134347) (#134399) 2025-05-21 00:20:53 +00:00
Miss Islington (bot)
81c348b6da
GH-130727: Avoid race condition in _wmimodule by copying shared data (GH-134313)
(cherry picked from commit e4fbfb1288)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-05-20 21:47:12 +00:00
Miss Islington (bot)
69710b7087
[3.14] gh-134215: PyREPL: Do not show underscored modules by default during autocompletion (gh-134267) (gh-134388)
(cherry picked from commit a3a3cf6d15)

Co-authored-by: Kevin Hernández <kevin.hernandez@unet.edu.ve>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-20 23:12:02 +02:00
Miss Islington (bot)
04829d4d87
[3.14] gh-134209: use heap-allocated memory in _curses.window.{instr,getstr} (GH-134283) (#134391)
gh-134209: use heap-allocated memory in `_curses.window.{instr,getstr}` (GH-134283)

* made curses buffer heap allocated instead of stack
* change docs to explicitly mention the max buffer size
* changing GetStr() function to behave similarly too
* Update Doc/library/curses.rst
* Update instr with proper return error handling
* Update Modules/_cursesmodule.c
* change to strlen and better memory safety
* change from const int to Py_ssize_t
* add mem allocation guard
* update versionchanged to mention it was an increase.
* explicitly use versionchanged 3.14 as that is its own branch now.

TESTED: `python -m test -u curses test_curses`

---------
(cherry picked from commit aadda87b3d)

Co-authored-by: tigerding <43339228+zydtiger@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-05-20 14:01:45 -07:00
Miss Islington (bot)
379805d03c
[3.14] gh-128066: Properly handle history file writes for RO fs on PyREPL (gh-134380) (gh-134385)
(cherry picked from commit c91ad5da9d)

Co-authored-by: Chris Patti <feoh@feoh.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-20 22:15:23 +02:00
Miss Islington (bot)
899ce7d390
[3.14] gh-85045: clarified that the underlying buffer of a TextIOBase can be a RawIOBase (GH-134372) (#134374)
gh-85045: clarified that the underlying buffer of a TextIOBase can be a RawIOBase (GH-134372)

Added a clarification that the underlying binary buffer of a TextIOBase can be a BufferedIOBase OR a RawIOBase
(cherry picked from commit 36eb711d2f)

Co-authored-by: Alex Kautz <alex@takemobi.com>
2025-05-20 12:28:03 -07:00
Miss Islington (bot)
6f1f871483
[3.14] gh-127146: xfail more Emscripten stack overflows (GH-134358) (#134382)
Adds some additional test xfails for Emscripten stack overflows. Also corrects a test skip for test_io.
(cherry picked from commit 91e6a58e2d)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-05-20 19:07:08 +00:00
Miss Islington (bot)
a2950d50cc
[3.14] gh-131357: Add tests for zero-sized bytes objects in test_bytes.py (GH-134234) (#134378)
gh-131357: Add tests for zero-sized bytes objects in test_bytes.py (GH-134234)
(cherry picked from commit 306f9e04e5)

Co-authored-by: abstractedfox <coldcaption@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-05-20 18:59:00 +00:00
Miss Islington (bot)
2d90cc8b35
[3.14] gh-106213: Shorten Emscripten wasm-gc trampoline by a little (GH-133984) (#134376)
Using the if instruction results in slightly shorter trampoline code.
(cherry picked from commit 3b7888bf3d)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-05-20 18:49:29 +00:00
Miss Islington (bot)
efdaae5b35
[3.14] gh-86802: Fix asyncio memory leak; shielded task exceptions log once through the exception handler (gh-134331) (gh-134343)
(cherry picked from commit f695eca60c)

Co-authored-by: Christian Harries <68507104+ChristianHrs@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-20 19:43:09 +02:00
Miss Islington (bot)
6ce2045139
[3.14] GH-133779: Fix finding pyconfig.h on Windows JIT builds (GH-134359)
(cherry picked from commit 7ad90463df)
2025-05-20 13:22:24 -04:00
Miss Islington (bot)
6074e1e6c4
[3.14] gh-75459: Doc: C API: Improve object life cycle documentation (GH-125962) (GH-134344)
gh-75459: Doc: C API: Improve object life cycle documentation (GH-125962)

  * Add "cyclic isolate" to the glossary.
  * Add a new "Object Life Cycle" page.
  * Improve docs for related API, with special focus on cross-references and warnings
(cherry picked from commit 3246ea514d)

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-05-20 19:11:01 +02:00
Miss Islington (bot)
6d4b56d2f3
[3.14] gh-127945: Update What's New in Python 3.14 for free-threaded ctypes (GH-134332) (#134364)
gh-127945: Update What's New in Python 3.14 for free-threaded ctypes (GH-134332)
(cherry picked from commit b430e92dd8)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-20 17:02:55 +00:00
Miss Islington (bot)
402d983f27
[3.14] gh-128002: add what's new docs for asyncio (GH-134324) (#134362)
gh-128002: add what's new docs for `asyncio` (GH-134324)
(cherry picked from commit 0584533dc7)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-20 16:47:42 +00:00
Miss Islington (bot)
8e8d5c91cd
[3.14] gh-132542: Set native thread ID after fork (GH-132701) (GH-134356)
(cherry picked from commit 6b73502313)

Co-authored-by: Noam Cohen <noam@noam.me>
2025-05-20 16:46:52 +00:00
Miss Islington (bot)
dc5866ab25
[3.14] gh-129748: Update mimalloc to use atomic store for mi_block_set_nextx (GH-134238) (gh-134352)
gh-129748: Update mimalloc to use atomic store for mi_block_set_nextx (GH-134238)
(cherry picked from commit 317c496223)

Co-authored-by: Donghee Na <donghee.na@python.org>
2025-05-20 16:25:04 +00:00
Miss Islington (bot)
ff0facd332
[3.14] gh-101100: Fix Sphinx warnings in library/decimal.rst (GH-134303) (#134338)
Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
2025-05-20 14:52:11 +00:00
Miss Islington (bot)
b9a7e79ee1
[3.14] gh-128307: Update what's new in 3.13 and 3.14 with create_task changes of asyncio (GH-134304) (#134319)
gh-128307: Update what's new in 3.13 and 3.14 with create_task changes of asyncio  (GH-134304)
(cherry picked from commit 28625d4f95)

Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-20 14:15:18 +00:00
Miss Islington (bot)
2dedf5eb45
[3.14] gh-62824: Add alias for iso-8859-8-i which is the same as iso-8859-8 (gh-134306) (gh-134330)
(cherry picked from commit 5ab66a882d)

Co-authored-by: Bas Bloemsaat <bas@bloemsaat.com>
Co-authored-by: David Goncalves <davegoncalves@gmail.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2025-05-20 16:05:16 +02:00
Miss Islington (bot)
7e67b36d97
[3.14] gh-117596: Add more tests for os.path with invalid paths (GH-134189) (GH-134265)
(cherry picked from commit 871d269875)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-20 12:55:21 +00:00
Miss Islington (bot)
a3fa72578a
[3.14] gh-53189: Document peculiarities of InteractiveConsole in relation to pickle (GH-123069) (GH-134328)
gh-53189: Document peculiarities of InteractiveConsole in relation to pickle (GH-123069)

(cherry picked from commit a31bbc951a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-05-20 12:15:34 +00:00
Miss Islington (bot)
c23bdc2ece
[3.14] gh-133890: Handle UnicodeEncodeError in tarfile (GH-134147) (GH-134195)
UnicodeEncodeError is now handled the same way as OSError during
TarFile member extraction.
(cherry picked from commit 9983c7d441)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-20 10:13:40 +00:00
Miss Islington (bot)
9c73a4de0c
[3.14] gh-133940: test_strftime incorrectly calculates expected week (GH-134281) (#134301)
gh-133940: test_strftime incorrectly calculates expected week (GH-134281)

Let the system determine the correct tm_wday and tm_isdst.
(cherry picked from commit e3dda8f818)

Co-authored-by: Gustaf <79180496+GGyll@users.noreply.github.com>
2025-05-20 10:11:39 +00:00
Miss Islington (bot)
ccaf865364
[3.14] gh-131505: Move len boundary assertions before using len. (GH-131536) (GH-134239)
gh-131505: Move len boundary assertions before using len. (GH-131536)

Move len boundary assertions before using len.
(cherry picked from commit c45e661226)

Co-authored-by: naya451 <41294408+naya451@users.noreply.github.com>
2025-05-20 09:57:39 +00:00
Miss Islington (bot)
9be3413b60
[3.14] Clean up test_posixpath (GH-134315) (GH-134316)
* Ensure that created files and dirs are always removed after test.
  Now addCleanup() does not conflict with tearDown().
* Use os_helper.unlink() and os_helper.rmdir().
* Import TESTFN from os_helper.
(cherry picked from commit e29171bf8a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-20 08:18:13 +00:00
Miss Islington (bot)
90aa13ae47
[3.14] gh-133374: fix test_python_legacy_windows_stdio (GH-134080) (GH-134314)
(cherry picked from commit 652d6938ef)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2025-05-20 06:53:44 +00:00
Miss Islington (bot)
07a2033fcf
[3.14] gh-132983: Call Py_XDECREF rather than PyObject_GC_Del in failed __new__ (GH-133962) (#134305)
gh-132983: Call Py_XDECREF rather than PyObject_GC_Del in failed __new__ (GH-133962)

Call Py_XDECREF rather than PyObject_GC_Del in failed __new__

This will call tp_dealloc and clear all members.
(cherry picked from commit e575190abb)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-05-20 02:58:51 +00:00
Miss Islington (bot)
4effd060fc
[3.14] gh-132983: Convert zstd `__new__` methods to Argument Clinic (GH-133860) (#133915)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-20 03:25:24 +01:00
Miss Islington (bot)
e20f05f53f
[3.14] gh-134201: Expand explanation of Base85 encodings in base64 docs (GH-134288) (#134298)
gh-134201: Expand explanation of Base85 encodings in base64 docs (GH-134288)

Explain history of de-facto standard and how to pick between the two Base-85 encoding functions in the base-64 module.

---------
(cherry picked from commit 66aaad6103)

Co-authored-by: Alek Binion <aleksander.binion@gmail.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2025-05-20 00:05:26 +00:00
Miss Islington (bot)
7cbc3ea8fb
[3.14] gh-134235: Import Autocomplete for Builtin Modules (GH-134277) (#134285)
gh-134235: Import Autocomplete for Builtin Modules (GH-134277)

* added enhancement auto completing import with sys builtins

---------
(cherry picked from commit 8421b03b16)

Co-authored-by: Tom Wang <85062819+tommix626@users.noreply.github.com>
Co-authored-by: Hunter <hyoung3@gmail.com>
2025-05-19 21:46:50 +00:00
Steve Dower
7686c752b3
[3.14] gh-133779: Revert Windows generation of pyconfig.h and go back to a static header. (GH-133966)
Extension builders must specify Py_GIL_DISABLED if they want to link to the free-threaded builds.
This was usually the case already, but this change guarantees it in all circumstances.
2025-05-19 21:24:53 +01:00
Miss Islington (bot)
89b744a772
[3.14] gh-125225: Fix column misalignment in help('topics') output (gh-125226) (gh-134225)
The 'help("topics")' output was misaligned due to "ASSIGNMENTEXPRESSIONS"
exceeding the implicit maximum default column width of 19 characters.

Reduced the number of columns from 4 to 3 in the listtopics()
function to allow more space for longer topic names.
(cherry picked from commit b22460c44d)

Co-authored-by: Étienne Pelletier <EtiennePelletier@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-19 17:22:14 +02:00
Miss Islington (bot)
c869898f39
[3.14] gh-128045: Mark unknown opcodes as deopting to themselves (GH-128044) (#134228)
* gh-128045: Mark unknown opcodes as deopting to themselves (GH-128044)
2025-05-19 11:09:15 -04:00
Miss Islington (bot)
7d995ea9fd
[3.14] gh-134214: Fix test case in pyrepl (gh-134223) (gh-134229)
(cherry picked from commit faebf87b37)

Co-authored-by: Jessica Temporal <jtemporal@users.noreply.github.com>
2025-05-19 14:51:46 +00:00
Miss Islington (bot)
a3c3d6f0ef
[3.14] gh-134158: Fix PyREPL coloring of double braces in f/t-strings (gh-134159) (#134227)
Co-authored-by: Loïc Simon <loic.pano@gmail.com>
Co-authored-by: Loïc Simon <loic.simon@napta.io>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-19 17:39:05 +03:00
Miss Islington (bot)
182464eb9e
[3.14] gh-134097: Print number of refs & blocks after each statement in new REPL (gh-134136) (gh-134220)
(cherry picked from commit c31547a591)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-19 16:13:44 +02:00
Miss Islington (bot)
e3cc4008c4
[3.14] gh-122055: Clarify documentation for empty matches in RE (GH-133169) (GH-134217)
(cherry picked from commit 44b73d3cd4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-19 16:49:46 +03:00
Miss Islington (bot)
d9c08c57e9
[3.14] gh-133999: Fix except parsing regression in 3.14 (GH-134035) (#134206)
gh-133999: Fix `except` parsing regression in 3.14 (GH-134035)
(cherry picked from commit 84914ad0e5)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-19 14:26:27 +03:00
Miss Islington (bot)
9136ccfffe
[3.14] gh-76023: Make os.path.realpath to ignore WinError 1005 in non-strict mode (GH-128328) (GH-134203)
(cherry picked from commit d55e11b804)

Co-authored-by: BecoKo <koev_v@yahoo.com>
2025-05-19 09:59:58 +00:00
Stan Ulbrych
91d71ac1bd
[3.14] gh-134060: Don't create a certain symlink in venv if platform does not support it (GH-134061) 2025-05-18 22:33:14 +03:00
Miss Islington (bot)
70735878ab
[3.14] gh-133889: Only show the path of the URL in the SimpleHTTPRequestHandler page (GH-134135) (GH-134190)
The query and fragment are ambiguous and not used.
(cherry picked from commit 5cbc8c632e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-18 22:16:37 +03:00
Miss Islington (bot)
76957eb8cc
[3.14] document Py_VISIT as a macro in the docs (GH-133688) (#134186)
document `Py_VISIT` as a macro in the docs (GH-133688)
(cherry picked from commit bb32f3c698)

Co-authored-by: da-woods <dw-git@d-woods.co.uk>
2025-05-18 16:34:19 +00:00
Miss Islington (bot)
11650c354f
[3.14] fix indent in controlflow.rst docs (GH-134008) (#134184)
fix indent in `controlflow.rst` docs (GH-134008)
(cherry picked from commit 4ce91871a9)

Co-authored-by: Yongzi Li <1538321957@qq.com>
2025-05-18 16:29:03 +00:00
Miss Islington (bot)
bb5f92adcf
[3.14] gh-134144: Fix use-after-free in zapthreads() (GH-134145) (#134182)
gh-134144: Fix use-after-free in zapthreads() (GH-134145)
(cherry picked from commit f2de1e6861)

Co-authored-by: b-pass <b-pass@users.noreply.github.com>
2025-05-18 15:29:19 +00:00
Miss Islington (bot)
8d51ed6b05
[3.14] gh-134100: Fix use-after-free in PyImport_ImportModuleLevelObject (GH-134117) (#134171)
gh-134100: Fix use-after-free in `PyImport_ImportModuleLevelObject` (GH-134117)
(cherry picked from commit 4e9005d32f)

Co-authored-by: Nico-Posada <102486290+Nico-Posada@users.noreply.github.com>
2025-05-18 20:38:40 +05:30
Miss Islington (bot)
bf39decabd
[3.14] gh-134150: Clarify distinction between JSON and Python objects (GH-134154) (#134166)
gh-134150: Clarify distinction between JSON and Python objects (GH-134154)

* gh-134150: Clarify distinction between JSON objects and Python objects in json module docs

* Revert change to JSON introduction

* Clarify occurrences of "object literal" as JSON
(cherry picked from commit fa4e088668)

Co-authored-by: Micha Albert <micha@2231puppy.tech>
2025-05-18 01:54:00 +00:00
Miss Islington (bot)
eaee2ae033
[3.14] gh-134064: Fix sys.remote_exec() error checking (GH-134067) (#134162)
gh-134064: Fix sys.remote_exec() error checking (GH-134067)
(cherry picked from commit 009e7b3698)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-05-17 22:50:00 +00:00
Miss Islington (bot)
1ba5e65b76
[3.14] gh-134119: Fix crash from calling next() on exhausted template iterator (GH-134120) (#134153)
gh-134119: Fix crash from calling next() on exhausted template iterator (GH-134120)
(cherry picked from commit fc7f4c3666)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-05-17 19:48:54 +00:00
Miss Islington (bot)
cca18fcbe8
[3.14] gh-88275: Add missing __init__ method to match example (GH-120281) (#134142)
gh-88275: Add missing `__init__` method to `match` example (GH-120281)
(cherry picked from commit 7a9d46295a)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2025-05-17 13:17:23 +00:00
Miss Islington (bot)
b43e1d0b48
[3.14] Docs: fix spelling of "test case" in unittest documentation (GH-134137) (#134138)
Docs: fix spelling of "test case" in `unittest` documentation (GH-134137)
(cherry picked from commit b41d79c776)

Co-authored-by: Clifford Gama <53076065+cliff688@users.noreply.github.com>
2025-05-17 14:03:33 +02:00
Miss Islington (bot)
9f1307afa0
[3.14] Docs: C API: Improve documentation around non-Python threads with subinterpreters (GH-131087) (GH-134130)
Docs: C API: Improve documentation around non-Python threads with subinterpreters (GH-131087)

(cherry picked from commit af6b3b825f)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-05-17 09:04:42 +00:00
Miss Islington (bot)
851b26f4be
[3.14] gh-113878: fix versionadded in dataclasses.field() documentation (GH-134065) (#134128)
gh-113878: fix `versionadded` in `dataclasses.field()` documentation (GH-134065)
(cherry picked from commit 9d73875072)

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
2025-05-17 08:06:04 +00:00
Miss Islington (bot)
075cabb026
[3.14] gh-133881: add forward reference to list.sort() in lambda expression tutorial (GH-133910) (#134126)
gh-133881: add forward reference to `list.sort()` in lambda expression tutorial (GH-133910)
(cherry picked from commit c1c9ad1d5a)

Co-authored-by: Oleg Burnaev <51371645+Shepard2154@users.noreply.github.com>
2025-05-17 08:05:47 +00:00
Miss Islington (bot)
d7230e1110
[3.14] gh-134098: Fix handling %-encoded trailing slash in SimpleHTTPRequestHandler (GH-134099) (GH-134123)
(cherry picked from commit 2f1ecb3bc4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-17 07:37:43 +00:00
Miss Islington (bot)
5cdad8c90c
[3.14] gh-133889: Improve tests for SimpleHTTPRequestHandler (GH-134102) (GH-134121)
(cherry picked from commit fcaf009907)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-17 07:27:38 +00:00
Miss Islington (bot)
f89323236f
[3.14] gh-134109: Fix showing comments in pydoc output for argparse (GH-134110) (GH-134112)
Comments immediately preceding the object's source code are used
if the object has no docstring.
Comments that do not describe the object should be separated from
the following source code by an empty line.
(cherry picked from commit 71cf4dd622)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-16 20:56:24 +00:00
Miss Islington (bot)
7a5851dc90
[3.14] gh-117026: Remove outdated sentence in SimpleHTTPRequestHandler docs (GH-117027) (GH-134107)
The code was changed in 0f7cddc308 (bpo-839496/gh-39531).
(cherry picked from commit ea2d707bd5)

Co-authored-by: Saleh Dehqanpour <salehdeh76@gmail.com>
2025-05-16 22:23:52 +03:00
Miss Islington (bot)
c8dcde4d5e
[3.14] gh-133286: add explanation about seq for pathlib Pattern Language (GH-133340) (#134105)
gh-133286: add explanation about `seq` for pathlib Pattern Language (GH-133340)
(cherry picked from commit ac8df4b589)

Co-authored-by: alexey semenyuk <alexsemenyuk88@gmail.com>
2025-05-16 20:20:47 +01:00
Miss Islington (bot)
2d00484f30
[3.14] gh-133515: fix docs for unawaited coroutines in debug mode (GH-134081) (#134093)
gh-133515: fix docs for unawaited coroutines in debug mode (GH-134081)
(cherry picked from commit d94b1e9cac)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-16 15:37:01 +00:00
Miss Islington (bot)
fe5636ea96
[3.14] gh-124210: Add introduction to threading docs (GH-127046) (#134090)
Co-authored-by: Semyon Moroz <donbarbos@proton.me>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-05-16 12:29:40 +00:00
Miss Islington (bot)
dda5dc5f06
[3.14] gh-132388: test HACL* and OpenSSL hash functions in pure Python HMAC (GH-134051) (#134089)
gh-132388: test HACL* and OpenSSL hash functions in pure Python HMAC (GH-134051)
(cherry picked from commit 73d71a416f)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-05-16 12:26:37 +00:00
Miss Islington (bot)
7725ba8461
[3.14] gh-134069: bump HACL* revision to incoporate memset_s (GH-134027) (#134084)
Bumps the HACL* revision to include recent revisions that corrects issues
building with legacy/cross-platform macOS SDKs.
(cherry picked from commit 1566c34dc7)

Signed-off-by: aeiouaeiouaeiouaeiouaeiouaeiou <aeioudev@outlook.com>
Co-authored-by: aeiouaeiouaeiouaeiouaeiouaeiou <aeioudev@outlook.com>
2025-05-16 10:49:08 +00:00
Miss Islington (bot)
5374762234
[3.14] gh-130000: Release the GIL in winreg when doing Windows API calls (GH-130001) (#134072)
gh-130000: Release the GIL in winreg when doing Windows API calls (GH-130001)
(cherry picked from commit 7a504b3d5d)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2025-05-16 10:04:24 +00:00
Miss Islington (bot)
ba06ccbb6d
Improve the administrative install docs for Python Install Manager (GH-134066)
(cherry picked from commit 6a22963291)

Co-authored-by: Steve Dower <steve.dower@python.org>
2025-05-15 21:18:26 +00:00
Miss Islington (bot)
438f464a5a
[3.14] gh-77065: Use putwch instead of putch in getpass.win_getpass (GH-134058) (#134059)
gh-77065: Use `putwch` instead of `putch` in `getpass.win_getpass` (GH-134058)
(cherry picked from commit 52a7a22a6b)

Co-authored-by: Semyon Moroz <donbarbos@proton.me>
2025-05-15 15:41:37 +00:00
Miss Islington (bot)
31deafb8ee
[3.14] gh-133410: Fix PR detection in build workflow (GH-133671) (#134055)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-05-15 13:37:41 +00:00
Miss Islington (bot)
29d69e8b66
[3.14] gh-77065: add missing parameter echo_char in getpass.fallback_getpass (GH-133849) (#134053)
gh-77065: add missing parameter `echo_char` in `getpass.fallback_getpass` (GH-133849)
(cherry picked from commit d029a1a1cb)

Co-authored-by: Semyon Moroz <donbarbos@proton.me>
2025-05-15 13:34:50 +00:00
Miss Islington (bot)
620065c33e
[3.14] gh-133403: Check Tools/build/deepfreeze.py with mypy (GH-133802) (#134038)
gh-133403: Check `Tools/build/deepfreeze.py` with mypy (GH-133802)
(cherry picked from commit 7eaa097390)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-15 09:39:20 +00:00
Miss Islington (bot)
fede4ed1d3
[3.14] Test also error messages in test_limit_int. (GH-134018) (GH-134033)
(cherry picked from commit e123a1d09b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-15 07:47:24 +00:00
Miss Islington (bot)
f2a4b1066b
[3.14] gh-133970: Make PEP750 types generic (GH-133976) (#134029)
gh-133970: Make PEP750 types generic (GH-133976)
(cherry picked from commit c3a1da5b93)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-15 06:39:39 +00:00
Miss Islington (bot)
b6299e8f16
[3.14] gh-133986: Document string split algorithm when sep is None and maxsplit is 0 (GH-133987) (#133993)
---------
(cherry picked from commit 3e23047363)

Co-authored-by: Joey Smith <joeysmith@gmail.com>
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Co-authored-by: Semyon Moroz <donbarbos@proton.me>
2025-05-14 21:32:45 -04:00
Miss Islington (bot)
4adb1ddac8
[3.14] Improve tests for str to Fraction conversion (GH-134010) (GH-134016)
(cherry picked from commit 17d0fec702)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-14 18:18:04 +00:00
Miss Islington (bot)
ea15c55143
[3.14] Docs: remove link elements in builders other than HTML (GH-133720) (#134005)
Co-authored-by: Maciej Olko <maciej.olko@affirm.com>
2025-05-14 18:22:07 +03:00
Miss Islington (bot)
d6cb8fa86e
[3.14] gh-133701: Fix incorrect __annotations__ on TypedDict defined under PEP 563 (GH-133772) (#134003)
gh-133701: Fix incorrect `__annotations__` on TypedDict defined under PEP 563 (GH-133772)
(cherry picked from commit 9836503b48)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-14 13:54:29 +00:00
Miss Islington (bot)
a962934106
[3.14] gh-132983: Style improvements for compression.zstd (GH-133547) (#134001)
gh-132983: Style improvements for `compression.zstd` (GH-133547)
(cherry picked from commit b44c824856)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-14 12:39:43 +00:00
Miss Islington (bot)
275c8d5dbd
[3.14] Remove trailing whitespace from python.gram (GH-133858) (#133990)
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-05-14 08:19:47 +00:00
Miss Islington (bot)
66d6860439
[3.14] gh-132641: fix race in lru_cache under free-threading (GH-133787) (#133979)
gh-132641: fix race in `lru_cache` under free-threading (GH-133787)

Fix race in `lru_cache` by acquiring critical section on the cache object itself and call the lock held variant of dict functions to modify the underlying dict.
(cherry picked from commit 9ad0c7b0f1)

Co-authored-by: Peter Hawkins <phawkins@google.com>
2025-05-14 07:11:38 +00:00
Miss Islington (bot)
b94a63c0f1
[3.14] gh-132983: Fix small issues with zstd support in zipfile (GH-133723) (#133974)
gh-132983: Fix small issues with zstd support in zipfile (GH-133723)
(cherry picked from commit 35f47d0589)

Co-authored-by: Carey Metcalfe <carey@cmetcalfe.ca>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-05-13 16:10:59 +00:00
Miss Islington (bot)
24847d04b2
gh-133928: Improvements to using/windows.rst (GH-133952)
(cherry picked from commit fc3cddd90a)

Co-authored-by: Steve Dower <steve.dower@python.org>
2025-05-13 16:06:29 +00:00
Miss Islington (bot)
5632e93f46
[3.14] gh-133968: Add fast path to PyUnicodeWriter_WriteStr() (GH-133969) (#133971)
gh-133968: Add fast path to PyUnicodeWriter_WriteStr() (GH-133969)

Don't call PyObject_Str() if the input type is str.
(cherry picked from commit fe9f6e829a)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-05-13 13:58:25 +00:00
Miss Islington (bot)
69b4387f78
[3.14] gh-133767: Fix use-after-free in the unicode-escape decoder with an error handler (GH-129648) (GH-133942)
If the error handler is used, a new bytes object is created to set as
the object attribute of UnicodeDecodeError, and that bytes object then
replaces the original data. A pointer to the decoded data will became invalid
after destroying that temporary bytes object. So we need other way to return
the first invalid escape from _PyUnicode_DecodeUnicodeEscapeInternal().

_PyBytes_DecodeEscape() does not have such issue, because it does not
use the error handlers registry, but it should be changed for compatibility
with _PyUnicode_DecodeUnicodeEscapeInternal().
(cherry picked from commit 9f69a58623)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-13 16:25:08 +03:00
Miss Islington (bot)
f0a7a6c2cc
[3.14] gh-133886: Fix sys.remote_exec() for non-UTF-8 paths (GH-133887) (GH-133963)
It now supports non-ASCII paths in non-UTF-8 locales and
non-UTF-8 paths in UTF-8 locales.
(cherry picked from commit c09cec5d69)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-13 09:23:39 +00:00
Miss Islington (bot)
198dc8dcb2
[3.14] gh-133885: skip test_compress_locking in test_zstd (GH-133943) (#133949)
gh-133885: skip `test_compress_locking` in `test_zstd` (GH-133943)
(cherry picked from commit e8665d4d46)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-13 08:27:17 +00:00
Miss Islington (bot)
3467656b18
[3.14] gh-132775: Add _PyFunction_GetXIData() (gh-133955)
(cherry picked from commit 8cf4947b0f, AKA gh-133481)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-05-12 22:37:55 +00:00
Miss Islington (bot)
c1aa5f82d9
[3.14] gh-132983: Fix compiler warning about unused function `mt_continue_should_break()` (GH-133947) (#133950)
gh-132983: Fix compiler warning about unused function ``mt_continue_should_break()`` (GH-133947)
(cherry picked from commit 121ed71f4e)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2025-05-12 19:49:44 +00:00
Miss Islington (bot)
5ba525c7d0
[3.14] gh-133413: Fix references to removed Request.has_data (GH-133414) (GH-133945)
The has_data() method of http.request.Request
was removed in version 3.4.
(cherry picked from commit 86c1d439e0)

Co-authored-by: ppaez <pp@pp.com.mx>
2025-05-12 18:23:35 +00:00
Miss Islington (bot)
c15980b57b
[3.14] gh-133653: Fix argparse.ArgumentParser with the formatter_class argument (GH-133813) (GH-133941)
* Fix TypeError when formatter_class is a custom subclass of
  HelpFormatter.
* Fix TypeError when formatter_class is not a subclass of
  HelpFormatter and non-standard prefix_char is used.
* Fix support of colorizing when formatter_class is not a subclass of
  HelpFormatter.
* Remove the prefix_chars parameter of HelpFormatter.
(cherry picked from commit 734e15b70d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-12 17:54:07 +00:00
Miss Islington (bot)
c11fc4bc96
[3.14] gh-133677: Fix tests when running in non-UTF-8 locale (GH-133865) (GH-133938)
(cherry picked from commit 14305a83d3)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-12 16:41:40 +00:00
Miss Islington (bot)
89c801b84e
[3.14] gh-133925: Make typing._UnionGenericAlias hashable (GH-133929) (#133936)
gh-133925: Make typing._UnionGenericAlias hashable (GH-133929)
(cherry picked from commit 8d478c7953)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-12 15:50:10 +00:00
Miss Islington (bot)
ecc12bff24
[3.14] gh-133904: Fix math.factorial documentation (GH-133907) (#133918)
gh-133904: Fix `math.factorial` documentation (GH-133907)
(cherry picked from commit 27ed64575d)

Co-authored-by: mkaraev <maruf.karaev97@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-12 12:53:44 +00:00
Miss Islington (bot)
cedc37a894
[3.14] gh-91555: disable logger while handling log record (GH-131812) (GH-133899)
Prevent the possibility of re-entrancy leading to deadlock or infinite recursion (caused by logging triggered by logging), by disabling logging while the logger is handling log messages.
(cherry picked from commit 2561e148ec)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
2025-05-12 13:02:21 +01:00
Miss Islington (bot)
f5d2d73995
[3.14] gh-133744: Fix multiprocessing interrupt test: add an event (GH-133746) (#133916)
gh-133744: Fix multiprocessing interrupt test: add an event (GH-133746)

Add an event to synchronize the parent process with the child
process: wait until the child process starts sleeping.
(cherry picked from commit c2989b7070)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-05-12 09:38:07 +00:00
Miss Islington (bot)
94938caf35
[3.14] gh-119180: annotationlib: Fix values of Format members in docs (GH-133841) (#133903)
gh-119180: annotationlib: Fix values of Format members in docs (GH-133841)
(cherry picked from commit 0eb448cae5)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-11 15:49:21 +00:00
Miss Islington (bot)
a3475e68bb
[3.14] gh-119180: More documentation for PEP 649/749 (GH-133552) (#133902)
gh-119180: More documentation for PEP 649/749 (GH-133552)

The SC asked that the Appendix in PEP-749 be added to the docs.
(cherry picked from commit 3396df56d0)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-11 15:49:06 +00:00
Miss Islington (bot)
507715d5f7
[3.14] gh-133893: asyncio.graph: Replace TextIO annotation with io.Writer (GH-133894) (#133901)
gh-133893: asyncio.graph: Replace TextIO annotation with io.Writer (GH-133894)
(cherry picked from commit 1d3eacedb8)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2025-05-11 15:25:43 +00:00
Miss Islington (bot)
98ef4837ec
[3.14] gh-133590: ensure that TableEntry.linenumber_borrow is initialized (GH-133681) (#133872)
gh-133590: ensure that `TableEntry.linenumber_borrow` is initialized (GH-133681)
(cherry picked from commit c838e21fda)

Co-authored-by: Lauta <ljfp@ljfp.xyz>
2025-05-11 08:44:22 +00:00
Miss Islington (bot)
f7d7248a03
[3.14] gh-133823: update "Pending Removal in 3.15" notes about TypedDict (GH-133864) (#133870)
gh-133823: update "Pending Removal in 3.15" notes about `TypedDict` (GH-133864)
(cherry picked from commit f91127ae1a)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-05-11 08:16:28 +00:00
Miss Islington (bot)
5c9f0ae49d
gh-133703: dict: fix calculate_log2_keysize() (GH-133809)
(cherry picked from commit 92337f666e)
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2025-05-11 16:34:15 +09:00
Miss Islington (bot)
2b761d1122
[3.14] gh-132983: Remove leftovers from EndlessZstdDecompressor (GH-133856) (#133859)
gh-132983: Remove leftovers from EndlessZstdDecompressor (GH-133856)
(cherry picked from commit 878e0fb8b4)

Co-authored-by: Rogdham <3994389+Rogdham@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-05-11 02:30:55 +00:00
Miss Islington (bot)
1e8a534533
[3.14] gh-132983: Make zstd types immutable (GH-133784) (#133857)
gh-132983: Make zstd types immutable (GH-133784)
(cherry picked from commit 1a87b6e9ae)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-10 23:02:44 +00:00
Miss Islington (bot)
da1e5c434b
[3.14] gh-133336: Remove comment about reserved -J in `initconfig.c` (GH-133821) (#133855) 2025-05-10 22:25:42 +00:00
Miss Islington (bot)
f7c441cc82
[3.14] gh-132983: Reduce the size of `_zstdmodule.h` (GH-133793) (#133854)
gh-132983: Reduce the size of ``_zstdmodule.h`` (GH-133793)
(cherry picked from commit 1a548c0a50)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-10 21:51:11 +00:00
Miss Islington (bot)
39485d5935
[3.14] Add classmethod to setUpClass in test_pdb (GH-133840) (#133846)
Add classmethod to setUpClass in test_pdb (GH-133840)
(cherry picked from commit 4f2f780d53)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2025-05-10 18:38:14 +00:00
Miss Islington (bot)
e7e105f51b
[3.14] gh-86155: Fix data loss after unclosed script or style tag in HTMLParser (GH-22658) (GH-133844)
When calling .close() the HTMLParser should flush all remaining content,
even when that content is in an unclosed script or style tag.
(cherry picked from commit 53383e90e4)

Co-authored-by: Waylan Limberg <waylan.limberg@icloud.com>
2025-05-10 18:02:23 +00:00
Miss Islington (bot)
856e5903ba
[3.14] gh-133783: Fix __replace__ on AST nodes for optional attributes (GH-133797) (#133842)
gh-133783: Fix __replace__ on AST nodes for optional attributes (GH-133797)
(cherry picked from commit 7dddb4e667)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-10 16:44:07 +00:00
Miss Islington (bot)
13c94d0401
[3.14] gh-132642: document how to render human-readable timedelta objects (GH-133825) (#133837)
gh-132642: document how to render human-readable `timedelta` objects (GH-133825)
(cherry picked from commit efcc42ba70)

Co-authored-by: Kentaro Jay Takahashi <64148935+KentaroJay@users.noreply.github.com>
2025-05-10 16:00:36 +00:00
Miss Islington (bot)
6dc12dad4b
[3.14] gh-117088: Fix AIX build (GH-132595) (GH-133838)
(cherry picked from commit 47f1722d80)

Co-authored-by: Ayappan Perumal <ayappap2@in.ibm.com>
2025-05-10 15:55:47 +00:00
Miss Islington (bot)
381159b2be
[3.14] gh-77057: Fix handling of invalid markup declarations in HTMLParser (GH-9295) (GH-133833)
(cherry picked from commit 76c0b01bc4)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-10 14:58:23 +00:00
Miss Islington (bot)
f3f22f9f51
[3.14] Tiny doc fix to double up backslashes in a Windows filesystem path (GH-133828) (#133830)
Tiny doc fix to double up backslashes in a Windows filesystem path (GH-133828)
(cherry picked from commit e7741dd773)

Co-authored-by: Tim Golden <mail@timgolden.me.uk>
2025-05-10 13:51:49 +00:00
Miss Islington (bot)
10cd1aafc4
[3.14] gh-115999: Note Python 3.14 free-threaded changes in What's New (gh-131285) (gh-133824)
gh-115999: Note Python 3.14 free-threaded changes in What's New (gh-131285)

---------
(cherry picked from commit f28cbc9fd3)

Co-authored-by: Donghee Na <donghee.na@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: T. Wouters <thomas@python.org>
Co-authored-by: mpage <mpage@cs.stanford.edu>
2025-05-10 10:37:02 +00:00
Miss Islington (bot)
4b78cbd76f
[3.14] gh-132971: Update shutil.which() docs (GH-133067) (#133803)
gh-132971: Update shutil.which() docs (GH-133067)
(cherry picked from commit d13d5fdf61)

Co-authored-by: Kokona <125976684+985025074@users.noreply.github.com>
2025-05-10 10:51:55 +02:00
Miss Islington (bot)
62109c4174
[3.14] gh-133009: fix UAF in xml.etree.ElementTree.Element.__deepcopy__ (GH-133010) (#133805)
gh-133009: fix UAF in `xml.etree.ElementTree.Element.__deepcopy__` (GH-133010)
(cherry picked from commit 116a9f9b37)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-05-10 07:58:10 +00:00
Miss Islington (bot)
99ca086f91
[3.14] gh-132983: Don't allow trailer data in ZstdFile (GH-133736) (#133799)
gh-132983: Don't allow trailer data in ZstdFile (GH-133736)
(cherry picked from commit 50b5370664)

Co-authored-by: Rogdham <3994389+Rogdham@users.noreply.github.com>
2025-05-10 02:58:43 +00:00
Miss Islington (bot)
f6a4604017
[3.14] Fix a typo in Misc/NEWS.d/3.140a1.rst (GH-133790) (#133798)
Fix a typo in Misc/NEWS.d/3.140a1.rst (GH-133790)
(cherry picked from commit c896dae029)

Co-authored-by: Tan Long <tanloong@foxmail.com>
2025-05-10 02:37:05 +00:00
Miss Islington (bot)
d9571c938c
[3.14] GH-132983: PEP 7 and Argument Clinic changes for zstd (GH-133791) (#133792)
GH-132983: PEP 7 and Argument Clinic changes for zstd (GH-133791)
(cherry picked from commit 1978904a2f)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-10 00:59:30 +00:00
Miss Islington (bot)
9023b6ffae
[3.14] GH-132983: remove empty_bytes from _zstd module state (GH-133785) (#133788)
GH-132983: remove empty_bytes from _zstd module state (GH-133785)
(cherry picked from commit 98e2c3af47)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-09 20:42:55 +00:00
Miss Islington (bot)
5796e3b588
[3.14] gh-132983: Simplify `_zstd_exec()` (GH-133775) (#133786)
gh-132983: Simplify ``_zstd_exec()`` (GH-133775)
(cherry picked from commit bbe9c31edc)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-09 20:15:32 +00:00
Miss Islington (bot)
aaeca91b05
[3.14] gh-133532: Run GC fast cycles test in subprocess. (gh-133533) (gh-133716)
This makes the test more reliable since there are not extra objects on the heap leftover
from other tests.

(cherry picked from commit 8598e57942)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2025-05-09 12:30:27 -07:00
Miss Islington (bot)
da41ce6b69
[3.14] Update HTTP links in the _pydatetime docstrings (GH-133025) (GH-133781)
(cherry picked from commit aed28eb5a0)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-05-09 19:06:49 +00:00
Miss Islington (bot)
359696f031
[3.14] gh-133519: Add console to resources in libregrtest (GH-133520) (#133776)
gh-133519: Add console to resources in libregrtest (GH-133520)

Add console to resources in libregrtest
(cherry picked from commit 4274b47156)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2025-05-09 16:56:39 +00:00
Miss Islington (bot)
5e730a8baa
[3.14] gh-133741: Fix _can_strace(): check --trace option (GH-133766) (#133774)
gh-133741: Fix _can_strace(): check --trace option (GH-133766)

The --trace option needs strace 5.5 or newer.
(cherry picked from commit 67086282fc)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-05-09 16:52:23 +00:00
Miss Islington (bot)
4e57e213d6
[3.14] gh-123299: Some copyedits to What's New in 3.14 (GH-133622) (#133771)
Co-authored-by: Éric <earaujo@caravan.coop>
2025-05-09 19:12:48 +03:00
Miss Islington (bot)
9ad1516357
[3.14] gh-46236: Document PyUnicode_BuildEncodingMap (GH-133270) (#133769)
gh-46236: Document PyUnicode_BuildEncodingMap (GH-133270)
(cherry picked from commit f34ec09ba5)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-05-09 15:24:59 +00:00
Miss Islington (bot)
b6c55511c3
[3.14] GH-132983: Restore libzstd fallback detection (GH-133565) (#133757)
GH-132983: Restore libzstd fallback detection (GH-133565)
(cherry picked from commit 2c7cac4c0d)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-09 15:59:07 +01:00
Miss Islington (bot)
2df021d9dc
[3.14] gh-132983: Clean-ups for `_zstd` (GH-133670) (#133756)
gh-132983: Clean-ups for ``_zstd`` (GH-133670)
(cherry picked from commit c2a5d4b383)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-09 15:58:58 +01:00
Miss Islington (bot)
bd6aad0ec4
[3.14] gh-133403: Check Tools/build/generate-build-details.py with mypy (GH-133735) (#133764)
gh-133403: Check `Tools/build/generate-build-details.py` with mypy (GH-133735)
(cherry picked from commit cd2f234ad2)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-09 14:48:05 +00:00
Miss Islington (bot)
5dddedf327
[3.14] GH-132983: Remove subclassing support from zstd types (GH-133694) (#133762)
GH-132983: Remove subclassing support from zstd types (GH-133694)

For consistency with ``bz2``, ``lzma``, and ``zlib``.
(cherry picked from commit bd7c5859c6)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-09 14:43:52 +00:00
Miss Islington (bot)
52d89f5343
[3.14] gh-133682: Fix inconsistent set ordering in annotationlib test (GH-133702) (#133754)
gh-133682: Fix inconsistent set ordering in annotationlib test (GH-133702)
(cherry picked from commit a2a0fa91c4)

Co-authored-by: Akshat Gupta <akshat.gupta24@gmail.com>
2025-05-09 14:27:13 +00:00
Miss Islington (bot)
94a823f501
[3.14] Docs: use boolean constants for returning boolean value (GH-133325) (GH-133760)
(cherry picked from commit 076004ae54)

Co-authored-by: Yongzi Li <1538321957@qq.com>
2025-05-09 14:17:53 +00:00
Miss Islington (bot)
a100a2b1b8
[3.14] Manpage: -X gil is not related to PYTHON_HISTORY (GH-133753) (#133758)
Co-authored-by: Stefano Rivera <stefano@rivera.za.net>
2025-05-09 14:17:33 +00:00
Miss Islington (bot)
9a77637067
[3.14] gh-133644: update Py_InteractiveFlag deprecation notice (GH-133749) (#133751)
gh-133644: update `Py_InteractiveFlag` deprecation notice (GH-133749)
(cherry picked from commit 3ed8d6fdd1)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-05-09 13:48:35 +00:00
Miss Islington (bot)
beb8a50ca1
[3.14] gh-133439: Fix dot commands with trailing spaces are mistaken for multi-line sqlite statements in the sqlite3 command-line interface (GH-133440) (GH-133738)
(cherry picked from commit ebd4881db2)

Co-authored-by: Tan Long <tanloong@foxmail.com>
2025-05-09 15:17:24 +03:00
Miss Islington (bot)
92d56777a1
[3.14] gh-133581: Fix refleak in t-string AST unparsing (GH-133724) (#133731)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-09 07:38:12 +00:00
Miss Islington (bot)
47d4947823
[3.14] gh-133412: amend docs for the inst definition (GH-133708) (#133729)
gh-133412: amend docs for the `inst` definition (GH-133708)

The `stack_effect` is incorrectly documented as being allowed to be optional.
(cherry picked from commit f77dac66e1)

Co-authored-by: Nybblista <170842536+nybblista@users.noreply.github.com>
2025-05-09 07:12:41 +00:00
Miss Islington (bot)
3937c78e36
[3.14] gh-69426: HTMLParser: only unescape properly terminated character entities in attribute values (GH-95215) (GH-133704)
According to the HTML5 spec, named character references in attribute values
should only be processed if they are not followed by an ASCII alphanumeric,
or an equals sign.
(cherry picked from commit 77b14a6d58)


https: //html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state

Co-authored-by: Sascha Ißbrücker <sascha.issbruecker@googlemail.com>
2025-05-09 09:43:21 +03:00
Miss Islington (bot)
8e86f9c3cc
[3.14] gh-132917: Use /proc/self/status for mem usage info. (GH-133544) (gh-133718)
On Linux, use /proc/self/status for mem usage info.  Using smaps_rollup is quite a lot slower and
we can get the similar info from /proc/self/status.
(cherry picked from commit 751db4e649)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2025-05-08 16:37:59 -07:00
Miss Islington (bot)
4c6fa89216
[3.14] gh-133467: Add TSAN suppressions for races in typeobject (gh-133534) (gh-133717)
(cherry picked from commit 8679c8d5cc)
2025-05-08 16:37:08 -07:00
Miss Islington (bot)
0c340d1083
[3.14] gh-133541: Handle SyntaxError raised by the tokenizer on user input (GH-133606) (#133709) 2025-05-08 20:41:01 +00:00
Miss Islington (bot)
add970f08e
gh-133626: Ensure the traditional Windows installer doesn't accidentally pick up site-packages (GH-133693)
(cherry picked from commit 6ce469dcba)

Co-authored-by: Steve Dower <steve.dower@python.org>
2025-05-08 20:17:11 +00:00
Miss Islington (bot)
79644893c5
[3.14] Fix typo in pending-removal-in-3.14.rst (GH-133680) (GH-133697)
(cherry picked from commit 9546eeea90)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2025-05-08 19:03:10 +00:00
Miss Islington (bot)
8806d0f499
[3.14] gh-103092: Support subinterpreters in `_zstd` (GH-133674) (#133695)
gh-103092: Support subinterpreters in ``_zstd`` (GH-133674)
(cherry picked from commit 6f6f48d289)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-08 18:38:40 +00:00
Miss Islington (bot)
3fcb9afb20
Adds docs to help with troubleshooting pip installs. (GH-133692)
(cherry picked from commit dd670fa7ca)

Co-authored-by: Steve Dower <steve.dower@python.org>
2025-05-08 18:35:57 +00:00
Miss Islington (bot)
cc6cf8a928
[3.14] gh-133403: Check Tools/build/verify_ensurepip_wheels.py with mypy (GH-133453) (#133689)
gh-133403: Check `Tools/build/verify_ensurepip_wheels.py` with mypy (GH-133453)
(cherry picked from commit 5f3d3f2a6c)

Co-authored-by: Flosckow <66554425+Flosckow@users.noreply.github.com>
Co-authored-by: Daniil Dumchenko <dumchenko.de@sibvaleo.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-08 18:20:13 +00:00
Miss Islington (bot)
3e7552e4ae
[3.14] gh-132762: Fix underallocation bug in dict.fromkeys()(gh-133627) (gh-133685)
The function `dict_set_fromkeys()` adds elements of a set to an existing
dictionary. The size of the expanded dictionary was estimated with
`PySet_GET_SIZE(iterable)`, which did not take into account the size of the
existing dictionary.
(cherry picked from commit 421ba589d0)

Co-authored-by: Angela Liss <59097311+angela-tarantula@users.noreply.github.com>
2025-05-08 17:39:39 +00:00
Miss Islington (bot)
8f071bc322
[3.14] gh-132886: use relaxed atomics for sock_fd in gil builds in socket module (GH-133208) (#133683)
gh-132886: use relaxed atomics for `sock_fd` in gil builds in socket module (GH-133208)
(cherry picked from commit 2d82ab761a)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-08 17:30:40 +00:00
Miss Islington (bot)
1059548686
[3.14] gh-132775: Add _PyCode_GetScriptXIData() (gh-133676)
This converts functions, code, str, bytes, bytearray, and memoryview objects to PyCodeObject,
and ensure that the object looks like a script.  That means no args, no return, and no closure.
_PyCode_GetPureScriptXIData() takes it a step further and ensures there are no globals.

We also add _PyObject_SupportedAsScript() to the internal C-API.

(cherry picked from commit c81fa2b9cd, AKA gh-133480)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2025-05-08 10:05:34 -06:00
Miss Islington (bot)
dc1a4dda88
[3.14] gh-131031: Fix test_pickle when invoked directly (GH-133356) (GH-133673)
(cherry picked from commit e15bbfafbc)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-08 15:19:58 +00:00
Miss Islington (bot)
153496921a
[3.14] gh-133581: Improve AST unparsing of t-strings (GH-133635) (#133666)
gh-133581: Improve AST unparsing of t-strings (GH-133635)
(cherry picked from commit bfac7d2edc)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-08 13:40:44 +00:00
Miss Islington (bot)
863722be6b
[3.14] gh-133454: Mark tests with many threads that use much memory as bigmem (GH-133456) (GH-133663)
(cherry picked from commit 26839eae20)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-08 13:24:38 +00:00
Miss Islington (bot)
caeb422cbc
gh-133597: Fix memory leak if error occurred in _sys_getwindowsversion_from_kernel32 (GH-133598)
(cherry picked from commit 0ec8fc83a8)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
2025-05-08 11:36:38 +00:00
Miss Islington (bot)
0f7046b187
[3.14] gh-133583: Add support for fixed size unsigned integers in argument parsing (GH-133584) (GH-133650)
* Add Argument Clinic converters: uint8, uint16, uint32, uint64.
* Add private C API: _PyLong_UInt8_Converter(),
  _PyLong_UInt16_Converter(), _PyLong_UInt32_Converter(),
  _PyLong_UInt64_Converter().
(cherry picked from commit 4c914e7a36)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-08 09:54:44 +00:00
Miss Islington (bot)
a020336256
[3.14] gh-127833: Add links to token types to the lexical analysis intro (GH-131468) (#133652)
gh-127833: Add links to token types to the lexical analysis intro (GH-131468)
(cherry picked from commit 45bb5ba61a)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-08 10:46:47 +01:00
Miss Islington (bot)
3cd4c2db7b
[3.14] Doc: Allow translating a code block in the tutorial (GH-131353) (#133648)
Doc: Allow translating a code block in the tutorial (GH-131353)
(cherry picked from commit 3224b99872)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-08 09:28:58 +00:00
Miss Islington (bot)
2de8a8b7e9
[3.14] gh-133639: Fix test_auto_indent_default() doesn't run input_code (GH-133640) (#133646) 2025-05-08 08:50:57 +00:00
Miss Islington (bot)
d35c0e48da
[3.14] gh-133641: Doc: Add missing source link in `concurrent.futures` (GH-133642) (#133643)
gh-133641: Doc: Add missing source link in ``concurrent.futures`` (GH-133642)
(cherry picked from commit 4fcd377563)

Co-authored-by: Jonas Obrist <ojiidotch@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-08 09:34:20 +01:00
Miss Islington (bot)
effe8d4971
[3.14] gh-125028: Prohibit placeholders in partial keywords (GH-126062) (GH-133645)
(cherry picked from commit afed5f8835)

Co-authored-by: dgpb <3577712+dg-pb@users.noreply.github.com>
2025-05-08 08:26:14 +00:00
Miss Islington (bot)
c6a56e3d91
[3.14] gh-132983: Remove pyzstd in identifiers (GH-133535) (#133629) 2025-05-08 08:11:49 +01:00
Miss Islington (bot)
e8c279f394
[3.14] gh-133403: Type Tools/build/update_file.py and check it with mypy (GH-133404) (#133603)
gh-133403: Type `Tools/build/update_file.py` and check it with `mypy` (GH-133404)
(cherry picked from commit 50b52cba2d)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Zachary Ware <zach@python.org>
2025-05-08 09:32:05 +03:00
Miss Islington (bot)
f12e576128
[3.14] gh-133551: Skip annotationlib for now in ast roundtrip tests (GH-133634) (#133636)
gh-133551: Skip annotationlib for now in ast roundtrip tests (GH-133634)
(cherry picked from commit 0a3ccb8dff)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-08 03:01:33 +00:00
Miss Islington (bot)
aadfc2cbc7
[3.14] gh-133555: Allow regenerating the parser with Python < 3.14 (GH-133557) (#133630)
gh-133555: Allow regenerating the parser with Python < 3.14 (GH-133557)
(cherry picked from commit b48599b801)

Co-authored-by: Alex Prengère <2138730+alexprengere@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-08 01:54:42 +00:00
Miss Islington (bot)
ca3e3b8a27
[3.14] gh-127833: lexical analysis: Add backticks to BOM example (GH-132407) (#133632)
gh-127833: lexical analysis: Add backticks to BOM example (GH-132407)
(cherry picked from commit 0552ce0fb2)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-05-08 01:40:41 +00:00
Miss Islington (bot)
9e1aa354ae
[3.14] gh-133551: Support t-strings in annotationlib (GH-133553) (#133628)
gh-133551: Support t-strings in annotationlib (GH-133553)

I don't know why you'd use t-strings in annotations, but now if you do,
the STRING format will do a great job of recovering the source code.
(cherry picked from commit 90f476e0f8)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-08 01:37:03 +00:00
Eric Snow
c39bc81b70
[3.14] gh-132775: Unrevert "Add _PyCode_VerifyStateless()" (gh-133625)
This reverts commit 3c73cf5 (gh-133497), which itself reverted
the original commit d270bb5 (gh-133221).

We reverted the original change due to failing android tests.
The checks in _PyCode_CheckNoInternalState() were too strict,
so we've relaxed them.
2025-05-08 00:00:33 +00:00
Miss Islington (bot)
54c3aa1597
[3.14] gh-133516: Raise ValueError when constants True, False or None are used as an identifier after NFKC normalization (GH-133523) (#133596) 2025-05-07 22:26:06 +00:00
Miss Islington (bot)
c98b5a9369
[3.14] gh-133558: Skip test_pdb tests on FreeBSD (GH-133566) (#133616)
gh-133558: Skip test_pdb tests on FreeBSD (GH-133566)

'\x08' is not interpreted as backspace on FreeBSD.
(cherry picked from commit 79b8a32fcb)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-05-07 22:20:17 +00:00
Miss Islington (bot)
cc588aaa5f
[3.14] gh-133361: move the explanation of dict equal before its use (GH-133424) (#133620)
gh-133361: move the explanation of dict equal before its use (GH-133424)

Also move up the explanation of insertion order preservation.  Both paragraphs seemed out of place down where they were.
---------
(cherry picked from commit 61ac88c06e)

Co-authored-by: Yongzi Li <1538321957@qq.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-05-07 22:10:51 +00:00
Brian Schubert
e2d440ebc6
[3.14] gh-131535: Fix stale example in html.parser docs, make examples doctests (GH-131551) (GH-133589)
(cherry picked from commit ee76e36d76)
2025-05-07 22:03:30 +00:00
Zachary Ware
0eb2291a7e
[3.14] Forward-port 'check-abi' CI job from 3.13 (GH-133614)
Also add the python3.14.abi file as generated by the new job and remove
the 'main branch only' entry from .gitignore.

The only difference from the 3.13 job is the addition of `with.python-version: 3.x`
to the `setup-python` configuration to pacify a warning.
2025-05-07 21:35:46 +00:00
Hugo van Kemenade
7504fe61b8 Post 3.14.0b1 2025-05-07 18:45:45 +03:00
1456 changed files with 109221 additions and 28829 deletions

View file

@ -1,13 +1,10 @@
{
"image": "ghcr.io/python/devcontainer:2024.09.25.11038928730",
"image": "ghcr.io/python/devcontainer:latest",
"onCreateCommand": [
// Install common tooling.
"dnf",
"install",
"-y",
"which",
"zsh",
"fish",
// For umask fix below.
"/usr/bin/setfacl"
],

View file

@ -1,11 +1,11 @@
root = true
[*.{py,c,cpp,h,js,rst,md,yml,yaml}]
[*.{py,c,cpp,h,js,rst,md,yml,yaml,gram}]
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
[*.{py,c,cpp,h}]
[*.{py,c,cpp,h,gram}]
indent_size = 4
[*.rst]

3
.gitattributes vendored
View file

@ -10,6 +10,7 @@
*.ico binary
*.jpg binary
*.pck binary
*.pdf binary
*.png binary
*.psd binary
*.tar binary
@ -67,6 +68,7 @@ PCbuild/readme.txt dos
**/clinic/*.cpp.h generated
**/clinic/*.h.h generated
*_db.h generated
Doc/c-api/lifecycle.dot.svg generated
Doc/data/stable_abi.dat generated
Doc/library/token-list.inc generated
Include/internal/pycore_ast.h generated
@ -81,6 +83,7 @@ Include/opcode_ids.h generated
Include/token.h generated
Lib/_opcode_metadata.py generated
Lib/keyword.py generated
Lib/idlelib/help.html generated
Lib/test/certdata/*.pem generated
Lib/test/certdata/*.0 generated
Lib/test/levenshtein_examples.json generated

28
.github/CODEOWNERS vendored
View file

@ -8,7 +8,7 @@
.github/** @ezio-melotti @hugovk @AA-Turner
# pre-commit
.pre-commit-config.yaml @hugovk @AlexWaygood
.pre-commit-config.yaml @hugovk
.ruff.toml @hugovk @AlexWaygood @AA-Turner
# Build system
@ -16,6 +16,10 @@ configure* @erlend-aasland @corona10
Makefile.pre.in @erlend-aasland
Modules/Setup* @erlend-aasland
# generate-build-details
Tools/build/generate-build-details.py @FFY00
Lib/test/test_build_details.py @FFY00
# argparse
**/*argparse* @savannahostrowski
@ -27,6 +31,7 @@ Modules/Setup* @erlend-aasland
**/*genobject* @markshannon
**/*hamt* @1st1
**/*jit* @brandtbucher @savannahostrowski
Python/perf_jit_trampoline.c # Exclude the owners of "**/*jit*", above.
Objects/set* @rhettinger
Objects/dict* @methane @markshannon
Objects/typevarobject.c @JelleZijlstra
@ -281,14 +286,21 @@ Doc/howto/clinic.rst @erlend-aasland
# Subinterpreters
**/*interpreteridobject.* @ericsnowcurrently
**/*crossinterp* @ericsnowcurrently
Lib/test/support/interpreters/ @ericsnowcurrently
Modules/_interp*module.c @ericsnowcurrently
Lib/test/test__interp*.py @ericsnowcurrently
Lib/concurrent/interpreters/ @ericsnowcurrently
Lib/test/support/channels.py @ericsnowcurrently
Doc/library/concurrent.interpreters.rst @ericsnowcurrently
Lib/test/test_interpreters/ @ericsnowcurrently
Lib/concurrent/futures/interpreter.py @ericsnowcurrently
# Android
**/*Android* @mhsmith @freakboy3742
**/*android* @mhsmith @freakboy3742
# Apple
/Apple @freakboy3742
# iOS (but not termios)
**/iOS* @freakboy3742
**/ios* @freakboy3742
@ -298,7 +310,12 @@ Lib/test/test_interpreters/ @ericsnowcurrently
**/*-ios* @freakboy3742
# WebAssembly
/Tools/wasm/ @brettcannon @freakboy3742
Tools/wasm/config.site-wasm32-emscripten @freakboy3742
/Tools/wasm/README.md @brettcannon @freakboy3742
/Tools/wasm/wasi-env @brettcannon
/Tools/wasm/wasi_build.py @brettcannon
/Tools/wasm/emscripten @freakboy3742
/Tools/wasm/wasi @brettcannon
# SBOM
/Misc/externals.spdx.json @sethmlarson
@ -326,3 +343,8 @@ Modules/_xxtestfuzz/ @ammaraskar
**/*templateobject* @lysnikolaou
**/*templatelib* @lysnikolaou
**/*tstring* @lysnikolaou
# Remote debugging
Python/remote_debug.h @pablogsal
Python/remote_debugging.c @pablogsal
Modules/_remote_debugging_module.c @pablogsal @ambv @1st1

View file

@ -1,6 +1,7 @@
self-hosted-runner:
# Pending https://github.com/rhysd/actionlint/issues/533
labels: ["windows-11-arm"]
# and https://github.com/rhysd/actionlint/issues/571
labels: ["windows-11-arm", "macos-15-intel"]
config-variables: null

View file

@ -15,7 +15,13 @@ permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-reusable
# https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#concurrency
# 'group' must be a key uniquely representing a PR or push event.
# github.workflow is the workflow name
# github.actor is the user invoking the workflow
# github.head_ref is the source branch of the PR or otherwise blank
# github.run_id is a unique number for the current run
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
@ -43,6 +49,53 @@ jobs:
if: fromJSON(needs.build-context.outputs.run-docs)
uses: ./.github/workflows/reusable-docs.yml
check-abi:
name: 'Check if the ABI has changed'
runs-on: ubuntu-22.04 # 24.04 causes spurious errors
needs: build-context
if: needs.build-context.outputs.run-tests == 'true'
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
sudo ./.github/workflows/posix-deps-apt.sh
sudo apt-get install -yq abigail-tools
- name: Build CPython
env:
CFLAGS: -g3 -O0
run: |
# Build Python with the libpython dynamic library
./configure --enable-shared
make -j4
- name: Check for changes in the ABI
id: check
run: |
if ! make check-abidump; then
echo "Generated ABI file is not up to date."
echo "Please add the release manager of this branch as a reviewer of this PR."
echo ""
echo "The up to date ABI file should be attached to this build as an artifact."
echo ""
echo "To learn more about this check: https://devguide.python.org/getting-started/setup-building/index.html#regenerate-the-abi-dump"
echo ""
exit 1
fi
- name: Generate updated ABI files
if: ${{ failure() && steps.check.conclusion == 'failure' }}
run: |
make regen-abidump
- uses: actions/upload-artifact@v4
name: Publish updated ABI files
if: ${{ failure() && steps.check.conclusion == 'failure' }}
with:
name: abi-data
path: ./Doc/data/*.abi
check-autoconf-regen:
name: 'Check if Autoconf files are up to date'
# Don't use ubuntu-latest but a specific version to make the job
@ -103,20 +156,10 @@ jobs:
python-version: '3.x'
- name: Runner image version
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
- name: Restore config.cache
uses: actions/cache@v4
with:
path: config.cache
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}-${{ env.pythonLocation }}
- name: Install dependencies
run: sudo ./.github/workflows/posix-deps-apt.sh
- name: Add ccache to PATH
run: echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
- name: Configure ccache action
uses: hendrikmuhs/ccache-action@v1.2
with:
save: false
- name: Configure CPython
run: |
# Build Python with the libpython dynamic library
@ -124,7 +167,7 @@ jobs:
- name: Build CPython
run: |
make -j4 regen-all
make regen-stdlib-module-names regen-sbom regen-unicodedata
make regen-stdlib-module-names regen-sbom
- name: Check for changes
run: |
git add -u
@ -172,8 +215,8 @@ jobs:
free-threading: ${{ matrix.free-threading }}
build-windows-msi:
name: >- # ${{ '' } is a hack to nest jobs under the same sidebar category
Windows MSI${{ '' }}
# ${{ '' } is a hack to nest jobs under the same sidebar category.
name: Windows MSI${{ '' }} # zizmor: ignore[obfuscation]
needs: build-context
if: fromJSON(needs.build-context.outputs.run-windows-msi)
strategy:
@ -196,28 +239,19 @@ jobs:
strategy:
fail-fast: false
matrix:
# Cirrus and macos-14 are M1, macos-13 is default GHA Intel.
# macOS 13 only runs tests against the GIL-enabled CPython.
# Cirrus used for upstream, macos-14 for forks.
# macos-14 is M1, macos-15-intel is Intel.
# macos-15-intel only runs tests against the GIL-enabled CPython.
os:
- ghcr.io/cirruslabs/macos-runner:sonoma
- macos-14
- macos-13
is-fork: # only used for the exclusion trick
- ${{ github.repository_owner != 'python' }}
- macos-15-intel
free-threading:
- false
- true
exclude:
- os: ghcr.io/cirruslabs/macos-runner:sonoma
is-fork: true
- os: macos-14
is-fork: false
- os: macos-13
- os: macos-15-intel
free-threading: true
uses: ./.github/workflows/reusable-macos.yml
with:
config_hash: ${{ needs.build-context.outputs.config-hash }}
free-threading: ${{ matrix.free-threading }}
os: ${{ matrix.os }}
@ -249,7 +283,6 @@ jobs:
bolt: true
uses: ./.github/workflows/reusable-ubuntu.yml
with:
config_hash: ${{ needs.build-context.outputs.config-hash }}
bolt-optimizations: ${{ matrix.bolt }}
free-threading: ${{ matrix.free-threading }}
os: ${{ matrix.os }}
@ -264,7 +297,10 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-24.04]
openssl_ver: [3.0.16, 3.1.8, 3.2.4, 3.3.3, 3.4.1]
# Keep 1.1.1w in our list despite it being upstream EOL and otherwise
# unsupported as it most resembles other 1.1.1-work-a-like ssl APIs
# supported by important vendors such as AWS-LC.
openssl_ver: [1.1.1w, 3.0.18, 3.2.6, 3.3.5, 3.4.3, 3.5.4]
# See Tools/ssl/make_ssl_data.py for notes on adding a new version
env:
OPENSSL_VER: ${{ matrix.openssl_ver }}
@ -277,11 +313,6 @@ jobs:
persist-credentials: false
- name: Runner image version
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
- name: Restore config.cache
uses: actions/cache@v4
with:
path: config.cache
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
- name: Register gcc problem matcher
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
- name: Install dependencies
@ -303,10 +334,6 @@ jobs:
- name: Add ccache to PATH
run: |
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
- name: Configure ccache action
uses: hendrikmuhs/ccache-action@v1.2
with:
save: false
- name: Configure CPython
run: ./configure CFLAGS="-fdiagnostics-format=json" --config-cache --enable-slower-safety --with-pydebug --with-openssl="$OPENSSL_DIR"
- name: Build CPython
@ -316,13 +343,56 @@ jobs:
- name: SSL tests
run: ./python Lib/test/ssltests.py
build-android:
name: Android (${{ matrix.arch }})
needs: build-context
if: needs.build-context.outputs.run-tests == 'true'
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- arch: aarch64
runs-on: macos-14
- arch: x86_64
runs-on: ubuntu-24.04
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Build and test
run: ./Android/android.py ci --fast-ci ${{ matrix.arch }}-linux-android
build-ios:
name: iOS
needs: build-context
if: needs.build-context.outputs.run-tests == 'true'
timeout-minutes: 60
runs-on: macos-15
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
# GitHub recommends explicitly selecting the desired Xcode version:
# https://github.com/actions/runner-images/issues/12541#issuecomment-3083850140
# This became a necessity as a result of
# https://github.com/actions/runner-images/issues/12541 and
# https://github.com/actions/runner-images/issues/12751.
- name: Select Xcode version
run: |
sudo xcode-select --switch /Applications/Xcode_16.4.app
- name: Build and test
run: python3 Apple ci iOS --fast-ci --simulator 'iPhone 16e,OS=18.5'
build-wasi:
name: 'WASI'
needs: build-context
if: needs.build-context.outputs.run-tests == 'true'
uses: ./.github/workflows/reusable-wasi.yml
with:
config_hash: ${{ needs.build-context.outputs.config-hash }}
test-hypothesis:
name: "Hypothesis tests on Ubuntu"
@ -331,7 +401,7 @@ jobs:
needs: build-context
if: needs.build-context.outputs.run-tests == 'true'
env:
OPENSSL_VER: 3.0.16
OPENSSL_VER: 3.0.18
PYTHONSTRICTEXTENSIONBUILD: 1
steps:
- uses: actions/checkout@v4
@ -358,10 +428,6 @@ jobs:
- name: Add ccache to PATH
run: |
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
- name: Configure ccache action
uses: hendrikmuhs/ccache-action@v1.2
with:
save: false
- name: Setup directory envs for out-of-tree builds
run: |
echo "CPYTHON_RO_SRCDIR=$(realpath -m "${GITHUB_WORKSPACE}"/../cpython-ro-srcdir)" >> "$GITHUB_ENV"
@ -372,11 +438,6 @@ jobs:
run: sudo mount --bind -o ro "$GITHUB_WORKSPACE" "$CPYTHON_RO_SRCDIR"
- name: Runner image version
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
- name: Restore config.cache
uses: actions/cache@v4
with:
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
- name: Configure CPython out-of-tree
working-directory: ${{ env.CPYTHON_BUILDDIR }}
run: |
@ -451,7 +512,7 @@ jobs:
matrix:
os: [ubuntu-24.04]
env:
OPENSSL_VER: 3.0.16
OPENSSL_VER: 3.0.18
PYTHONSTRICTEXTENSIONBUILD: 1
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
steps:
@ -460,11 +521,6 @@ jobs:
persist-credentials: false
- name: Runner image version
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
- name: Restore config.cache
uses: actions/cache@v4
with:
path: config.cache
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
- name: Register gcc problem matcher
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
- name: Install dependencies
@ -490,11 +546,6 @@ jobs:
- name: Add ccache to PATH
run: |
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
- name: Configure ccache action
uses: hendrikmuhs/ccache-action@v1.2
with:
save: ${{ github.event_name == 'push' }}
max-size: "200M"
- name: Configure CPython
run: ./configure --config-cache --with-address-sanitizer --without-pymalloc
- name: Build CPython
@ -504,21 +555,28 @@ jobs:
- name: Tests
run: xvfb-run make ci
build-tsan:
name: >-
Thread sanitizer
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
build-san:
# ${{ '' } is a hack to nest jobs under the same sidebar category.
name: Sanitizers${{ '' }} # zizmor: ignore[obfuscation]
needs: build-context
if: needs.build-context.outputs.run-tests == 'true'
strategy:
fail-fast: false
matrix:
check-name:
- Thread
free-threading:
- false
- true
uses: ./.github/workflows/reusable-tsan.yml
sanitizer:
- TSan
include:
- check-name: Undefined behavior
sanitizer: UBSan
free-threading: false
uses: ./.github/workflows/reusable-san.yml
with:
config_hash: ${{ needs.build-context.outputs.config-hash }}
sanitizer: ${{ matrix.sanitizer }}
free-threading: ${{ matrix.free-threading }}
cross-build-linux:
@ -533,11 +591,6 @@ jobs:
persist-credentials: false
- name: Runner image version
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
- name: Restore config.cache
uses: actions/cache@v4
with:
path: config.cache
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
- name: Register gcc problem matcher
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
- name: Set build dir
@ -615,10 +668,12 @@ jobs:
- build-macos
- build-ubuntu
- build-ubuntu-ssltests
- build-android
- build-ios
- build-wasi
- test-hypothesis
- build-asan
- build-tsan
- build-san
- cross-build-linux
- cifuzz
if: always()
@ -648,10 +703,12 @@ jobs:
build-macos,
build-ubuntu,
build-ubuntu-ssltests,
build-android,
build-ios,
build-wasi,
test-hypothesis,
build-asan,
build-tsan,
build-san,
cross-build-linux,
'
|| ''

View file

@ -68,16 +68,16 @@ jobs:
include:
- target: i686-pc-windows-msvc/msvc
architecture: Win32
runner: windows-latest
runner: windows-2022
- target: x86_64-pc-windows-msvc/msvc
architecture: x64
runner: windows-latest
runner: windows-2022
- target: aarch64-pc-windows-msvc/msvc
architecture: ARM64
runner: windows-11-arm
- target: x86_64-apple-darwin/clang
architecture: x86_64
runner: macos-13
runner: macos-15-intel
- target: aarch64-apple-darwin/clang
architecture: aarch64
runner: macos-14
@ -102,17 +102,16 @@ jobs:
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }}
./PCbuild/rt.bat ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
# The `find` line is required as a result of https://github.com/actions/runner-images/issues/9966.
# This is a bug in the macOS runner image where the pre-installed Python is installed in the same
# directory as the Homebrew Python, which causes the build to fail for macos-13. This line removes
# the symlink to the pre-installed Python so that the Homebrew Python is used instead.
- name: macOS
if: runner.os == 'macOS'
run: |
brew update
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
brew install llvm@${{ matrix.llvm }}
export SDKROOT="$(xcrun --show-sdk-path)"
# Set MACOSX_DEPLOYMENT_TARGET and -Werror=unguarded-availability to
# make sure we don't break downstream distributors (like uv):
export CFLAGS_JIT='-Werror=unguarded-availability'
export MACOSX_DEPLOYMENT_TARGET=10.15
./configure --enable-experimental-jit --enable-universalsdk --with-universal-archs=universal2 ${{ matrix.debug && '--with-pydebug' || '' }}
make all --jobs 4
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
@ -153,3 +152,26 @@ jobs:
# - name: Run tests
# run: |
# ./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
tail-call-jit:
name: JIT with tail calling interpreter
needs: interpreter
runs-on: ubuntu-24.04
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
llvm:
- 19
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build with JIT and tailcall
run: |
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
CC=clang-${{ matrix.llvm }} ./configure --enable-experimental-jit --with-tail-call-interp --with-pydebug
make all --jobs 4

View file

@ -13,13 +13,22 @@ on:
- "Lib/test/libregrtest/**"
- "Lib/tomllib/**"
- "Misc/mypy/**"
- "Tools/build/check_extension_modules.py"
- "Tools/build/check_warnings.py"
- "Tools/build/compute-changes.py"
- "Tools/build/deepfreeze.py"
- "Tools/build/generate-build-details.py"
- "Tools/build/generate_sbom.py"
- "Tools/build/generate_stdlib_module_names.py"
- "Tools/build/mypy.ini"
- "Tools/build/umarshal.py"
- "Tools/build/update_file.py"
- "Tools/build/verify_ensurepip_wheels.py"
- "Tools/cases_generator/**"
- "Tools/clinic/**"
- "Tools/jit/**"
- "Tools/peg_generator/**"
- "Tools/requirements-dev.txt"
- "Tools/wasm/**"
workflow_dispatch:
permissions:
@ -51,7 +60,6 @@ jobs:
"Tools/clinic",
"Tools/jit",
"Tools/peg_generator",
"Tools/wasm",
]
steps:
- uses: actions/checkout@v4

View file

@ -17,6 +17,7 @@ apt-get -yq install \
libreadline6-dev \
libsqlite3-dev \
libssl-dev \
libzstd-dev \
lzma \
lzma-dev \
strace \

View file

@ -17,9 +17,6 @@ on: # yamllint disable-line rule:truthy
# || 'falsy-branch'
# }}
#
config-hash:
description: Config hash value for use in cache keys
value: ${{ jobs.compute-changes.outputs.config-hash }} # str
run-docs:
description: Whether to build the docs
value: ${{ jobs.compute-changes.outputs.run-docs }} # bool
@ -42,7 +39,6 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
config-hash: ${{ steps.config-hash.outputs.hash }}
run-ci-fuzz: ${{ steps.changes.outputs.run-ci-fuzz }}
run-docs: ${{ steps.changes.outputs.run-docs }}
run-tests: ${{ steps.changes.outputs.run-tests }}
@ -97,10 +93,6 @@ jobs:
run: python Tools/build/compute-changes.py
env:
GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
CCF_TARGET_REF: ${{ github.base_ref || github.event.repository.default_branch }}
CCF_HEAD_REF: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Compute hash for config cache key
id: config-hash
run: |
echo "hash=${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}" >> "$GITHUB_OUTPUT"

View file

@ -66,7 +66,7 @@ jobs:
run: |
set -Eeuo pipefail
# Build docs with the nit-picky option; write warnings to file
make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet --nitpicky --fail-on-warning --warning-file sphinx-warnings.txt" html
make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet --nitpicky --warning-file sphinx-warnings.txt" html
- name: 'Check warnings'
if: github.event_name == 'pull_request'
run: |
@ -102,3 +102,30 @@ jobs:
# Use "xvfb-run" since some doctest tests open GUI windows
- name: 'Run documentation doctest'
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXERRORHANDLING="--fail-on-warning" doctest
check-epub:
name: 'Check EPUB'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3'
cache: 'pip'
cache-dependency-path: 'Doc/requirements.txt'
- name: 'Install build dependencies'
run: |
make -C Doc/ venv
python -m pip install epubcheck
- name: 'Build EPUB documentation'
run: make -C Doc/ PYTHON=../python epub
- name: 'Run epubcheck'
continue-on-error: true
run: epubcheck Doc/build/epub/Python.epub &> Doc/epubcheck.txt
- run: cat Doc/epubcheck.txt
- name: 'Check for fatal errors in EPUB'
run: python Doc/tools/check-epub.py

View file

@ -3,9 +3,6 @@ name: Reusable macOS
on:
workflow_call:
inputs:
config_hash:
required: true
type: string
free-threading:
required: false
type: boolean
@ -36,11 +33,6 @@ jobs:
persist-credentials: false
- name: Runner image version
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
- name: Restore config.cache
uses: actions/cache@v4
with:
path: config.cache
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ inputs.config_hash }}
- name: Install Homebrew dependencies
run: |
brew install pkg-config openssl@3.0 xz gdbm tcl-tk@8 make
@ -60,15 +52,15 @@ jobs:
--prefix=/opt/python-dev \
--with-openssl="$(brew --prefix openssl@3.0)"
- name: Build CPython
if : ${{ inputs.free-threading || inputs.os != 'macos-13' }}
if : ${{ inputs.free-threading || inputs.os != 'macos-15-intel' }}
run: gmake -j8
- name: Build CPython for compiler warning check
if : ${{ !inputs.free-threading && inputs.os == 'macos-13' }}
if : ${{ !inputs.free-threading && inputs.os == 'macos-15-intel' }}
run: set -o pipefail; gmake -j8 --output-sync 2>&1 | tee compiler_output_macos.txt
- name: Display build info
run: make pythoninfo
- name: Check compiler warnings
if : ${{ !inputs.free-threading && inputs.os == 'macos-13' }}
if : ${{ !inputs.free-threading && inputs.os == 'macos-15-intel' }}
run: >-
python3 Tools/build/check_warnings.py
--compiler-output-file-path=compiler_output_macos.txt

111
.github/workflows/reusable-san.yml vendored Normal file
View file

@ -0,0 +1,111 @@
name: Reusable Sanitizer
on:
workflow_call:
inputs:
sanitizer:
required: true
type: string
free-threading:
description: Whether to use free-threaded mode
required: false
type: boolean
default: false
env:
FORCE_COLOR: 1
jobs:
build-san-reusable:
name: >-
${{ inputs.sanitizer }}${{
inputs.free-threading
&& ' (free-threading)'
|| ''
}}
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Runner image version
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
- name: Install dependencies
run: |
sudo ./.github/workflows/posix-deps-apt.sh
# Install clang
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
if [ "${SANITIZER}" = "TSan" ]; then
sudo ./llvm.sh 17 # gh-121946: llvm-18 package is temporarily broken
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 100
sudo update-alternatives --set clang /usr/bin/clang-17
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 100
sudo update-alternatives --set clang++ /usr/bin/clang++-17
# Reduce ASLR to avoid TSan crashing
sudo sysctl -w vm.mmap_rnd_bits=28
else
sudo ./llvm.sh 20
fi
- name: Sanitizer option setup
run: |
if [ "${SANITIZER}" = "TSan" ]; then
echo "TSAN_OPTIONS=${SAN_LOG_OPTION} suppressions=${GITHUB_WORKSPACE}/Tools/tsan/suppressions${{
fromJSON(inputs.free-threading)
&& '_free_threading'
|| ''
}}.txt handle_segv=0" >> "$GITHUB_ENV"
else
echo "UBSAN_OPTIONS=${SAN_LOG_OPTION}" >> "$GITHUB_ENV"
fi
echo "CC=clang" >> "$GITHUB_ENV"
echo "CXX=clang++" >> "$GITHUB_ENV"
env:
SANITIZER: ${{ inputs.sanitizer }}
SAN_LOG_OPTION: log_path=${{ github.workspace }}/san_log
- name: Add ccache to PATH
run: |
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
- name: Configure CPython
run: >-
./configure
--config-cache
${{
inputs.sanitizer == 'TSan'
&& '--with-thread-sanitizer'
|| '--with-undefined-behavior-sanitizer'
}}
--with-pydebug
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
- name: Build CPython
run: make -j4
- name: Display build info
run: make pythoninfo
- name: Tests
run: >-
./python -m test
${{ inputs.sanitizer == 'TSan' && '--tsan' || '' }}
-j4
- name: Parallel tests
if: >-
inputs.sanitizer == 'TSan'
&& fromJSON(inputs.free-threading)
run: ./python -m test --tsan-parallel --parallel-threads=4 -j4
- name: Display logs
if: always()
run: find "${GITHUB_WORKSPACE}" -name 'san_log.*' | xargs head -n 1000
- name: Archive logs
if: always()
uses: actions/upload-artifact@v4
with:
name: >-
${{ inputs.sanitizer }}-logs-${{
fromJSON(inputs.free-threading)
&& 'free-threading'
|| 'default'
}}
path: san_log.*
if-no-files-found: ignore

View file

@ -1,94 +0,0 @@
name: Reusable Thread Sanitizer
on:
workflow_call:
inputs:
config_hash:
required: true
type: string
free-threading:
description: Whether to use free-threaded mode
required: false
type: boolean
default: false
env:
FORCE_COLOR: 1
jobs:
build-tsan-reusable:
name: 'Thread sanitizer'
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Runner image version
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
- name: Restore config.cache
uses: actions/cache@v4
with:
path: config.cache
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ inputs.config_hash }}
- name: Install dependencies
run: |
sudo ./.github/workflows/posix-deps-apt.sh
# Install clang-18
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17 # gh-121946: llvm-18 package is temporarily broken
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 100
sudo update-alternatives --set clang /usr/bin/clang-17
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 100
sudo update-alternatives --set clang++ /usr/bin/clang++-17
# Reduce ASLR to avoid TSAN crashing
sudo sysctl -w vm.mmap_rnd_bits=28
- name: TSAN option setup
run: |
echo "TSAN_OPTIONS=log_path=${GITHUB_WORKSPACE}/tsan_log suppressions=${GITHUB_WORKSPACE}/Tools/tsan/suppressions${{
fromJSON(inputs.free-threading)
&& '_free_threading'
|| ''
}}.txt handle_segv=0" >> "$GITHUB_ENV"
echo "CC=clang" >> "$GITHUB_ENV"
echo "CXX=clang++" >> "$GITHUB_ENV"
- name: Add ccache to PATH
run: |
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
- name: Configure ccache action
uses: hendrikmuhs/ccache-action@v1.2
with:
save: ${{ github.event_name == 'push' }}
max-size: "200M"
- name: Configure CPython
run: >-
./configure
--config-cache
--with-thread-sanitizer
--with-pydebug
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
- name: Build CPython
run: make -j4
- name: Display build info
run: make pythoninfo
- name: Tests
run: ./python -m test --tsan -j4
- name: Parallel tests
if: fromJSON(inputs.free-threading)
run: ./python -m test --tsan-parallel --parallel-threads=4 -j4
- name: Display TSAN logs
if: always()
run: find "${GITHUB_WORKSPACE}" -name 'tsan_log.*' | xargs head -n 1000
- name: Archive TSAN logs
if: always()
uses: actions/upload-artifact@v4
with:
name: >-
tsan-logs-${{
fromJSON(inputs.free-threading)
&& 'free-threading'
|| 'default'
}}
path: tsan_log.*
if-no-files-found: ignore

View file

@ -3,9 +3,6 @@ name: Reusable Ubuntu
on:
workflow_call:
inputs:
config_hash:
required: true
type: string
bolt-optimizations:
description: Whether to enable BOLT optimizations
required: false
@ -30,7 +27,7 @@ jobs:
runs-on: ${{ inputs.os }}
timeout-minutes: 60
env:
OPENSSL_VER: 3.0.15
OPENSSL_VER: 3.0.18
PYTHONSTRICTEXTENSIONBUILD: 1
TERM: linux
steps:
@ -64,11 +61,6 @@ jobs:
- name: Add ccache to PATH
run: |
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
- name: Configure ccache action
uses: hendrikmuhs/ccache-action@v1.2
with:
save: ${{ github.event_name == 'push' }}
max-size: "200M"
- name: Setup directory envs for out-of-tree builds
run: |
echo "CPYTHON_RO_SRCDIR=$(realpath -m "${GITHUB_WORKSPACE}"/../cpython-ro-srcdir)" >> "$GITHUB_ENV"
@ -79,11 +71,6 @@ jobs:
run: sudo mount --bind -o ro "$GITHUB_WORKSPACE" "$CPYTHON_RO_SRCDIR"
- name: Runner image version
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
- name: Restore config.cache
uses: actions/cache@v4
with:
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ inputs.config_hash }}
- name: Configure CPython out-of-tree
working-directory: ${{ env.CPYTHON_BUILDDIR }}
# `test_unpickle_module_race` writes to the source directory, which is

View file

@ -2,10 +2,6 @@ name: Reusable WASI
on:
workflow_call:
inputs:
config_hash:
required: true
type: string
env:
FORCE_COLOR: 1
@ -42,11 +38,6 @@ jobs:
mkdir "${WASI_SDK_PATH}" && \
curl -s -S --location "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-x86_64-linux.tar.gz" | \
tar --strip-components 1 --directory "${WASI_SDK_PATH}" --extract --gunzip
- name: "Configure ccache action"
uses: hendrikmuhs/ccache-action@v1.2
with:
save: ${{ github.event_name == 'push' }}
max-size: "200M"
- name: "Add ccache to PATH"
run: echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
- name: "Install Python"
@ -55,29 +46,15 @@ jobs:
python-version: '3.x'
- name: "Runner image version"
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
- name: "Restore Python build config.cache"
uses: actions/cache@v4
with:
path: ${{ env.CROSS_BUILD_PYTHON }}/config.cache
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python.
# Include the hash of `Tools/wasm/wasi.py` as it may change the environment variables.
# (Make sure to keep the key in sync with the other config.cache step below.)
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ env.WASI_SDK_VERSION }}-${{ env.WASMTIME_VERSION }}-${{ inputs.config_hash }}-${{ hashFiles('Tools/wasm/wasi.py') }}-${{ env.pythonLocation }}
- name: "Configure build Python"
run: python3 Tools/wasm/wasi.py configure-build-python -- --config-cache --with-pydebug
run: python3 Tools/wasm/wasi configure-build-python -- --config-cache --with-pydebug
- name: "Make build Python"
run: python3 Tools/wasm/wasi.py make-build-python
- name: "Restore host config.cache"
uses: actions/cache@v4
with:
path: ${{ env.CROSS_BUILD_WASI }}/config.cache
# Should be kept in sync with the other config.cache step above.
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ env.WASI_SDK_VERSION }}-${{ env.WASMTIME_VERSION }}-${{ inputs.config_hash }}-${{ hashFiles('Tools/wasm/wasi.py') }}-${{ env.pythonLocation }}
run: python3 Tools/wasm/wasi make-build-python
- name: "Configure host"
# `--with-pydebug` inferred from configure-build-python
run: python3 Tools/wasm/wasi.py configure-host -- --config-cache
run: python3 Tools/wasm/wasi configure-host -- --config-cache
- name: "Make host"
run: python3 Tools/wasm/wasi.py make-host
run: python3 Tools/wasm/wasi make-host
- name: "Display build info"
run: make --directory "${CROSS_BUILD_WASI}" pythoninfo
- name: "Test"

View file

@ -17,7 +17,7 @@ env:
jobs:
build:
name: installer for ${{ inputs.arch }}
runs-on: ${{ inputs.arch == 'arm64' && 'windows-11-arm' || 'windows-latest' }}
runs-on: ${{ inputs.arch == 'arm64' && 'windows-11-arm' || 'windows-2022' }}
timeout-minutes: 60
env:
ARCH: ${{ inputs.arch }}

View file

@ -21,7 +21,7 @@ env:
jobs:
build:
name: Build and test (${{ inputs.arch }})
runs-on: ${{ inputs.arch == 'arm64' && 'windows-11-arm' || 'windows-latest' }}
runs-on: ${{ inputs.arch == 'arm64' && 'windows-11-arm' || 'windows-2022' }}
timeout-minutes: 60
env:
ARCH: ${{ inputs.arch }}

View file

@ -49,16 +49,16 @@ jobs:
include:
# - target: i686-pc-windows-msvc/msvc
# architecture: Win32
# runner: windows-latest
# runner: windows-2022
- target: x86_64-pc-windows-msvc/msvc
architecture: x64
runner: windows-latest
runner: windows-2022
# - target: aarch64-pc-windows-msvc/msvc
# architecture: ARM64
# runner: windows-latest
# runner: windows-2022
- target: x86_64-apple-darwin/clang
architecture: x86_64
runner: macos-13
runner: macos-15-intel
- target: aarch64-apple-darwin/clang
architecture: aarch64
runner: macos-14
@ -101,21 +101,14 @@ jobs:
set LLVMInstallDir=C:\Program Files\LLVM
./PCbuild/build.bat --tail-call-interp -p ${{ matrix.architecture }}
# The `find` line is required as a result of https://github.com/actions/runner-images/issues/9966.
# This is a bug in the macOS runner image where the pre-installed Python is installed in the same
# directory as the Homebrew Python, which causes the build to fail for macos-13. This line removes
# the symlink to the pre-installed Python so that the Homebrew Python is used instead.
# Note: when a new LLVM is released, the homebrew installation directory changes, so the builds will fail.
# We either need to upgrade LLVM or change the directory being pointed to.
- name: Native macOS (release)
if: runner.os == 'macOS'
run: |
brew update
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
brew install llvm@${{ matrix.llvm }}
export SDKROOT="$(xcrun --show-sdk-path)"
export PATH="/usr/local/opt/llvm/bin:$PATH"
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
export PATH="/usr/local/opt/llvm@${{ matrix.llvm }}/bin:$PATH"
export PATH="/opt/homebrew/opt/llvm@${{ matrix.llvm }}/bin:$PATH"
CC=clang-20 ./configure --with-tail-call-interp
make all --jobs 4
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
@ -137,4 +130,3 @@ jobs:
CC=clang-20 ./configure --with-tail-call-interp --disable-gil
make all --jobs 4
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3

25
.gitignore vendored
View file

@ -71,16 +71,15 @@ Lib/test/data/*
/Makefile
/Makefile.pre
/iOSTestbed.*
iOS/Frameworks/
iOS/Resources/Info.plist
iOS/testbed/build
iOS/testbed/Python.xcframework/ios-*/bin
iOS/testbed/Python.xcframework/ios-*/include
iOS/testbed/Python.xcframework/ios-*/lib
iOS/testbed/Python.xcframework/ios-*/Python.framework
iOS/testbed/iOSTestbed.xcodeproj/project.xcworkspace
iOS/testbed/iOSTestbed.xcodeproj/xcuserdata
iOS/testbed/iOSTestbed.xcodeproj/xcshareddata
Apple/iOS/Frameworks/
Apple/iOS/Resources/Info.plist
Apple/testbed/build
Apple/testbed/Python.xcframework/*/bin
Apple/testbed/Python.xcframework/*/include
Apple/testbed/Python.xcframework/*/lib
Apple/testbed/Python.xcframework/*/Python.framework
Apple/testbed/*Testbed.xcodeproj/project.xcworkspace
Apple/testbed/*Testbed.xcodeproj/xcuserdata
Mac/Makefile
Mac/PythonLauncher/Info.plist
Mac/PythonLauncher/Makefile
@ -135,7 +134,6 @@ Tools/unicode/data/
/config.log
/config.status
/config.status.lineno
# hendrikmuhs/ccache-action@v1
/.ccache
/cross-build/
/jit_stencils*.h
@ -171,5 +169,6 @@ Python/frozen_modules/MANIFEST
/python
!/Python/
# main branch only: ABI files are not checked/maintained.
Doc/data/python*.abi
# People's custom https://docs.anthropic.com/en/docs/claude-code/memory configs.
/.claude/
CLAUDE.local.md

View file

@ -1,23 +1,43 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.8
rev: v0.13.2
hooks:
- id: ruff
- id: ruff-check
name: Run Ruff (lint) on Apple/
args: [--exit-non-zero-on-fix, --config=Apple/.ruff.toml]
files: ^Apple/
- id: ruff-check
name: Run Ruff (lint) on Doc/
args: [--exit-non-zero-on-fix]
files: ^Doc/
- id: ruff
- id: ruff-check
name: Run Ruff (lint) on Lib/test/
args: [--exit-non-zero-on-fix]
files: ^Lib/test/
- id: ruff
- id: ruff-check
name: Run Ruff (lint) on Tools/build/
args: [--exit-non-zero-on-fix, --config=Tools/build/.ruff.toml]
files: ^Tools/build/
- id: ruff
- id: ruff-check
name: Run Ruff (lint) on Tools/i18n/
args: [--exit-non-zero-on-fix, --config=Tools/i18n/.ruff.toml]
files: ^Tools/i18n/
- id: ruff-check
name: Run Ruff (lint) on Argument Clinic
args: [--exit-non-zero-on-fix, --config=Tools/clinic/.ruff.toml]
files: ^Tools/clinic/|Lib/test/test_clinic.py
- id: ruff-check
name: Run Ruff (lint) on Tools/peg_generator/
args: [--exit-non-zero-on-fix, --config=Tools/peg_generator/.ruff.toml]
files: ^Tools/peg_generator/
- id: ruff-check
name: Run Ruff (lint) on Tools/wasm/
args: [--exit-non-zero-on-fix, --config=Tools/wasm/.ruff.toml]
files: ^Tools/wasm/
- id: ruff-format
name: Run Ruff (format) on Apple/
args: [--exit-non-zero-on-fix, --config=Apple/.ruff.toml]
files: ^Apple
- id: ruff-format
name: Run Ruff (format) on Doc/
args: [--check]
@ -26,16 +46,26 @@ repos:
name: Run Ruff (format) on Tools/build/check_warnings.py
args: [--check, --config=Tools/build/.ruff.toml]
files: ^Tools/build/check_warnings.py
- id: ruff-format
name: Run Ruff (format) on Tools/wasm/
args: [--check, --config=Tools/wasm/.ruff.toml]
files: ^Tools/wasm/
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.1.0
rev: 25.9.0
hooks:
- id: black
name: Run Black on Tools/jit/
files: ^Tools/jit/
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
hooks:
- id: remove-tabs
types: [python]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
@ -43,13 +73,17 @@ repos:
exclude: ^Lib/test/test_tomllib/
- id: check-yaml
- id: end-of-file-fixer
types: [python]
types_or: [python, yaml]
exclude: Lib/test/tokenizedata/coding20731.py
- id: end-of-file-fixer
files: '^\.github/CODEOWNERS$'
- id: trailing-whitespace
types_or: [c, inc, python, rst]
types_or: [c, inc, python, rst, yaml]
- id: trailing-whitespace
files: '^\.github/CODEOWNERS|\.(gram)$'
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.33.0
rev: 0.34.0
hooks:
- id: check-dependabot
- id: check-github-workflows
@ -61,7 +95,7 @@ repos:
- id: actionlint
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.6.0
rev: v1.14.1
hooks:
- id: zizmor

View file

@ -32,4 +32,3 @@ build:
- make -C Doc venv html
- mkdir _readthedocs
- mv Doc/build/html _readthedocs/html

View file

@ -96,10 +96,12 @@ ## Packaging
## Testing
The Python test suite can be run on Linux, macOS, or Windows:
The Python test suite can be run on Linux, macOS, or Windows.
* On Linux, the emulator needs access to the KVM virtualization interface, and
a DISPLAY environment variable pointing at an X server. Xvfb is acceptable.
On Linux, the emulator needs access to the KVM virtualization interface. This may
require adding your user to a group, or changing your udev rules. On GitHub
Actions, the test script will do this automatically using the commands shown
[here](https://github.blog/changelog/2024-04-02-github-actions-hardware-accelerated-android-virtualization-now-available/).
The test suite can usually be run on a device with 2 GB of RAM, but this is
borderline, so you may need to increase it to 4 GB. As of Android
@ -156,6 +158,10 @@ ## Testing
and architecture-specific files such as sysconfigdata, will not take effect
until you re-run `android.py make-host` or `build`.
The testbed app can also be used to test third-party packages. For more details,
run `android.py test --help`, paying attention to the options `--site-packages`,
`--cwd`, `-c` and `-m`.
## Using in your own app

View file

@ -3,7 +3,7 @@
: "${HOST:?}" # GNU target triplet
# You may also override the following:
: "${api_level:=24}" # Minimum Android API level the build will run on
: "${ANDROID_API_LEVEL:=24}" # Minimum Android API level the build will run on
: "${PREFIX:-}" # Path in which to find required libraries
@ -24,7 +24,7 @@ fail() {
# * https://android.googlesource.com/platform/ndk/+/ndk-rXX-release/docs/BuildSystemMaintainers.md
# where XX is the NDK version. Do a diff against the version you're upgrading from, e.g.:
# https://android.googlesource.com/platform/ndk/+/ndk-r25-release..ndk-r26-release/docs/BuildSystemMaintainers.md
ndk_version=27.1.12297006
ndk_version=27.3.13750724
ndk=$ANDROID_HOME/ndk/$ndk_version
if ! [ -e "$ndk" ]; then
@ -43,7 +43,7 @@ fi
toolchain=$(echo "$ndk"/toolchains/llvm/prebuilt/*)
export AR="$toolchain/bin/llvm-ar"
export AS="$toolchain/bin/llvm-as"
export CC="$toolchain/bin/${clang_triplet}${api_level}-clang"
export CC="$toolchain/bin/${clang_triplet}${ANDROID_API_LEVEL}-clang"
export CXX="${CC}++"
export LD="$toolchain/bin/ld"
export NM="$toolchain/bin/llvm-nm"

View file

@ -2,7 +2,9 @@
import asyncio
import argparse
import json
import os
import platform
import re
import shlex
import shutil
@ -14,7 +16,7 @@
from contextlib import asynccontextmanager
from datetime import datetime, timezone
from glob import glob
from os.path import basename, relpath
from os.path import abspath, basename, relpath
from pathlib import Path
from subprocess import CalledProcessError
from tempfile import TemporaryDirectory
@ -22,9 +24,13 @@
SCRIPT_NAME = Path(__file__).name
ANDROID_DIR = Path(__file__).resolve().parent
CHECKOUT = ANDROID_DIR.parent
PYTHON_DIR = ANDROID_DIR.parent
in_source_tree = (
ANDROID_DIR.name == "Android" and (PYTHON_DIR / "pyconfig.h.in").exists()
)
TESTBED_DIR = ANDROID_DIR / "testbed"
CROSS_BUILD_DIR = CHECKOUT / "cross-build"
CROSS_BUILD_DIR = PYTHON_DIR / "cross-build"
HOSTS = ["aarch64-linux-android", "x86_64-linux-android"]
APP_ID = "org.python.testbed"
@ -46,7 +52,19 @@
+ (".bat" if os.name == "nt" else "")
)
logcat_started = False
# Whether we've seen any output from Python yet.
python_started = False
# Buffer for verbose output which will be displayed only if a test fails and
# there has been no output from Python.
hidden_output = []
def log_verbose(context, line, stream=sys.stdout):
if context.verbose:
stream.write(line)
else:
hidden_output.append((stream, line))
def delete_glob(pattern):
@ -76,39 +94,68 @@ def run(command, *, host=None, env=None, log=True, **kwargs):
kwargs.setdefault("check", True)
if env is None:
env = os.environ.copy()
original_env = env.copy()
if host:
env_script = ANDROID_DIR / "android-env.sh"
env_output = subprocess.run(
f"set -eu; "
f"HOST={host}; "
f"PREFIX={subdir(host)}/prefix; "
f". {env_script}; "
f"export",
check=True, shell=True, text=True, stdout=subprocess.PIPE
).stdout
for line in env_output.splitlines():
# We don't require every line to match, as there may be some other
# output from installing the NDK.
if match := re.search(
"^(declare -x |export )?(\\w+)=['\"]?(.*?)['\"]?$", line
):
key, value = match[2], match[3]
if env.get(key) != value:
print(line)
env[key] = value
if env == original_env:
raise ValueError(f"Found no variables in {env_script.name} output:\n"
+ env_output)
host_env = android_env(host)
print_env(host_env)
env.update(host_env)
if log:
print(">", " ".join(map(str, command)))
print(">", join_command(command))
return subprocess.run(command, env=env, **kwargs)
# Format a command so it can be copied into a shell. Like shlex.join, but also
# accepts arguments which are Paths, or a single string/Path outside of a list.
def join_command(args):
if isinstance(args, (str, Path)):
return str(args)
else:
return shlex.join(map(str, args))
# Format the environment so it can be pasted into a shell.
def print_env(env):
for key, value in sorted(env.items()):
print(f"export {key}={shlex.quote(value)}")
def android_env(host):
if host:
prefix = subdir(host) / "prefix"
else:
prefix = ANDROID_DIR / "prefix"
sysconfig_files = prefix.glob("lib/python*/_sysconfigdata__android_*.py")
sysconfig_filename = next(sysconfig_files).name
host = re.fullmatch(r"_sysconfigdata__android_(.+).py", sysconfig_filename)[1]
env_script = ANDROID_DIR / "android-env.sh"
env_output = subprocess.run(
f"set -eu; "
f"HOST={host}; "
f"PREFIX={prefix}; "
f". {env_script}; "
f"export",
check=True, shell=True, capture_output=True, encoding='utf-8',
).stdout
env = {}
for line in env_output.splitlines():
# We don't require every line to match, as there may be some other
# output from installing the NDK.
if match := re.search(
"^(declare -x |export )?(\\w+)=['\"]?(.*?)['\"]?$", line
):
key, value = match[2], match[3]
if os.environ.get(key) != value:
env[key] = value
if not env:
raise ValueError(f"Found no variables in {env_script.name} output:\n"
+ env_output)
return env
def build_python_path():
"""The path to the build Python binary."""
build_dir = subdir("build")
@ -127,7 +174,7 @@ def configure_build_python(context):
clean("build")
os.chdir(subdir("build", create=True))
command = [relpath(CHECKOUT / "configure")]
command = [relpath(PYTHON_DIR / "configure")]
if context.args:
command.extend(context.args)
run(command)
@ -138,13 +185,20 @@ def make_build_python(context):
run(["make", "-j", str(os.cpu_count())])
# To create new builds of these dependencies, usually all that's necessary is to
# push a tag to the cpython-android-source-deps repository, and GitHub Actions
# will do the rest.
#
# If you're a member of the Python core team, and you'd like to be able to push
# these tags yourself, please contact Malcolm Smith or Russell Keith-Magee.
def unpack_deps(host, prefix_dir):
os.chdir(prefix_dir)
deps_url = "https://github.com/beeware/cpython-android-source-deps/releases/download"
for name_ver in ["bzip2-1.0.8-2", "libffi-3.4.4-3", "openssl-3.0.15-4",
"sqlite-3.49.1-0", "xz-5.4.6-1"]:
for name_ver in ["bzip2-1.0.8-3", "libffi-3.4.4-3", "openssl-3.0.18-0",
"sqlite-3.50.4-0", "xz-5.4.6-1", "zstd-1.5.7-1"]:
filename = f"{name_ver}-{host}.tar.gz"
download(f"{deps_url}/{name_ver}/{filename}")
shutil.unpack_archive(filename, prefix_dir)
shutil.unpack_archive(filename)
os.remove(filename)
@ -167,7 +221,7 @@ def configure_host_python(context):
os.chdir(host_dir)
command = [
# Basic cross-compiling configuration
relpath(CHECKOUT / "configure"),
relpath(PYTHON_DIR / "configure"),
f"--host={context.host}",
f"--build={sysconfig.get_config_var('BUILD_GNU_TYPE')}",
f"--with-build-python={build_python_path()}",
@ -196,9 +250,18 @@ def make_host_python(context):
for pattern in ("include/python*", "lib/libpython*", "lib/python*"):
delete_glob(f"{prefix_dir}/{pattern}")
# The Android environment variables were already captured in the Makefile by
# `configure`, and passing them again when running `make` may cause some
# flags to be duplicated. So we don't use the `host` argument here.
os.chdir(host_dir)
run(["make", "-j", str(os.cpu_count())], host=context.host)
run(["make", "install", f"prefix={prefix_dir}"], host=context.host)
run(["make", "-j", str(os.cpu_count())])
# The `make install` output is very verbose and rarely useful, so
# suppress it by default.
run(
["make", "install", f"prefix={prefix_dir}"],
capture_output=not context.verbose,
)
def build_all(context):
@ -217,6 +280,18 @@ def clean_all(context):
clean(host)
def setup_ci():
# https://github.blog/changelog/2024-04-02-github-actions-hardware-accelerated-android-virtualization-now-available/
if "GITHUB_ACTIONS" in os.environ and platform.system() == "Linux":
run(
["sudo", "tee", "/etc/udev/rules.d/99-kvm4all.rules"],
input='KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"\n',
text=True,
)
run(["sudo", "udevadm", "control", "--reload-rules"])
run(["sudo", "udevadm", "trigger", "--name-match=kvm"])
def setup_sdk():
sdkmanager = android_home / (
"cmdline-tools/latest/bin/sdkmanager"
@ -228,7 +303,12 @@ def setup_sdk():
if not all((android_home / "licenses" / path).exists() for path in [
"android-sdk-arm-dbt-license", "android-sdk-license"
]):
run([sdkmanager, "--licenses"], text=True, input="y\n" * 100)
run(
[sdkmanager, "--licenses"],
text=True,
capture_output=True,
input="y\n" * 100,
)
# Gradle may install this automatically, but we can't rely on that because
# we need to run adb within the logcat task.
@ -411,17 +491,19 @@ async def logcat_task(context, initial_devices):
# `--pid` requires API level 24 or higher.
args = [adb, "-s", serial, "logcat", "--pid", pid, "--format", "tag"]
hidden_output = []
logcat_started = False
async with async_process(
*args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
) as process:
while line := (await process.stdout.readline()).decode(*DECODE_ARGS):
if match := re.fullmatch(r"([A-Z])/(.*)", line, re.DOTALL):
logcat_started = True
level, message = match.groups()
else:
# If the regex doesn't match, this is probably the second or
# subsequent line of a multi-line message. Python won't produce
# such messages, but other components might.
# If the regex doesn't match, this is either a logcat startup
# error, or the second or subsequent line of a multi-line
# message. Python won't produce multi-line messages, but other
# components might.
level, message = None, line
# Exclude high-volume messages which are rarely useful.
@ -441,25 +523,22 @@ async def logcat_task(context, initial_devices):
# tag indicators from Python's stdout and stderr.
for prefix in ["python.stdout: ", "python.stderr: "]:
if message.startswith(prefix):
global logcat_started
logcat_started = True
global python_started
python_started = True
stream.write(message.removeprefix(prefix))
break
else:
if context.verbose:
# Non-Python messages add a lot of noise, but they may
# sometimes help explain a failure.
stream.write(line)
else:
hidden_output.append(line)
# Non-Python messages add a lot of noise, but they may
# sometimes help explain a failure.
log_verbose(context, line, stream)
# If the device disconnects while logcat is running, which always
# happens in --managed mode, some versions of adb return non-zero.
# Distinguish this from a logcat startup error by checking whether we've
# received a message from Python yet.
# received any logcat messages yet.
status = await wait_for(process.wait(), timeout=1)
if status != 0 and not logcat_started:
raise CalledProcessError(status, args, "".join(hidden_output))
raise CalledProcessError(status, args)
def stop_app(serial):
@ -474,12 +553,38 @@ async def gradle_task(context):
task_prefix = "connected"
env["ANDROID_SERIAL"] = context.connected
if context.ci_mode:
context.args[0:0] = [
# See _add_ci_python_opts in libregrtest/main.py.
"-W", "error", "-bb", "-E",
# Randomization is disabled because order-dependent failures are
# much less likely to pass on a rerun in single-process mode.
"-m", "test",
f"--{context.ci_mode}-ci", "--single-process", "--no-randomize"
]
if not any(arg in context.args for arg in ["-c", "-m"]):
context.args[0:0] = ["-m", "test"]
args = [
gradlew, "--console", "plain", f"{task_prefix}DebugAndroidTest",
"-Pandroid.testInstrumentationRunnerArguments.pythonArgs="
+ shlex.join(context.args),
] + [
f"-P{name}={value}"
for name, value in [
("python.sitePackages", context.site_packages),
("python.cwd", context.cwd),
(
"android.testInstrumentationRunnerArguments.pythonArgs",
json.dumps(context.args),
),
]
if value
]
hidden_output = []
if context.verbose >= 2:
args.append("--info")
log_verbose(context, f"> {join_command(args)}\n")
try:
async with async_process(
*args, cwd=TESTBED_DIR, env=env,
@ -488,10 +593,10 @@ async def gradle_task(context):
while line := (await process.stdout.readline()).decode(*DECODE_ARGS):
# Gradle may take several minutes to install SDK packages, so
# it's worth showing those messages even in non-verbose mode.
if context.verbose or line.startswith('Preparing "Install'):
if line.startswith('Preparing "Install'):
sys.stdout.write(line)
else:
hidden_output.append(line)
log_verbose(context, line)
status = await wait_for(process.wait(), timeout=1)
if status == 0:
@ -499,17 +604,13 @@ async def gradle_task(context):
else:
raise CalledProcessError(status, args)
finally:
# If logcat never started, then something has gone badly wrong, so the
# user probably wants to see the Gradle output even in non-verbose mode.
if hidden_output and not logcat_started:
sys.stdout.write("".join(hidden_output))
# Gradle does not stop the tests when interrupted.
if context.connected:
stop_app(context.connected)
async def run_testbed(context):
setup_ci()
setup_sdk()
setup_testbed()
@ -533,6 +634,12 @@ async def run_testbed(context):
except* MySystemExit as e:
raise SystemExit(*e.exceptions[0].args) from None
except* CalledProcessError as e:
# If Python produced no output, then the user probably wants to see the
# verbose output to explain why the test failed.
if not python_started:
for stream, line in hidden_output:
stream.write(line)
# Extract it from the ExceptionGroup so it can be handled by `main`.
raise e.exceptions[0]
@ -597,11 +704,64 @@ def package(context):
else:
shutil.copy2(src, dst, follow_symlinks=False)
# Strip debug information.
if not context.debug:
so_files = glob(f"{temp_dir}/**/*.so", recursive=True)
run([android_env(context.host)["STRIP"], *so_files], log=False)
dist_dir = subdir(context.host, "dist", create=True)
package_path = shutil.make_archive(
f"{dist_dir}/python-{version}-{context.host}", "gztar", temp_dir
)
print(f"Wrote {package_path}")
return package_path
def ci(context):
for step in [
configure_build_python,
make_build_python,
configure_host_python,
make_host_python,
package,
]:
caption = (
step.__name__.replace("_", " ")
.capitalize()
.replace("python", "Python")
)
print(f"::group::{caption}")
result = step(context)
if step is package:
package_path = result
print("::endgroup::")
if (
"GITHUB_ACTIONS" in os.environ
and (platform.system(), platform.machine()) != ("Linux", "x86_64")
):
print(
"Skipping tests: GitHub Actions does not support the Android "
"emulator on this platform."
)
else:
with TemporaryDirectory(prefix=SCRIPT_NAME) as temp_dir:
print("::group::Tests")
# Prove the package is self-contained by using it to run the tests.
shutil.unpack_archive(package_path, temp_dir)
launcher_args = [
"--managed", "maxVersion", "-v", f"--{context.ci_mode}-ci"
]
run(
["./android.py", "test", *launcher_args],
cwd=temp_dir
)
print("::endgroup::")
def env(context):
print_env(android_env(getattr(context, "host", None)))
# Handle SIGTERM the same way as SIGINT. This ensures that if we're terminated
@ -615,45 +775,54 @@ def signal_handler(*args):
def parse_args():
parser = argparse.ArgumentParser()
subcommands = parser.add_subparsers(dest="subcommand")
subcommands = parser.add_subparsers(dest="subcommand", required=True)
def add_parser(*args, **kwargs):
parser = subcommands.add_parser(*args, **kwargs)
parser.add_argument(
"-v", "--verbose", action="count", default=0,
help="Show verbose output. Use twice to be even more verbose.")
return parser
# Subcommands
build = subcommands.add_parser("build", help="Build everything")
configure_build = subcommands.add_parser("configure-build",
help="Run `configure` for the "
"build Python")
make_build = subcommands.add_parser("make-build",
help="Run `make` for the build Python")
configure_host = subcommands.add_parser("configure-host",
help="Run `configure` for Android")
make_host = subcommands.add_parser("make-host",
help="Run `make` for Android")
subcommands.add_parser(
"clean", help="Delete all build and prefix directories")
subcommands.add_parser(
"build-testbed", help="Build the testbed app")
test = subcommands.add_parser(
"test", help="Run the test suite")
package = subcommands.add_parser("package", help="Make a release package")
build = add_parser(
"build", help="Run configure-build, make-build, configure-host and "
"make-host")
configure_build = add_parser(
"configure-build", help="Run `configure` for the build Python")
add_parser(
"make-build", help="Run `make` for the build Python")
configure_host = add_parser(
"configure-host", help="Run `configure` for Android")
make_host = add_parser(
"make-host", help="Run `make` for Android")
add_parser("clean", help="Delete all build directories")
add_parser("build-testbed", help="Build the testbed app")
test = add_parser("test", help="Run the testbed app")
package = add_parser("package", help="Make a release package")
ci = add_parser("ci", help="Run build, package and test")
env = add_parser("env", help="Print environment variables")
# Common arguments
for subcommand in build, configure_build, configure_host:
for subcommand in [build, configure_build, configure_host, ci]:
subcommand.add_argument(
"--clean", action="store_true", default=False, dest="clean",
help="Delete the relevant build and prefix directories first")
for subcommand in [build, configure_host, make_host, package]:
help="Delete the relevant build directories first")
host_commands = [build, configure_host, make_host, package, ci]
if in_source_tree:
host_commands.append(env)
for subcommand in host_commands:
subcommand.add_argument(
"host", metavar="HOST", choices=HOSTS,
help="Host triplet: choices=[%(choices)s]")
for subcommand in build, configure_build, configure_host:
for subcommand in [build, configure_build, configure_host, ci]:
subcommand.add_argument("args", nargs="*",
help="Extra arguments to pass to `configure`")
# Test arguments
test.add_argument(
"-v", "--verbose", action="count", default=0,
help="Show Gradle output, and non-Python logcat messages. "
"Use twice to include high-volume messages which are rarely useful.")
device_group = test.add_mutually_exclusive_group(required=True)
device_group.add_argument(
"--connected", metavar="SERIAL", help="Run on a connected device. "
@ -661,9 +830,34 @@ def parse_args():
device_group.add_argument(
"--managed", metavar="NAME", help="Run on a Gradle-managed device. "
"These are defined in `managedDevices` in testbed/app/build.gradle.kts.")
test.add_argument(
"args", nargs="*", help=f"Arguments for `python -m test`. "
f"Separate them from {SCRIPT_NAME}'s own arguments with `--`.")
"--site-packages", metavar="DIR", type=abspath,
help="Directory to copy as the app's site-packages.")
test.add_argument(
"--cwd", metavar="DIR", type=abspath,
help="Directory to copy as the app's working directory.")
test.add_argument(
"args", nargs="*", help=f"Python command-line arguments. "
f"Separate them from {SCRIPT_NAME}'s own arguments with `--`. "
f"If neither -c nor -m are included, `-m test` will be prepended, "
f"which will run Python's own test suite.")
# Package arguments.
for subcommand in [package, ci]:
subcommand.add_argument(
"-g", action="store_true", default=False, dest="debug",
help="Include debug information in package")
# CI arguments
for subcommand in [test, ci]:
group = subcommand.add_mutually_exclusive_group(required=subcommand is ci)
group.add_argument(
"--fast-ci", action="store_const", dest="ci_mode", const="fast",
help="Add test arguments for GitHub Actions")
group.add_argument(
"--slow-ci", action="store_const", dest="ci_mode", const="slow",
help="Add test arguments for buildbots")
return parser.parse_args()
@ -688,6 +882,8 @@ def main():
"build-testbed": build_testbed,
"test": run_testbed,
"package": package,
"ci": ci,
"env": env,
}
try:
@ -702,20 +898,17 @@ def main():
def print_called_process_error(e):
for stream_name in ["stdout", "stderr"]:
content = getattr(e, stream_name)
if isinstance(content, bytes):
content = content.decode(*DECODE_ARGS)
stream = getattr(sys, stream_name)
if content:
stream.write(content)
if not content.endswith("\n"):
stream.write("\n")
# Format the command so it can be copied into a shell. shlex uses single
# quotes, so we surround the whole command with double quotes.
args_joined = (
e.cmd if isinstance(e.cmd, str)
else " ".join(shlex.quote(str(arg)) for arg in e.cmd)
)
# shlex uses single quotes, so we surround the command with double quotes.
print(
f'Command "{args_joined}" returned exit status {e.returncode}'
f'Command "{join_command(e.cmd)}" returned exit status {e.returncode}'
)

View file

@ -47,7 +47,7 @@ for ((i, prefix) in prefixes.withIndex()) {
val libDir = file("$prefix/lib")
val version = run {
for (filename in libDir.list()!!) {
"""python(\d+\.\d+)""".toRegex().matchEntire(filename)?.let {
"""python(\d+\.\d+[a-z]*)""".toRegex().matchEntire(filename)?.let {
return@run it.groupValues[1]
}
}
@ -64,9 +64,10 @@ for ((i, prefix) in prefixes.withIndex()) {
val libPythonDir = file("$libDir/python$pythonVersion")
val triplet = run {
for (filename in libPythonDir.list()!!) {
"""_sysconfigdata__android_(.+).py""".toRegex().matchEntire(filename)?.let {
return@run it.groupValues[1]
}
"""_sysconfigdata_[a-z]*_android_(.+).py""".toRegex()
.matchEntire(filename)?.let {
return@run it.groupValues[1]
}
}
throw GradleException("Failed to find Python triplet in $libPythonDir")
}
@ -85,7 +86,7 @@ android {
minSdk = androidEnvFile.useLines {
for (line in it) {
"""api_level:=(\d+)""".toRegex().find(line)?.let {
"""ANDROID_API_LEVEL:=(\d+)""".toRegex().find(line)?.let {
return@useLines it.groupValues[1].toInt()
}
}
@ -205,11 +206,29 @@ androidComponents.onVariants { variant ->
into("site-packages") {
from("$projectDir/src/main/python")
val sitePackages = findProperty("python.sitePackages") as String?
if (!sitePackages.isNullOrEmpty()) {
if (!file(sitePackages).exists()) {
throw GradleException("$sitePackages does not exist")
}
from(sitePackages)
}
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
exclude("**/__pycache__")
}
into("cwd") {
val cwd = findProperty("python.cwd") as String?
if (!cwd.isNullOrEmpty()) {
if (!file(cwd).exists()) {
throw GradleException("$cwd does not exist")
}
from(cwd)
}
}
}
}

View file

@ -17,11 +17,11 @@ class PythonSuite {
fun testPython() {
val start = System.currentTimeMillis()
try {
val context =
val status = PythonTestRunner(
InstrumentationRegistry.getInstrumentation().targetContext
val args =
InstrumentationRegistry.getArguments().getString("pythonArgs", "")
val status = PythonTestRunner(context).run(args)
).run(
InstrumentationRegistry.getArguments().getString("pythonArgs")!!,
)
assertEquals(0, status)
} finally {
// Make sure the process lives long enough for the test script to

View file

@ -3,6 +3,7 @@
#include <jni.h>
#include <pthread.h>
#include <Python.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@ -15,6 +16,13 @@ static void throw_runtime_exception(JNIEnv *env, const char *message) {
message);
}
static void throw_errno(JNIEnv *env, const char *error_prefix) {
char error_message[1024];
snprintf(error_message, sizeof(error_message),
"%s: %s", error_prefix, strerror(errno));
throw_runtime_exception(env, error_message);
}
// --- Stdio redirection ------------------------------------------------------
@ -95,10 +103,7 @@ JNIEXPORT void JNICALL Java_org_python_testbed_PythonTestRunner_redirectStdioToL
for (StreamInfo *si = STREAMS; si->file; si++) {
char *error_prefix;
if ((error_prefix = redirect_stream(si))) {
char error_message[1024];
snprintf(error_message, sizeof(error_message),
"%s: %s", error_prefix, strerror(errno));
throw_runtime_exception(env, error_message);
throw_errno(env, error_prefix);
return;
}
}
@ -107,13 +112,38 @@ JNIEXPORT void JNICALL Java_org_python_testbed_PythonTestRunner_redirectStdioToL
// --- Python initialization ---------------------------------------------------
static PyStatus set_config_string(
JNIEnv *env, PyConfig *config, wchar_t **config_str, jstring value
) {
const char *value_utf8 = (*env)->GetStringUTFChars(env, value, NULL);
PyStatus status = PyConfig_SetBytesString(config, config_str, value_utf8);
(*env)->ReleaseStringUTFChars(env, value, value_utf8);
return status;
static char *init_signals() {
// Some tests use SIGUSR1, but that's blocked by default in an Android app in
// order to make it available to `sigwait` in the Signal Catcher thread.
// (https://cs.android.com/android/platform/superproject/+/android14-qpr3-release:art/runtime/signal_catcher.cc).
// That thread's functionality is only useful for debugging the JVM, so disabling
// it should not weaken the tests.
//
// There's no safe way of stopping the thread completely (#123982), but simply
// unblocking SIGUSR1 is enough to fix most tests.
//
// However, in tests that generate multiple different signals in quick
// succession, it's possible for SIGUSR1 to arrive while the main thread is busy
// running the C-level handler for a different signal. In that case, the SIGUSR1
// may be sent to the Signal Catcher thread instead, which will generate a log
// message containing the text "reacting to signal".
//
// Such tests may need to be changed in one of the following ways:
// * Use a signal other than SIGUSR1 (e.g. test_stress_delivery_simultaneous in
// test_signal.py).
// * Send the signal to a specific thread rather than the whole process (e.g.
// test_signals in test_threadsignals.py.
sigset_t set;
if (sigemptyset(&set)) {
return "sigemptyset";
}
if (sigaddset(&set, SIGUSR1)) {
return "sigaddset";
}
if ((errno = pthread_sigmask(SIG_UNBLOCK, &set, NULL))) {
return "pthread_sigmask";
}
return NULL;
}
static void throw_status(JNIEnv *env, PyStatus status) {
@ -121,27 +151,47 @@ static void throw_status(JNIEnv *env, PyStatus status) {
}
JNIEXPORT int JNICALL Java_org_python_testbed_PythonTestRunner_runPython(
JNIEnv *env, jobject obj, jstring home, jstring runModule
JNIEnv *env, jobject obj, jstring home, jarray args
) {
const char *home_utf8 = (*env)->GetStringUTFChars(env, home, NULL);
char cwd[PATH_MAX];
snprintf(cwd, sizeof(cwd), "%s/%s", home_utf8, "cwd");
if (chdir(cwd)) {
throw_errno(env, "chdir");
return 1;
}
char *error_prefix;
if ((error_prefix = init_signals())) {
throw_errno(env, error_prefix);
return 1;
}
PyConfig config;
PyStatus status;
PyConfig_InitIsolatedConfig(&config);
PyConfig_InitPythonConfig(&config);
status = set_config_string(env, &config, &config.home, home);
if (PyStatus_Exception(status)) {
jsize argc = (*env)->GetArrayLength(env, args);
const char *argv[argc + 1];
for (int i = 0; i < argc; i++) {
jobject arg = (*env)->GetObjectArrayElement(env, args, i);
argv[i] = (*env)->GetStringUTFChars(env, arg, NULL);
}
argv[argc] = NULL;
// PyConfig_SetBytesArgv "must be called before other methods, since the
// preinitialization configuration depends on command line arguments"
if (PyStatus_Exception(status = PyConfig_SetBytesArgv(&config, argc, (char**)argv))) {
throw_status(env, status);
return 1;
}
status = set_config_string(env, &config, &config.run_module, runModule);
status = PyConfig_SetBytesString(&config, &config.home, home_utf8);
if (PyStatus_Exception(status)) {
throw_status(env, status);
return 1;
}
// Some tests generate SIGPIPE and SIGXFSZ, which should be ignored.
config.install_signal_handlers = 1;
status = Py_InitializeFromConfig(&config);
if (PyStatus_Exception(status)) {
throw_status(env, status);

View file

@ -5,6 +5,7 @@ import android.os.*
import android.system.Os
import android.widget.TextView
import androidx.appcompat.app.*
import org.json.JSONArray
import java.io.*
@ -15,18 +16,25 @@ class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val status = PythonTestRunner(this).run("-W -uall")
val status = PythonTestRunner(this).run("""["-m", "test", "-W", "-uall"]""")
findViewById<TextView>(R.id.tvHello).text = "Exit status $status"
}
}
class PythonTestRunner(val context: Context) {
/** @param args Extra arguments for `python -m test`.
* @return The Python exit status: zero if the tests passed, nonzero if
* they failed. */
fun run(args: String = "") : Int {
Os.setenv("PYTHON_ARGS", args, true)
/** Run Python.
*
* @param args Python command-line, encoded as JSON.
* @return The Python exit status: zero on success, nonzero on failure. */
fun run(args: String) : Int {
// We leave argument 0 as an empty string, which is a placeholder for the
// executable name in embedded mode.
val argsJsonArray = JSONArray(args)
val argsStringArray = Array<String>(argsJsonArray.length() + 1) { it -> ""}
for (i in 0..<argsJsonArray.length()) {
argsStringArray[i + 1] = argsJsonArray.getString(i)
}
// Python needs this variable to help it find the temporary directory,
// but Android only sets it on API level 33 and later.
@ -35,9 +43,7 @@ class PythonTestRunner(val context: Context) {
val pythonHome = extractAssets()
System.loadLibrary("main_activity")
redirectStdioToLogcat()
// The main module is in src/main/python/main.py.
return runPython(pythonHome.toString(), "main")
return runPython(pythonHome.toString(), argsStringArray)
}
private fun extractAssets() : File {
@ -46,6 +52,13 @@ class PythonTestRunner(val context: Context) {
throw RuntimeException("Failed to delete $pythonHome")
}
extractAssetDir("python", context.filesDir)
// Empty directories are lost in the asset packing/unpacking process.
val cwd = File(pythonHome, "cwd")
if (!cwd.exists()) {
cwd.mkdir()
}
return pythonHome
}
@ -75,5 +88,5 @@ class PythonTestRunner(val context: Context) {
}
private external fun redirectStdioToLogcat()
private external fun runPython(home: String, runModule: String) : Int
private external fun runPython(home: String, args: Array<String>) : Int
}

View file

@ -1,32 +0,0 @@
import os
import runpy
import shlex
import signal
import sys
# Some tests use SIGUSR1, but that's blocked by default in an Android app in
# order to make it available to `sigwait` in the Signal Catcher thread.
# (https://cs.android.com/android/platform/superproject/+/android14-qpr3-release:art/runtime/signal_catcher.cc).
# That thread's functionality is only useful for debugging the JVM, so disabling
# it should not weaken the tests.
#
# There's no safe way of stopping the thread completely (#123982), but simply
# unblocking SIGUSR1 is enough to fix most tests.
#
# However, in tests that generate multiple different signals in quick
# succession, it's possible for SIGUSR1 to arrive while the main thread is busy
# running the C-level handler for a different signal. In that case, the SIGUSR1
# may be sent to the Signal Catcher thread instead, which will generate a log
# message containing the text "reacting to signal".
#
# Such tests may need to be changed in one of the following ways:
# * Use a signal other than SIGUSR1 (e.g. test_stress_delivery_simultaneous in
# test_signal.py).
# * Send the signal to a specific thread rather than the whole process (e.g.
# test_signals in test_threadsignals.py.
signal.pthread_sigmask(signal.SIG_UNBLOCK, [signal.SIGUSR1])
sys.argv[1:] = shlex.split(os.environ["PYTHON_ARGS"])
# The test module will call sys.exit to indicate whether the tests passed.
runpy.run_module("test")

View file

@ -1,5 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.6.1" apply false
id("com.android.application") version "8.10.0" apply false
id("org.jetbrains.kotlin.android") version "1.9.22" apply false
}

View file

@ -1,6 +1,6 @@
#Mon Feb 19 20:29:06 GMT 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

22
Apple/.ruff.toml Normal file
View file

@ -0,0 +1,22 @@
extend = "../.ruff.toml" # Inherit the project-wide settings
[format]
preview = true
docstring-code-format = true
[lint]
select = [
"C4", # flake8-comprehensions
"E", # pycodestyle
"F", # pyflakes
"I", # isort
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"PGH", # pygrep-hooks
"PT", # flake8-pytest-style
"PYI", # flake8-pyi
"RUF100", # Ban unused `# noqa` comments
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
]

1065
Apple/__main__.py Normal file

File diff suppressed because it is too large Load diff

339
Apple/iOS/README.md Normal file
View file

@ -0,0 +1,339 @@
# Python on iOS README
**iOS support is [tier 3](https://peps.python.org/pep-0011/#tier-3).**
This document provides a quick overview of some iOS specific features in the
Python distribution.
These instructions are only needed if you're planning to compile Python for iOS
yourself. Most users should *not* need to do this. If you're looking to
experiment with writing an iOS app in Python, tools such as [BeeWare's
Briefcase](https://briefcase.readthedocs.io) and [Kivy's
Buildozer](https://buildozer.readthedocs.io) will provide a much more
approachable user experience.
## Compilers for building on iOS
Building for iOS requires the use of Apple's Xcode tooling. It is strongly
recommended that you use the most recent stable release of Xcode. This will
require the use of the most (or second-most) recently released macOS version,
as Apple does not maintain Xcode for older macOS versions. The Xcode Command
Line Tools are not sufficient for iOS development; you need a *full* Xcode
install.
If you want to run your code on the iOS simulator, you'll also need to install
an iOS Simulator Platform. You should be prompted to select an iOS Simulator
Platform when you first run Xcode. Alternatively, you can add an iOS Simulator
Platform by selecting an open the Platforms tab of the Xcode Settings panel.
## Building Python on iOS
### ABIs and Architectures
iOS apps can be deployed on physical devices, and on the iOS simulator. Although
the API used on these devices is identical, the ABI is different - you need to
link against different libraries for an iOS device build (`iphoneos`) or an
iOS simulator build (`iphonesimulator`).
Apple uses the `XCframework` format to allow specifying a single dependency
that supports multiple ABIs. An `XCframework` is a wrapper around multiple
ABI-specific frameworks that share a common API.
iOS can also support different CPU architectures within each ABI. At present,
there is only a single supported architecture on physical devices - ARM64.
However, the *simulator* supports 2 architectures - ARM64 (for running on Apple
Silicon machines), and x86_64 (for running on older Intel-based machines).
To support multiple CPU architectures on a single platform, Apple uses a "fat
binary" format - a single physical file that contains support for multiple
architectures. It is possible to compile and use a "thin" single architecture
version of a binary for testing purposes; however, the "thin" binary will not be
portable to machines using other architectures.
### Building a multi-architecture iOS XCframework
The `Apple` subfolder of the Python repository acts as a build script that
can be used to coordinate the compilation of a complete iOS XCframework. To use
it, run::
python Apple build iOS
This will:
* Configure and compile a version of Python to run on the build machine
* Download pre-compiled binary dependencies for each platform
* Configure and build a `Python.framework` for each required architecture and
iOS SDK
* Merge the multiple `Python.framework` folders into a single `Python.xcframework`
* Produce a `.tar.gz` archive in the `cross-build/dist` folder containing
the `Python.xcframework`, plus a copy of the Testbed app pre-configured to
use the XCframework.
The `Apple` build script has other entry points that will perform the
individual parts of the overall `build` target, plus targets to test the
build, clean the `cross-build` folder of iOS build products, and perform a
complete "build and test" CI run. The `--clean` flag can also be used on
individual commands to ensure that a stale build product are removed before
building.
### Building a single-architecture framework
If you're using the `Apple` build script, you won't need to build
individual frameworks. However, if you do need to manually configure an iOS
Python build for a single framework, the following options are available.
#### iOS specific arguments to configure
* `--enable-framework[=DIR]`
This argument specifies the location where the Python.framework will be
installed. If `DIR` is not specified, the framework will be installed into
a subdirectory of the `iOS/Frameworks` folder.
This argument *must* be provided when configuring iOS builds. iOS does not
support non-framework builds.
* `--with-framework-name=NAME`
Specify the name for the Python framework; defaults to `Python`.
> [!NOTE]
> Unless you know what you're doing, changing the name of the Python
> framework on iOS is not advised. If you use this option, you won't be able
> to run the `Apple` build script without making significant manual
> alterations, and you won't be able to use any binary packages unless you
> compile them yourself using your own framework name.
#### Building Python for iOS
The Python build system will create a `Python.framework` that supports a
*single* ABI with a *single* architecture. Unlike macOS, iOS does not allow a
framework to contain non-library content, so the iOS build will produce a
`bin` and `lib` folder in the same output folder as `Python.framework`.
The `lib` folder will be needed at runtime to support the Python library.
If you want to use Python in a real iOS project, you need to produce multiple
`Python.framework` builds, one for each ABI and architecture. iOS builds of
Python *must* be constructed as framework builds. To support this, you must
provide the `--enable-framework` flag when configuring the build. The build
also requires the use of cross-compilation. The minimal commands for building
Python for the ARM64 iOS simulator will look something like:
```
export PATH="$(pwd)/Apple/iOS/Resources/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin"
./configure \
--enable-framework \
--host=arm64-apple-ios-simulator \
--build=arm64-apple-darwin \
--with-build-python=/path/to/python.exe
make
make install
```
In this invocation:
* `Apple/iOS/Resources/bin` has been added to the path, providing some shims for the
compilers and linkers needed by the build. Xcode requires the use of `xcrun`
to invoke compiler tooling. However, if `xcrun` is pre-evaluated and the
result passed to `configure`, these results can embed user- and
version-specific paths into the sysconfig data, which limits the portability
of the compiled Python. Alternatively, if `xcrun` is used *as* the compiler,
it requires that compiler variables like `CC` include spaces, which can
cause significant problems with many C configuration systems which assume that
`CC` will be a single executable.
To work around this problem, the `Apple/iOS/Resources/bin` folder contains some
wrapper scripts that present as simple compilers and linkers, but wrap
underlying calls to `xcrun`. This allows configure to use a `CC`
definition without spaces, and without user- or version-specific paths, while
retaining the ability to adapt to the local Xcode install. These scripts are
included in the `bin` directory of an iOS install.
These scripts will, by default, use the currently active Xcode installation.
If you want to use a different Xcode installation, you can use
`xcode-select` to set a new default Xcode globally, or you can use the
`DEVELOPER_DIR` environment variable to specify an Xcode install. The
scripts will use the default `iphoneos`/`iphonesimulator` SDK version for
the select Xcode install; if you want to use a different SDK, you can set the
`IOS_SDK_VERSION` environment variable. (e.g, setting
`IOS_SDK_VERSION=17.1` would cause the scripts to use the `iphoneos17.1`
and `iphonesimulator17.1` SDKs, regardless of the Xcode default.)
The path has also been cleared of any user customizations. A common source of
bugs is for tools like Homebrew to accidentally leak macOS binaries into an iOS
build. Resetting the path to a known "bare bones" value is the easiest way to
avoid these problems.
* `--host` is the architecture and ABI that you want to build, in GNU compiler
triple format. This will be one of:
- `arm64-apple-ios` for ARM64 iOS devices.
- `arm64-apple-ios-simulator` for the iOS simulator running on Apple
Silicon devices.
- `x86_64-apple-ios-simulator` for the iOS simulator running on Intel
devices.
* `--build` is the GNU compiler triple for the machine that will be running
the compiler. This is one of:
- `arm64-apple-darwin` for Apple Silicon devices.
- `x86_64-apple-darwin` for Intel devices.
* `/path/to/python.exe` is the path to a Python binary on the machine that
will be running the compiler. This is needed because the Python compilation
process involves running some Python code. On a normal desktop build of
Python, you can compile a python interpreter and then use that interpreter to
run Python code. However, the binaries produced for iOS won't run on macOS, so
you need to provide an external Python interpreter. This interpreter must be
the same version as the Python that is being compiled. To be completely safe,
this should be the *exact* same commit hash. However, the longer a Python
release has been stable, the more likely it is that this constraint can be
relaxed - the same micro version will often be sufficient.
* The `install` target for iOS builds is slightly different to other
platforms. On most platforms, `make install` will install the build into
the final runtime location. This won't be the case for iOS, as the final
runtime location will be on a physical device.
However, you still need to run the `install` target for iOS builds, as it
performs some final framework assembly steps. The location specified with
`--enable-framework` will be the location where `make install` will
assemble the complete iOS framework. This completed framework can then
be copied and relocated as required.
For a full CPython build, you also need to specify the paths to iOS builds of
the binary libraries that CPython depends on (such as XZ, LibFFI and OpenSSL).
This can be done by defining library specific environment variables (such as
`LIBLZMA_CFLAGS`, `LIBLZMA_LIBS`), and the `--with-openssl` configure
option. Versions of these libraries pre-compiled for iOS can be found in [this
repository](https://github.com/beeware/cpython-apple-source-deps/releases).
LibFFI is especially important, as many parts of the standard library
(including the `platform`, `sysconfig` and `webbrowser` modules) require
the use of the `ctypes` module at runtime.
By default, Python will be compiled with an iOS deployment target (i.e., the
minimum supported iOS version) of 13.0. To specify a different deployment
target, provide the version number as part of the `--host` argument - for
example, `--host=arm64-apple-ios15.4-simulator` would compile an ARM64
simulator build with a deployment target of 15.4.
## Testing Python on iOS
### Testing a multi-architecture framework
Once you have a built an XCframework, you can test that framework by running:
$ python Apple test iOS
This test will attempt to find an "SE-class" simulator (i.e., an iPhone SE, or
iPhone 16e, or similar), and run the test suite on the most recent version of
iOS that is available. You can specify a simulator using the `--simulator`
command line argument, providing the name of the simulator (e.g., `--simulator
'iPhone 16 Pro'`). You can also use this argument to control the OS version used
for testing; `--simulator 'iPhone 16 Pro,OS=18.2'` would attempt to run the
tests on an iPhone 16 Pro running iOS 18.2.
If the test runner is executed on GitHub Actions, the `GITHUB_ACTIONS`
environment variable will be exposed to the iOS process at runtime.
### Testing a single-architecture framework
The `Apple/testbed` folder that contains an Xcode project that is able to run
the Python test suite on Apple platforms. This project converts the Python test
suite into a single test case in Xcode's XCTest framework. The single XCTest
passes if the test suite passes.
To run the test suite, configure a Python build for an iOS simulator (i.e.,
`--host=arm64-apple-ios-simulator` or `--host=x86_64-apple-ios-simulator`
), specifying a framework build (i.e. `--enable-framework`). Ensure that your
`PATH` has been configured to include the `Apple/iOS/Resources/bin` folder and
exclude any non-iOS tools, then run:
```
make all
make install
make testios
```
This will:
* Build an iOS framework for your chosen architecture;
* Finalize the single-platform framework;
* Make a clean copy of the testbed project;
* Install the Python iOS framework into the copy of the testbed project; and
* Run the test suite on an "entry-level device" simulator (i.e., an iPhone SE,
iPhone 16e, or a similar).
On success, the test suite will exit and report successful completion of the
test suite. On a 2022 M1 MacBook Pro, the test suite takes approximately 15
minutes to run; a couple of extra minutes is required to compile the testbed
project, and then boot and prepare the iOS simulator.
### Debugging test failures
Running `python Apple test iOS` generates a standalone version of the
`Apple/testbed` project, and runs the full test suite. It does this using
`Apple/testbed` itself - the folder is an executable module that can be used
to create and run a clone of the testbed project. The standalone version of the
testbed will be created in a directory named
`cross-build/iOS-testbed.<timestamp>`.
You can generate your own standalone testbed instance by running:
```
python cross-build/iOS/testbed clone my-testbed
```
In this invocation, `my-testbed` is the name of the folder for the new
testbed clone.
If you've built your own XCframework, or you only want to test a single architecture,
you can construct a standalone testbed instance by running:
```
python Apple/testbed clone --platform iOS --framework <path/to/framework> my-testbed
```
The framework path can be the path path to a `Python.xcframework`, or the
path to a folder that contains a single-platform `Python.framework`.
You can then use the `my-testbed` folder to run the Python test suite,
passing in any command line arguments you may require. For example, if you're
trying to diagnose a failure in the `os` module, you might run:
```
python my-testbed run -- test -W test_os
```
This is the equivalent of running `python -m test -W test_os` on a desktop
Python build. Any arguments after the `--` will be passed to testbed as if
they were arguments to `python -m` on a desktop machine.
### Testing in Xcode
You can also open the testbed project in Xcode by running:
```
open my-testbed/iOSTestbed.xcodeproj
```
This will allow you to use the full Xcode suite of tools for debugging.
The arguments used to run the test suite are defined as part of the test plan.
To modify the test plan, select the test plan node of the project tree (it
should be the first child of the root node), and select the "Configurations"
tab. Modify the "Arguments Passed On Launch" value to change the testing
arguments.
The test plan also disables parallel testing, and specifies the use of the
`Testbed.lldbinit` file for providing configuration of the debugger. The
default debugger configuration disables automatic breakpoints on the
`SIGINT`, `SIGUSR1`, `SIGUSR2`, and `SIGXFSZ` signals.
### Testing on an iOS device
To test on an iOS device, the app needs to be signed with known developer
credentials. To obtain these credentials, you must have an iOS Developer
account, and your Xcode install will need to be logged into your account (see
the Accounts tab of the Preferences dialog).
Once the project is open, and you're signed into your Apple Developer account,
select the root node of the project tree (labeled "iOSTestbed"), then the
"Signing & Capabilities" tab in the details page. Select a development team
(this will likely be your own name), and plug in a physical device to your
macOS machine with a USB cable. You should then be able to select your physical
device from the list of targets in the pulldown in the Xcode titlebar.

View file

@ -0,0 +1,2 @@
#!/bin/sh
xcrun --sdk iphoneos${IOS_SDK_VERSION} ar "$@"

View file

@ -0,0 +1,2 @@
#!/bin/sh
xcrun --sdk iphoneos${IOS_SDK_VERSION} clang -target arm64-apple-ios${IPHONEOS_DEPLOYMENT_TARGET} "$@"

View file

@ -0,0 +1,2 @@
#!/bin/sh
xcrun --sdk iphoneos${IOS_SDK_VERSION} clang++ -target arm64-apple-ios${IPHONEOS_DEPLOYMENT_TARGET} "$@"

View file

@ -0,0 +1,2 @@
#!/bin/sh
xcrun --sdk iphoneos${IOS_SDK_VERSION} clang -target arm64-apple-ios${IPHONEOS_DEPLOYMENT_TARGET} -E "$@"

View file

@ -0,0 +1,2 @@
#!/bin/sh
xcrun --sdk iphonesimulator${IOS_SDK_VERSION} ar "$@"

View file

@ -0,0 +1,2 @@
#!/bin/sh
xcrun --sdk iphonesimulator${IOS_SDK_VERSION} clang -target arm64-apple-ios${IPHONEOS_DEPLOYMENT_TARGET}-simulator "$@"

View file

@ -0,0 +1,2 @@
#!/bin/sh
xcrun --sdk iphonesimulator${IOS_SDK_VERSION} clang++ -target arm64-apple-ios${IPHONEOS_DEPLOYMENT_TARGET}-simulator "$@"

View file

@ -0,0 +1,2 @@
#!/bin/sh
xcrun --sdk iphonesimulator${IOS_SDK_VERSION} clang -target arm64-apple-ios${IPHONEOS_DEPLOYMENT_TARGET}-simulator -E "$@"

View file

@ -0,0 +1,2 @@
#!/bin/sh
xcrun --sdk iphonesimulator${IOS_SDK_VERSION} strip -arch arm64 "$@"

View file

@ -0,0 +1,2 @@
#!/bin/sh
xcrun --sdk iphoneos${IOS_SDK_VERSION} strip -arch arm64 "$@"

View file

@ -0,0 +1,2 @@
#!/bin/sh
xcrun --sdk iphonesimulator${IOS_SDK_VERSION} ar "$@"

View file

@ -0,0 +1,2 @@
#!/bin/sh
xcrun --sdk iphonesimulator${IOS_SDK_VERSION} clang -target x86_64-apple-ios${IPHONEOS_DEPLOYMENT_TARGET}-simulator "$@"

View file

@ -0,0 +1,2 @@
#!/bin/sh
xcrun --sdk iphonesimulator${IOS_SDK_VERSION} clang++ -target x86_64-apple-ios${IPHONEOS_DEPLOYMENT_TARGET}-simulator "$@"

View file

@ -0,0 +1,2 @@
#!/bin/sh
xcrun --sdk iphonesimulator${IOS_SDK_VERSION} clang -target x86_64-apple-ios${IPHONEOS_DEPLOYMENT_TARGET}-simulator -E "$@"

View file

@ -0,0 +1,2 @@
#!/bin/sh
xcrun --sdk iphonesimulator${IOS_SDK_VERSION} strip -arch x86_64 "$@"

View file

@ -19,7 +19,7 @@
<string>iPhoneOS</string>
</array>
<key>MinimumOSVersion</key>
<string>12.0</string>
<string>13.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>

View file

@ -0,0 +1,151 @@
# Utility methods for use in an Xcode project.
#
# An iOS XCframework cannot include any content other than the library binary
# and relevant metadata. However, Python requires a standard library at runtime.
# Therefore, it is necessary to add a build step to an Xcode app target that
# processes the standard library and puts the content into the final app.
#
# In general, these tools will be invoked after bundle resources have been
# copied into the app, but before framework embedding (and signing).
#
# The following is an example script, assuming that:
# * Python.xcframework is in the root of the project
# * There is an `app` folder that contains the app code
# * There is an `app_packages` folder that contains installed Python packages.
# -----
# set -e
# source $PROJECT_DIR/Python.xcframework/build/build_utils.sh
# install_python Python.xcframework app app_packages
# -----
# Copy the standard library from the XCframework into the app bundle.
#
# Accepts one argument:
# 1. The path, relative to the root of the Xcode project, where the Python
# XCframework can be found.
install_stdlib() {
PYTHON_XCFRAMEWORK_PATH=$1
mkdir -p "$CODESIGNING_FOLDER_PATH/python/lib"
if [ "$EFFECTIVE_PLATFORM_NAME" = "-iphonesimulator" ]; then
echo "Installing Python modules for iOS Simulator"
if [ -d "$PROJECT_DIR/$PYTHON_XCFRAMEWORK_PATH/ios-arm64-simulator" ]; then
SLICE_FOLDER="ios-arm64-simulator"
else
SLICE_FOLDER="ios-arm64_x86_64-simulator"
fi
else
echo "Installing Python modules for iOS Device"
SLICE_FOLDER="ios-arm64"
fi
# If the XCframework has a shared lib folder, then it's a full framework.
# Copy both the common and slice-specific part of the lib directory.
# Otherwise, it's a single-arch framework; use the "full" lib folder.
if [ -d "$PROJECT_DIR/$PYTHON_XCFRAMEWORK_PATH/lib" ]; then
rsync -au --delete "$PROJECT_DIR/$PYTHON_XCFRAMEWORK_PATH/lib/" "$CODESIGNING_FOLDER_PATH/python/lib/"
rsync -au "$PROJECT_DIR/$PYTHON_XCFRAMEWORK_PATH/$SLICE_FOLDER/lib-$ARCHS/" "$CODESIGNING_FOLDER_PATH/python/lib/"
else
# A single-arch framework will have a libpython symlink; that can't be included at runtime
rsync -au --delete "$PROJECT_DIR/$PYTHON_XCFRAMEWORK_PATH/$SLICE_FOLDER/lib/" "$CODESIGNING_FOLDER_PATH/python/lib/" --exclude 'libpython*.dylib'
fi
}
# Convert a single .so library into a framework that iOS can load.
#
# Accepts three arguments:
# 1. The path, relative to the root of the Xcode project, where the Python
# XCframework can be found.
# 2. The base path, relative to the installed location in the app bundle, that
# needs to be processed. Any .so file found in this path (or a subdirectory
# of it) will be processed.
# 2. The full path to a single .so file to process. This path should include
# the base path.
install_dylib () {
PYTHON_XCFRAMEWORK_PATH=$1
INSTALL_BASE=$2
FULL_EXT=$3
# The name of the extension file
EXT=$(basename "$FULL_EXT")
# The name and location of the module
MODULE_PATH=$(dirname "$FULL_EXT")
MODULE_NAME=$(echo $EXT | cut -d "." -f 1)
# The location of the extension file, relative to the bundle
RELATIVE_EXT=${FULL_EXT#$CODESIGNING_FOLDER_PATH/}
# The path to the extension file, relative to the install base
PYTHON_EXT=${RELATIVE_EXT/$INSTALL_BASE/}
# The full dotted name of the extension module, constructed from the file path.
FULL_MODULE_NAME=$(echo $PYTHON_EXT | cut -d "." -f 1 | tr "/" ".");
# A bundle identifier; not actually used, but required by Xcode framework packaging
FRAMEWORK_BUNDLE_ID=$(echo $PRODUCT_BUNDLE_IDENTIFIER.$FULL_MODULE_NAME | tr "_" "-")
# The name of the framework folder.
FRAMEWORK_FOLDER="Frameworks/$FULL_MODULE_NAME.framework"
# If the framework folder doesn't exist, create it.
if [ ! -d "$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER" ]; then
echo "Creating framework for $RELATIVE_EXT"
mkdir -p "$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER"
cp "$PROJECT_DIR/$PYTHON_XCFRAMEWORK_PATH/build/$PLATFORM_FAMILY_NAME-dylib-Info-template.plist" "$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/Info.plist"
plutil -replace CFBundleExecutable -string "$FULL_MODULE_NAME" "$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/Info.plist"
plutil -replace CFBundleIdentifier -string "$FRAMEWORK_BUNDLE_ID" "$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/Info.plist"
fi
echo "Installing binary for $FRAMEWORK_FOLDER/$FULL_MODULE_NAME"
mv "$FULL_EXT" "$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/$FULL_MODULE_NAME"
# Create a placeholder .fwork file where the .so was
echo "$FRAMEWORK_FOLDER/$FULL_MODULE_NAME" > ${FULL_EXT%.so}.fwork
# Create a back reference to the .so file location in the framework
echo "${RELATIVE_EXT%.so}.fwork" > "$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/$FULL_MODULE_NAME.origin"
# If the framework provides an xcprivacy file, install it.
if [ -e "$MODULE_PATH/$MODULE_NAME.xcprivacy" ]; then
echo "Installing XCPrivacy file for $FRAMEWORK_FOLDER/$FULL_MODULE_NAME"
XCPRIVACY_FILE="$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/PrivacyInfo.xcprivacy"
if [ -e "$XCPRIVACY_FILE" ]; then
rm -rf "$XCPRIVACY_FILE"
fi
mv "$MODULE_PATH/$MODULE_NAME.xcprivacy" "$XCPRIVACY_FILE"
fi
echo "Signing framework as $EXPANDED_CODE_SIGN_IDENTITY_NAME ($EXPANDED_CODE_SIGN_IDENTITY)..."
/usr/bin/codesign --force --sign "$EXPANDED_CODE_SIGN_IDENTITY" ${OTHER_CODE_SIGN_FLAGS:-} -o runtime --timestamp=none --preserve-metadata=identifier,entitlements,flags --generate-entitlement-der "$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER"
}
# Process all the dynamic libraries in a path into Framework format.
#
# Accepts two arguments:
# 1. The path, relative to the root of the Xcode project, where the Python
# XCframework can be found.
# 2. The base path, relative to the installed location in the app bundle, that
# needs to be processed. Any .so file found in this path (or a subdirectory
# of it) will be processed.
process_dylibs () {
PYTHON_XCFRAMEWORK_PATH=$1
LIB_PATH=$2
find "$CODESIGNING_FOLDER_PATH/$LIB_PATH" -name "*.so" | while read FULL_EXT; do
install_dylib $PYTHON_XCFRAMEWORK_PATH "$LIB_PATH/" "$FULL_EXT"
done
}
# The entry point for post-processing a Python XCframework.
#
# Accepts 1 or more arguments:
# 1. The path, relative to the root of the Xcode project, where the Python
# XCframework can be found. If the XCframework is in the root of the project,
# 2+. The path of a package, relative to the root of the packaged app, that contains
# library content that should be processed for binary libraries.
install_python() {
PYTHON_XCFRAMEWORK_PATH=$1
shift
install_stdlib $PYTHON_XCFRAMEWORK_PATH
PYTHON_VER=$(ls -1 "$CODESIGNING_FOLDER_PATH/python/lib")
echo "Install Python $PYTHON_VER standard library extension modules..."
process_dylibs $PYTHON_XCFRAMEWORK_PATH python/lib/$PYTHON_VER/lib-dynload
for package_path in $@; do
echo "Installing $package_path extension modules ..."
process_dylibs $PYTHON_XCFRAMEWORK_PATH $package_path
done
}

View file

@ -0,0 +1,4 @@
process handle SIGINT -n true -p true -s false
process handle SIGUSR1 -n true -p true -s false
process handle SIGUSR2 -n true -p true -s false
process handle SIGXFSZ -n true -p true -s false

View file

@ -1,11 +1,11 @@
#import <XCTest/XCTest.h>
#import <Python/Python.h>
@interface iOSTestbedTests : XCTestCase
@interface TestbedTests : XCTestCase
@end
@implementation iOSTestbedTests
@implementation TestbedTests
- (void)testPython {
@ -15,6 +15,11 @@
PyStatus status;
PyPreConfig preconfig;
PyConfig config;
PyObject *app_packages_path;
PyObject *method_args;
PyObject *result;
PyObject *site_module;
PyObject *site_addsitedir_attr;
PyObject *sys_module;
PyObject *sys_path_attr;
NSArray *test_args;
@ -30,19 +35,26 @@
setenv("NO_COLOR", "1", true);
setenv("PYTHON_COLORS", "0", true);
if (getenv("GITHUB_ACTIONS")) {
NSLog(@"Running in a GitHub Actions environment");
}
// Arguments to pass into the test suite runner.
// argv[0] must identify the process; any subsequent arg
// will be handled as if it were an argument to `python -m test`
test_args = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"TestArgs"];
// The processInfo arguments contain the binary that is running,
// followed by the arguments defined in the test plan. This means:
// run_module = test_args[1]
// argv = ["Testbed"] + test_args[2:]
test_args = [[NSProcessInfo processInfo] arguments];
if (test_args == NULL) {
NSLog(@"Unable to identify test arguments.");
}
argv = malloc(sizeof(char *) * ([test_args count] + 1));
argv[0] = "iOSTestbed";
for (int i = 1; i < [test_args count]; i++) {
argv[i] = [[test_args objectAtIndex:i] UTF8String];
NSLog(@"Test arguments: %@", test_args);
argv = malloc(sizeof(char *) * ([test_args count] - 1));
argv[0] = "Testbed";
for (int i = 1; i < [test_args count] - 1; i++) {
argv[i] = [[test_args objectAtIndex:i+1] UTF8String];
}
NSLog(@"Test command: %@", test_args);
// Generate an isolated Python configuration.
NSLog(@"Configuring isolated Python...");
@ -63,7 +75,7 @@
// Ensure that signal handlers are installed
config.install_signal_handlers = 1;
// Run the test module.
config.run_module = Py_DecodeLocale([[test_args objectAtIndex:0] UTF8String], NULL);
config.run_module = Py_DecodeLocale([[test_args objectAtIndex:1] UTF8String], NULL);
// For debugging - enable verbose mode.
// config.verbose = 1;
@ -96,7 +108,7 @@
}
NSLog(@"Configure argc/argv...");
status = PyConfig_SetBytesArgv(&config, [test_args count], (char**) argv);
status = PyConfig_SetBytesArgv(&config, [test_args count] - 1, (char**) argv);
if (PyStatus_Exception(status)) {
XCTFail(@"Unable to configure argc/argv: %s", status.err_msg);
PyConfig_Clear(&config);
@ -111,6 +123,43 @@
return;
}
// Add app_packages as a site directory. This both adds to sys.path,
// and ensures that any .pth files in that directory will be executed.
site_module = PyImport_ImportModule("site");
if (site_module == NULL) {
XCTFail(@"Could not import site module");
return;
}
site_addsitedir_attr = PyObject_GetAttrString(site_module, "addsitedir");
if (site_addsitedir_attr == NULL || !PyCallable_Check(site_addsitedir_attr)) {
XCTFail(@"Could not access site.addsitedir");
return;
}
path = [NSString stringWithFormat:@"%@/app_packages", resourcePath, nil];
NSLog(@"App packages path: %@", path);
wtmp_str = Py_DecodeLocale([path UTF8String], NULL);
app_packages_path = PyUnicode_FromWideChar(wtmp_str, wcslen(wtmp_str));
if (app_packages_path == NULL) {
XCTFail(@"Could not convert app_packages path to unicode");
return;
}
PyMem_RawFree(wtmp_str);
method_args = Py_BuildValue("(O)", app_packages_path);
if (method_args == NULL) {
XCTFail(@"Could not create arguments for site.addsitedir");
return;
}
result = PyObject_CallObject(site_addsitedir_attr, method_args);
if (result == NULL) {
XCTFail(@"Could not add app_packages directory using site.addsitedir");
return;
}
// Add test code to sys.path
sys_module = PyImport_ImportModule("sys");
if (sys_module == NULL) {
XCTFail(@"Could not import sys module");
@ -123,17 +172,6 @@
return;
}
// Add the app packages path
path = [NSString stringWithFormat:@"%@/app_packages", resourcePath, nil];
NSLog(@"App packages path: %@", path);
wtmp_str = Py_DecodeLocale([path UTF8String], NULL);
failed = PyList_Insert(sys_path_attr, 0, PyUnicode_FromString([path UTF8String]));
if (failed) {
XCTFail(@"Unable to add app packages to sys.path");
return;
}
PyMem_RawFree(wtmp_str);
path = [NSString stringWithFormat:@"%@/app", resourcePath, nil];
NSLog(@"App path: %@", path);
wtmp_str = Py_DecodeLocale([path UTF8String], NULL);

435
Apple/testbed/__main__.py Normal file
View file

@ -0,0 +1,435 @@
import argparse
import json
import os
import re
import shlex
import shutil
import subprocess
import sys
from pathlib import Path
TEST_SLICES = {
"iOS": "ios-arm64_x86_64-simulator",
}
DECODE_ARGS = ("UTF-8", "backslashreplace")
# The system log prefixes each line:
# 2025-01-17 16:14:29.093742+0800 iOSTestbed[23987:1fd393b4] ...
# 2025-01-17 16:14:29.093742+0800 iOSTestbed[23987:1fd393b4] ...
LOG_PREFIX_REGEX = re.compile(
r"^\d{4}-\d{2}-\d{2}" # YYYY-MM-DD
r"\s+\d+:\d{2}:\d{2}\.\d+\+\d{4}" # HH:MM:SS.ssssss+ZZZZ
r"\s+iOSTestbed\[\d+:\w+\]" # Process/thread ID
)
# Select a simulator device to use.
def select_simulator_device(platform):
# List the testing simulators, in JSON format
raw_json = subprocess.check_output(["xcrun", "simctl", "list", "-j"])
json_data = json.loads(raw_json)
if platform == "iOS":
# Any iOS device will do; we'll look for "SE" devices - but the name
# isn't consistent over time. Older Xcode versions will use "iPhone SE
# (Nth generation)"; As of 2025, they've started using "iPhone 16e".
#
# When Xcode is updated after a new release, new devices will be
# available and old ones will be dropped from the set available on the
# latest iOS version. Select the one with the highest minimum runtime
# version - this is an indicator of the "newest" released device, which
# should always be supported on the "most recent" iOS version.
se_simulators = sorted(
(devicetype["minRuntimeVersion"], devicetype["name"])
for devicetype in json_data["devicetypes"]
if devicetype["productFamily"] == "iPhone"
and (
(
"iPhone " in devicetype["name"]
and devicetype["name"].endswith("e")
)
or "iPhone SE " in devicetype["name"]
)
)
simulator = se_simulators[-1][1]
else:
raise ValueError(f"Unknown platform {platform}")
return simulator
def xcode_test(location: Path, platform: str, simulator: str, verbose: bool):
# Build and run the test suite on the named simulator.
args = [
"-project",
str(location / f"{platform}Testbed.xcodeproj"),
"-scheme",
f"{platform}Testbed",
"-destination",
f"platform={platform} Simulator,name={simulator}",
"-derivedDataPath",
str(location / "DerivedData"),
]
verbosity_args = [] if verbose else ["-quiet"]
print("Building test project...")
subprocess.run(
["xcodebuild", "build-for-testing"] + args + verbosity_args,
check=True,
)
# Any environment variable prefixed with TEST_RUNNER_ is exposed into the
# test runner environment. There are some variables (like those identifying
# CI platforms) that can be useful to have access to.
test_env = os.environ.copy()
if "GITHUB_ACTIONS" in os.environ:
test_env["TEST_RUNNER_GITHUB_ACTIONS"] = os.environ["GITHUB_ACTIONS"]
print("Running test project...")
# Test execution *can't* be run -quiet; verbose mode
# is how we see the output of the test output.
process = subprocess.Popen(
["xcodebuild", "test-without-building"] + args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
env=test_env,
)
while line := (process.stdout.readline()).decode(*DECODE_ARGS):
# Strip the timestamp/process prefix from each log line
line = LOG_PREFIX_REGEX.sub("", line)
sys.stdout.write(line)
sys.stdout.flush()
status = process.wait(timeout=5)
exit(status)
def copy(src, tgt):
"""An all-purpose copy.
If src is a file, it is copied. If src is a symlink, it is copied *as a
symlink*. If src is a directory, the full tree is duplicated, with symlinks
being preserved.
"""
if src.is_file() or src.is_symlink():
shutil.copyfile(src, tgt, follow_symlinks=False)
else:
shutil.copytree(src, tgt, symlinks=True)
def clone_testbed(
source: Path,
target: Path,
framework: Path,
platform: str,
apps: list[Path],
) -> None:
if target.exists():
print(f"{target} already exists; aborting without creating project.")
sys.exit(10)
if framework is None:
if not (
source / "Python.xcframework" / TEST_SLICES[platform] / "bin"
).is_dir():
print(
f"The testbed being cloned ({source}) does not contain "
"a framework with slices. Re-run with --framework"
)
sys.exit(11)
else:
if not framework.is_dir():
print(f"{framework} does not exist.")
sys.exit(12)
elif not (
framework.suffix == ".xcframework"
or (framework / "Python.framework").is_dir()
):
print(
f"{framework} is not an XCframework, "
f"or a simulator slice of a framework build."
)
sys.exit(13)
print("Cloning testbed project:")
print(f" Cloning {source}...", end="")
# Only copy the files for the platform being cloned plus the files common
# to all platforms. The XCframework will be copied later, if needed.
target.mkdir(parents=True)
for name in [
"__main__.py",
"TestbedTests",
"Testbed.lldbinit",
f"{platform}Testbed",
f"{platform}Testbed.xcodeproj",
f"{platform}Testbed.xctestplan",
]:
copy(source / name, target / name)
print(" done")
orig_xc_framework_path = source / "Python.xcframework"
xc_framework_path = target / "Python.xcframework"
test_framework_path = xc_framework_path / TEST_SLICES[platform]
if framework is not None:
if framework.suffix == ".xcframework":
print(" Installing XCFramework...", end="")
xc_framework_path.symlink_to(
framework.relative_to(xc_framework_path.parent, walk_up=True)
)
print(" done")
else:
print(" Installing simulator framework...", end="")
# We're only installing a slice of a framework; we need
# to do a full tree copy to make sure we don't damage
# symlinked content.
shutil.copytree(orig_xc_framework_path, xc_framework_path)
if test_framework_path.is_dir():
shutil.rmtree(test_framework_path)
else:
test_framework_path.unlink(missing_ok=True)
test_framework_path.symlink_to(
framework.relative_to(test_framework_path.parent, walk_up=True)
)
print(" done")
else:
copy(orig_xc_framework_path, xc_framework_path)
if (
xc_framework_path.is_symlink()
and not xc_framework_path.readlink().is_absolute()
):
# XCFramework is a relative symlink. Rewrite the symlink relative
# to the new location.
print(" Rewriting symlink to XCframework...", end="")
resolved_xc_framework_path = (
source / xc_framework_path.readlink()
).resolve()
xc_framework_path.unlink()
xc_framework_path.symlink_to(
resolved_xc_framework_path.relative_to(
xc_framework_path.parent, walk_up=True
)
)
print(" done")
elif (
test_framework_path.is_symlink()
and not test_framework_path.readlink().is_absolute()
):
print(" Rewriting symlink to simulator framework...", end="")
# Simulator framework is a relative symlink. Rewrite the symlink
# relative to the new location.
orig_test_framework_path = (
source / "Python.XCframework" / test_framework_path.readlink()
).resolve()
test_framework_path.unlink()
test_framework_path.symlink_to(
orig_test_framework_path.relative_to(
test_framework_path.parent, walk_up=True
)
)
print(" done")
else:
print(" Using pre-existing Python framework.")
for app_src in apps:
print(f" Installing app {app_src.name!r}...", end="")
app_target = target / f"Testbed/app/{app_src.name}"
if app_target.is_dir():
shutil.rmtree(app_target)
shutil.copytree(app_src, app_target)
print(" done")
print(f"Successfully cloned testbed: {target.resolve()}")
def update_test_plan(testbed_path, platform, args):
# Modify the test plan to use the requested test arguments.
test_plan_path = testbed_path / f"{platform}Testbed.xctestplan"
with test_plan_path.open("r", encoding="utf-8") as f:
test_plan = json.load(f)
test_plan["defaultOptions"]["commandLineArgumentEntries"] = [
{"argument": shlex.quote(arg)} for arg in args
]
with test_plan_path.open("w", encoding="utf-8") as f:
json.dump(test_plan, f, indent=2)
def run_testbed(
platform: str,
simulator: str | None,
args: list[str],
verbose: bool = False,
):
location = Path(__file__).parent
print("Updating test plan...", end="")
update_test_plan(location, platform, args)
print(" done.")
if simulator is None:
simulator = select_simulator_device(platform)
print(f"Running test on {simulator}")
xcode_test(
location,
platform=platform,
simulator=simulator,
verbose=verbose,
)
def main():
# Look for directories like `iOSTestbed` as an indicator of the platforms
# that the testbed folder supports. The original source testbed can support
# many platforms, but when cloned, only one platform is preserved.
available_platforms = [
platform
for platform in ["iOS"]
if (Path(__file__).parent / f"{platform}Testbed").is_dir()
]
parser = argparse.ArgumentParser(
description=(
"Manages the process of testing an Apple Python project "
"through Xcode."
),
)
subcommands = parser.add_subparsers(dest="subcommand")
clone = subcommands.add_parser(
"clone",
description=(
"Clone the testbed project, copying in a Python framework and"
"any specified application code."
),
help="Clone a testbed project to a new location.",
)
clone.add_argument(
"--framework",
help=(
"The location of the XCFramework (or simulator-only slice of an "
"XCFramework) to use when running the testbed"
),
)
clone.add_argument(
"--platform",
dest="platform",
choices=available_platforms,
default=available_platforms[0],
help=f"The platform to target (default: {available_platforms[0]})",
)
clone.add_argument(
"--app",
dest="apps",
action="append",
default=[],
help="The location of any code to include in the testbed project",
)
clone.add_argument(
"location",
help="The path where the testbed will be cloned.",
)
run = subcommands.add_parser(
"run",
usage=(
"%(prog)s [-h] [--simulator SIMULATOR] -- "
"<test arg> [<test arg> ...]"
),
description=(
"Run a testbed project. The arguments provided after `--` will be "
"passed to the running iOS process as if they were arguments to "
"`python -m`."
),
help="Run a testbed project",
)
run.add_argument(
"--platform",
dest="platform",
choices=available_platforms,
default=available_platforms[0],
help=f"The platform to target (default: {available_platforms[0]})",
)
run.add_argument(
"--simulator",
help=(
"The name of the simulator to use (eg: 'iPhone 16e'). Defaults to "
"the most recently released 'entry level' iPhone device. Device "
"architecture and OS version can also be specified; e.g., "
"`--simulator 'iPhone 16 Pro,arch=arm64,OS=26.0'` would run on "
"an ARM64 iPhone 16 Pro simulator running iOS 26.0."
),
)
run.add_argument(
"-v",
"--verbose",
action="store_true",
help="Enable verbose output",
)
try:
pos = sys.argv.index("--")
testbed_args = sys.argv[1:pos]
test_args = sys.argv[pos + 1 :]
except ValueError:
testbed_args = sys.argv[1:]
test_args = []
context = parser.parse_args(testbed_args)
if context.subcommand == "clone":
clone_testbed(
source=Path(__file__).parent.resolve(),
target=Path(context.location).resolve(),
framework=Path(context.framework).resolve()
if context.framework
else None,
platform=context.platform,
apps=[Path(app) for app in context.apps],
)
elif context.subcommand == "run":
if test_args:
if not (
Path(__file__).parent
/ "Python.xcframework"
/ TEST_SLICES[context.platform]
/ "bin"
).is_dir():
print(
"Testbed does not contain a compiled Python framework. "
f"Use `python {sys.argv[0]} clone ...` to create a "
"runnable clone of this testbed."
)
sys.exit(20)
run_testbed(
platform=context.platform,
simulator=context.simulator,
verbose=context.verbose,
args=test_args,
)
else:
print(
"Must specify test arguments "
f"(e.g., {sys.argv[0]} run -- test)"
)
print()
parser.print_help(sys.stderr)
sys.exit(21)
else:
parser.print_help(sys.stderr)
sys.exit(1)
if __name__ == "__main__":
# Under the buildbot, stdout is not a TTY, but we must still flush after
# every line to make sure our output appears in the correct order relative
# to the output of our subprocesses.
for stream in [sys.stdout, sys.stderr]:
stream.reconfigure(line_buffering=True)
main()

View file

@ -11,12 +11,11 @@
607A66222B0EFA390010BFC8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607A66212B0EFA390010BFC8 /* Assets.xcassets */; };
607A66252B0EFA390010BFC8 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607A66232B0EFA390010BFC8 /* LaunchScreen.storyboard */; };
607A66282B0EFA390010BFC8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 607A66272B0EFA390010BFC8 /* main.m */; };
607A66322B0EFA3A0010BFC8 /* iOSTestbedTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 607A66312B0EFA3A0010BFC8 /* iOSTestbedTests.m */; };
607A66322B0EFA3A0010BFC8 /* TestbedTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 607A66312B0EFA3A0010BFC8 /* TestbedTests.m */; };
607A664C2B0EFC080010BFC8 /* Python.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 607A664A2B0EFB310010BFC8 /* Python.xcframework */; };
607A664D2B0EFC080010BFC8 /* Python.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 607A664A2B0EFB310010BFC8 /* Python.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
607A66502B0EFFE00010BFC8 /* Python.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 607A664A2B0EFB310010BFC8 /* Python.xcframework */; };
607A66512B0EFFE00010BFC8 /* Python.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 607A664A2B0EFB310010BFC8 /* Python.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
607A66582B0F079F0010BFC8 /* dylib-Info-template.plist in Resources */ = {isa = PBXBuildFile; fileRef = 607A66572B0F079F0010BFC8 /* dylib-Info-template.plist */; };
608619542CB77BA900F46182 /* app_packages in Resources */ = {isa = PBXBuildFile; fileRef = 608619532CB77BA900F46182 /* app_packages */; };
608619562CB7819B00F46182 /* app in Resources */ = {isa = PBXBuildFile; fileRef = 608619552CB7819B00F46182 /* app */; };
/* End PBXBuildFile section */
@ -64,12 +63,12 @@
607A66242B0EFA390010BFC8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
607A66272B0EFA390010BFC8 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
607A662D2B0EFA3A0010BFC8 /* iOSTestbedTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iOSTestbedTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
607A66312B0EFA3A0010BFC8 /* iOSTestbedTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = iOSTestbedTests.m; sourceTree = "<group>"; };
607A66312B0EFA3A0010BFC8 /* TestbedTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestbedTests.m; sourceTree = "<group>"; };
607A664A2B0EFB310010BFC8 /* Python.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = Python.xcframework; sourceTree = "<group>"; };
607A66572B0F079F0010BFC8 /* dylib-Info-template.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "dylib-Info-template.plist"; sourceTree = "<group>"; };
607A66592B0F08600010BFC8 /* iOSTestbed-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iOSTestbed-Info.plist"; sourceTree = "<group>"; };
608619532CB77BA900F46182 /* app_packages */ = {isa = PBXFileReference; lastKnownFileType = folder; path = app_packages; sourceTree = "<group>"; };
608619552CB7819B00F46182 /* app */ = {isa = PBXFileReference; lastKnownFileType = folder; path = app; sourceTree = "<group>"; };
60FE0EFB2E56BB6D00524F87 /* iOSTestbed.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = iOSTestbed.xctestplan; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -95,9 +94,10 @@
607A66092B0EFA380010BFC8 = {
isa = PBXGroup;
children = (
60FE0EFB2E56BB6D00524F87 /* iOSTestbed.xctestplan */,
607A664A2B0EFB310010BFC8 /* Python.xcframework */,
607A66142B0EFA380010BFC8 /* iOSTestbed */,
607A66302B0EFA3A0010BFC8 /* iOSTestbedTests */,
607A66302B0EFA3A0010BFC8 /* TestbedTests */,
607A66132B0EFA380010BFC8 /* Products */,
607A664F2B0EFFE00010BFC8 /* Frameworks */,
);
@ -118,7 +118,6 @@
608619552CB7819B00F46182 /* app */,
608619532CB77BA900F46182 /* app_packages */,
607A66592B0F08600010BFC8 /* iOSTestbed-Info.plist */,
607A66572B0F079F0010BFC8 /* dylib-Info-template.plist */,
607A66152B0EFA380010BFC8 /* AppDelegate.h */,
607A66162B0EFA380010BFC8 /* AppDelegate.m */,
607A66212B0EFA390010BFC8 /* Assets.xcassets */,
@ -128,12 +127,12 @@
path = iOSTestbed;
sourceTree = "<group>";
};
607A66302B0EFA3A0010BFC8 /* iOSTestbedTests */ = {
607A66302B0EFA3A0010BFC8 /* TestbedTests */ = {
isa = PBXGroup;
children = (
607A66312B0EFA3A0010BFC8 /* iOSTestbedTests.m */,
607A66312B0EFA3A0010BFC8 /* TestbedTests.m */,
);
path = iOSTestbedTests;
path = TestbedTests;
sourceTree = "<group>";
};
607A664F2B0EFFE00010BFC8 /* Frameworks */ = {
@ -153,8 +152,7 @@
607A660E2B0EFA380010BFC8 /* Sources */,
607A660F2B0EFA380010BFC8 /* Frameworks */,
607A66102B0EFA380010BFC8 /* Resources */,
607A66552B0F061D0010BFC8 /* Install Target Specific Python Standard Library */,
607A66562B0F06200010BFC8 /* Prepare Python Binary Modules */,
607A66552B0F061D0010BFC8 /* Process Python libraries */,
607A664E2B0EFC080010BFC8 /* Embed Frameworks */,
);
buildRules = (
@ -228,7 +226,6 @@
buildActionMask = 2147483647;
files = (
607A66252B0EFA390010BFC8 /* LaunchScreen.storyboard in Resources */,
607A66582B0F079F0010BFC8 /* dylib-Info-template.plist in Resources */,
608619562CB7819B00F46182 /* app in Resources */,
607A66222B0EFA390010BFC8 /* Assets.xcassets in Resources */,
608619542CB77BA900F46182 /* app_packages in Resources */,
@ -245,7 +242,7 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
607A66552B0F061D0010BFC8 /* Install Target Specific Python Standard Library */ = {
607A66552B0F061D0010BFC8 /* Process Python libraries */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
@ -255,34 +252,14 @@
);
inputPaths = (
);
name = "Install Target Specific Python Standard Library";
name = "Process Python libraries";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\n\nmkdir -p \"$CODESIGNING_FOLDER_PATH/python/lib\"\nif [ \"$EFFECTIVE_PLATFORM_NAME\" = \"-iphonesimulator\" ]; then\n echo \"Installing Python modules for iOS Simulator\"\n rsync -au --delete \"$PROJECT_DIR/Python.xcframework/ios-arm64_x86_64-simulator/lib/\" \"$CODESIGNING_FOLDER_PATH/python/lib/\" \nelse\n echo \"Installing Python modules for iOS Device\"\n rsync -au --delete \"$PROJECT_DIR/Python.xcframework/ios-arm64/lib/\" \"$CODESIGNING_FOLDER_PATH/python/lib/\" \nfi\n";
showEnvVarsInLog = 0;
};
607A66562B0F06200010BFC8 /* Prepare Python Binary Modules */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Prepare Python Binary Modules";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\n\ninstall_dylib () {\n INSTALL_BASE=$1\n FULL_EXT=$2\n\n # The name of the extension file\n EXT=$(basename \"$FULL_EXT\")\n # The location of the extension file, relative to the bundle\n RELATIVE_EXT=${FULL_EXT#$CODESIGNING_FOLDER_PATH/} \n # The path to the extension file, relative to the install base\n PYTHON_EXT=${RELATIVE_EXT/$INSTALL_BASE/}\n # The full dotted name of the extension module, constructed from the file path.\n FULL_MODULE_NAME=$(echo $PYTHON_EXT | cut -d \".\" -f 1 | tr \"/\" \".\"); \n # A bundle identifier; not actually used, but required by Xcode framework packaging\n FRAMEWORK_BUNDLE_ID=$(echo $PRODUCT_BUNDLE_IDENTIFIER.$FULL_MODULE_NAME | tr \"_\" \"-\")\n # The name of the framework folder.\n FRAMEWORK_FOLDER=\"Frameworks/$FULL_MODULE_NAME.framework\"\n\n # If the framework folder doesn't exist, create it.\n if [ ! -d \"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER\" ]; then\n echo \"Creating framework for $RELATIVE_EXT\" \n mkdir -p \"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER\"\n cp \"$CODESIGNING_FOLDER_PATH/dylib-Info-template.plist\" \"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/Info.plist\"\n plutil -replace CFBundleExecutable -string \"$FULL_MODULE_NAME\" \"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/Info.plist\"\n plutil -replace CFBundleIdentifier -string \"$FRAMEWORK_BUNDLE_ID\" \"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/Info.plist\"\n fi\n \n echo \"Installing binary for $FRAMEWORK_FOLDER/$FULL_MODULE_NAME\" \n mv \"$FULL_EXT\" \"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/$FULL_MODULE_NAME\"\n # Create a placeholder .fwork file where the .so was\n echo \"$FRAMEWORK_FOLDER/$FULL_MODULE_NAME\" > ${FULL_EXT%.so}.fwork\n # Create a back reference to the .so file location in the framework\n echo \"${RELATIVE_EXT%.so}.fwork\" > \"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/$FULL_MODULE_NAME.origin\" \n}\n\nPYTHON_VER=$(ls -1 \"$CODESIGNING_FOLDER_PATH/python/lib\")\necho \"Install Python $PYTHON_VER standard library extension modules...\"\nfind \"$CODESIGNING_FOLDER_PATH/python/lib/$PYTHON_VER/lib-dynload\" -name \"*.so\" | while read FULL_EXT; do\n install_dylib python/lib/$PYTHON_VER/lib-dynload/ \"$FULL_EXT\"\ndone\necho \"Install app package extension modules...\"\nfind \"$CODESIGNING_FOLDER_PATH/app_packages\" -name \"*.so\" | while read FULL_EXT; do\n install_dylib app_packages/ \"$FULL_EXT\"\ndone\necho \"Install app extension modules...\"\nfind \"$CODESIGNING_FOLDER_PATH/app\" -name \"*.so\" | while read FULL_EXT; do\n install_dylib app/ \"$FULL_EXT\"\ndone\n\n# Clean up dylib template \nrm -f \"$CODESIGNING_FOLDER_PATH/dylib-Info-template.plist\"\necho \"Signing frameworks as $EXPANDED_CODE_SIGN_IDENTITY_NAME ($EXPANDED_CODE_SIGN_IDENTITY)...\"\nfind \"$CODESIGNING_FOLDER_PATH/Frameworks\" -name \"*.framework\" -exec /usr/bin/codesign --force --sign \"$EXPANDED_CODE_SIGN_IDENTITY\" ${OTHER_CODE_SIGN_FLAGS:-} -o runtime --timestamp=none --preserve-metadata=identifier,entitlements,flags --generate-entitlement-der \"{}\" \\; \n";
shellScript = "set -e\nsource $PROJECT_DIR/Python.xcframework/build/utils.sh\ninstall_python Python.xcframework app app_packages\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
@ -301,7 +278,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
607A66322B0EFA3A0010BFC8 /* iOSTestbedTests.m in Sources */,
607A66322B0EFA3A0010BFC8 /* TestbedTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -379,7 +356,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
@ -434,7 +411,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
@ -460,7 +437,7 @@
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -491,7 +468,7 @@
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -514,7 +491,7 @@
DEVELOPMENT_TEAM = 3HEZE76D99;
GENERATE_INFOPLIST_FILE = YES;
HEADER_SEARCH_PATHS = "\"$(BUILT_PRODUCTS_DIR)/Python.framework/Headers\"";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = org.python.iOSTestbedTests;
PRODUCT_NAME = "$(TARGET_NAME)";
@ -534,7 +511,7 @@
DEVELOPMENT_TEAM = 3HEZE76D99;
GENERATE_INFOPLIST_FILE = YES;
HEADER_SEARCH_PATHS = "\"$(BUILT_PRODUCTS_DIR)/Python.framework/Headers\"";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = org.python.iOSTestbedTests;
PRODUCT_NAME = "$(TARGET_NAME)";

View file

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1640"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607A66112B0EFA380010BFC8"
BuildableName = "iOSTestbed.app"
BlueprintName = "iOSTestbed"
ReferencedContainer = "container:iOSTestbed.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SOURCE_ROOT)/Testbed.lldbinit"
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:iOSTestbed.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607A662C2B0EFA3A0010BFC8"
BuildableName = "iOSTestbedTests.xctest"
BlueprintName = "iOSTestbedTests"
ReferencedContainer = "container:iOSTestbed.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607A66112B0EFA380010BFC8"
BuildableName = "iOSTestbed.app"
BlueprintName = "iOSTestbed"
ReferencedContainer = "container:iOSTestbed.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607A66112B0EFA380010BFC8"
BuildableName = "iOSTestbed.app"
BlueprintName = "iOSTestbed"
ReferencedContainer = "container:iOSTestbed.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View file

@ -0,0 +1,46 @@
{
"configurations" : [
{
"id" : "F5A95CE4-1ADE-4A6E-A0E1-CDBAE26DF0C5",
"name" : "Test Scheme Action",
"options" : {
}
}
],
"defaultOptions" : {
"commandLineArgumentEntries" : [
{
"argument" : "test"
},
{
"argument" : "-uall"
},
{
"argument" : "--single-process"
},
{
"argument" : "--rerun"
},
{
"argument" : "-W"
}
],
"targetForVariableExpansion" : {
"containerPath" : "container:iOSTestbed.xcodeproj",
"identifier" : "607A66112B0EFA380010BFC8",
"name" : "iOSTestbed"
}
},
"testTargets" : [
{
"parallelizable" : false,
"target" : {
"containerPath" : "container:iOSTestbed.xcodeproj",
"identifier" : "607A662C2B0EFA3A0010BFC8",
"name" : "iOSTestbedTests"
}
}
],
"version" : 1
}

View file

@ -1,7 +1,7 @@
This folder can contain any Python application code.
During the build, any binary modules found in this folder will be processed into
iOS Framework form.
Framework form.
When the test suite runs, this folder will be on the PYTHONPATH, and will be the
working directory for the test suite.

View file

@ -2,6 +2,6 @@ This folder can be a target for installing any Python dependencies needed by the
test suite.
During the build, any binary modules found in this folder will be processed into
iOS Framework form.
Framework form.
When the test suite runs, this folder will be on the PYTHONPATH.

View file

@ -41,18 +41,6 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>TestArgs</key>
<array>
<string>test</string> <!-- Invoke "python -m test" -->
<string>-uall</string> <!-- Enable all resources -->
<string>--single-process</string> <!-- always run all tests sequentially in a single process -->
<string>--rerun</string> <!-- Re-run failed tests in verbose mode -->
<string>-W</string> <!-- Display test output on failure -->
<!-- To run a subset of tests, add the test names below; e.g.,
<string>test_os</string>
<string>test_sys</string>
-->
</array>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>

View file

@ -170,6 +170,7 @@ venv:
echo "venv already exists."; \
echo "To recreate it, remove it first with \`make clean-venv'."; \
else \
set -e; \
echo "Creating venv in $(VENVDIR)"; \
if $(UV) --version >/dev/null 2>&1; then \
$(UV) venv --python=$(PYTHON) $(VENVDIR); \
@ -183,7 +184,7 @@ venv:
fi
.PHONY: dist-no-html
dist-no-html: dist-text dist-pdf dist-epub dist-texinfo
dist-no-html: dist-text dist-epub dist-texinfo
.PHONY: dist
dist:
@ -240,7 +241,8 @@ dist-pdf:
# as otherwise the full latexmk process is run twice.
# ($$ is needed to escape the $; https://www.gnu.org/software/make/manual/make.html#Basics-of-Variable-References)
-sed -i 's/: all-$$(FMT)/:/' build/latex/Makefile
(cd build/latex; $(MAKE) clean && $(MAKE) --jobs=$$((`nproc`+1)) --output-sync LATEXMKOPTS='-quiet' all-pdf && $(MAKE) FMT=pdf zip bz2)
if [ -n "$(filter output-sync,$(value .FEATURES))" ]; then OUTPUTSYNC=--output-sync; else OUTPUTSYNC=; fi && \
(cd build/latex; $(MAKE) clean && $(MAKE) --jobs=$$((`getconf _NPROCESSORS_ONLN`+1)) $$OUTPUTSYNC LATEXMKOPTS='-quiet' all-pdf && $(MAKE) FMT=pdf zip bz2)
cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-a4.zip
cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-a4.tar.bz2
@echo "Build finished and archived!"

View file

@ -19,6 +19,12 @@ If you find a bug in this documentation or would like to propose an improvement,
please submit a bug report on the :ref:`issue tracker <using-the-tracker>`. If you
have a suggestion on how to fix it, include that as well.
.. only:: translation
If the bug or suggested improvement concerns the translation of this
documentation, submit the report to the
`translations repository <TRANSLATION_REPO_>`_ instead.
You can also open a discussion item on our
`Documentation Discourse forum <https://discuss.python.org/c/documentation/26>`_.

View file

@ -16,7 +16,20 @@ Allocating Objects on the Heap
Initialize a newly allocated object *op* with its type and initial
reference. Returns the initialized object. Other fields of the object are
not affected.
not initialized. Despite its name, this function is unrelated to the
object's :meth:`~object.__init__` method (:c:member:`~PyTypeObject.tp_init`
slot). Specifically, this function does **not** call the object's
:meth:`!__init__` method.
In general, consider this function to be a low-level routine. Use
:c:member:`~PyTypeObject.tp_alloc` where possible.
For implementing :c:member:`!tp_alloc` for your type, prefer
:c:func:`PyType_GenericAlloc` or :c:func:`PyObject_New`.
.. note::
This function only initializes the object's memory corresponding to the
initial :c:type:`PyObject` structure. It does not zero the rest.
.. c:function:: PyVarObject* PyObject_InitVar(PyVarObject *op, PyTypeObject *type, Py_ssize_t size)
@ -24,43 +37,108 @@ Allocating Objects on the Heap
This does everything :c:func:`PyObject_Init` does, and also initializes the
length information for a variable-size object.
.. note::
This function only initializes some of the object's memory. It does not
zero the rest.
.. c:macro:: PyObject_New(TYPE, typeobj)
Allocate a new Python object using the C structure type *TYPE*
and the Python type object *typeobj* (``PyTypeObject*``).
Fields not defined by the Python object header are not initialized.
The caller will own the only reference to the object
(i.e. its reference count will be one).
The size of the memory allocation is determined from the
:c:member:`~PyTypeObject.tp_basicsize` field of the type object.
Allocates a new Python object using the C structure type *TYPE* and the
Python type object *typeobj* (``PyTypeObject*``) by calling
:c:func:`PyObject_Malloc` to allocate memory and initializing it like
:c:func:`PyObject_Init`. The caller will own the only reference to the
object (i.e. its reference count will be one).
Note that this function is unsuitable if *typeobj* has
:c:macro:`Py_TPFLAGS_HAVE_GC` set. For such objects,
use :c:func:`PyObject_GC_New` instead.
Avoid calling this directly to allocate memory for an object; call the type's
:c:member:`~PyTypeObject.tp_alloc` slot instead.
When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot,
:c:func:`PyType_GenericAlloc` is preferred over a custom function that
simply calls this macro.
This macro does not call :c:member:`~PyTypeObject.tp_alloc`,
:c:member:`~PyTypeObject.tp_new` (:meth:`~object.__new__`), or
:c:member:`~PyTypeObject.tp_init` (:meth:`~object.__init__`).
This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set in
:c:member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_New` instead.
Memory allocated by this macro must be freed with :c:func:`PyObject_Free`
(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot).
.. note::
The returned memory is not guaranteed to have been completely zeroed
before it was initialized.
.. note::
This macro does not construct a fully initialized object of the given
type; it merely allocates memory and prepares it for further
initialization by :c:member:`~PyTypeObject.tp_init`. To construct a
fully initialized object, call *typeobj* instead. For example::
PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);
.. seealso::
* :c:func:`PyObject_Free`
* :c:macro:`PyObject_GC_New`
* :c:func:`PyType_GenericAlloc`
* :c:member:`~PyTypeObject.tp_alloc`
.. c:macro:: PyObject_NewVar(TYPE, typeobj, size)
Allocate a new Python object using the C structure type *TYPE* and the
Python type object *typeobj* (``PyTypeObject*``).
Fields not defined by the Python object header
are not initialized. The allocated memory allows for the *TYPE* structure
plus *size* (``Py_ssize_t``) fields of the size
given by the :c:member:`~PyTypeObject.tp_itemsize` field of
*typeobj*. This is useful for implementing objects like tuples, which are
able to determine their size at construction time. Embedding the array of
fields into the same allocation decreases the number of allocations,
improving the memory management efficiency.
Like :c:macro:`PyObject_New` except:
Note that this function is unsuitable if *typeobj* has
:c:macro:`Py_TPFLAGS_HAVE_GC` set. For such objects,
use :c:func:`PyObject_GC_NewVar` instead.
* It allocates enough memory for the *TYPE* structure plus *size*
(``Py_ssize_t``) fields of the size given by the
:c:member:`~PyTypeObject.tp_itemsize` field of *typeobj*.
* The memory is initialized like :c:func:`PyObject_InitVar`.
This is useful for implementing objects like tuples, which are able to
determine their size at construction time. Embedding the array of fields
into the same allocation decreases the number of allocations, improving the
memory management efficiency.
.. c:function:: void PyObject_Del(void *op)
Avoid calling this directly to allocate memory for an object; call the type's
:c:member:`~PyTypeObject.tp_alloc` slot instead.
When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot,
:c:func:`PyType_GenericAlloc` is preferred over a custom function that
simply calls this macro.
This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set in
:c:member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_NewVar`
instead.
Memory allocated by this function must be freed with :c:func:`PyObject_Free`
(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot).
.. note::
The returned memory is not guaranteed to have been completely zeroed
before it was initialized.
.. note::
This macro does not construct a fully initialized object of the given
type; it merely allocates memory and prepares it for further
initialization by :c:member:`~PyTypeObject.tp_init`. To construct a
fully initialized object, call *typeobj* instead. For example::
PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);
.. seealso::
* :c:func:`PyObject_Free`
* :c:macro:`PyObject_GC_NewVar`
* :c:func:`PyType_GenericAlloc`
* :c:member:`~PyTypeObject.tp_alloc`
Same as :c:func:`PyObject_Free`.
.. c:var:: PyObject _Py_NoneStruct
@ -71,6 +149,38 @@ Allocating Objects on the Heap
.. seealso::
:c:func:`PyModule_Create`
:ref:`moduleobjects`
To allocate and create extension modules.
Deprecated aliases
^^^^^^^^^^^^^^^^^^
These are :term:`soft deprecated` aliases to existing functions and macros.
They exist solely for backwards compatibility.
.. list-table::
:widths: auto
:header-rows: 1
* * Deprecated alias
* Function
* * .. c:macro:: PyObject_NEW(type, typeobj)
* :c:macro:`PyObject_New`
* * .. c:macro:: PyObject_NEW_VAR(type, typeobj, n)
* :c:macro:`PyObject_NewVar`
* * .. c:macro:: PyObject_INIT(op, typeobj)
* :c:func:`PyObject_Init`
* * .. c:macro:: PyObject_INIT_VAR(op, typeobj, n)
* :c:func:`PyObject_InitVar`
* * .. c:macro:: PyObject_MALLOC(n)
* :c:func:`PyObject_Malloc`
* * .. c:macro:: PyObject_REALLOC(p, n)
* :c:func:`PyObject_Realloc`
* * .. c:macro:: PyObject_FREE(p)
* :c:func:`PyObject_Free`
* * .. c:macro:: PyObject_DEL(p)
* :c:func:`PyObject_Free`
* * .. c:macro:: PyObject_Del(p)
* :c:func:`PyObject_Free`

View file

@ -113,18 +113,14 @@ There are three ways strings and buffers can be converted to C:
``z`` (:class:`str` or ``None``) [const char \*]
Like ``s``, but the Python object may also be ``None``, in which case the C
pointer is set to ``NULL``.
It is the same as ``s?`` with the C pointer was initialized to ``NULL``.
``z*`` (:class:`str`, :term:`bytes-like object` or ``None``) [Py_buffer]
Like ``s*``, but the Python object may also be ``None``, in which case the
``buf`` member of the :c:type:`Py_buffer` structure is set to ``NULL``.
It is the same as ``s*?`` with the ``buf`` member of the :c:type:`Py_buffer`
structure was initialized to ``NULL``.
``z#`` (:class:`str`, read-only :term:`bytes-like object` or ``None``) [const char \*, :c:type:`Py_ssize_t`]
Like ``s#``, but the Python object may also be ``None``, in which case the C
pointer is set to ``NULL``.
It is the same as ``s#?`` with the C pointer was initialized to ``NULL``.
``y`` (read-only :term:`bytes-like object`) [const char \*]
This format converts a bytes-like object to a C pointer to a
@ -164,7 +160,7 @@ There are three ways strings and buffers can be converted to C:
``w*`` (read-write :term:`bytes-like object`) [Py_buffer]
This format accepts any object which implements the read-write buffer
interface. It fills a :c:type:`Py_buffer` structure provided by the caller.
The buffer may contain embedded null bytes. The caller have to call
The buffer may contain embedded null bytes. The caller has to call
:c:func:`PyBuffer_Release` when it is done with the buffer.
``es`` (:class:`str`) [const char \*encoding, char \*\*buffer]
@ -387,17 +383,6 @@ Other objects
Non-tuple sequences are deprecated if *items* contains format units
which store a borrowed buffer or a borrowed reference.
``unit?`` (anything or ``None``) [*matching-variable(s)*]
``?`` modifies the behavior of the preceding format unit.
The C variable(s) corresponding to that parameter should be initialized
to their default value --- when the argument is ``None``,
:c:func:`PyArg_ParseTuple` does not touch the contents of the corresponding
C variable(s).
If the argument is not ``None``, it is parsed according to the specified
format unit.
.. versionadded:: 3.14
A few other characters have a meaning in a format string. These may not occur
inside nested parentheses. They are:
@ -685,6 +670,13 @@ Building values
``p`` (:class:`bool`) [int]
Convert a C :c:expr:`int` to a Python :class:`bool` object.
Be aware that this format requires an ``int`` argument.
Unlike most other contexts in C, variadic arguments are not coerced to
a suitable type automatically.
You can convert another type (for example, a pointer or a float) to a
suitable ``int`` value using ``(x) ? 1 : 0`` or ``!!x``.
.. versionadded:: 3.14
``c`` (:class:`bytes` of length 1) [char]

View file

@ -261,6 +261,10 @@ readonly, format
MUST be consistent for all consumers. For example, :c:expr:`PyBUF_SIMPLE | PyBUF_WRITABLE`
can be used to request a simple writable buffer.
.. c:macro:: PyBUF_WRITEABLE
This is a :term:`soft deprecated` alias to :c:macro:`PyBUF_WRITABLE`.
.. c:macro:: PyBUF_FORMAT
Controls the :c:member:`~Py_buffer.format` field. If set, this field MUST

View file

@ -219,3 +219,38 @@ called with a non-bytes parameter.
reallocation fails, the original bytes object at *\*bytes* is deallocated,
*\*bytes* is set to ``NULL``, :exc:`MemoryError` is set, and ``-1`` is
returned.
.. c:function:: PyObject *PyBytes_Repr(PyObject *bytes, int smartquotes)
Get the string representation of *bytes*. This function is currently used to
implement :meth:`!bytes.__repr__` in Python.
This function does not do type checking; it is undefined behavior to pass
*bytes* as a non-bytes object or ``NULL``.
If *smartquotes* is true, the representation will use a double-quoted string
instead of single-quoted string when single-quotes are present in *bytes*.
For example, the byte string ``'Python'`` would be represented as
``b"'Python'"`` when *smartquotes* is true, or ``b'\'Python\''`` when it is
false.
On success, this function returns a :term:`strong reference` to a
:class:`str` object containing the representation. On failure, this
returns ``NULL`` with an exception set.
.. c:function:: PyObject *PyBytes_DecodeEscape(const char *s, Py_ssize_t len, const char *errors, Py_ssize_t unicode, const char *recode_encoding)
Unescape a backslash-escaped string *s*. *s* must not be ``NULL``.
*len* must be the size of *s*.
*errors* must be one of ``"strict"``, ``"replace"``, or ``"ignore"``. If
*errors* is ``NULL``, then ``"strict"`` is used by default.
On success, this function returns a :term:`strong reference` to a Python
:class:`bytes` object containing the unescaped string. On failure, this
function returns ``NULL`` with an exception set.
.. versionchanged:: 3.9
*unicode* and *recode_encoding* are now unused.

View file

@ -15,13 +15,19 @@ Refer to :ref:`using-capsules` for more information on using these objects.
.. c:type:: PyCapsule
This subtype of :c:type:`PyObject` represents an opaque value, useful for C
extension modules who need to pass an opaque value (as a :c:expr:`void*`
extension modules which need to pass an opaque value (as a :c:expr:`void*`
pointer) through Python code to other C code. It is often used to make a C
function pointer defined in one module available to other modules, so the
regular import mechanism can be used to access C APIs defined in dynamically
loaded modules.
.. c:var:: PyTypeObject PyCapsule_Type
The type object corresponding to capsule objects. This is the same object
as :class:`types.CapsuleType` in the Python layer.
.. c:type:: PyCapsule_Destructor
The type of a destructor callback for a capsule. Defined as::
@ -105,9 +111,19 @@ Refer to :ref:`using-capsules` for more information on using these objects.
``module.attribute``. The *name* stored in the capsule must match this
string exactly.
This function splits *name* on the ``.`` character, and imports the first
element. It then processes further elements using attribute lookups.
Return the capsule's internal *pointer* on success. On failure, set an
exception and return ``NULL``.
.. note::
If *name* points to an attribute of some submodule or subpackage, this
submodule or subpackage must be previously imported using other means
(for example, by using :c:func:`PyImport_ImportModule`) for the
attribute lookups to succeed.
.. versionchanged:: 3.3
*no_block* has no effect anymore.

View file

@ -7,7 +7,7 @@ Cell Objects
"Cell" objects are used to implement variables referenced by multiple scopes.
For each such variable, a cell object is created to store the value; the local
variables of each stack frame that references the value contains a reference to
variables of each stack frame that references the value contain a reference to
the cells from outer scopes which also use that variable. When the value is
accessed, the value contained in the cell is used instead of the cell object
itself. This de-referencing of the cell object requires support from the

View file

@ -182,7 +182,7 @@ bound into a function.
Type of a code object watcher callback function.
If *event* is ``PY_CODE_EVENT_CREATE``, then the callback is invoked
after `co` has been fully initialized. Otherwise, the callback is invoked
after *co* has been fully initialized. Otherwise, the callback is invoked
before the destruction of *co* takes place, so the prior state of *co*
can be inspected.
@ -211,6 +211,82 @@ bound into a function.
.. versionadded:: 3.12
.. c:function:: PyObject *PyCode_Optimize(PyObject *code, PyObject *consts, PyObject *names, PyObject *lnotab_obj)
This is a :term:`soft deprecated` function that does nothing.
Prior to Python 3.10, this function would perform basic optimizations to a
code object.
.. versionchanged:: 3.10
This function now does nothing.
.. _c_codeobject_flags:
Code Object Flags
-----------------
Code objects contain a bit-field of flags, which can be retrieved as the
:attr:`~codeobject.co_flags` Python attribute (for example using
:c:func:`PyObject_GetAttrString`), and set using a *flags* argument to
:c:func:`PyUnstable_Code_New` and similar functions.
Flags whose names start with ``CO_FUTURE_`` correspond to features normally
selectable by :ref:`future statements <future>`. These flags can be used in
:c:member:`PyCompilerFlags.cf_flags`.
Note that many ``CO_FUTURE_`` flags are mandatory in current versions of
Python, and setting them has no effect.
The following flags are available.
For their meaning, see the linked documentation of their Python equivalents.
.. list-table::
:widths: auto
:header-rows: 1
* * Flag
* Meaning
* * .. c:macro:: CO_OPTIMIZED
* :py:data:`inspect.CO_OPTIMIZED`
* * .. c:macro:: CO_NEWLOCALS
* :py:data:`inspect.CO_NEWLOCALS`
* * .. c:macro:: CO_VARARGS
* :py:data:`inspect.CO_VARARGS`
* * .. c:macro:: CO_VARKEYWORDS
* :py:data:`inspect.CO_VARKEYWORDS`
* * .. c:macro:: CO_NESTED
* :py:data:`inspect.CO_NESTED`
* * .. c:macro:: CO_GENERATOR
* :py:data:`inspect.CO_GENERATOR`
* * .. c:macro:: CO_COROUTINE
* :py:data:`inspect.CO_COROUTINE`
* * .. c:macro:: CO_ITERABLE_COROUTINE
* :py:data:`inspect.CO_ITERABLE_COROUTINE`
* * .. c:macro:: CO_ASYNC_GENERATOR
* :py:data:`inspect.CO_ASYNC_GENERATOR`
* * .. c:macro:: CO_HAS_DOCSTRING
* :py:data:`inspect.CO_HAS_DOCSTRING`
* * .. c:macro:: CO_METHOD
* :py:data:`inspect.CO_METHOD`
* * .. c:macro:: CO_FUTURE_DIVISION
* no effect (:py:data:`__future__.division`)
* * .. c:macro:: CO_FUTURE_ABSOLUTE_IMPORT
* no effect (:py:data:`__future__.absolute_import`)
* * .. c:macro:: CO_FUTURE_WITH_STATEMENT
* no effect (:py:data:`__future__.with_statement`)
* * .. c:macro:: CO_FUTURE_PRINT_FUNCTION
* no effect (:py:data:`__future__.print_function`)
* * .. c:macro:: CO_FUTURE_UNICODE_LITERALS
* no effect (:py:data:`__future__.unicode_literals`)
* * .. c:macro:: CO_FUTURE_GENERATOR_STOP
* no effect (:py:data:`__future__.generator_stop`)
* * .. c:macro:: CO_FUTURE_ANNOTATIONS
* :py:data:`__future__.annotations`
Extra information
-----------------
@ -224,7 +300,7 @@ may change without deprecation warnings.
.. c:function:: Py_ssize_t PyUnstable_Eval_RequestCodeExtraIndex(freefunc free)
Return a new an opaque index value used to adding data to code objects.
Return a new opaque index value used to adding data to code objects.
You generally call this function once (per interpreter) and use the result
with ``PyCode_GetExtra`` and ``PyCode_SetExtra`` to manipulate

View file

@ -7,7 +7,7 @@ Codec registry and support functions
Register a new codec search function.
As side effect, this tries to load the :mod:`!encodings` package, if not yet
As a side effect, this tries to load the :mod:`!encodings` package, if not yet
done, to make sure that it is always first in the list of search functions.
.. c:function:: int PyCodec_Unregister(PyObject *search_function)
@ -39,7 +39,7 @@ Codec registry and support functions
*object* is passed through the decoder function found for the given
*encoding* using the error handling method defined by *errors*. *errors* may
be ``NULL`` to use the default method defined for the codec. Raises a
:exc:`LookupError` if no encoder can be found.
:exc:`LookupError` if no decoder can be found.
Codec lookup API
@ -129,3 +129,13 @@ Registry API for Unicode encoding error handlers
Replace the unicode encode error with ``\N{...}`` escapes.
.. versionadded:: 3.5
Codec utility variables
-----------------------
.. c:var:: const char *Py_hexdigits
A string constant containing the lowercase hexadecimal digits: ``"0123456789abcdef"``.
.. versionadded:: 3.3

View file

@ -109,11 +109,20 @@ Other Objects
descriptor.rst
slice.rst
memoryview.rst
picklebuffer.rst
weakref.rst
capsule.rst
frame.rst
gen.rst
coro.rst
contextvars.rst
datetime.rst
typehints.rst
C API for extension modules
===========================
.. toctree::
curses.rst
datetime.rst

View file

@ -41,7 +41,7 @@ The return value (*rv*) for these functions should be interpreted as follows:
``rv + 1`` bytes would have been needed to succeed. ``str[size-1]`` is ``'\0'``
in this case.
* When ``rv < 0``, "something bad happened." ``str[size-1]`` is ``'\0'`` in
* When ``rv < 0``, the output conversion failed and ``str[size-1]`` is ``'\0'`` in
this case too, but the rest of *str* is undefined. The exact cause of the error
depends on the underlying platform.
@ -128,18 +128,28 @@ The following functions provide locale-independent string to number conversions.
must be 0 and is ignored. The ``'r'`` format code specifies the
standard :func:`repr` format.
*flags* can be zero or more of the values ``Py_DTSF_SIGN``,
``Py_DTSF_ADD_DOT_0``, or ``Py_DTSF_ALT``, or-ed together:
*flags* can be zero or more of the following values or-ed together:
* ``Py_DTSF_SIGN`` means to always precede the returned string with a sign
character, even if *val* is non-negative.
.. c:macro:: Py_DTSF_SIGN
* ``Py_DTSF_ADD_DOT_0`` means to ensure that the returned string will not look
like an integer.
Always precede the returned string with a sign
character, even if *val* is non-negative.
* ``Py_DTSF_ALT`` means to apply "alternate" formatting rules. See the
documentation for the :c:func:`PyOS_snprintf` ``'#'`` specifier for
details.
.. c:macro:: Py_DTSF_ADD_DOT_0
Ensure that the returned string will not look like an integer.
.. c:macro:: Py_DTSF_ALT
Apply "alternate" formatting rules.
See the documentation for the :c:func:`PyOS_snprintf` ``'#'`` specifier for
details.
.. c:macro:: Py_DTSF_NO_NEG_0
Negative zero is converted to positive zero.
.. versionadded:: 3.11
If *ptype* is non-``NULL``, then the value it points to will be set to one of
``Py_DTST_FINITE``, ``Py_DTST_INFINITE``, or ``Py_DTST_NAN``, signifying that
@ -152,13 +162,85 @@ The following functions provide locale-independent string to number conversions.
.. versionadded:: 3.1
.. c:function:: int PyOS_stricmp(const char *s1, const char *s2)
.. c:function:: int PyOS_mystricmp(const char *str1, const char *str2)
int PyOS_mystrnicmp(const char *str1, const char *str2, Py_ssize_t size)
Case insensitive comparison of strings. The function works almost
identically to :c:func:`!strcmp` except that it ignores the case.
Case insensitive comparison of strings. These functions work almost
identically to :c:func:`!strcmp` and :c:func:`!strncmp` (respectively),
except that they ignore the case of ASCII characters.
Return ``0`` if the strings are equal, a negative value if *str1* sorts
lexicographically before *str2*, or a positive value if it sorts after.
In the *str1* or *str2* arguments, a NUL byte marks the end of the string.
For :c:func:`!PyOS_mystrnicmp`, the *size* argument gives the maximum size
of the string, as if NUL was present at the index given by *size*.
These functions do not use the locale.
.. c:function:: int PyOS_strnicmp(const char *s1, const char *s2, Py_ssize_t size)
.. c:function:: int PyOS_stricmp(const char *str1, const char *str2)
int PyOS_strnicmp(const char *str1, const char *str2, Py_ssize_t size)
Case insensitive comparison of strings. The function works almost
identically to :c:func:`!strncmp` except that it ignores the case.
Case insensitive comparison of strings.
On Windows, these are aliases of :c:func:`!stricmp` and :c:func:`!strnicmp`,
respectively.
On other platforms, they are aliases of :c:func:`PyOS_mystricmp` and
:c:func:`PyOS_mystrnicmp`, respectively.
Character classification and conversion
=======================================
The following macros provide locale-independent (unlike the C standard library
``ctype.h``) character classification and conversion.
The argument must be a signed or unsigned :c:expr:`char`.
.. c:macro:: Py_ISALNUM(c)
Return true if the character *c* is an alphanumeric character.
.. c:macro:: Py_ISALPHA(c)
Return true if the character *c* is an alphabetic character (``a-z`` and ``A-Z``).
.. c:macro:: Py_ISDIGIT(c)
Return true if the character *c* is a decimal digit (``0-9``).
.. c:macro:: Py_ISLOWER(c)
Return true if the character *c* is a lowercase ASCII letter (``a-z``).
.. c:macro:: Py_ISUPPER(c)
Return true if the character *c* is an uppercase ASCII letter (``A-Z``).
.. c:macro:: Py_ISSPACE(c)
Return true if the character *c* is a whitespace character (space, tab,
carriage return, newline, vertical tab, or form feed).
.. c:macro:: Py_ISXDIGIT(c)
Return true if the character *c* is a hexadecimal digit (``0-9``, ``a-f``, and
``A-F``).
.. c:macro:: Py_TOLOWER(c)
Return the lowercase equivalent of the character *c*.
.. c:macro:: Py_TOUPPER(c)
Return the uppercase equivalent of the character *c*.

138
Doc/c-api/curses.rst Normal file
View file

@ -0,0 +1,138 @@
.. highlight:: c
Curses C API
------------
:mod:`curses` exposes a small C interface for extension modules.
Consumers must include the header file :file:`py_curses.h` (which is not
included by default by :file:`Python.h`) and :c:func:`import_curses` must
be invoked, usually as part of the module initialisation function, to populate
:c:var:`PyCurses_API`.
.. warning::
Neither the C API nor the pure Python :mod:`curses` module are compatible
with subinterpreters.
.. c:macro:: import_curses()
Import the curses C API. The macro does not need a semi-colon to be called.
On success, populate the :c:var:`PyCurses_API` pointer.
On failure, set :c:var:`PyCurses_API` to NULL and set an exception.
The caller must check if an error occurred via :c:func:`PyErr_Occurred`:
.. code-block::
import_curses(); // semi-colon is optional but recommended
if (PyErr_Occurred()) { /* cleanup */ }
.. c:var:: void **PyCurses_API
Dynamically allocated object containing the curses C API.
This variable is only available once :c:macro:`import_curses` succeeds.
``PyCurses_API[0]`` corresponds to :c:data:`PyCursesWindow_Type`.
``PyCurses_API[1]``, ``PyCurses_API[2]``, and ``PyCurses_API[3]``
are pointers to predicate functions of type ``int (*)(void)``.
When called, these predicates return whether :func:`curses.setupterm`,
:func:`curses.initscr`, and :func:`curses.start_color` have been called
respectively.
See also the convenience macros :c:macro:`PyCursesSetupTermCalled`,
:c:macro:`PyCursesInitialised`, and :c:macro:`PyCursesInitialisedColor`.
.. note::
The number of entries in this structure is subject to changes.
Consider using :c:macro:`PyCurses_API_pointers` to check if
new fields are available or not.
.. c:macro:: PyCurses_API_pointers
The number of accessible fields (``4``) in :c:var:`PyCurses_API`.
This number is incremented whenever new fields are added.
.. c:var:: PyTypeObject PyCursesWindow_Type
The :ref:`heap type <heap-types>` corresponding to :class:`curses.window`.
.. c:function:: int PyCursesWindow_Check(PyObject *op)
Return true if *op* is a :class:`curses.window` instance, false otherwise.
The following macros are convenience macros expanding into C statements.
In particular, they can only be used as ``macro;`` or ``macro``, but not
``macro()`` or ``macro();``.
.. c:macro:: PyCursesSetupTermCalled
Macro checking if :func:`curses.setupterm` has been called.
The macro expansion is roughly equivalent to:
.. code-block::
{
typedef int (*predicate_t)(void);
predicate_t was_setupterm_called = (predicate_t)PyCurses_API[1];
if (!was_setupterm_called()) {
return NULL;
}
}
.. c:macro:: PyCursesInitialised
Macro checking if :func:`curses.initscr` has been called.
The macro expansion is roughly equivalent to:
.. code-block::
{
typedef int (*predicate_t)(void);
predicate_t was_initscr_called = (predicate_t)PyCurses_API[2];
if (!was_initscr_called()) {
return NULL;
}
}
.. c:macro:: PyCursesInitialisedColor
Macro checking if :func:`curses.start_color` has been called.
The macro expansion is roughly equivalent to:
.. code-block::
{
typedef int (*predicate_t)(void);
predicate_t was_start_color_called = (predicate_t)PyCurses_API[3];
if (!was_start_color_called()) {
return NULL;
}
}
Internal data
-------------
The following objects are exposed by the C API but should be considered
internal-only.
.. c:macro:: PyCurses_CAPSULE_NAME
Name of the curses capsule to pass to :c:func:`PyCapsule_Import`.
Internal usage only. Use :c:macro:`import_curses` instead.

View file

@ -8,11 +8,42 @@ DateTime Objects
Various date and time objects are supplied by the :mod:`datetime` module.
Before using any of these functions, the header file :file:`datetime.h` must be
included in your source (note that this is not included by :file:`Python.h`),
and the macro :c:macro:`!PyDateTime_IMPORT` must be invoked, usually as part of
and the macro :c:macro:`PyDateTime_IMPORT` must be invoked, usually as part of
the module initialisation function. The macro puts a pointer to a C structure
into a static variable, :c:data:`!PyDateTimeAPI`, that is used by the following
into a static variable, :c:data:`PyDateTimeAPI`, that is used by the following
macros.
.. c:macro:: PyDateTime_IMPORT()
Import the datetime C API.
On success, populate the :c:var:`PyDateTimeAPI` pointer.
On failure, set :c:var:`PyDateTimeAPI` to ``NULL`` and set an exception.
The caller must check if an error occurred via :c:func:`PyErr_Occurred`:
.. code-block::
PyDateTime_IMPORT;
if (PyErr_Occurred()) { /* cleanup */ }
.. warning::
This is not compatible with subinterpreters.
.. c:type:: PyDateTime_CAPI
Structure containing the fields for the datetime C API.
The fields of this structure are private and subject to change.
Do not use this directly; prefer ``PyDateTime_*`` APIs instead.
.. c:var:: PyDateTime_CAPI *PyDateTimeAPI
Dynamically allocated object containing the datetime C API.
This variable is only available once :c:macro:`PyDateTime_IMPORT` succeeds.
.. c:type:: PyDateTime_Date
This subtype of :c:type:`PyObject` represents a Python date object.
@ -46,7 +77,7 @@ macros.
.. c:var:: PyTypeObject PyDateTime_DeltaType
This instance of :c:type:`PyTypeObject` represents Python type for
This instance of :c:type:`PyTypeObject` represents the Python type for
the difference between two datetime values;
it is the same object as :class:`datetime.timedelta` in the Python layer.
@ -325,3 +356,16 @@ Macros for the convenience of modules implementing the DB API:
Create and return a new :class:`datetime.date` object given an argument
tuple suitable for passing to :meth:`datetime.date.fromtimestamp`.
Internal data
-------------
The following symbols are exposed by the C API but should be considered
internal-only.
.. c:macro:: PyDateTime_CAPSULE_NAME
Name of the datetime capsule to pass to :c:func:`PyCapsule_Import`.
Internal usage only. Use :c:macro:`PyDateTime_IMPORT` instead.

View file

@ -21,20 +21,104 @@ found in the dictionary of type objects.
.. c:function:: PyObject* PyDescr_NewMember(PyTypeObject *type, struct PyMemberDef *meth)
.. c:var:: PyTypeObject PyMemberDescr_Type
The type object for member descriptor objects created from
:c:type:`PyMemberDef` structures. These descriptors expose fields of a
C struct as attributes on a type, and correspond
to :class:`types.MemberDescriptorType` objects in Python.
.. c:var:: PyTypeObject PyGetSetDescr_Type
The type object for get/set descriptor objects created from
:c:type:`PyGetSetDef` structures. These descriptors implement attributes
whose value is computed by C getter and setter functions, and are used
for many built-in type attributes.
.. c:function:: PyObject* PyDescr_NewMethod(PyTypeObject *type, struct PyMethodDef *meth)
.. c:var:: PyTypeObject PyMethodDescr_Type
The type object for method descriptor objects created from
:c:type:`PyMethodDef` structures. These descriptors expose C functions as
methods on a type, and correspond to :class:`types.MemberDescriptorType`
objects in Python.
.. c:function:: PyObject* PyDescr_NewWrapper(PyTypeObject *type, struct wrapperbase *wrapper, void *wrapped)
.. c:var:: PyTypeObject PyWrapperDescr_Type
The type object for wrapper descriptor objects created by
:c:func:`PyDescr_NewWrapper` and :c:func:`PyWrapper_New`. Wrapper
descriptors are used internally to expose special methods implemented
via wrapper structures, and appear in Python as
:class:`types.WrapperDescriptorType` objects.
.. c:function:: PyObject* PyDescr_NewClassMethod(PyTypeObject *type, PyMethodDef *method)
.. c:function:: int PyDescr_IsData(PyObject *descr)
Return non-zero if the descriptor objects *descr* describes a data attribute, or
Return non-zero if the descriptor object *descr* describes a data attribute, or
``0`` if it describes a method. *descr* must be a descriptor object; there is
no error checking.
.. c:function:: PyObject* PyWrapper_New(PyObject *, PyObject *)
Built-in descriptors
^^^^^^^^^^^^^^^^^^^^
.. c:var:: PyTypeObject PySuper_Type
The type object for super objects. This is the same object as
:class:`super` in the Python layer.
.. c:var:: PyTypeObject PyClassMethod_Type
The type of class method objects. This is the same object as
:class:`classmethod` in the Python layer.
.. c:var:: PyTypeObject PyClassMethodDescr_Type
The type object for C-level class method descriptor objects.
This is the type of the descriptors created for :func:`classmethod` defined in
C extension types, and is the same object as :class:`classmethod`
in Python.
.. c:function:: PyObject *PyClassMethod_New(PyObject *callable)
Create a new :class:`classmethod` object wrapping *callable*.
*callable* must be a callable object and must not be ``NULL``.
On success, this function returns a :term:`strong reference` to a new class
method descriptor. On failure, this function returns ``NULL`` with an
exception set.
.. c:var:: PyTypeObject PyStaticMethod_Type
The type of static method objects. This is the same object as
:class:`staticmethod` in the Python layer.
.. c:function:: PyObject *PyStaticMethod_New(PyObject *callable)
Create a new :class:`staticmethod` object wrapping *callable*.
*callable* must be a callable object and must not be ``NULL``.
On success, this function returns a :term:`strong reference` to a new static
method descriptor. On failure, this function returns ``NULL`` with an
exception set.

View file

@ -43,6 +43,17 @@ Dictionary Objects
prevent modification of the dictionary for non-dynamic class types.
.. c:var:: PyTypeObject PyDictProxy_Type
The type object for mapping proxy objects created by
:c:func:`PyDictProxy_New` and for the read-only ``__dict__`` attribute
of many built-in types. A :c:type:`PyDictProxy_Type` instance provides a
dynamic, read-only view of an underlying dictionary: changes to the
underlying dictionary are reflected in the proxy, but the proxy itself
does not support mutation operations. This corresponds to
:class:`types.MappingProxyType` in Python.
.. c:function:: void PyDict_Clear(PyObject *p)
Empty an existing dictionary of all key-value pairs.
@ -50,7 +61,7 @@ Dictionary Objects
.. c:function:: int PyDict_Contains(PyObject *p, PyObject *key)
Determine if dictionary *p* contains *key*. If an item in *p* is matches
Determine if dictionary *p* contains *key*. If an item in *p* matches
*key*, return ``1``, otherwise return ``0``. On error, return ``-1``.
This is equivalent to the Python expression ``key in p``.
@ -198,7 +209,7 @@ Dictionary Objects
.. c:function:: int PyDict_Pop(PyObject *p, PyObject *key, PyObject **result)
Remove *key* from dictionary *p* and optionally return the removed value.
Do not raise :exc:`KeyError` if the key missing.
Do not raise :exc:`KeyError` if the key is missing.
- If the key is present, set *\*result* to a new reference to the removed
value if *result* is not ``NULL``, and return ``1``.
@ -207,7 +218,7 @@ Dictionary Objects
- On error, raise an exception and return ``-1``.
Similar to :meth:`dict.pop`, but without the default value and
not raising :exc:`KeyError` if the key missing.
not raising :exc:`KeyError` if the key is missing.
.. versionadded:: 3.13
@ -245,6 +256,11 @@ Dictionary Objects
``len(p)`` on a dictionary.
.. c:function:: Py_ssize_t PyDict_GET_SIZE(PyObject *p)
Similar to :c:func:`PyDict_Size`, but without error checking.
.. c:function:: int PyDict_Next(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue)
Iterate over all key-value pairs in the dictionary *p*. The
@ -301,6 +317,15 @@ Dictionary Objects
}
Py_END_CRITICAL_SECTION();
.. note::
On the free-threaded build, this function can be used safely inside a
critical section. However, the references returned for *pkey* and *pvalue*
are :term:`borrowed <borrowed reference>` and are only valid while the
critical section is held. If you need to use these objects outside the
critical section or when the critical section can be suspended, create a
:term:`strong reference <strong reference>` (for example, using
:c:func:`Py_NewRef`).
.. c:function:: int PyDict_Merge(PyObject *a, PyObject *b, int override)
@ -417,3 +442,138 @@ Dictionary Objects
it before returning.
.. versionadded:: 3.12
Dictionary View Objects
^^^^^^^^^^^^^^^^^^^^^^^
.. c:function:: int PyDictViewSet_Check(PyObject *op)
Return true if *op* is a view of a set inside a dictionary. This is currently
equivalent to :c:expr:`PyDictKeys_Check(op) || PyDictItems_Check(op)`. This
function always succeeds.
.. c:var:: PyTypeObject PyDictKeys_Type
Type object for a view of dictionary keys. In Python, this is the type of
the object returned by :meth:`dict.keys`.
.. c:function:: int PyDictKeys_Check(PyObject *op)
Return true if *op* is an instance of a dictionary keys view. This function
always succeeds.
.. c:var:: PyTypeObject PyDictValues_Type
Type object for a view of dictionary values. In Python, this is the type of
the object returned by :meth:`dict.values`.
.. c:function:: int PyDictValues_Check(PyObject *op)
Return true if *op* is an instance of a dictionary values view. This function
always succeeds.
.. c:var:: PyTypeObject PyDictItems_Type
Type object for a view of dictionary items. In Python, this is the type of
the object returned by :meth:`dict.items`.
.. c:function:: int PyDictItems_Check(PyObject *op)
Return true if *op* is an instance of a dictionary items view. This function
always succeeds.
Ordered Dictionaries
^^^^^^^^^^^^^^^^^^^^
Python's C API provides interface for :class:`collections.OrderedDict` from C.
Since Python 3.7, dictionaries are ordered by default, so there is usually
little need for these functions; prefer ``PyDict*`` where possible.
.. c:var:: PyTypeObject PyODict_Type
Type object for ordered dictionaries. This is the same object as
:class:`collections.OrderedDict` in the Python layer.
.. c:function:: int PyODict_Check(PyObject *od)
Return true if *od* is an ordered dictionary object or an instance of a
subtype of the :class:`~collections.OrderedDict` type. This function
always succeeds.
.. c:function:: int PyODict_CheckExact(PyObject *od)
Return true if *od* is an ordered dictionary object, but not an instance of
a subtype of the :class:`~collections.OrderedDict` type.
This function always succeeds.
.. c:var:: PyTypeObject PyODictKeys_Type
Analogous to :c:type:`PyDictKeys_Type` for ordered dictionaries.
.. c:var:: PyTypeObject PyODictValues_Type
Analogous to :c:type:`PyDictValues_Type` for ordered dictionaries.
.. c:var:: PyTypeObject PyODictItems_Type
Analogous to :c:type:`PyDictItems_Type` for ordered dictionaries.
.. c:function:: PyObject *PyODict_New(void)
Return a new empty ordered dictionary, or ``NULL`` on failure.
This is analogous to :c:func:`PyDict_New`.
.. c:function:: int PyODict_SetItem(PyObject *od, PyObject *key, PyObject *value)
Insert *value* into the ordered dictionary *od* with a key of *key*.
Return ``0`` on success or ``-1`` with an exception set on failure.
This is analogous to :c:func:`PyDict_SetItem`.
.. c:function:: int PyODict_DelItem(PyObject *od, PyObject *key)
Remove the entry in the ordered dictionary *od* with key *key*.
Return ``0`` on success or ``-1`` with an exception set on failure.
This is analogous to :c:func:`PyDict_DelItem`.
These are :term:`soft deprecated` aliases to ``PyDict`` APIs:
.. list-table::
:widths: auto
:header-rows: 1
* * ``PyODict``
* ``PyDict``
* * .. c:macro:: PyODict_GetItem(od, key)
* :c:func:`PyDict_GetItem`
* * .. c:macro:: PyODict_GetItemWithError(od, key)
* :c:func:`PyDict_GetItemWithError`
* * .. c:macro:: PyODict_GetItemString(od, key)
* :c:func:`PyDict_GetItemString`
* * .. c:macro:: PyODict_Contains(od, key)
* :c:func:`PyDict_Contains`
* * .. c:macro:: PyODict_Size(od)
* :c:func:`PyDict_Size`
* * .. c:macro:: PyODict_SIZE(od)
* :c:func:`PyDict_GET_SIZE`

View file

@ -309,6 +309,14 @@ For convenience, some of these functions will always return a
.. versionadded:: 3.4
.. c:function:: void PyErr_RangedSyntaxLocationObject(PyObject *filename, int lineno, int col_offset, int end_lineno, int end_col_offset)
Similar to :c:func:`PyErr_SyntaxLocationObject`, but also sets the
*end_lineno* and *end_col_offset* information for the current exception.
.. versionadded:: 3.10
.. c:function:: void PyErr_SyntaxLocationEx(const char *filename, int lineno, int col_offset)
Like :c:func:`PyErr_SyntaxLocationObject`, but *filename* is a byte string
@ -331,6 +339,23 @@ For convenience, some of these functions will always return a
use.
.. c:function:: PyObject *PyErr_ProgramTextObject(PyObject *filename, int lineno)
Get the source line in *filename* at line *lineno*. *filename* should be a
Python :class:`str` object.
On success, this function returns a Python string object with the found line.
On failure, this function returns ``NULL`` without an exception set.
.. c:function:: PyObject *PyErr_ProgramText(const char *filename, int lineno)
Similar to :c:func:`PyErr_ProgramTextObject`, but *filename* is a
:c:expr:`const char *`, which is decoded with the
:term:`filesystem encoding and error handler`, instead of a
Python object reference.
Issuing warnings
================
@ -394,6 +419,15 @@ an error value).
.. versionadded:: 3.2
.. c:function:: int PyErr_WarnExplicitFormat(PyObject *category, const char *filename, int lineno, const char *module, PyObject *registry, const char *format, ...)
Similar to :c:func:`PyErr_WarnExplicit`, but uses
:c:func:`PyUnicode_FromFormat` to format the warning message. *format* is
an ASCII-encoded string.
.. versionadded:: 3.2
.. c:function:: int PyErr_ResourceWarning(PyObject *source, Py_ssize_t stack_level, const char *format, ...)
Function similar to :c:func:`PyErr_WarnFormat`, but *category* is
@ -749,9 +783,30 @@ Exception Classes
.. versionadded:: 3.2
.. c:function:: int PyExceptionClass_Check(PyObject *ob)
Return non-zero if *ob* is an exception class, zero otherwise. This function always succeeds.
.. c:function:: const char *PyExceptionClass_Name(PyObject *ob)
Return :c:member:`~PyTypeObject.tp_name` of the exception class *ob*.
Exception Objects
=================
.. c:function:: int PyExceptionInstance_Check(PyObject *op)
Return true if *op* is an instance of :class:`BaseException`, false
otherwise. This function always succeeds.
.. c:macro:: PyExceptionInstance_Class(op)
Equivalent to :c:func:`Py_TYPE(op) <Py_TYPE>`.
.. c:function:: PyObject* PyException_GetTraceback(PyObject *ex)
Return the traceback associated with the exception as a new reference, as
@ -929,6 +984,9 @@ because the :ref:`call protocol <call>` takes care of recursion handling.
be concatenated to the :exc:`RecursionError` message caused by the recursion
depth limit.
.. seealso::
The :c:func:`PyUnstable_ThreadState_SetStackProtection` function.
.. versionchanged:: 3.9
This function is now also available in the :ref:`limited API <limited-c-api>`.
@ -969,184 +1027,159 @@ these are the C equivalent to :func:`reprlib.recursive_repr`.
Ends a :c:func:`Py_ReprEnter`. Must be called once for each
invocation of :c:func:`Py_ReprEnter` that returns zero.
.. c:function:: int Py_GetRecursionLimit(void)
Get the recursion limit for the current interpreter. It can be set with
:c:func:`Py_SetRecursionLimit`. The recursion limit prevents the
Python interpreter stack from growing infinitely.
This function cannot fail, and the caller must hold an
:term:`attached thread state`.
.. seealso::
:py:func:`sys.getrecursionlimit`
.. c:function:: void Py_SetRecursionLimit(int new_limit)
Set the recursion limit for the current interpreter.
This function cannot fail, and the caller must hold an
:term:`attached thread state`.
.. seealso::
:py:func:`sys.setrecursionlimit`
.. _standardexceptions:
Standard Exceptions
===================
Exception and warning types
===========================
All standard Python exceptions are available as global variables whose names are
``PyExc_`` followed by the Python exception name. These have the type
:c:expr:`PyObject*`; they are all class objects. For completeness, here are all
the variables:
All standard Python exceptions and warning categories are available as global
variables whose names are ``PyExc_`` followed by the Python exception name.
These have the type :c:expr:`PyObject*`; they are all class objects.
.. index::
single: PyExc_BaseException (C var)
single: PyExc_Exception (C var)
single: PyExc_ArithmeticError (C var)
single: PyExc_AssertionError (C var)
single: PyExc_AttributeError (C var)
single: PyExc_BlockingIOError (C var)
single: PyExc_BrokenPipeError (C var)
single: PyExc_BufferError (C var)
single: PyExc_ChildProcessError (C var)
single: PyExc_ConnectionAbortedError (C var)
single: PyExc_ConnectionError (C var)
single: PyExc_ConnectionRefusedError (C var)
single: PyExc_ConnectionResetError (C var)
single: PyExc_EOFError (C var)
single: PyExc_FileExistsError (C var)
single: PyExc_FileNotFoundError (C var)
single: PyExc_FloatingPointError (C var)
single: PyExc_GeneratorExit (C var)
single: PyExc_ImportError (C var)
single: PyExc_IndentationError (C var)
single: PyExc_IndexError (C var)
single: PyExc_InterruptedError (C var)
single: PyExc_IsADirectoryError (C var)
single: PyExc_KeyError (C var)
single: PyExc_KeyboardInterrupt (C var)
single: PyExc_LookupError (C var)
single: PyExc_MemoryError (C var)
single: PyExc_ModuleNotFoundError (C var)
single: PyExc_NameError (C var)
single: PyExc_NotADirectoryError (C var)
single: PyExc_NotImplementedError (C var)
single: PyExc_OSError (C var)
single: PyExc_OverflowError (C var)
single: PyExc_PermissionError (C var)
single: PyExc_ProcessLookupError (C var)
single: PyExc_PythonFinalizationError (C var)
single: PyExc_RecursionError (C var)
single: PyExc_ReferenceError (C var)
single: PyExc_RuntimeError (C var)
single: PyExc_StopAsyncIteration (C var)
single: PyExc_StopIteration (C var)
single: PyExc_SyntaxError (C var)
single: PyExc_SystemError (C var)
single: PyExc_SystemExit (C var)
single: PyExc_TabError (C var)
single: PyExc_TimeoutError (C var)
single: PyExc_TypeError (C var)
single: PyExc_UnboundLocalError (C var)
single: PyExc_UnicodeDecodeError (C var)
single: PyExc_UnicodeEncodeError (C var)
single: PyExc_UnicodeError (C var)
single: PyExc_UnicodeTranslateError (C var)
single: PyExc_ValueError (C var)
single: PyExc_ZeroDivisionError (C var)
For completeness, here are all the variables:
+-----------------------------------------+---------------------------------+----------+
| C Name | Python Name | Notes |
+=========================================+=================================+==========+
| :c:data:`PyExc_BaseException` | :exc:`BaseException` | [1]_ |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_Exception` | :exc:`Exception` | [1]_ |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_ArithmeticError` | :exc:`ArithmeticError` | [1]_ |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_AssertionError` | :exc:`AssertionError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_AttributeError` | :exc:`AttributeError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_BlockingIOError` | :exc:`BlockingIOError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_BrokenPipeError` | :exc:`BrokenPipeError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_BufferError` | :exc:`BufferError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_ChildProcessError` | :exc:`ChildProcessError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_ConnectionAbortedError` | :exc:`ConnectionAbortedError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_ConnectionError` | :exc:`ConnectionError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_ConnectionRefusedError` | :exc:`ConnectionRefusedError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_ConnectionResetError` | :exc:`ConnectionResetError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_EOFError` | :exc:`EOFError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_FileExistsError` | :exc:`FileExistsError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_FileNotFoundError` | :exc:`FileNotFoundError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_FloatingPointError` | :exc:`FloatingPointError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_GeneratorExit` | :exc:`GeneratorExit` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_ImportError` | :exc:`ImportError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_IndentationError` | :exc:`IndentationError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_IndexError` | :exc:`IndexError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_InterruptedError` | :exc:`InterruptedError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_IsADirectoryError` | :exc:`IsADirectoryError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_KeyError` | :exc:`KeyError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_KeyboardInterrupt` | :exc:`KeyboardInterrupt` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_LookupError` | :exc:`LookupError` | [1]_ |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_MemoryError` | :exc:`MemoryError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_ModuleNotFoundError` | :exc:`ModuleNotFoundError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_NameError` | :exc:`NameError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_NotADirectoryError` | :exc:`NotADirectoryError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_NotImplementedError` | :exc:`NotImplementedError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_OSError` | :exc:`OSError` | [1]_ |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_OverflowError` | :exc:`OverflowError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_PermissionError` | :exc:`PermissionError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_ProcessLookupError` | :exc:`ProcessLookupError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_PythonFinalizationError` | :exc:`PythonFinalizationError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_RecursionError` | :exc:`RecursionError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_ReferenceError` | :exc:`ReferenceError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_RuntimeError` | :exc:`RuntimeError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_StopAsyncIteration` | :exc:`StopAsyncIteration` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_StopIteration` | :exc:`StopIteration` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_SyntaxError` | :exc:`SyntaxError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_SystemError` | :exc:`SystemError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_SystemExit` | :exc:`SystemExit` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_TabError` | :exc:`TabError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_TimeoutError` | :exc:`TimeoutError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_TypeError` | :exc:`TypeError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_UnboundLocalError` | :exc:`UnboundLocalError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_UnicodeDecodeError` | :exc:`UnicodeDecodeError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_UnicodeEncodeError` | :exc:`UnicodeEncodeError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_UnicodeError` | :exc:`UnicodeError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_UnicodeTranslateError` | :exc:`UnicodeTranslateError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_ValueError` | :exc:`ValueError` | |
+-----------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_ZeroDivisionError` | :exc:`ZeroDivisionError` | |
+-----------------------------------------+---------------------------------+----------+
Exception types
---------------
.. list-table::
:align: left
:widths: auto
:header-rows: 1
* * C name
* Python name
* * .. c:var:: PyObject *PyExc_BaseException
* :exc:`BaseException`
* * .. c:var:: PyObject *PyExc_BaseExceptionGroup
* :exc:`BaseExceptionGroup`
* * .. c:var:: PyObject *PyExc_Exception
* :exc:`Exception`
* * .. c:var:: PyObject *PyExc_ArithmeticError
* :exc:`ArithmeticError`
* * .. c:var:: PyObject *PyExc_AssertionError
* :exc:`AssertionError`
* * .. c:var:: PyObject *PyExc_AttributeError
* :exc:`AttributeError`
* * .. c:var:: PyObject *PyExc_BlockingIOError
* :exc:`BlockingIOError`
* * .. c:var:: PyObject *PyExc_BrokenPipeError
* :exc:`BrokenPipeError`
* * .. c:var:: PyObject *PyExc_BufferError
* :exc:`BufferError`
* * .. c:var:: PyObject *PyExc_ChildProcessError
* :exc:`ChildProcessError`
* * .. c:var:: PyObject *PyExc_ConnectionAbortedError
* :exc:`ConnectionAbortedError`
* * .. c:var:: PyObject *PyExc_ConnectionError
* :exc:`ConnectionError`
* * .. c:var:: PyObject *PyExc_ConnectionRefusedError
* :exc:`ConnectionRefusedError`
* * .. c:var:: PyObject *PyExc_ConnectionResetError
* :exc:`ConnectionResetError`
* * .. c:var:: PyObject *PyExc_EOFError
* :exc:`EOFError`
* * .. c:var:: PyObject *PyExc_FileExistsError
* :exc:`FileExistsError`
* * .. c:var:: PyObject *PyExc_FileNotFoundError
* :exc:`FileNotFoundError`
* * .. c:var:: PyObject *PyExc_FloatingPointError
* :exc:`FloatingPointError`
* * .. c:var:: PyObject *PyExc_GeneratorExit
* :exc:`GeneratorExit`
* * .. c:var:: PyObject *PyExc_ImportError
* :exc:`ImportError`
* * .. c:var:: PyObject *PyExc_IndentationError
* :exc:`IndentationError`
* * .. c:var:: PyObject *PyExc_IndexError
* :exc:`IndexError`
* * .. c:var:: PyObject *PyExc_InterruptedError
* :exc:`InterruptedError`
* * .. c:var:: PyObject *PyExc_IsADirectoryError
* :exc:`IsADirectoryError`
* * .. c:var:: PyObject *PyExc_KeyError
* :exc:`KeyError`
* * .. c:var:: PyObject *PyExc_KeyboardInterrupt
* :exc:`KeyboardInterrupt`
* * .. c:var:: PyObject *PyExc_LookupError
* :exc:`LookupError`
* * .. c:var:: PyObject *PyExc_MemoryError
* :exc:`MemoryError`
* * .. c:var:: PyObject *PyExc_ModuleNotFoundError
* :exc:`ModuleNotFoundError`
* * .. c:var:: PyObject *PyExc_NameError
* :exc:`NameError`
* * .. c:var:: PyObject *PyExc_NotADirectoryError
* :exc:`NotADirectoryError`
* * .. c:var:: PyObject *PyExc_NotImplementedError
* :exc:`NotImplementedError`
* * .. c:var:: PyObject *PyExc_OSError
* :exc:`OSError`
* * .. c:var:: PyObject *PyExc_OverflowError
* :exc:`OverflowError`
* * .. c:var:: PyObject *PyExc_PermissionError
* :exc:`PermissionError`
* * .. c:var:: PyObject *PyExc_ProcessLookupError
* :exc:`ProcessLookupError`
* * .. c:var:: PyObject *PyExc_PythonFinalizationError
* :exc:`PythonFinalizationError`
* * .. c:var:: PyObject *PyExc_RecursionError
* :exc:`RecursionError`
* * .. c:var:: PyObject *PyExc_ReferenceError
* :exc:`ReferenceError`
* * .. c:var:: PyObject *PyExc_RuntimeError
* :exc:`RuntimeError`
* * .. c:var:: PyObject *PyExc_StopAsyncIteration
* :exc:`StopAsyncIteration`
* * .. c:var:: PyObject *PyExc_StopIteration
* :exc:`StopIteration`
* * .. c:var:: PyObject *PyExc_SyntaxError
* :exc:`SyntaxError`
* * .. c:var:: PyObject *PyExc_SystemError
* :exc:`SystemError`
* * .. c:var:: PyObject *PyExc_SystemExit
* :exc:`SystemExit`
* * .. c:var:: PyObject *PyExc_TabError
* :exc:`TabError`
* * .. c:var:: PyObject *PyExc_TimeoutError
* :exc:`TimeoutError`
* * .. c:var:: PyObject *PyExc_TypeError
* :exc:`TypeError`
* * .. c:var:: PyObject *PyExc_UnboundLocalError
* :exc:`UnboundLocalError`
* * .. c:var:: PyObject *PyExc_UnicodeDecodeError
* :exc:`UnicodeDecodeError`
* * .. c:var:: PyObject *PyExc_UnicodeEncodeError
* :exc:`UnicodeEncodeError`
* * .. c:var:: PyObject *PyExc_UnicodeError
* :exc:`UnicodeError`
* * .. c:var:: PyObject *PyExc_UnicodeTranslateError
* :exc:`UnicodeTranslateError`
* * .. c:var:: PyObject *PyExc_ValueError
* :exc:`ValueError`
* * .. c:var:: PyObject *PyExc_ZeroDivisionError
* :exc:`ZeroDivisionError`
.. versionadded:: 3.3
:c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`,
@ -1164,88 +1197,116 @@ the variables:
.. versionadded:: 3.6
:c:data:`PyExc_ModuleNotFoundError`.
These are compatibility aliases to :c:data:`PyExc_OSError`:
.. versionadded:: 3.11
:c:data:`PyExc_BaseExceptionGroup`.
.. index::
single: PyExc_EnvironmentError (C var)
single: PyExc_IOError (C var)
single: PyExc_WindowsError (C var)
+-------------------------------------+----------+
| C Name | Notes |
+=====================================+==========+
| :c:data:`!PyExc_EnvironmentError` | |
+-------------------------------------+----------+
| :c:data:`!PyExc_IOError` | |
+-------------------------------------+----------+
| :c:data:`!PyExc_WindowsError` | [2]_ |
+-------------------------------------+----------+
OSError aliases
---------------
The following are a compatibility aliases to :c:data:`PyExc_OSError`.
.. versionchanged:: 3.3
These aliases used to be separate exception types.
.. list-table::
:align: left
:widths: auto
:header-rows: 1
* * C name
* Python name
* Notes
* * .. c:var:: PyObject *PyExc_EnvironmentError
* :exc:`OSError`
*
* * .. c:var:: PyObject *PyExc_IOError
* :exc:`OSError`
*
* * .. c:var:: PyObject *PyExc_WindowsError
* :exc:`OSError`
* [win]_
Notes:
.. [1]
This is a base class for other standard exceptions.
.. [win]
:c:var:`!PyExc_WindowsError` is only defined on Windows; protect code that
uses this by testing that the preprocessor macro ``MS_WINDOWS`` is defined.
.. [2]
Only defined on Windows; protect code that uses this by testing that the
preprocessor macro ``MS_WINDOWS`` is defined.
.. _standardwarningcategories:
Standard Warning Categories
===========================
Warning types
-------------
All standard Python warning categories are available as global variables whose
names are ``PyExc_`` followed by the Python exception name. These have the type
:c:expr:`PyObject*`; they are all class objects. For completeness, here are all
the variables:
.. list-table::
:align: left
:widths: auto
:header-rows: 1
.. index::
single: PyExc_Warning (C var)
single: PyExc_BytesWarning (C var)
single: PyExc_DeprecationWarning (C var)
single: PyExc_FutureWarning (C var)
single: PyExc_ImportWarning (C var)
single: PyExc_PendingDeprecationWarning (C var)
single: PyExc_ResourceWarning (C var)
single: PyExc_RuntimeWarning (C var)
single: PyExc_SyntaxWarning (C var)
single: PyExc_UnicodeWarning (C var)
single: PyExc_UserWarning (C var)
+------------------------------------------+---------------------------------+----------+
| C Name | Python Name | Notes |
+==========================================+=================================+==========+
| :c:data:`PyExc_Warning` | :exc:`Warning` | [3]_ |
+------------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_BytesWarning` | :exc:`BytesWarning` | |
+------------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_DeprecationWarning` | :exc:`DeprecationWarning` | |
+------------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_FutureWarning` | :exc:`FutureWarning` | |
+------------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_ImportWarning` | :exc:`ImportWarning` | |
+------------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_PendingDeprecationWarning`| :exc:`PendingDeprecationWarning`| |
+------------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_ResourceWarning` | :exc:`ResourceWarning` | |
+------------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_RuntimeWarning` | :exc:`RuntimeWarning` | |
+------------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_SyntaxWarning` | :exc:`SyntaxWarning` | |
+------------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_UnicodeWarning` | :exc:`UnicodeWarning` | |
+------------------------------------------+---------------------------------+----------+
| :c:data:`PyExc_UserWarning` | :exc:`UserWarning` | |
+------------------------------------------+---------------------------------+----------+
* * C name
* Python name
* * .. c:var:: PyObject *PyExc_Warning
* :exc:`Warning`
* * .. c:var:: PyObject *PyExc_BytesWarning
* :exc:`BytesWarning`
* * .. c:var:: PyObject *PyExc_DeprecationWarning
* :exc:`DeprecationWarning`
* * .. c:var:: PyObject *PyExc_EncodingWarning
* :exc:`EncodingWarning`
* * .. c:var:: PyObject *PyExc_FutureWarning
* :exc:`FutureWarning`
* * .. c:var:: PyObject *PyExc_ImportWarning
* :exc:`ImportWarning`
* * .. c:var:: PyObject *PyExc_PendingDeprecationWarning
* :exc:`PendingDeprecationWarning`
* * .. c:var:: PyObject *PyExc_ResourceWarning
* :exc:`ResourceWarning`
* * .. c:var:: PyObject *PyExc_RuntimeWarning
* :exc:`RuntimeWarning`
* * .. c:var:: PyObject *PyExc_SyntaxWarning
* :exc:`SyntaxWarning`
* * .. c:var:: PyObject *PyExc_UnicodeWarning
* :exc:`UnicodeWarning`
* * .. c:var:: PyObject *PyExc_UserWarning
* :exc:`UserWarning`
.. versionadded:: 3.2
:c:data:`PyExc_ResourceWarning`.
Notes:
.. versionadded:: 3.10
:c:data:`PyExc_EncodingWarning`.
.. [3]
This is a base class for other standard warning categories.
Tracebacks
==========
.. c:var:: PyTypeObject PyTraceBack_Type
Type object for traceback objects. This is available as
:class:`types.TracebackType` in the Python layer.
.. c:function:: int PyTraceBack_Check(PyObject *op)
Return true if *op* is a traceback object, false otherwise. This function
does not account for subtypes.
.. c:function:: int PyTraceBack_Here(PyFrameObject *f)
Replace the :attr:`~BaseException.__traceback__` attribute on the current
exception with a new traceback prepending *f* to the existing chain.
Calling this function without an exception set is undefined behavior.
This function returns ``0`` on success, and returns ``-1`` with an
exception set on failure.
.. c:function:: int PyTraceBack_Print(PyObject *tb, PyObject *f)
Write the traceback *tb* into the file *f*.
This function returns ``0`` on success, and returns ``-1`` with an
exception set on failure.

View file

@ -0,0 +1,247 @@
.. highlight:: c
.. _extension-modules:
Defining extension modules
--------------------------
A C extension for CPython is a shared library (for example, a ``.so`` file
on Linux, ``.pyd`` DLL on Windows), which is loadable into the Python process
(for example, it is compiled with compatible compiler settings), and which
exports an :ref:`initialization function <extension-export-hook>`.
To be importable by default (that is, by
:py:class:`importlib.machinery.ExtensionFileLoader`),
the shared library must be available on :py:attr:`sys.path`,
and must be named after the module name plus an extension listed in
:py:attr:`importlib.machinery.EXTENSION_SUFFIXES`.
.. note::
Building, packaging and distributing extension modules is best done with
third-party tools, and is out of scope of this document.
One suitable tool is Setuptools, whose documentation can be found at
https://setuptools.pypa.io/en/latest/setuptools.html.
Normally, the initialization function returns a module definition initialized
using :c:func:`PyModuleDef_Init`.
This allows splitting the creation process into several phases:
- Before any substantial code is executed, Python can determine which
capabilities the module supports, and it can adjust the environment or
refuse loading an incompatible extension.
- By default, Python itself creates the module object -- that is, it does
the equivalent of :py:meth:`object.__new__` for classes.
It also sets initial attributes like :attr:`~module.__package__` and
:attr:`~module.__loader__`.
- Afterwards, the module object is initialized using extension-specific
code -- the equivalent of :py:meth:`~object.__init__` on classes.
This is called *multi-phase initialization* to distinguish it from the legacy
(but still supported) *single-phase initialization* scheme,
where the initialization function returns a fully constructed module.
See the :ref:`single-phase-initialization section below <single-phase-initialization>`
for details.
.. versionchanged:: 3.5
Added support for multi-phase initialization (:pep:`489`).
Multiple module instances
.........................
By default, extension modules are not singletons.
For example, if the :py:attr:`sys.modules` entry is removed and the module
is re-imported, a new module object is created, and typically populated with
fresh method and type objects.
The old module is subject to normal garbage collection.
This mirrors the behavior of pure-Python modules.
Additional module instances may be created in
:ref:`sub-interpreters <sub-interpreter-support>`
or after Python runtime reinitialization
(:c:func:`Py_Finalize` and :c:func:`Py_Initialize`).
In these cases, sharing Python objects between module instances would likely
cause crashes or undefined behavior.
To avoid such issues, each instance of an extension module should
be *isolated*: changes to one instance should not implicitly affect the others,
and all state owned by the module, including references to Python objects,
should be specific to a particular module instance.
See :ref:`isolating-extensions-howto` for more details and a practical guide.
A simpler way to avoid these issues is
:ref:`raising an error on repeated initialization <isolating-extensions-optout>`.
All modules are expected to support
:ref:`sub-interpreters <sub-interpreter-support>`, or otherwise explicitly
signal a lack of support.
This is usually achieved by isolation or blocking repeated initialization,
as above.
A module may also be limited to the main interpreter using
the :c:data:`Py_mod_multiple_interpreters` slot.
.. _extension-export-hook:
Initialization function
.......................
The initialization function defined by an extension module has the
following signature:
.. c:function:: PyObject* PyInit_modulename(void)
Its name should be :samp:`PyInit_{<name>}`, with ``<name>`` replaced by the
name of the module.
For modules with ASCII-only names, the function must instead be named
:samp:`PyInit_{<name>}`, with ``<name>`` replaced by the name of the module.
When using :ref:`multi-phase-initialization`, non-ASCII module names
are allowed. In this case, the initialization function name is
:samp:`PyInitU_{<name>}`, with ``<name>`` encoded using Python's
*punycode* encoding with hyphens replaced by underscores. In Python:
.. code-block:: python
def initfunc_name(name):
try:
suffix = b'_' + name.encode('ascii')
except UnicodeEncodeError:
suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')
return b'PyInit' + suffix
It is recommended to define the initialization function using a helper macro:
.. c:macro:: PyMODINIT_FUNC
Declare an extension module initialization function.
This macro:
* specifies the :c:expr:`PyObject*` return type,
* adds any special linkage declarations required by the platform, and
* for C++, declares the function as ``extern "C"``.
For example, a module called ``spam`` would be defined like this::
static struct PyModuleDef spam_module = {
.m_base = PyModuleDef_HEAD_INIT,
.m_name = "spam",
...
};
PyMODINIT_FUNC
PyInit_spam(void)
{
return PyModuleDef_Init(&spam_module);
}
It is possible to export multiple modules from a single shared library by
defining multiple initialization functions. However, importing them requires
using symbolic links or a custom importer, because by default only the
function corresponding to the filename is found.
See the `Multiple modules in one library <https://peps.python.org/pep-0489/#multiple-modules-in-one-library>`__
section in :pep:`489` for details.
The initialization function is typically the only non-\ ``static``
item defined in the module's C source.
.. _multi-phase-initialization:
Multi-phase initialization
..........................
Normally, the :ref:`initialization function <extension-export-hook>`
(``PyInit_modulename``) returns a :c:type:`PyModuleDef` instance with
non-``NULL`` :c:member:`~PyModuleDef.m_slots`.
Before it is returned, the ``PyModuleDef`` instance must be initialized
using the following function:
.. c:function:: PyObject* PyModuleDef_Init(PyModuleDef *def)
Ensure a module definition is a properly initialized Python object that
correctly reports its type and a reference count.
Return *def* cast to ``PyObject*``, or ``NULL`` if an error occurred.
Calling this function is required for :ref:`multi-phase-initialization`.
It should not be used in other contexts.
Note that Python assumes that ``PyModuleDef`` structures are statically
allocated.
This function may return either a new reference or a borrowed one;
this reference must not be released.
.. versionadded:: 3.5
.. _single-phase-initialization:
Legacy single-phase initialization
..................................
.. attention::
Single-phase initialization is a legacy mechanism to initialize extension
modules, with known drawbacks and design flaws. Extension module authors
are encouraged to use multi-phase initialization instead.
In single-phase initialization, the
:ref:`initialization function <extension-export-hook>` (``PyInit_modulename``)
should create, populate and return a module object.
This is typically done using :c:func:`PyModule_Create` and functions like
:c:func:`PyModule_AddObjectRef`.
Single-phase initialization differs from the :ref:`default <multi-phase-initialization>`
in the following ways:
* Single-phase modules are, or rather *contain*, “singletons”.
When the module is first initialized, Python saves the contents of
the module's ``__dict__`` (that is, typically, the module's functions and
types).
For subsequent imports, Python does not call the initialization function
again.
Instead, it creates a new module object with a new ``__dict__``, and copies
the saved contents to it.
For example, given a single-phase module ``_testsinglephase``
[#testsinglephase]_ that defines a function ``sum`` and an exception class
``error``:
.. code-block:: python
>>> import sys
>>> import _testsinglephase as one
>>> del sys.modules['_testsinglephase']
>>> import _testsinglephase as two
>>> one is two
False
>>> one.__dict__ is two.__dict__
False
>>> one.sum is two.sum
True
>>> one.error is two.error
True
The exact behavior should be considered a CPython implementation detail.
* To work around the fact that ``PyInit_modulename`` does not take a *spec*
argument, some state of the import machinery is saved and applied to the
first suitable module created during the ``PyInit_modulename`` call.
Specifically, when a sub-module is imported, this mechanism prepends the
parent package name to the name of the module.
A single-phase ``PyInit_modulename`` function should create “its” module
object as soon as possible, before any other module objects can be created.
* Non-ASCII module names (``PyInitU_modulename``) are not supported.
* Single-phase modules support module lookup functions like
:c:func:`PyState_FindModule`.
.. [#testsinglephase] ``_testsinglephase`` is an internal module used
in CPython's self-test suite; your installation may or may not
include it.

View file

@ -93,6 +93,29 @@ the :mod:`io` APIs instead.
.. versionadded:: 3.8
.. c:function:: PyObject *PyFile_OpenCodeObject(PyObject *path)
Open *path* with the mode ``'rb'``. *path* must be a Python :class:`str`
object. The behavior of this function may be overridden by
:c:func:`PyFile_SetOpenCodeHook` to allow for some preprocessing of the
text.
This is analogous to :func:`io.open_code` in Python.
On success, this function returns a :term:`strong reference` to a Python
file object. On failure, this function returns ``NULL`` with an exception
set.
.. versionadded:: 3.8
.. c:function:: PyObject *PyFile_OpenCode(const char *path)
Similar to :c:func:`PyFile_OpenCodeObject`, but *path* is a
UTF-8 encoded :c:expr:`const char*`.
.. versionadded:: 3.8
.. c:function:: int PyFile_WriteObject(PyObject *obj, PyObject *p, int flags)

View file

@ -78,6 +78,104 @@ Floating-Point Objects
Return the minimum normalized positive float *DBL_MIN* as C :c:expr:`double`.
.. c:macro:: Py_INFINITY
This macro expands a to constant expression of type :c:expr:`double`, that
represents the positive infinity.
On most platforms, this is equivalent to the :c:macro:`!INFINITY` macro from
the C11 standard ``<math.h>`` header.
.. c:macro:: Py_NAN
This macro expands a to constant expression of type :c:expr:`double`, that
represents a quiet not-a-number (qNaN) value.
On most platforms, this is equivalent to the :c:macro:`!NAN` macro from
the C11 standard ``<math.h>`` header.
.. c:macro:: Py_HUGE_VAL
Equivalent to :c:macro:`!INFINITY`.
.. deprecated:: 3.14
The macro is :term:`soft deprecated`.
.. c:macro:: Py_MATH_E
The definition (accurate for a :c:expr:`double` type) of the :data:`math.e` constant.
.. c:macro:: Py_MATH_El
High precision (long double) definition of :data:`~math.e` constant.
.. c:macro:: Py_MATH_PI
The definition (accurate for a :c:expr:`double` type) of the :data:`math.pi` constant.
.. c:macro:: Py_MATH_PIl
High precision (long double) definition of :data:`~math.pi` constant.
.. c:macro:: Py_MATH_TAU
The definition (accurate for a :c:expr:`double` type) of the :data:`math.tau` constant.
.. versionadded:: 3.6
.. c:macro:: Py_RETURN_NAN
Return :data:`math.nan` from a function.
On most platforms, this is equivalent to ``return PyFloat_FromDouble(NAN)``.
.. c:macro:: Py_RETURN_INF(sign)
Return :data:`math.inf` or :data:`-math.inf <math.inf>` from a function,
depending on the sign of *sign*.
On most platforms, this is equivalent to the following::
return PyFloat_FromDouble(copysign(INFINITY, sign));
.. c:macro:: Py_IS_FINITE(X)
Return ``1`` if the given floating-point number *X* is finite,
that is, it is normal, subnormal or zero, but not infinite or NaN.
Return ``0`` otherwise.
.. deprecated:: 3.14
The macro is :term:`soft deprecated`. Use :c:macro:`!isfinite` instead.
.. c:macro:: Py_IS_INFINITY(X)
Return ``1`` if the given floating-point number *X* is positive or negative
infinity. Return ``0`` otherwise.
.. deprecated:: 3.14
The macro is :term:`soft deprecated`. Use :c:macro:`!isinf` instead.
.. c:macro:: Py_IS_NAN(X)
Return ``1`` if the given floating-point number *X* is a not-a-number (NaN)
value. Return ``0`` otherwise.
.. deprecated:: 3.14
The macro is :term:`soft deprecated`. Use :c:macro:`!isnan` instead.
Pack and Unpack functions
-------------------------
@ -96,8 +194,8 @@ NaNs (if such things exist on the platform) isn't handled correctly, and
attempting to unpack a bytes string containing an IEEE INF or NaN will raise an
exception.
Note that NaNs type may not be preserved on IEEE platforms (silent NaN become
quiet), for example on x86 systems in 32-bit mode.
Note that NaNs type may not be preserved on IEEE platforms (signaling NaN become
quiet NaN), for example on x86 systems in 32-bit mode.
On non-IEEE platforms with more precision, or larger dynamic range, than IEEE
754 supports, not all values can be packed; on non-IEEE platforms with less
@ -124,15 +222,15 @@ There are two problems on non-IEEE platforms:
* What this does is undefined if *x* is a NaN or infinity.
* ``-0.0`` and ``+0.0`` produce the same bytes string.
.. c:function:: int PyFloat_Pack2(double x, unsigned char *p, int le)
.. c:function:: int PyFloat_Pack2(double x, char *p, int le)
Pack a C double as the IEEE 754 binary16 half-precision format.
.. c:function:: int PyFloat_Pack4(double x, unsigned char *p, int le)
.. c:function:: int PyFloat_Pack4(double x, char *p, int le)
Pack a C double as the IEEE 754 binary32 single precision format.
.. c:function:: int PyFloat_Pack8(double x, unsigned char *p, int le)
.. c:function:: int PyFloat_Pack8(double x, char *p, int le)
Pack a C double as the IEEE 754 binary64 double precision format.
@ -154,14 +252,14 @@ Return value: The unpacked double. On error, this is ``-1.0`` and
Note that on a non-IEEE platform this will refuse to unpack a bytes string that
represents a NaN or infinity.
.. c:function:: double PyFloat_Unpack2(const unsigned char *p, int le)
.. c:function:: double PyFloat_Unpack2(const char *p, int le)
Unpack the IEEE 754 binary16 half-precision format as a C double.
.. c:function:: double PyFloat_Unpack4(const unsigned char *p, int le)
.. c:function:: double PyFloat_Unpack4(const char *p, int le)
Unpack the IEEE 754 binary32 single precision format as a C double.
.. c:function:: double PyFloat_Unpack8(const unsigned char *p, int le)
.. c:function:: double PyFloat_Unpack8(const char *p, int le)
Unpack the IEEE 754 binary64 double precision format as a C double.

View file

@ -29,6 +29,12 @@ See also :ref:`Reflection <reflection>`.
Previously, this type was only available after including
``<frameobject.h>``.
.. c:function:: PyFrameObject *PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals, PyObject *locals)
Create a new frame object. This function returns a :term:`strong reference`
to the new frame object on success, and returns ``NULL`` with an exception
set on failure.
.. c:function:: int PyFrame_Check(PyObject *obj)
Return non-zero if *obj* is a frame object.
@ -161,6 +167,57 @@ See :pep:`667` for more information.
Return non-zero if *obj* is a frame :func:`locals` proxy.
Legacy Local Variable APIs
^^^^^^^^^^^^^^^^^^^^^^^^^^
These APIs are :term:`soft deprecated`. As of Python 3.13, they do nothing.
They exist solely for backwards compatibility.
.. c:function:: void PyFrame_LocalsToFast(PyFrameObject *f, int clear)
This function is :term:`soft deprecated` and does nothing.
Prior to Python 3.13, this function would copy the :attr:`~frame.f_locals`
attribute of *f* to the internal "fast" array of local variables, allowing
changes in frame objects to be visible to the interpreter. If *clear* was
true, this function would process variables that were unset in the locals
dictionary.
.. versionchanged:: 3.13
This function now does nothing.
.. c:function:: void PyFrame_FastToLocals(PyFrameObject *f)
This function is :term:`soft deprecated` and does nothing.
Prior to Python 3.13, this function would copy the internal "fast" array
of local variables (which is used by the interpreter) to the
:attr:`~frame.f_locals` attribute of *f*, allowing changes in local
variables to be visible to frame objects.
.. versionchanged:: 3.13
This function now does nothing.
.. c:function:: int PyFrame_FastToLocalsWithError(PyFrameObject *f)
This function is :term:`soft deprecated` and does nothing.
Prior to Python 3.13, this function was similar to
:c:func:`PyFrame_FastToLocals`, but would return ``0`` on success, and
``-1`` with an exception set on failure.
.. versionchanged:: 3.13
This function now does nothing.
.. seealso::
:pep:`667`
Internal Frames
^^^^^^^^^^^^^^^

View file

@ -95,6 +95,22 @@ There are a few functions specific to Python functions.
.. versionadded:: 3.12
.. c:function:: PyObject* PyFunction_GetKwDefaults(PyObject *op)
Return the keyword-only argument default values of the function object *op*. This can be a
dictionary of arguments or ``NULL``.
.. c:function:: int PyFunction_SetKwDefaults(PyObject *op, PyObject *defaults)
Set the keyword-only argument default values of the function object *op*.
*defaults* must be a dictionary of keyword-only arguments or ``Py_None``.
This function returns ``0`` on success, and returns ``-1`` with an exception
set on failure.
.. c:function:: PyObject* PyFunction_GetClosure(PyObject *op)
Return the closure associated with the function object *op*. This can be ``NULL``
@ -123,6 +139,19 @@ There are a few functions specific to Python functions.
Raises :exc:`SystemError` and returns ``-1`` on failure.
.. c:function:: PyObject *PyFunction_GET_CODE(PyObject *op)
PyObject *PyFunction_GET_GLOBALS(PyObject *op)
PyObject *PyFunction_GET_MODULE(PyObject *op)
PyObject *PyFunction_GET_DEFAULTS(PyObject *op)
PyObject *PyFunction_GET_KW_DEFAULTS(PyObject *op)
PyObject *PyFunction_GET_CLOSURE(PyObject *op)
PyObject *PyFunction_GET_ANNOTATIONS(PyObject *op)
These functions are similar to their ``PyFunction_Get*`` counterparts, but
do not do type checking. Passing anything other than an instance of
:c:data:`PyFunction_Type` is undefined behavior.
.. c:function:: int PyFunction_AddWatcher(PyFunction_WatchCallback callback)
Register *callback* as a function watcher for the current interpreter.
@ -169,7 +198,7 @@ There are a few functions specific to Python functions.
unpredictable effects, including infinite recursion.
If *event* is ``PyFunction_EVENT_CREATE``, then the callback is invoked
after `func` has been fully initialized. Otherwise, the callback is invoked
after *func* has been fully initialized. Otherwise, the callback is invoked
before the modification to *func* takes place, so the prior state of *func*
can be inspected. The runtime is permitted to optimize away the creation of
function objects when possible. In such cases no event will be emitted.

View file

@ -57,11 +57,49 @@ rules:
Analogous to :c:macro:`PyObject_New` but for container objects with the
:c:macro:`Py_TPFLAGS_HAVE_GC` flag set.
Do not call this directly to allocate memory for an object; call the type's
:c:member:`~PyTypeObject.tp_alloc` slot instead.
When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot,
:c:func:`PyType_GenericAlloc` is preferred over a custom function that
simply calls this macro.
Memory allocated by this macro must be freed with
:c:func:`PyObject_GC_Del` (usually called via the object's
:c:member:`~PyTypeObject.tp_free` slot).
.. seealso::
* :c:func:`PyObject_GC_Del`
* :c:macro:`PyObject_New`
* :c:func:`PyType_GenericAlloc`
* :c:member:`~PyTypeObject.tp_alloc`
.. c:macro:: PyObject_GC_NewVar(TYPE, typeobj, size)
Analogous to :c:macro:`PyObject_NewVar` but for container objects with the
:c:macro:`Py_TPFLAGS_HAVE_GC` flag set.
Do not call this directly to allocate memory for an object; call the type's
:c:member:`~PyTypeObject.tp_alloc` slot instead.
When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot,
:c:func:`PyType_GenericAlloc` is preferred over a custom function that
simply calls this macro.
Memory allocated by this macro must be freed with
:c:func:`PyObject_GC_Del` (usually called via the object's
:c:member:`~PyTypeObject.tp_free` slot).
.. seealso::
* :c:func:`PyObject_GC_Del`
* :c:macro:`PyObject_NewVar`
* :c:func:`PyType_GenericAlloc`
* :c:member:`~PyTypeObject.tp_alloc`
.. c:function:: PyObject* PyUnstable_Object_GC_NewWithExtraData(PyTypeObject *type, size_t extra_size)
Analogous to :c:macro:`PyObject_GC_New` but allocates *extra_size*
@ -73,6 +111,10 @@ rules:
The extra data will be deallocated with the object, but otherwise it is
not managed by Python.
Memory allocated by this function must be freed with
:c:func:`PyObject_GC_Del` (usually called via the object's
:c:member:`~PyTypeObject.tp_free` slot).
.. warning::
The function is marked as unstable because the final mechanism
for reserving extra data after an instance is not yet decided.
@ -136,6 +178,21 @@ rules:
Releases memory allocated to an object using :c:macro:`PyObject_GC_New` or
:c:macro:`PyObject_GC_NewVar`.
Do not call this directly to free an object's memory; call the type's
:c:member:`~PyTypeObject.tp_free` slot instead.
Do not use this for memory allocated by :c:macro:`PyObject_New`,
:c:macro:`PyObject_NewVar`, or related allocation functions; use
:c:func:`PyObject_Free` instead.
.. seealso::
* :c:func:`PyObject_Free` is the non-GC equivalent of this function.
* :c:macro:`PyObject_GC_New`
* :c:macro:`PyObject_GC_NewVar`
* :c:func:`PyType_GenericAlloc`
* :c:member:`~PyTypeObject.tp_free`
.. c:function:: void PyObject_GC_UnTrack(void *op)
@ -180,9 +237,9 @@ provided. In order to use this macro, the :c:member:`~PyTypeObject.tp_traverse`
must name its arguments exactly *visit* and *arg*:
.. c:function:: void Py_VISIT(PyObject *o)
.. c:macro:: Py_VISIT(o)
If *o* is not ``NULL``, call the *visit* callback, with arguments *o*
If the :c:expr:`PyObject *` *o* is not ``NULL``, call the *visit* callback, with arguments *o*
and *arg*. If *visit* returns a non-zero value, then return it.
Using this macro, :c:member:`~PyTypeObject.tp_traverse` handlers
look like::

View file

@ -44,3 +44,41 @@ than explicitly calling :c:func:`PyGen_New` or :c:func:`PyGen_NewWithQualName`.
with ``__name__`` and ``__qualname__`` set to *name* and *qualname*.
A reference to *frame* is stolen by this function. The *frame* argument
must not be ``NULL``.
.. c:function:: PyCodeObject* PyGen_GetCode(PyGenObject *gen)
Return a new :term:`strong reference` to the code object wrapped by *gen*.
This function always succeeds.
Asynchronous Generator Objects
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. seealso::
:pep:`525`
.. c:var:: PyTypeObject PyAsyncGen_Type
The type object corresponding to asynchronous generator objects. This is
available as :class:`types.AsyncGeneratorType` in the Python layer.
.. versionadded:: 3.6
.. c:function:: PyObject *PyAsyncGen_New(PyFrameObject *frame, PyObject *name, PyObject *qualname)
Create a new asynchronous generator wrapping *frame*, with ``__name__`` and
``__qualname__`` set to *name* and *qualname*. *frame* is stolen by this
function and must not be ``NULL``.
On success, this function returns a :term:`strong reference` to the
new asynchronous generator. On failure, this function returns ``NULL``
with an exception set.
.. versionadded:: 3.6
.. c:function:: int PyAsyncGen_CheckExact(PyObject *op)
Return true if *op* is an asynchronous generator object, false otherwise.
This function always succeeds.
.. versionadded:: 3.6

View file

@ -11,47 +11,103 @@ See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`.
.. versionadded:: 3.2
.. c:type:: Py_uhash_t
Hash value type: unsigned integer.
.. versionadded:: 3.2
.. c:macro:: Py_HASH_ALGORITHM
A numerical value indicating the algorithm for hashing of :class:`str`,
:class:`bytes`, and :class:`memoryview`.
The algorithm name is exposed by :data:`sys.hash_info.algorithm`.
.. versionadded:: 3.4
.. c:macro:: Py_HASH_FNV
Py_HASH_SIPHASH24
Py_HASH_SIPHASH13
Numerical values to compare to :c:macro:`Py_HASH_ALGORITHM` to determine
which algorithm is used for hashing. The hash algorithm can be configured
via the configure :option:`--with-hash-algorithm` option.
.. versionadded:: 3.4
Add :c:macro:`!Py_HASH_FNV` and :c:macro:`!Py_HASH_SIPHASH24`.
.. versionadded:: 3.11
Add :c:macro:`!Py_HASH_SIPHASH13`.
.. c:macro:: Py_HASH_CUTOFF
Buffers of length in range ``[1, Py_HASH_CUTOFF)`` are hashed using DJBX33A
instead of the algorithm described by :c:macro:`Py_HASH_ALGORITHM`.
- A :c:macro:`!Py_HASH_CUTOFF` of 0 disables the optimization.
- :c:macro:`!Py_HASH_CUTOFF` must be non-negative and less or equal than 7.
32-bit platforms should use a cutoff smaller than 64-bit platforms because
it is easier to create colliding strings. A cutoff of 7 on 64-bit platforms
and 5 on 32-bit platforms should provide a decent safety margin.
This corresponds to the :data:`sys.hash_info.cutoff` constant.
.. versionadded:: 3.4
.. c:macro:: PyHASH_MODULUS
The `Mersenne prime <https://en.wikipedia.org/wiki/Mersenne_prime>`_ ``P = 2**n -1``, used for numeric hash scheme.
The `Mersenne prime <https://en.wikipedia.org/wiki/Mersenne_prime>`_ ``P = 2**n -1``,
used for numeric hash scheme.
This corresponds to the :data:`sys.hash_info.modulus` constant.
.. versionadded:: 3.13
.. c:macro:: PyHASH_BITS
The exponent ``n`` of ``P`` in :c:macro:`PyHASH_MODULUS`.
.. versionadded:: 3.13
.. c:macro:: PyHASH_MULTIPLIER
Prime multiplier used in string and various other hashes.
.. versionadded:: 3.13
.. c:macro:: PyHASH_INF
The hash value returned for a positive infinity.
This corresponds to the :data:`sys.hash_info.inf` constant.
.. versionadded:: 3.13
.. c:macro:: PyHASH_IMAG
The multiplier used for the imaginary part of a complex number.
This corresponds to the :data:`sys.hash_info.imag` constant.
.. versionadded:: 3.13
.. c:type:: PyHash_FuncDef
Hash function definition used by :c:func:`PyHash_GetFuncDef`.
.. c::member:: Py_hash_t (*const hash)(const void *, Py_ssize_t)
.. c:member:: Py_hash_t (*const hash)(const void *, Py_ssize_t)
Hash function.
@ -59,14 +115,20 @@ See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`.
Hash function name (UTF-8 encoded string).
This corresponds to the :data:`sys.hash_info.algorithm` constant.
.. c:member:: const int hash_bits
Internal size of the hash value in bits.
This corresponds to the :data:`sys.hash_info.hash_bits` constant.
.. c:member:: const int seed_bits
Size of seed input in bits.
This corresponds to the :data:`sys.hash_info.seed_bits` constant.
.. versionadded:: 3.4

View file

@ -327,6 +327,13 @@ Importing Modules
initialization.
.. c:var:: struct _inittab *PyImport_Inittab
The table of built-in modules used by Python initialization. Do not use this directly;
use :c:func:`PyImport_AppendInittab` and :c:func:`PyImport_ExtendInittab`
instead.
.. c:function:: PyObject* PyImport_ImportModuleAttr(PyObject *mod_name, PyObject *attr_name)
Import the module *mod_name* and get its attribute *attr_name*.

View file

@ -17,6 +17,7 @@ document the API functions in detail.
veryhigh.rst
refcounting.rst
exceptions.rst
extension-modules.rst
utilities.rst
abstract.rst
concrete.rst

Some files were not shown because too many files have changed in this diff Show more