gh-116181: Remove Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE in rotatingtree.c (GH-121260)
(cherry picked from commit 705a123898)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Refactor the fast Unicode hash check into `_PyObject_HashFast` and use relaxed
atomic loads in the free-threaded build.
After this change, the TSAN doesn't report data races for this method.
(cherry picked from commit 294e724964)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
This will allow Py_TRACE_REFS builds to pass the test suite, until the underlying issue can be resolved.
(cherry picked from commit 9bcb7d8c6f, AKA gh-121236)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
gh-114104: clarify asynchronous comprehension docs to match runtime behavior (GH-121175)
(cherry picked from commit 91313afdb3)
Co-authored-by: Danny Yang <yangdanny97@users.noreply.github.com>
gh-121200: Fix test_expanduser_pwd2() of test_posixpath (GH-121228)
Call getpwnam() to get pw_dir, since it can be different than
getpwall() pw_dir.
(cherry picked from commit 02cb5fdee3)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-121200: Log pwd entry in test_expanduser_pwd2() (GH-121207)
Use subTest() to log the pwd entry in test_expanduser_pwd2() of
test_posixpath to help debugging.
(cherry picked from commit 05a6f8da60)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-121084: Call _abc_registry_clear() when checking refleaks (GH-121191)
dash_R_cleanup() now calls _abc_registry_clear() before calling again
register().
(cherry picked from commit c766ad206e)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-121188: Sanitize invalid XML characters in regrtest (GH-121195)
When creating the JUnit XML file, regrtest now escapes characters
which are invalid in XML, such as the chr(27) control character used
in ANSI escape sequences.
(cherry picked from commit af8c3d7a26)
Co-authored-by: Victor Stinner <vstinner@python.org>
1. Use pkg-config to check for ncursesw/panelw. If that fails, use
pkg-config to check for ncurses/panel.
2. Regardless of pkg-config output, search for curses/panel headers, so
we're sure we have all defines in pyconfig.h.
3. Regardless of pkg-config output, check if libncurses or libncursesw
contains the 'initscr' symbol; if it does _and_ pkg-config failed
earlier, add the resulting -llib linker option to CURSES_LIBS.
Ditto for 'update_panels' and PANEL_LIBS.
4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're
using updated LIBS and CPPFLAGS for those.
Add the PY_CHECK_CURSES convenience macro.
(cherry picked from commit f80376b129)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
gh-87744: fix waitpid race while calling send_signal in asyncio (GH-121126)
asyncio earlier relied on subprocess module to send signals to the process, this has some drawbacks one being that subprocess module unnecessarily calls waitpid on child processes and hence it races with asyncio implementation which internally uses child watchers. To mitigate this, now asyncio sends signals directly to the process without going through the subprocess on non windows systems. On Windows it fallbacks to subprocess module handling but on windows there are no child watchers so this issue doesn't exists altogether.
(cherry picked from commit bd473aa598)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
gh-120522: Add a `--with-app-store-compliance` configure option to patch out problematic code (GH-120984)
* Add --app-store-compliance configuration option.
* Added blurb.
* Correct tab-vs-spaces formatting issue.
* Correct source file name in docs.
* Correct source code reference in Mac docs
* Only apply the patch forward, and ensure the working directory is correct.
* Make patching reslient to multiple builds.
* Documentation fixes found during review
* Documentation and configure.ac syntax improvements
* Regenerate configure script.
* Silence the patch echo output.
---------
(cherry picked from commit 48cd104b0c)
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
GH-119054: Add alt text to pathlib inheritance diagram (GH-121158)
(cherry picked from commit 6b280a8498)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
GH-119054: Add "Expanding and resolving paths" section to pathlib docs. (GH-120970)
Add dedicated subsection for `home()`, `expanduser()`, `cwd()`,
`absolute()`, `resolve()` and `readlink()`. The position of this section
keeps all the `Path` constructors (`Path()`, `Path.from_uri()`,
`Path.home()` and `Path.cwd()`) near the top. Within the section, closely
related methods are kept adjacent. Specifically:
- `home()` and `expanduser()` (the former calls the latter)
- `cwd()` and `absolute()` (the former calls the latter)
- `absolute()` and `resolve()` (both make paths absolute)
- `resolve()` and `readlink()` (both read symlink targets)
- Ditto `cwd()` and `absolute()`
- Ditto `absolute()` and `resolve()`
The "Other methods" section is removed.
(cherry picked from commit d6d8707ff2)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
doc: Mention the missing reflected special methods for all binary operations (GH-119931)
(cherry picked from commit bf5e1065f4)
Co-authored-by: Paulo Freitas <me@paulofreitas.me>
gh-121137: Add missing Py_DECREF calls for ADDITEMS opcode of _pickle.c (GH-121136)
PyObject_GetAttr returns a new reference, but this reference is never decremented using Py_DECREF, so Py_DECREF calls to this referece are added
(cherry picked from commit 92893fd8dc)
Co-authored-by: Justin Applegate <70449145+Legoclones@users.noreply.github.com>
* parse_intermixed_args() now raises ArgumentError instead of calling
error() if exit_on_error is false.
* Internal code now always raises ArgumentError instead of calling
error(). It is then caught at the higher level and error() is called if
exit_on_error is true.
(cherry picked from commit 81a654a342)
* Move pprinter parameter descriptions to a table
* Make pprint doc with params markup
* Remove duplication of the parameters' description
---------
(cherry picked from commit 0890ad7c02)
Co-authored-by: Kerim Kabirov <the.privat33r+gh@pm.me>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
The check for whether the log file is a real file is expensive on NFS
filesystems. This commit reorders the rollover condition checking to
not do the file type check if the expected file size is less than the
rotation threshold.
(cherry picked from commit e9b4ec614b)
Co-authored-by: Craig Robson <craig@zhatt.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
gh-120837: Update _Py_DumpExtensionModules to be async-signal-safe (gh-121051)
(cherry picked from commit 1a2e7a7475)
Co-authored-by: Donghee Na <donghee.na@python.org>
gh-119521: Remove _IncompleteInputError from the docs (GH-120993)
(cherry picked from commit 1167a9a30b)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
This change makes things a little less painful for some users. It also fixes a failing assert (gh-120765), by making sure all subinterpreters are destroyed before the main interpreter. As part of that, we make sure Py_Finalize() always runs with the main interpreter active.
(cherry picked from commit 4be1f37b20, AKA gh-121060)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
We also add _PyThreadState_NewBound() and drop _PyThreadState_SetWhence().
This change only affects internal API.
(cherry picked from commit a905721b9c, AKA gh-121010)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
gh-120937: Reference weakref from the `__del__` documentation (GH-120940)
(cherry picked from commit 1c13b29d54)
Co-authored-by: chaen <christophe.haen@cern.ch>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
gh-121008: Fix idlelib.run tests (GH-121046)
When testing IDLE, don't create a Tk to avoid side effects such as
installing a PyOS_InputHook hook.
(cherry picked from commit 44eafd6688)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-120380: fix Python implementation of `pickle.Pickler` for `bytes` and `bytearray` objects in protocol version 5. (GH-120422)
(cherry picked from commit 7595e6743a)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>