gh-121913: Use str(exc) instead of exc.strerror in `asyncio.base_events` (GH-122269)
(cherry picked from commit 070f1e2e5b)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Serializing objects with complex __qualname__ (such as unbound methods and
nested classes) by name no longer involves serializing parent objects by value
in pickle protocols < 4.
(cherry picked from commit dc07f65a53)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-122187: Avoid TSan reported race in `run_udp_echo_server` (GH-122189)
TSan doesn't fully recognize the synchronization via I/O, so ensure that
socket name is retrieved earlier and use a different socket for sending
the "STOP" message.
(cherry picked from commit 2f74b709b6)
Co-authored-by: Sam Gross <colesbury@gmail.com>
__spec__.loader is now required in the module globals (see gh-86298).
(cherry picked from commit 9b4fe9b718)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
In gh-121602, I applied a fix to a builtin types initialization bug.
That fix made sense in the context of some broader future changes,
but introduced a little bit of extra complexity. For earlier versions
those future changes are not relevant; we can avoid the extra complexity.
Thus we can revert that earlier change and replace it with this one,
which is more focused and conceptually simpler. This is essentially
the implementation of an idea that @markshannon pointed out to me.
Note that this change would be much smaller if we didn't have to deal
with repr compatibility for builtin types that explicitly inherit tp slots
(see expect_manually_inherited()). The alternative is to stop
*explicitly* inheriting tp slots in static PyTypeObject values,
which is churn that we can do separately.
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
GH-120754: Add more tests around seek + readall (GH-122103)
In the process of speeding up readall, A number of related tests
(ex. large file tests in test_zipfile) found problems with the
change I was making. This adds I/O tests to specifically test these
cases to help ensure they don't regress and hopefully make debugging
easier.
This is part of the improvements from
https://github.com/python/cpython/pull/121593GH-issuecomment-2222261986
(cherry picked from commit 9eb734111b)
Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
gh-122029: Log call events in sys.setprofile when it's a method with c function (GH-122072)
Log call events in sys.setprofile when it is a method with a C function.
(cherry picked from commit e91ef13861)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
gh-121832: Skip subinterpreter static type check on iOS to restore test suite. (GH-122150)
(cherry picked from commit 1bcc9eb862)
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
These tests fail when run under thread sanitizer due to the use of fork
and threads.
(cherry picked from commit 64e221d7ad)
Co-authored-by: Sam Gross <colesbury@gmail.com>
gh-120974: Make _asyncio._leave_task atomic in the free-threaded build (GH-122139)
* gh-120974: Make _asyncio._leave_task atomic in the free-threaded build
Update `_PyDict_DelItemIf` to allow for an argument to be passed to the
predicate.
(cherry picked from commit a15feded71)
Co-authored-by: Sam Gross <colesbury@gmail.com>
This fixes the flakiness in:
* test_inspect_keeps_globals_from_inspected_file
* test_inspect_keeps_globals_from_inspected_module
The output already includes newlines. Adding newlines for every entry in
the output list introduces non-determinism because it added '\n' in
places where stdout is flushed or some buffer becomes full.
The regex also needed to be updated because pyrepl includes control
characters -- the visible output on each line doesn't immediately follow
a newline character.
(cherry picked from commit 2c1b1e7a07)
Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Docs: Use cross-reference to `os.uname` in `sysconfig.get_platform` (GH-122083)
(cherry picked from commit 498cb6dff1)
Co-authored-by: Ville Skyttä <ville.skytta@iki.fi>
gh-120974: Make _asyncio._enter_task atomic in the free-threaded build (GH-122138)
Use `PyDict_SetDefaultRef` to set the current task in a single operation
under the dictionary's lock.
(cherry picked from commit 47847aa8ef)
Co-authored-by: Sam Gross <colesbury@gmail.com>
Share common code for tests for PyLong_As*() functions.
(cherry picked from commit 69f2dc5c06)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
This reverts commit 53774e911d.
The LLVM 18 Ubuntu package is working now.
(cherry picked from commit ad935a9016)
Co-authored-by: Sam Gross <colesbury@gmail.com>
Relatedly, emit the `cpython.run_startup` event from the Python version of
`PYTHONSTARTUP` handling.
(cherry picked from commit dc93d1125f)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Docs: spelling and grammar fixes (GH-122084)
Corrected some grammar and spelling issues in documentation.
(cherry picked from commit bc264eac3a)
Co-authored-by: Ville Skyttä <ville.skytta@iki.fi>
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
gh-120522: Apply App Store compliance patch during installation (GH-121947)
Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.
(cherry picked from commit 728432c804)
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
gh-121266: Remove Py_ALWAYS_INLINE in dictobject.c (GH-121493)
compare_unicode_generic(), compare_unicode_unicode() and
compare_generic() are callbacks used by do_lookup(). When enabling
assertions, it's not possible to inline these functions.
(cherry picked from commit c5a6b9afd8)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-121390: tracemalloc: Fix tracebacks memory leak (GH-121391)
The tracemalloc_tracebacks hash table has traceback keys and NULL
values, but its destructors do not reflect this -- key_destroy_func is
NULL while value_destroy_func is raw_free. Swap these to free the
traceback keys instead.
(cherry picked from commit db39bc42f9)
Co-authored-by: Josh Brobst <jbrobst@proton.me>
Delete stale note about mp.Lock.acquire/SIGINT (GH-120929)
(cherry picked from commit 0dcbc83853)
Co-authored-by: Andrey Mishchenko <mishchea@gmail.com>
gh-121977: Add tips for handling unhashable data (GH-122075)
(cherry picked from commit ebc18abbf3)
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
gh-121266: Change dict check_lookup() return type to int (GH-121581)
(cherry picked from commit 51da3dfbf3)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-121988: Fix test hang when pyrepl is not available (GH-121990)
Also explicitly fail the test if we timeout while waiting for output so
that this failure mode is caught earlier.
(cherry picked from commit a09e215abf)
Co-authored-by: Sam Gross <colesbury@gmail.com>
GH-121970: Modernise the patchlevel extension (GH-121995)
(cherry picked from commit b7ad711fcb)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Docs: Fix a typo in What's New in Python 3.13 (GH-122051)
(cherry picked from commit 3de092b82f)
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
The futureobj freelist isn't thread-safe. We intend to re-enable the
freelist in a thread-safe way for 3.14 (but not 3.13).
(cherry picked from commit 97248204a1)
This is a small refactoring to the current design that allows us to
avoid manually iterating over threads.
This should also fix gh-118490.
(cherry picked from commit e059aa6b01)
Co-authored-by: mpage <mpage@meta.com>
gh-120930: Remove extra blank occuring in wrapped encoded words in email headers (GH-121747)
(cherry picked from commit cecaceea31)
Co-authored-by: Matthieu Caneill <matthieucan@users.noreply.github.com>
This adds tests for the documented behaviour of `pkgutil.extend_path`
regarding different argument types as well as for `*.pkg` files.
(cherry picked from commit 8f2532168b)
Co-authored-by: Andreas Stocker <andreas@stocker.co.it>
This is not something we can do too much about, without help from the
underlying libraries.
(cherry picked from commit 709db44255)
Co-authored-by: Petr Viktorin <encukou@gmail.com>