Commit graph

118347 commits

Author SHA1 Message Date
Victor Stinner
34d57d5871
[3.12] gh-106560: Fix redundant declarations in Python/frozen.c (#112612) (#112651)
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)
2023-12-03 11:54:59 +00:00
Victor Stinner
05f5d416de
[3.12] gh-106560: Fix redundant declarations in Include/ (#112611) (#112650)
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.
2023-12-03 11:45:32 +00:00
Miss Islington (bot)
73cda994a3
[3.12] gh-112578: Fix RuntimeWarning when running zipfile (GH-112579) (GH-112646)
(cherry picked from commit 29e6c7b68a)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-12-03 11:41:50 +00:00
Alex Waygood
6221482f0c
[3.12] gh-112316: improve docs for inspect.signature and inspect.Signature (#112631) (#112649)
(cherry-picked from commit fc9e24b01f)
2023-12-03 11:26:53 +00:00
Alex Waygood
2a378ca2ef
[3.12] gh-112618: Make Annotated cache typed (#112619) (#112628) 2023-12-03 00:41:03 +00:00
Alex Waygood
e3c7947770
[3.12] gh-112316: Improve docs of inspect.signature and Signature.from_callable (#112317) (#112629)
gh-112316: Improve docs of `inspect.signature` and `Signature.from_callable` (#112317)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-12-02 22:38:11 +00:00
Alex Waygood
acc62db8af
[3.12] gh-109413: libregrtest: Backport .py-file changes from #112558 (#112605) 2023-12-01 18:54:38 +00:00
Alex Waygood
36dbebed44
[3.12] gh-109413: libregrtest: enable mypy's --strict-optional check on most files (#112586) (#112602)
gh-109413: libregrtest: enable mypy's `--strict-optional` check on most files (#112586)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-12-01 17:13:22 +00:00
Alex Waygood
4fc010cda2
[3.12] Bump mypy to 1.7.1 (#112581) (#112601) 2023-12-01 17:10:38 +00:00
Pablo Galindo Salgado
11232c1299
[3.12] gh-112367: Only free perf trampoline arenas at shutdown (GH-112368) (#112590)
(cherry picked from commit a73aa48e6b)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2023-12-01 16:05:31 +00:00
Miss Islington (bot)
4f919cf8b9
[3.12] gh-109413: regrtest: add WorkerRunTests class (GH-112588) (#112593)
gh-109413: regrtest: add WorkerRunTests class (GH-112588)
(cherry picked from commit f8ff80f635)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-12-01 14:46:42 +00:00
Miss Islington (bot)
7eff607deb
[3.12] gh-111058: Change coro.cr_frame/gen.gi_frame to be None for a closed coroutine/generator. (GH-112428) (#112589) 2023-12-01 14:13:15 +00:00
Miss Islington (bot)
edce0c4fb3
[3.12] gh-82565: Add tests for pickle and unpickle with bad files (GH-16606) (GH-112591)
(cherry picked from commit 058444308a)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2023-12-01 14:12:46 +00:00
Serhiy Storchaka
ae1ea41cf3
[3.12] gh-104231: Add more tests for str(), repr(), ascii(), and bytes() (GH-112551) (GH-112555)
(cherry picked from commit 2223899adc)
2023-12-01 10:16:47 +02:00
Miss Islington (bot)
88d9142639
[3.12] gh-66819: More IDLE htest updates (GH-112574) (#112575)
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>
2023-12-01 07:20:28 +00:00
Dennis Sweeney
a99305e7fb
[3.12] gh-112356: LOAD_GLOBAL can only include one PUSH_NULL (#112566) 2023-12-01 00:35:49 +00:00
Miss Islington (bot)
4c9da4c964
[3.12] gh-111699: Move smtpd note to dedicated section in What's New Python 3.12 doc (GH-112544) (GH-112552)
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>
2023-11-30 13:00:08 +00:00
Miss Islington (bot)
46adf6b701
[3.12] IDLE: fix config_key htest (GH-112545) (#112546)
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>
2023-11-30 03:29:59 -05:00
Miss Islington (bot)
749c8fdafb
[3.12] [Enum] update class creation for RuntimeError changes (GH-111815) (GH-112526)
(cherry picked from commit f9e6ce0395)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-11-29 13:49:52 -08:00
Miss Islington (bot)
8f43250c91
[3.12] Add more C API tests (GH-112522) (GH-112525)
Add tests for PyObject_Str(), PyObject_Repr(), PyObject_ASCII() and
PyObject_Bytes().
(cherry picked from commit e0449b9a7f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-11-29 22:02:57 +02:00
Miss Islington (bot)
c67812668f
[3.12] gh-112509: Fix keys being present in both required_keys and optional_keys in TypedDict (GH-112512) (#112530)
(cherry picked from commit 4038869423)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-29 17:55:06 +00:00
Miss Islington (bot)
01b882b390
[3.12] gh-110930: Correct book title by Alan D. Moore (GH-112490) (#112523)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-11-29 15:55:46 +00:00
Eric Snow
3e6b328752
[3.12] gh-112503: Fix test_sys on WASI (gh-112505)
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.
2023-11-29 00:36:07 +00:00
Eric Snow
5b6858c220
[3.12] gh-105716: Fix Refleaks in test_interpreters (gh-112500)
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.
2023-11-28 19:42:49 +00:00
Miss Islington (bot)
49494c4721
[3.12] gh-112431: Unconditionally call hash -r (GH-112432) (GH-112493)
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>
2023-11-28 15:14:03 +05:30
Miss Islington (bot)
e28722e772
[3.12] gh-109802: Increase test coverage for complexobject.c (GH-112452) (GH-112489)
(cherry picked from commit f14d741daa)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2023-11-28 08:33:44 +00:00
Miss Islington (bot)
7225a014de
[3.12] gh-112105: Make completer delims work on libedit (gh-112106) (gh-112487)
gh-112105: Make completer delims work on libedit (gh-112106)
(cherry picked from commit 2df26d8348)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2023-11-28 06:42:54 +00:00
Miss Islington (bot)
f7251e2af3
[3.12] gh-111698: Restrict Py_mod_multiple_interpreters to 3.12+ Under Py_LIMITED_API (gh-111707) (gh-111787)
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>
2023-11-27 19:42:27 -07:00
Miss Islington (bot)
0aceac557d
[3.12] gh-109894: Fix initialization of static MemoryError in subinterpreter (gh-110911) (gh-111238)
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>
2023-11-27 19:41:53 -07:00
Eric Snow
1e1a30f9f4
[3.12] gh-110310: Add a Per-Interpreter XID Registry for Heap Types (gh-110311) (gh-110714)
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)
2023-11-28 02:36:29 +00:00
Eric Snow
0122b4d7c9
[3.12] gh-105716: Support Background Threads in Subinterpreters Consistently (gh-109921) (gh-110707)
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)
2023-11-27 19:01:05 -07:00
Eric Snow
82ae5a609d
[3.12] gh-109793: Allow Switching Interpreters During Finalization (gh-109794) (gh-110705)
Essentially, we should check the thread ID rather than the thread state pointer.
2023-11-28 00:58:02 +00:00
Miss Islington (bot)
daf9ff99f9
[3.12] gh-112414: Add additional unit tests for calling repr() on a namespace package (GH-112475) (#112480)
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>
2023-11-28 00:39:01 +00:00
Miss Islington (bot)
c44af75e24
[3.12] Docs: fix markup for importlib.machinery.NamespaceLoader (GH-112479) (#112481)
Docs: fix markup for `importlib.machinery.NamespaceLoader` (GH-112479)
(cherry picked from commit 2e632fa07d)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-28 00:21:47 +00:00
Eric Snow
4f71f1680d
[3.12] gh-106931: Intern Statically Allocated Strings Globally (gh-107272) (gh-110713)
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)
2023-11-27 23:51:12 +00:00
Miss Islington (bot)
60a08e6ff2
[3.12] Correct documentation for AF_PACKET (GH-112339) (#112477)
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>
2023-11-27 23:48:59 +00:00
Eric Snow
ee7dc67081
[3.12] gh-105699: Revert gh-107783 "Re-enable the Multiple-Interpreters Stress Tests" (gh-112474)
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.
2023-11-27 22:39:04 +00:00
Eric Snow
313554457e
[3.12] gh-109853: Fix sys.path[0] For Subinterpreters (gh-109994) (gh-110701)
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)
2023-11-27 22:21:12 +00:00
Eric Snow
592a849fdf
[3.12] gh-76785: Use Pending Calls When Releasing Cross-Interpreter Data (gh-109556) (gh-112288)
This fixes some crashes in the _xxinterpchannels module, due to a race between interpreters.
(cherry picked from commit fd7e08a6f3)
2023-11-27 14:49:48 -07:00
Miss Islington (bot)
a4aac7d3ea
[3.12] gh-105699: Re-enable the Multiple-Interpreters Stress Tests (gh-107572) (#107783)
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>
2023-11-27 14:48:08 -07:00
Miss Islington (bot)
1cb95cd2c5
[3.12] gh-68166: Tkinter: Add tests and examples for element_create() (GH-111453) (GH-111857)
* 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>
2023-11-27 20:14:37 +00:00
Miss Islington (bot)
698b4b73bc
[3.12] gh-112388: Fix an error that was causing the parser to try to overwrite tokenizer errors (GH-112410) (#112466)
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>
2023-11-27 19:02:57 +00:00
Miss Islington (bot)
7140716c88
[3.12] gh-112387: Fix error positions for decoded strings with backwards tokenize errors (GH-112409) (#112468)
gh-112387: Fix error positions for decoded strings with backwards tokenize errors (GH-112409)
(cherry picked from commit 45d648597b)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2023-11-27 18:57:34 +00:00
Miss Islington (bot)
4463d2e018
[3.12] bpo-41422: Visit the Pickler's and Unpickler's memo in tp_traverse (GH-21664) (GH-112464)
(cherry picked from commit 967f2a3052)

Co-authored-by: kale-smoothie <34165060+kale-smoothie@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-11-27 18:42:48 +00:00
Miss Islington (bot)
46047bb12b
[3.12] gh-112438: Fix support of format units with the "e" prefix in nested tuples in PyArg_Parse (gh-112439) (GH-112460)
(cherry picked from commit 4eea1e8236)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-11-27 17:57:30 +00:00
Miss Islington (bot)
3ef75ee584
[3.12] gh-84443: SSLSocket.recv_into() now support buffer protocol with itemsize != 1 (GH-20310) (GH-112458)
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>
2023-11-27 17:30:53 +00:00
Miss Islington (bot)
a2ed553b1a
[3.12] GH-101100: Fix reference warnings for `socket` methods (GH-110114) (#112455)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-11-27 17:04:18 +02:00
Miss Islington (bot)
a8269628f6
[3.12] Move What's New In Python 3.12 entries to the right section (GH-112447) (#112450)
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>
2023-11-27 12:02:16 +00:00
Miss Islington (bot)
2718947886
[3.12] Docs: fix typo in doc for sqlite3.Cursor.execute (GH-112442) (#112444)
Docs: fix typo in doc for sqlite3.Cursor.execute (GH-112442)
(cherry picked from commit fb79e1ed4a)

Co-authored-by: Tom Levy <tomlevy93@gmail.com>
2023-11-27 09:34:19 +00:00
Miss Islington (bot)
f9861e69c9
[3.12] gh-112414: Fix AttributeError when calling repr() on a namespace package imported with a custom loader (GH-112425) (#112440)
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>
2023-11-27 08:53:57 +00:00