[3.14] gh-143774 - Improve IDLE Format Paragraph doc (GH-143775) (#144062)
gh-143774 - Improve IDLE Format Paragraph doc (GH-143775)
Add a reminder to not rewrap code line to the Menu => Format => Reformat Paragraph entry.
In Editing and Nagivagion, add a new 'Format block' subsection that defines 'paragraph'
to better match what is dependably handled as more or less expected.
In particular, specify equal indents and that the resulting indent equals original indent.
Also mention that selections are expanded to complete lines and how to modify max length.
[3.14] gh-143866: Verify return value of `pathlib.write_{bytes,text}` methods in tests (GH-143870) (#144029)
gh-143866: Verify return value of `pathlib.write_{bytes,text}` methods in tests (GH-143870)
(cherry picked from commit cb6a662bb0f7a9da9d4ba9dda820053f8d54a9f8)
[3.14] gh-143916: Reject control characters in wsgiref.headers.Headers (GH-143917) (#143972)
gh-143916: Reject control characters in wsgiref.headers.Headers (GH-143917)
* Add 'test.support' fixture for C0 control characters
* gh-143916: Reject control characters in wsgiref.headers.Headers
(cherry picked from commit f7fceed79ca1bceae8dbe5ba5bc8928564da7211)
Co-authored-by: Seth Michael Larson <seth@python.org>
[3.14] gh-143674: Document F/D complex format characters in struct module (GH-143675) (#143918)
gh-143674: Document F/D complex format characters in struct module (GH-143675)
Add documentation for the F (complex from two floats) and D (complex
from two doubles) format characters in the struct module docstring.
These format characters were implemented but not documented.
(cherry picked from commit 3e932257980be8907698c378c23026e262ba066c)
Co-authored-by: Muneeb Ullah <moneebullah25@gmail.com> Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
[3.14] gh-65784: Add support for parametrized resource wantobjects in regrtests (GH-143570) (GH-143913)
This allows to run Tkinter tests with the specified value of
tkinter.wantobjects, for example "-u wantobjects=0".
(cherry picked from commit 21ed1e2a9401a2e96ccc910fcb66f22afc96efbd)
Victor Stinner [Thu, 15 Jan 2026 16:02:46 +0000 (17:02 +0100)]
[3.14] gh-143602: Fix duplicate buffer exports in io.BytesIO.write (#143629) (#143872)
gh-143602: Fix duplicate buffer exports in io.BytesIO.write (#143629)
Fix an inconsistency issue in io.BytesIO.write() where the buffer was exported
twice, which could lead to unexpected data overwrites and position drift when
the buffer changes between exports.
[3.14] gh-143054: Disallow non-top-level Cut for now (GH-143622) (GH-143790)
The behaviour of Cut in nested parentheses, Repeat, Opt, and similar
is somewhat chaotic. Apparently even the academic papers on PEG aren't
as clear as they could be.
And it doesn't really matter. Python only uses top-level cuts.
When that changes, we can clarify as much as necessary (and even
change the implementation to make sense for what we'll need).
Document that this is deliberately unspecified, and add a test to
make sure any decision is deliberate, tested and documented.
(cherry picked from commit f0a0467c176e245a8fd45d4480a0876d748d7e78)
[3.14] gh-141805: Fix crash after concurrent addition objects with the same hash to set (GH-143815) (GH-143849)
This happens when the set contained several elements with the same hash,
and then some of them were removed.
(cherry picked from commit b8e925b4f8f6c5e28fbebc4f3965bf77610698b3)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
[3.14] gh-106287: Do not write objects after an unmarshalling error (GH-132715) (GH-143832)
Writing out an object may involve a slot lookup, which is not safe to do with
an exception raised. In debug mode an assertion failure will occur if this
happens.
(cherry picked from commit ce8f5f98c6fc95a1704360d986a4d0281eeada79)
[3.14] gh-141004: Document old provisional names for vectorcall/code API (GH-143568) (GH-143828)
For vectorcall API, the underscore-prefixed provisional names
continue to be available per PEP 590:
https://peps.python.org/pep-0590/#finalizing-the-api
Use `versionadded`, `versionchanged`, and `:no-typesetting:`
to mark this up.
For PyCode API, use `:no-typesetting:` rather than `index::` so that
these are semantically documented as C functions.
(cherry picked from commit 7e8a1b5061313e03f99bc2ffa2062702bcc76426)
[3.14] gh-137113 docs: note readline no longer supported in REPL after 3.13 (GH-137142) (GH-143791)
gh-137113 docs: note readline no longer supported in REPL after 3.13 (GH-137142)
Add a note to the readline module documentation stating that
Python 3.13 and later no longer supports readline in the default REPL,
as per gh-118840. Includes workaround using PYTHON_BASIC_REPL.
[3.14] gh-141004: Don't trigger `run-tests` when `Tools/check-c-api-docs/ignored_c_api.txt` is changed (GH-143583) (GH-143793)
gh-141004: Don't trigger `run-tests` when `Tools/check-c-api-docs/ignored_c_api.txt` is changed (GH-143583)
(cherry picked from commit 1176facbf21388ef29276ec55a95a66423f61191)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
[3.14] gh-143706: Fix sys.argv not set during multiprocessing forkserver `__main__` preload (GH-143717) (#143763)
gh-143706: Fix sys.argv not set during multiprocessing forkserver `__main__` preload (GH-143717)
The forkserver was not passing sys.argv to its main() function, causing
sys.argv to be empty during `__main__` module import in child processes. This
fixes a non-obvious regression inadvertently introduced by the gh-126631 main
preloading fix.
(cherry picked from commit 298d5440eb83f2dfd5651bac86d1592ec358d54c)
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
[3.14] gh-139707: Copy-strip change to idle.rst into idlelib (GH-143718) (#143744)
gh-139707: Copy-strip change to idle.rst into idlelib (GH-143718)
On Windows, running `python -c "from idlelib.help import copy_strip;
copy_strip()"` after idle.html is built results in
`f:\dev\3x\Doc\build\html\library\idle.html
copied to f:\dev\3x\Lib\idlelib\help.html`
This PR commits the html change to idlelib/help.html.
(cherry picked from commit ec254e2b40d70242f7b1724867a4aac4219fdc08)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
[3.14] gh-143196: Fix crash in non-standard use of internal JSON encoder object (GH-143618) (GH-143748)
The internal encoder object returned by undocumented function
json.encoder.c_make_encoder() (aka _json.make_encoder()) crashed
when it was called with non-zero second argument.
(cherry picked from commit c559135c931789ebc752ae68814858c398cb798b)
[3.14] gh-143544: Fix possible use-after-free in the JSON decoder when JSONDecodeError disappears during raising it (GH-143561) (#143733)
gh-143544: Fix possible use-after-free in the JSON decoder when JSONDecodeError disappears during raising it (GH-143561)
(cherry picked from commit c3157480601499565fd42a8afbdb0207328ac484)
[3.14] gh-127750: Fix annotations in singledispatchmethod signature tests (GH-143571) (GH-143707)
These tests relied on a bug -- gh-84644, which is that singledispatch
doesn't verify the annotation is on the "first" parameter.
(cherry picked from commit 620a5b92693ac1b2cef1f90fd3c2dba1bb794552)
Serhiy Storchaka [Sun, 11 Jan 2026 12:37:00 +0000 (14:37 +0200)]
[3.14] gh-143638: Forbid cuncurrent use of the Pickler and Unpickler objects in C implementation (GH-143664) (GH-143686)
Previously, this could cause crash or data corruption, now concurrent calls
of methods of the same object raise RuntimeError.
(cherry picked from commit d1282efb2b847bf9274d78c5f15ea00499b2c894)
[3.14] gh-141536: Fix a crash when running test_capi *after* test_code in the same process (GH-141537) (#143522)
gh-141536: Fix a crash when running test_capi *after* test_code in the same process (GH-141537)
(cherry picked from commit b2827de18fe88152dc38c1aa76c39b69ef59cb6f)
[3.14] gh-142829: Fix use-after-free in `Context.__eq__` via re-entrant `ContextVar.set` (GH-142905) (#143627)
gh-142829: Fix use-after-free in `Context.__eq__` via re-entrant `ContextVar.set` (GH-142905)
(cherry picked from commit a4086d7f89e5d388e4ffcdb13e4fba0255234286)
[3.14] gh-143006: Fix and optimize mixed comparison of float and int (GH-143084) (GH-143623)
When comparing negative non-integer float and int with the same number
of bits in the integer part, __neg__() in the int subclass returning
not an int caused an assertion error.
Now the integer is no longer negated. Also, reduced the number of
temporary created Python objects.
(cherry picked from commit 66bca383bd3b12d21e879d991d77b37a4c638f88)
gh-143460: Skip infinite recusion tests for infinite stack size (GH-143606)
Avoid tests being killed due to OOM on Linux if a system is configured with
'ulimit -s unlimited' by skipping tests relying on infinite recursion.
While unclear if Python should support 'ulimit -s unlimited', we should at
least try to avoid failing a PGO build running tests due to an unlimited
stack size being set.
(cherry picked from commit 61e036691c8ac70facb8d3fc39c670bde56218e8)
Signed-off-by: Jan André Reuter <j.reuter@fz-juelich.de> Co-authored-by: Jan André Reuter <jan.andre.reuter@hotmail.de>
[3.14] gh-143378: Fix use-after-free when BytesIO is concurrently mutated during write operations (GH-143408) (GH-143599)
PyObject_GetBuffer() can execute user code (e.g. via __buffer__), which may
close or otherwise mutate a BytesIO object while write() or writelines()
is in progress. This could invalidate the internal buffer and lead to a
use-after-free.
[3.14] gh-142095: Use thread local frame info in `py-bt` and `py-bt-full` when available (gh-143371) (#143566)
In optimized and `-Og` builds, arguments and local variables are frequently
unavailable in gdb. This makes `py-bt` fail to print anything useful. Use the
`PyThreadState*` pointers `_Py_tss_gilstate` and `Py_tss_tstate` to find the
interpreter frame if we can't get the frame from the
`_PyEval_EvalFrameDefault` call.
(cherry picked from commit 49c3b0a67a77bb42e736cea7dcbc1aa8fa704074)
Co-authored-by: Sam Gross <colesbury@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
[3.14] gh-133315: Document that compat32 should not be used with MIMEPart/EmailMessage (GH-143307) (#143496)
gh-133315: Document that compat32 should not be used with MIMEPart/EmailMessage (GH-143307)
(cherry picked from commit ff7d1cec41f391270560b9f4726791d8476c6eba)
[3.14] gh-75572: Forward-port test_xpickle from Python 2 to 3 (GH-22452) (GH-143485)
Move data classes used in tests to separate file test_picklecommon.py,
so it can be imported in old Python versions.
(cherry picked from commit 8735daf3e82d50defd791e9be7b9ae6843bc4ed1)
Co-authored-by: Ken Jin <kenjin@python.org> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
The documentation incorrectly stated that the file descriptor is not
inherited by child processes. In reality, the close-on-exec flag (when
available) only prevents inheritance across exec() calls, not fork().
(cherry picked from commit e79c9b703117d8b0e7c4d86b704e2e7f120db883)
Co-authored-by: ADITYA RAI <adi.hack1234@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
Stan Ulbrych [Tue, 6 Jan 2026 11:48:45 +0000 (11:48 +0000)]
[3.14] gh-143003: Fix possible shared buffer overflow in `bytearray.extend()` (GH-143086) (GH-143447)
When __length_hint__() returns 0 for non-empty iterator, the data can be
written past the shared 0-terminated buffer, corrupting it.
(cherry picked from commit 522563549a49d28e763635c58274a23a6055f041)