gh-106560: Fix redundant declarations in Python/frozen.c (#112612)
Avoid duplicated declarations of "extern" functions in
Python/frozen.c.
Compiler warnings seen by building Python with gcc -Wredundant-decls.
(cherry picked from commit d9e444dbb8)
gh-106560: Fix redundant declarations in Include/ (#112611)
Don't declare PyBool_Type and PyLong_Type twice, but only once.
Compiler warnings seen by building Python with gcc -Wredundant-decls.
Revise htest.py docstring and move 2 specs to alphabetical position.
(cherry picked from commit e44f1940bd)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Relocate smtpd deprecation notice to it's own section rather than under
'locale' in docs for What's New in Python 3.12 doc
(cherry picked from commit 1ff212debd)
Co-authored-by: Matt Prodani <mp5908@nyu.edu>
Change 'Dialog' to 'Window' in two places to match the name of the config_key class being tested.
(cherry picked from commit 81261fa67f)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Skip tests if no interpreters module.gh-110713 added some tests that use the interpreters module but did not accommodated builds that don't support subinterpreters (incl. an interpreters module). We fix that here by catching ImportError and skipping tests as appropriate.
gh-110707 (0122b4d) added some tests that didn't close file descriptors they created, leading to failures on the refleak buildbots. This closes the leaking file descriptors, resolving the failure.
gh-112431: Unconditionally call `hash -r` (GH-112432)
The `activate` script calls `hash -r` in two places to make sure the shell picks
up the environment changes the script makes. Before that, it checks to
see if the shell running the script is bash or zsh.
`hash -r` is specified by POSIX and is not exclusive to bash and zsh.
This guard prevents the script from calling `hash -r` in other
`GH-!/bin/sh`-compatible shells like dash.
(cherry picked from commit a194938f33)
Co-authored-by: James Morris <6653392+J-M0@users.noreply.github.com>
gh-112105: Make completer delims work on libedit (gh-112106)
(cherry picked from commit 2df26d8348)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
This should have been done in gh-104148.
(A similar fix has already be done for that slot's value macros, and backported to 3.12. See gh-110968.)
(cherry picked from commit 836e0a75d5)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Fixes GH-109894
* set `interp.static_objects.last_resort_memory_error.args` to empty tuple to avoid crash on `PyErr_Display()` call
* allow `_PyExc_InitGlobalObjects()` to be called on subinterpreter init
---------
(cherry picked from commit 47d3e2ed93)
Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
We do the following:
* add a per-interpreter XID registry (PyInterpreterState.xidregistry)
* put heap types there (keep static types in _PyRuntimeState.xidregistry)
* clear the registries during interpreter/runtime finalization
* avoid duplicate entries in the registry (when _PyCrossInterpreterData_RegisterClass() is called more than once for a type)
* use Py_TYPE() instead of PyObject_Type() in _PyCrossInterpreterData_Lookup()
The per-interpreter registry helps preserve isolation between interpreters. This is important when heap types are registered, which is something we haven't been doing yet but I will likely do soon.
(cherry-picked from commit 80dc39e1dc)
The existence of background threads running on a subinterpreter was preventing interpreters from getting properly destroyed, as well as impacting the ability to run the interpreter again. It also affected how we wait for non-daemon threads to finish.
We add PyInterpreterState.threads.main, with some internal C-API functions.
(cherry-picked from commit 1dd9dee45d)
gh-112414: Add additional unit tests for calling `repr()` on a namespace package (GH-112475)
(cherry picked from commit cf2054059c)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Docs: fix markup for `importlib.machinery.NamespaceLoader` (GH-112479)
(cherry picked from commit 2e632fa07d)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
We tried this before with a dict and for all interned strings. That ran into problems due to interpreter isolation. However, exclusively using a per-interpreter cache caused some inconsistency that can eliminate the benefit of interning. Here we circle back to using a global cache, but only for statically allocated strings. We also use a more-basic _Py_hashtable_t for that global cache instead of a dict.
Ideally we would only have the global cache, but the optional isolation of each interpreter's allocator means that a non-static string object must not outlive its interpreter. Thus we would have to store a copy of each such interned string in the global cache, tied to the main interpreter.
(cherry-picked from commit b72947a8d2)
Correct documentation for AF_PACKET (GH-112339)
Protocol in the address tuple should *not* be in the network-byte-order, because it is converted internally[1].
[1] 89ddea4886/Modules/socketmodule.cGH-L2144
network byte order doesn't make sense for a python level int anyways. It's a fixed size C serialization concept.
(cherry picked from commit 562d7149c6)
Co-authored-by: Eugene Toder <eltoder@users.noreply.github.com>
Revert "[3.12] gh-105699: Re-enable the Multiple-Interpreters Stress Tests (gh-107572) (#107783)"
This reverts commit a4aac7d3ea.
The stress tests are still failing on FreeBSD.
This change makes sure sys.path[0] is set properly for subinterpreters. Before, it wasn't getting set at all.
This change does not address the broader concerns from gh-109853.
(cherry-picked from commit a040a32ea2)
We had disabled them due to crashes they exposed, which have since been fixed.
(cherry picked from commit f9e3ff1ea4)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: T. Wouters <thomas@python.org>
* Remove mention of "vsapi" element type from the documentation.
* Add tests for element_create() and other ttk.Style methods.
* Add examples for element_create() in the documentation.
(cherry picked from commit 005d1e8fc8)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-112388: Fix an error that was causing the parser to try to overwrite tokenizer errors (GH-112410)
(cherry picked from commit 2c8b191742)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
It is also no longer use __len__().
(cherry picked from commit 812360fddd)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Move What's New In Python 3.12 entries to the right section (GH-112447)
Jython and ctypes removals are unrelated to C API Removals.
(cherry picked from commit d44ee42cd7)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-112414: Fix `AttributeError` when calling `repr()` on a namespace package imported with a custom loader (GH-112425)
(cherry picked from commit 0622839cfe)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>