Commit graph

30261 commits

Author SHA1 Message Date
Miss Islington (bot)
68657e2b73
[3.12] gh-109980: Fix test_tarfile_vs_tar on macOS (GH-112905) (#112927)
gh-109980: Fix test_tarfile_vs_tar on macOS (GH-112905)

On recentish macOS versions the system tar
command includes system metadata (ACLs, extended attributes
and resource forks) in the tar archive, which
shutil.make_archive will not do. This can cause
spurious test failures.
(cherry picked from commit dd2ebdf89f)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2023-12-10 19:49:39 +01:00
Miss Islington (bot)
46f86f50be
[3.12] gh-110017: Disable test_signal.test_stress_modifying_handlers on macOS (GH-112834) (#112851)
gh-110017: Disable test_signal.test_stress_modifying_handlers on macOS (GH-112834)

Test test_stress_modifying_handlers in test_signal can crash
the interpreter due to a bug in macOS. Filed as FB13453490
with Apple.
(cherry picked from commit bf0beae6a0)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2023-12-08 10:07:34 +01:00
Eric Snow
c0fc88fa2f
[3.12] gh-112826: Fix the threading Module When _thread is Missing _is_main_interpreter() (#112850)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-12-07 20:15:20 +00:00
Miss Islington (bot)
34e9e20cf2
[3.12] gh-79325: Fix recursion error in TemporaryDirectory cleanup on Windows (GH-112762) (GH-112847)
(cherry picked from commit b2923a61a1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-07 17:36:29 +00:00
Miss Islington (bot)
6ceb8aeda5
[3.12] gh-91133: tempfile.TemporaryDirectory: fix symlink bug in cleanup (GH-99930) (GH-112838)
(cherry picked from commit 81c16cd94e)

Co-authored-by: Søren Løvborg <sorenl@unity3d.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-07 18:35:50 +02:00
Łukasz Langa
8f1c9128dd
[3.12] gh-110190: Temporarily skip new test introduced in gh-112604 on PPC64LE (GH-112818) (#112829)
(cherry picked from commit 9f67042f28)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-12-07 14:07:45 +00:00
Victor Stinner
f27271619e
[3.12] gh-112125: Fix None.__ne__(None) returning NotImplemented instead of … (#112827)
gh-112125: Fix None.__ne__(None) returning NotImplemented instead of False (#112504)

(cherry picked from commit 9c3458e058)

Co-authored-by: andrewluotechnologies <44252973+andrewluotechnologies@users.noreply.github.com>
2023-12-07 13:41:00 +00:00
Miss Islington (bot)
e21a7a976a
[3.12] gh-109981: Fix support.fd_count() on macOS 14 (GH-112797) (#112824)
gh-109981: Fix support.fd_count() on macOS 14 (GH-112797)

Use scanning "/dev/fd/" on macOS in support.fd_count(). That's both more efficient than scanning all possible file descriptors, and avoids crashing the interpreter when there are open "guarded" file descriptors.

"Guarded" file descriptors are a macOS feature where file descriptors used by system libraries are marked and cause hard crashes when used by "user" code.

(cherry picked from commit 953ee622b3)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-12-07 11:28:26 +01:00
Diego Russo
f941ecfffa
[3.12] gh-110190: Fix ctypes structs with array on Arm (#112604) (#112767)
Set MAX_STRUCT_SIZE to 32 in stgdict.c when on Arm platforms.
This because on Arm platforms structs with at most 4 elements of any
floating point type values can be passed through registers. If the type
is double the maximum size of the struct is 32 bytes.
On x86-64 Linux, it's maximum 16 bytes hence we need to differentiate.

(cherry picked from commit bc68f4a4ab)
2023-12-06 16:57:34 +01:00
Miss Islington (bot)
f189bd3e83
[3.12] gh-75666: Tkinter: "unbind(sequence, funcid)" now only unbinds "funcid" (GH-111322) (GH-112802)
Previously, "widget.unbind(sequence, funcid)" destroyed the current binding
for "sequence", leaving "sequence" unbound, and deleted the "funcid"
command.

Now it removes only "funcid" from the binding for "sequence", keeping
other commands, and deletes the "funcid" command.
It leaves "sequence" unbound only if "funcid" was the last bound command.

(cherry picked from commit cc7e45cc57)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: GiovanniL <13402461+GiovaLomba@users.noreply.github.com>
2023-12-06 15:12:37 +00:00
Miss Islington (bot)
5720f7fcdf
[3.12] gh-112769: test_zlib: Fix comparison of ZLIB_RUNTIME_VERSION with non-int suffix (GH-112771) (GH-112773)
zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813ff1)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2023-12-05 20:03:00 +00:00
Miss Islington (bot)
e63bb9caf0
[3.12] bpo-35332: Handle os.close() errors in shutil.rmtree() (GH-23766) (GH-112763)
* Ignore os.close() errors when ignore_errors is True.
* Pass os.close() errors to the error handler if specified.
* os.close no longer retried after error.

(cherry picked from commit 11d88a178b)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-05 17:38:44 +00:00
Miss Islington (bot)
5acfb8258a
[3.12] bpo-43153: Don't mask PermissionError with NotADirectoryError during tempdirectory cleanup (GH-29940) (GH-112753)
(cherry picked from commit 8cdfee1bb9)

Co-authored-by: Ken Jin <kenjin@python.org>
Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-05 13:58:36 +00:00
Miss Islington (bot)
85bbfa8a4b
[3.12] gh-112334: Restore subprocess's use of vfork() & fix extra_groups=[] behavior (GH-112617) (#112731)
Restore `subprocess`'s intended use of `vfork()` by default for performance on Linux;
also fixes the behavior of `extra_groups=[]` which was unintentionally broken in 3.12.0:

Fixed a performance regression in 3.12's :mod:`subprocess` on Linux where it
would no longer use the fast-path ``vfork()`` system call when it could have
due to a logic bug, instead falling back to the safe but slower ``fork()``.

Also fixed a security bug introduced in 3.12.0.  If a value of ``extra_groups=[]``
was passed to :mod:`subprocess.Popen` or related APIs, the underlying
``setgroups(0, NULL)`` system call to clear the groups list would not be made
in the child process prior to ``exec()``.

The security issue was identified via code inspection in the process of
fixing the first bug.  Thanks to @vain for the detailed report and
analysis in the initial bug on Github.

(cherry picked from commit 9fe7655c6c)

+ Reword NEWS for the bugfix/security release. (mentions the assigned CVE number)

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-04 23:33:59 +00:00
Miss Islington (bot)
8d21242bd1
[3.12] gh-108927: Fix removing testing modules from sys.modules (GH-108952) (ПР-112711)
It breaks import machinery if the test module has submodules used in
other tests.
(cherry picked from commit e08b70fab1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-04 16:17:38 +00:00
Miss Islington (bot)
55896f470b
[3.12] gh-109786: Fix leaks and crash when re-enter itertools.pairwise.__next__() (GH-109788) (GH-112699)
(cherry picked from commit 6ca9d3e017)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-04 12:15:41 +00:00
Miss Islington (bot)
29a5ff0068
[3.12] gh-112625: Protect bytearray from being freed by misbehaving iterator inside bytearray.join (GH-112626) (GH-112693)
(cherry picked from commit 0e732d0997)

Co-authored-by: chilaxan <chilaxan@gmail.com>
2023-12-04 08:46:40 +00:00
Irit Katriel
f5965c2385
[3.12] gh-112645: remove deprecation warning for use of onerror in shutil.rmtree (#112659) (#112665)
gh-112645: remove deprecation warning for use of onerror in shutil.rmtree (#112659)

(cherry picked from commit 97857ac058)
2023-12-03 16:28:57 +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
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
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
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)
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
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)
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)
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
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
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
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
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)
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)
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
Mark Dickinson
42df73652d
[3.12] gh-112358: Fix Python 3.12 regression with subclassing struct.Struct (GH-112424) (#112426)
* [3.12] gh-112358: Fix Python 3.12 regression with subclassing struct.Struct. (GH-112424)

Revert commit c8c0afc713 (PR GH-94532),
which moved `struct.Struct` initialisation from `Struct.__init__` to `Struct.__new__`.
This caused issues with code in the wild that subclasses `struct.Struct`..
(cherry picked from commit 9fe60340d7)

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>

* Remove unrelated test
2023-11-27 08:25:06 +00:00
Miss Islington (bot)
e93af80749
[3.12] gh-94722: fix DocTest.__eq__ for case of no line number on one side (GH-112385) (#112400)
gh-94722: fix DocTest.__eq__ for case of no line number on one side (GH-112385)
(cherry picked from commit fbb9027a03)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2023-11-25 17:56:46 +00:00
Tian Gao
3210e3c6cc
[3.12] GH-109052: Use the base opcode when comparing code objects (GH-112329) 2023-11-23 10:18:17 -08:00
Pablo Galindo Salgado
7e70e2ed29
[3.12] gh-112243: Don't include comments in f-string debug expressions (GH-112284) (#112285)
(cherry picked from commit d59feb5dbe)
2023-11-20 15:38:57 +00:00