Using `race:` filters out warnings if the function appears anywhere in
the stack trace. This can hide a lot of unrelated warnings, especially
for a function like `_PyEval_EvalFrameDefault`, which is somewhere on
the stack more often than not.
Change all free-threaded suppressions to `race_top:`, which only matches
the top frame, and add any new suppressions this exposes.
(cherry picked from commit 98ff3f65c0)
Co-authored-by: Brett Simmers <swtaarrs@users.noreply.github.com>
Avoid immortalizing objects in tests that verify garbage collection of
classes or modules.
This fixes test_ordered_dict and test_struct.
(cherry picked from commit 1b1db2fd9a)
Co-authored-by: Sam Gross <colesbury@gmail.com>
Some embedders and extensions include parts of the internal API. The
pycore_mimalloc.h file is transitively include by a number of other
internal headers. This avoids include errors for code that was
already including those headers.
(cherry picked from commit 71cc0651e7)
Co-authored-by: Sam Gross <colesbury@gmail.com>
The `list_preallocate_exact` function did not zero initialize array
contents. In the free-threaded build, this could expose uninitialized
memory to concurrent readers between the call to
`list_preallocate_exact` and the filling of the array contents with
items.
(cherry picked from commit 2402715e10)
Co-authored-by: Sam Gross <colesbury@gmail.com>
gh-118849: Fix "code will never be executed" warning in `dictobject.c` (GH-118850)
(cherry picked from commit 82abe75e77)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
These methods are purely wrappers around `Semlock.{acquire,release}`,
which expect a critical section to be held.
(cherry picked from commit c30d8e5d6c)
Co-authored-by: mpage <mpage@meta.com>
Print only filename with lineno if linecache.getline() returns an empty string.
(cherry picked from commit 7c87ce777b)
Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
gh-118033: Fix `__weakref__` not set for generic dataclasses (GH-118099)
(cherry picked from commit fa9b9cb113)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
[tests]: Mark ``test_statistics.test_kde_random`` with a ``requires_resource('cpu')`` decorator (GH-118801)
Mark test_kde_random with a requires_resource('cpu') decorator
(cherry picked from commit 027e6d88fb)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Use relaxed atomics when reading / writing to the field. There are still a
few places in the GC where we do not use atomics. Those should be safe as
the world is stopped.
(cherry picked from commit cb6f75a32c)
Co-authored-by: mpage <mpage@meta.com>
docs: module page titles should not start with a link to themselves (GH-117099)
(cherry picked from commit bcb435ee8f)
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
A new `compute_powers()` function computes all and only the powers of the base the various base-conversion functions need, as efficiently as reasonably possible (turns out that invoking `**`is needed at most once). This typically gives a few % speedup, but the primary point is to simplify the base-conversion functions, which no longer need their own, ad hoc, and less efficient power-caching schemes.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Make a rough editorial pass over Python 3.13's What's New document. Add the
release highlights, remove or merge some duplicated entries, and reorder
some of the sections (removals should really go before future deprecations).
The `pool_in_threads.py` test file may crash in free-threaded builds,
which can lead to the Tsan test hanging. Skip it for now until we fix
the underlying issue.
Callbacks registered in the tkinter module now take arguments as
various Python objects (int, float, bytes, tuple), not just str.
To restore the previous behavior set tkinter module global wantobject to 1
before creating the Tk object or call the wantobject() method of the Tk object
with argument 1.
Calling it with argument 2 restores the current default behavior.
The provided example was incorrect:
- The example enum was missing the `int` mixin as implied by the context
- The value of `int('1a', 16)` was incorrectly given as 17
(should be 26)
Fix an edge case in `binascii.a2b_base64` strict mode, where
excessive padding was not detected when no padding is necessary.
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>