[3.12] gh-125783: Add more tests to prevent regressions with the combination of ctypes and metaclasses. (GH-126126) (GH-126276)
gh-125783: Add more tests to prevent regressions with the combination of ctypes and metaclasses. (GH-126126)
(cherry picked from commit 6c67446a6e73ab0e9a26e4360412cbd2f5550e66)
Co-authored-by: Jun Komoda <45822440+junkmd@users.noreply.github.com>
Co-authored-by: Zhikang Yan <2951256653@qq.com> Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com> Co-authored-by: Carol Willing <carolcode@willingconsulting.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
[3.12] docs: add a more precise example in enum doc (GH-121015) (#126307)
docs: add a more precise example in enum doc (GH-121015)
* docs: add a more precise example
Previous example used manual integer value assignment in class based declaration but in functional syntax has been used auto value assignment what could be confusing for the new users. Additionally documentation doesn't show how to declare new enum via functional syntax with usage of the manual value assignment.
[3.12] gh-126220: Fix crash on calls to `_lsprof.Profiler` methods with 0 args (backportable) (GH-126271) (#126311)
gh-126220: Fix crash on calls to `_lsprof.Profiler` methods with 0 args (backportable) (GH-126271)
(cherry picked from commit 28b148fb32e4548b461137d18d1ab6d366395d36)
Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
[3.12] gh-126080: fix UAF on `task->task_context` in `task_call_step_soon` due to an evil `loop.__getattribute__` (GH-126120) (#126251)
gh-126080: fix UAF on `task->task_context` in `task_call_step_soon` due to an evil `loop.__getattribute__` (GH-126120)
(cherry picked from commit 0e8665554b2f1334e530fd6de5b3a4e908405419)
[3.12] gh-126083: Fix a reference leak in `asyncio.Task` when reinitializing with new non-`None` context (GH-126103) (#126230)
gh-126083: Fix a reference leak in `asyncio.Task` when reinitializing with new non-`None` context (GH-126103)
(cherry picked from commit d07dcce6935364cab807e0df931ed09b088ade69)
[3.12] Prefer "similar" over "equivalent" in tutorial (GH-125343) (GH-125373)
Prefer "similar" over "equivalent" in tutorial (GH-125343)
In the datastructures tutorial doc, some operations are described as
"equivalent to" others. This has led to some user-confusion -- at
least in the Discourse forums -- about cases in which the operations
differ.
This change doesn't systematically eliminate the word "equivalent"
from the tutorial. It just substitutes "similar to" in several cases
in which "equivalent to" could mislead users into expecting exact
equivalence.
(cherry picked from commit 4a2282b0679bbf7b7fbd36aae1b1565145238961)
Co-authored-by: Stephen Rosen <sirosen@globus.org>
Serhiy Storchaka [Wed, 30 Oct 2024 09:10:10 +0000 (11:10 +0200)]
[3.12] gh-126071: Improve formatting of the argparse documentation (GH-126073) (GH-126174)
* Use appropriate roles for ArgumentParser, Action, etc.
* Remove superfluous repeated links.
* Explicitly document signatures and add index entries for some methods
and classes.
* Make it more clear that some parameters are keyword-only.
* Fix some minor errors.
(cherry picked from commit 2ab377a47c8290f8bf52c8ffb5d7fc4c45452611)
[3.12] gh-116938: Fix `dict.update` docstring and remove erraneous full stop from `dict` documentation (GH-125421) (#126151)
gh-116938: Fix `dict.update` docstring and remove erraneous full stop from `dict` documentation (GH-125421)
(cherry picked from commit 5527c4051c0b58218ce69044f92b45f1d66ed43f)
Co-authored-by: Prometheus3375 <35541026+Prometheus3375@users.noreply.github.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
[3.12] GH-125866: Improve tests for `pathname2url()` and `url2pathname()` (GH-125993) (#126145)
GH-125866: Improve tests for `pathname2url()` and `url2pathname()` (GH-125993)
Merge `URL2PathNameTests` and `PathName2URLTests` test cases (which test
only the Windows-specific implementations from `nturl2path`) into the main
`Pathname_Tests` test case for these functions.
Co-authored-by: Carol Willing <carolcode@willingconsulting.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
[3.12] gh-126105: Fix crash in `ast` module, when `._fields` is delet… (#126132)
[3.12] gh-126105: Fix crash in `ast` module, when `._fields` is deleted (GH-126115)
Previously, if the `ast.AST._fields` attribute was deleted, attempts to create a new `as`t node would crash due to the assumption that `_fields` always had a non-NULL value. Now it has been fixed by adding an extra check to ensure that `_fields` does not have a NULL value (this can happen when you manually remove `_fields` attribute).
(cherry picked from commit b2eaa75b176e07730215d76d8dce4d63fb493391)
Also: Add test_ctypes/_support.py from 3.13+
This partially backports be89ee5649031e08f191bf596fa20a09c5698079
(https://github.com/python/cpython/pull/113727)
by AN Long
Co-authored-by: Jun Komoda <45822440+junkmd@users.noreply.github.com> Co-authored-by: AN Long <aisk@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
[3.12] gh-124594: Create and reuse the same context for the entire asyncio REPL session (GH-124595) (#124849)
* gh-124594: Create and reuse the same context for the entire asyncio REPL session (GH-124595)
(cherry picked from commit 67e01a430f4ecfcb540d6a29b347966ff4e53454)
Co-authored-by: Bartosz Sławecki <bartoszpiotrslawecki@gmail.com> Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
---------
Co-authored-by: Bartosz Sławecki <bartoszpiotrslawecki@gmail.com> Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
[3.12] gh-121277: Allow `.. versionadded:: next` in docs (GH-121278) (GH-125980)
Make `versionchanged:: next`` expand to current (unreleased) version.
When a new CPython release is cut, the release manager will replace
all such occurences of "next" with the just-released version.
(See the issue for release-tools and devguide PRs.)
[3.12] gh-125966: fix use-after-free on `fut->fut_callback0` due to an evil callback's `__eq__` in asyncio (GH-125967) (#126048)
gh-125966: fix use-after-free on `fut->fut_callback0` due to an evil callback's `__eq__` in asyncio (GH-125967)
(cherry picked from commit ed5059eeb1aa50b481957307db5a34b937497382)
[3.12] gh-125984: fix use-after-free on `fut->fut_{callback,context}0` due to an evil `loop.__getattribute__` (GH-126003) (#126044)
gh-125984: fix use-after-free on `fut->fut_{callback,context}0` due to an evil `loop.__getattribute__` (GH-126003)
(cherry picked from commit f819d4301d7c75f02be1187fda017f0e7b608816)
[3.12] GH-125789: fix `fut._callbacks` to always return a copy of callbacks (GH-125922) (#125977)
GH-125789: fix `fut._callbacks` to always return a copy of callbacks (GH-125922)
Fix `asyncio.Future._callbacks` to always return a copy of the internal list of callbacks to avoid mutation from user code affecting the internal state.
Serhiy Storchaka [Tue, 22 Oct 2024 13:23:30 +0000 (16:23 +0300)]
[3.12] gh-125355: Rewrite parse_intermixed_args() in argparse (GH-125356) (GH-125839)
* The parser no longer changes temporarily during parsing.
* Default values are not processed twice.
* Required mutually exclusive groups containing positional arguments are
now supported.
* The missing arguments report now includes the names of all required
optional and positional arguments.
* Unknown options can be intermixed with positional arguments in
parse_known_intermixed_args().
[3.12] gh-124969: Make locale.nl_langinfo(locale.ALT_DIGITS) returning a string again (GH-125774) (GH-125805)
This is a follow up of GH-124974. Only Glibc needed a fix.
Now the returned value is a string consisting of semicolon-separated
symbols on all Posix platforms.
(cherry picked from commit dcc4fb2c9068f60353f0c0978948b7681f7745e6)
[3.12] Doc: C API: Move `tp_dealloc` paragraph to `tp_dealloc` section (GH-125737) (#125799)
Doc: C API: Move `tp_dealloc` paragraph to `tp_dealloc` section (GH-125737)
It looks like commit 43cf44ddcce6b225f959ea2a53e4817244ca6054
(gh-31501) accidentally moved the paragraph to the `tp_finalize`
section when the intent was to move it to the `tp_dealloc` section
(according to the commit message).
[3.12] gh-125519: Improve traceback if `importlib.reload()` is called with a non-module object (GH-125520) (#125769)
gh-125519: Improve traceback if `importlib.reload()` is called with a non-module object (GH-125520)
(cherry picked from commit c5c21fee7ae1ea689a351caa454c98e716a6e537)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
[3.12] gh-52551: Fix encoding issues in strftime() (GH-125193) (GH-125657) (GH-125661)
Fix time.strftime(), the strftime() method and formatting of the
datetime classes datetime, date and time.
* Characters not encodable in the current locale are now acceptable in
the format string.
* Surrogate pairs and sequence of surrogatescape-encoded bytes are no
longer recombinated.
* Embedded null character no longer terminates the format string.
[3.12] [3.13] gh-123370: Fix the canvas not clearing after running turtledemo.clock (gh-123457) (GH-125653) (#125656)
Rewriting the day and date every tick somehow prevented them from being removed either by clicking STOP or loading another example. The solution is to rewrite them only when they change.
(cherry picked from commit c124577ebe915a00de4033c0f7fa7c47621d79e0)
Sam Gross [Wed, 16 Oct 2024 18:03:32 +0000 (14:03 -0400)]
[3.12] gh-125451: Fix deadlock in ProcessPoolExecutor shutdown (GH-125492) (#125599)
There was a deadlock when `ProcessPoolExecutor` shuts down at the same
time that a queueing thread handles an error processing a task.
Don't use `_shutdown_lock` to protect the `_ThreadWakeup` pipes -- use
an internal lock instead. This fixes the ordering deadlock where the
`ExecutorManagerThread` holds the `_shutdown_lock` and joins the
queueing thread, while the queueing thread is attempting to acquire the
`_shutdown_lock` while closing the `_ThreadWakeup`.
(cherry picked from commit 760872efecb95017db8e38a8eda614bf23d2a22c)
Propagate fixes in Doc/library/idle.rst to help.html.
Change 'interruptable' to 'interruptible' in run.py.
The latter was reported by ember91 in PR 125473.
(cherry picked from commit 3fea1d000ef0a74062fd3fe218ad94618b08d9f2)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Barney Gale [Sun, 13 Oct 2024 18:18:41 +0000 (19:18 +0100)]
[3.12] GH-125069: Fix inconsistent joining in `WindowsPath(PosixPath(...))` (GH-125156) (#125410)
`PurePath.__init__()` incorrectly uses the `_raw_paths` of a given
`PurePath` object with a different flavour, even though the procedure to
join path segments can differ between flavours.
This change makes the `_raw_paths`-enabled deferred joining apply _only_
when the path flavours match.