Commit graph

28300 commits

Author SHA1 Message Date
Miss Islington (bot)
a9f2daf1ab
[3.12] GH-115983: skip building shared modules for testing under WASI (GH-116528) (#120316)
GH-115983: skip building shared modules for testing under WASI (GH-116528)
(cherry picked from commit 8c094c3095)

Co-authored-by: Brett Cannon <brett@python.org>
2024-06-10 13:27:04 +00:00
Serhiy Storchaka
7545b7cb63
[3.12] bpo-24766: doc= argument to subclasses of property not handled correctly (GH-2487) (GH-120312)
(cherry picked from commit 4829522b8d)

Co-authored-by: E. M. Bray <erik.bray@lri.fr>
2024-06-10 10:32:45 +00:00
Miss Islington (bot)
82c93ea55a
[3.12] gh-119666: fix multiple class-scope comprehensions referencing __class__ (GH-120295) (#120300) 2024-06-10 00:37:15 -04:00
Miss Islington (bot)
58657d0dc1
[3.12] gh-120121: Add InvalidStateError to concurrent.futures.__all__ (GH-120123) (#120274)
gh-120121: Add InvalidStateError to concurrent.futures.__all__ (GH-120123)
(cherry picked from commit 5d59b870ef)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-06-08 16:28:21 +00:00
Miss Islington (bot)
46e69f8c25
[3.12] gh-120244: Fix re.sub() reference leak (GH-120245) (GH-120265)
(cherry picked from commit 38a25e9560)

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
2024-06-08 14:10:44 +03:00
Serhiy Storchaka
88f67df22c
[3.12] bpo-37755: Use configured output in pydoc instead of pager (GH-15105) (GH-120262)
If the Helper() class was initialized with an output, the topics, keywords
and symbols help still use the pager instead of the output.
Change the behavior so  the output is used if available while keeping the
previous behavior if no output was configured.
(cherry picked from commit 2080425154)

Co-authored-by: Enrico Tröger <enrico.troeger@uvena.de>
2024-06-08 09:46:25 +00:00
Miss Islington (bot)
ac68d83fec
[3.12] gh-120211: Fix tkinter.ttk with Tcl/Tk 9.0 (GH-120213) (GH-120216)
* Use new methods for tracing Tcl variable.
* Fix Combobox.current() for empty combobox.
(cherry picked from commit d68a22e7a6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-07 14:30:50 +03:00
Miss Islington (bot)
ec139c8fae
[3.12] gh-112672: Fix builtin Tkinter with Tcl 9.0 (GH-112681) (GH-120209)
* Add declaration of Tcl_AppInit(), missing in Tcl 9.0.
* Use Tcl_Size instead of int where needed.

(cherry picked from commit e079935282)

Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-07 10:18:42 +00:00
Thomas Wouters
8e8a4baf65 Python 3.12.4 2024-06-06 20:26:44 +02:00
Jelle Zijlstra
dc40226ea1
[3.12] gh-119311: Fix name mangling with PEP 695 generic classes (#119464) (#119644)
* [3.12] gh-119311: Fix name mangling with PEP 695 generic classes (#119464)

Fixes #119311. Fixes #119395.

(cherry picked from commit a9a74da4a0)
2024-06-04 19:55:45 +00:00
Serhiy Storchaka
f98ec7574a
[3.12] gh-89928: Fix integer conversion of device numbers (GH-31794) (GH-120054)
Fix os.major(), os.minor() and os.makedev().
Support device numbers larger than 2**63-1.
Support non-existent device number (NODEV).
(cherry picked from commit 7111d9605f)
2024-06-04 17:12:13 +00:00
Miss Islington (bot)
0e150c36de
[3.12] gh-119819: Fix regression to allow logging configuration with multipr… (GH-120030) (GH-120034)
(cherry picked from commit 99d945c0c0)
2024-06-04 13:41:02 +01:00
Miss Islington (bot)
fe68908c54
[3.12] gh-118868: logging QueueHandler fix passing of kwargs (GH-118869) (GH-120031)
(cherry picked from commit dce14bb2dc)
2024-06-04 13:17:46 +01:00
Miss Islington (bot)
46545d3244
[3.12] gh-116145: Update macOS installer to Tcl/Tk 8.6.14 (GH-116151) (GH-119922)
(cherry picked from commit 4fa95c6ec3)
Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
2024-06-01 20:23:05 +00:00
Barney Gale
feb7870b46
[3.12] GH-89727: Fix shutil.rmtree() recursion error on deep trees (GH-119808) (#119919)
Implement `shutil._rmtree_safe_fd()` using a list as a stack to avoid emitting recursion errors on deeply nested trees.

`shutil._rmtree_unsafe()` was fixed in a150679f90.

(cherry picked from commit 53b1981fb0)
2024-06-01 20:39:35 +01:00
Miss Islington (bot)
55f65156cb
[3.12] gh-113892: Add a extra check to ProactorEventLoop.sock_connect to ensure that the given socket is in non-blocking mode (GH-119519) (#119913)
(cherry picked from commit cf3bba3f06)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-06-01 16:29:34 +00:00
Victor Stinner
34a0e7a824
[3.12] Revert "[3.12] gh-69214: Fix fcntl.ioctl() request type (#119498) (#1… (#119905)
Revert "[3.12] gh-69214: Fix fcntl.ioctl() request type (#119498) (#119505)"

This reverts commit 078da88ad1.

The change modified how negative values, like termios.TIOCSWINSZ, was
treated and is actually backward incompatible.
2024-06-01 17:08:07 +02:00
Jelle Zijlstra
6d9677d78e
[3.12] gh-119821: Support non-dict globals in LOAD_FROM_DICT_OR_GLOBALS (#119822) (#119890)
The implementation basically copies LOAD_GLOBAL. Possibly it could be deduplicated,
but that seems like it may get hairy since the two operations have different operands.

This is important to fix in 3.14 for PEP 649, but it's a bug in earlier versions too,
and we should backport to 3.13 and 3.12 if possible.

(cherry picked from commit 80a4e38994)
2024-05-31 21:56:38 -07:00
Sam Gross
738cf21609
[3.12] gh-119585: Fix crash involving PyGILState_Release() and PyThreadState_Clear() (GH-119753) (#119861)
Make sure that `gilstate_counter` is not zero in when calling
`PyThreadState_Clear()`. A destructor called from `PyThreadState_Clear()` may
call back into `PyGILState_Ensure()` and `PyGILState_Release()`. If
`gilstate_counter` is zero, it will try to create a new thread state before
the current active thread state is destroyed, leading to an assertion failure
or crash.
(cherry picked from commit bcc1be39cb)
2024-05-31 15:42:09 +00:00
Serhiy Storchaka
d4680b9e17
[3.12] gh-103194: Fix Tkinter’s Tcl value type handling for Tcl 8.7/9.0 (GH-103846) (GH-119831)
Some of standard Tcl types were renamed, removed, or no longer
registered in Tcl 8.7/9.0. This change fixes automatic conversion of Tcl
values to Python values to avoid returning a Tcl_Obj where the primary
Python types (int, bool, str, bytes) were returned in older Tcl.
(cherry picked from commit 94e9585e99)

Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
2024-05-31 09:15:53 +00:00
Steve Dower
e85e813bf1
gh-119690: Adds Unicode support for named pipes in _winapi (GH-119717)
Also backports a minor improvement to test_audit.
2024-05-30 15:40:23 +01:00
Miss Islington (bot)
aae371bda4
[3.12] GH-89727: Fix os.fwalk() recursion error on deep trees (GH-119638) (#119765)
GH-89727: Fix `os.fwalk()` recursion error on deep trees (GH-119638)

Implement `os.fwalk()` using a list as a stack to avoid emitting recursion
errors on deeply nested trees.
(cherry picked from commit 3c890b503c)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-05-30 03:32:14 +00:00
Barney Gale
45587df8d0
[3.12] GH-89727: Partially fix shutil.rmtree() recursion error on deep trees (GH-119634) (#119749)
* GH-89727: Partially fix `shutil.rmtree()` recursion error on deep trees (#119634)

Make `shutil._rmtree_unsafe()` call `os.walk()`, which is implemented
without recursion.

`shutil._rmtree_safe_fd()` is not affected and can still raise a recursion
error.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit a150679f90)
2024-05-29 21:53:08 +01:00
Steve Dower
bc01c5d225
gh-119070: Fix py.exe handling of /usr/bin/env commands missing extension (GH-119426) 2024-05-29 20:12:55 +01:00
Miss Islington (bot)
4a0af0cfdc
[3.12] gh-119118: Fix performance regression in tokenize module (GH-119615) (#119683)
- Cache line object to avoid creating a Unicode object
  for all of the tokens in the same line.
- Speed up byte offset to column offset conversion by using the
  smallest buffer possible to measure the difference.

(cherry picked from commit d87b015106)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2024-05-28 22:49:02 +02:00
Jelle Zijlstra
7f06cd335e
[3.12] gh-119011: type.__type_params__ now return an empty tuple (GH-119296) (#119681)
(cherry picked from commit 6b240c2308)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-05-28 19:54:47 +00:00
Nice Zombies
09a85eaa4c
gh-118263: Add additional arguments to path_t (Argument Clinic type) in posixmodule (GH-119608) 2024-05-28 11:13:01 +01:00
Miss Islington (bot)
53843c22e5
[3.12] Fix typos in HISTORY documentation (GH-119453) (#119598)
Co-authored-by: Xie Yanbo <xieyanbo@gmail.com>
2024-05-27 08:04:05 +00:00
Victor Stinner
078da88ad1
[3.12] gh-69214: Fix fcntl.ioctl() request type (#119498) (#119505)
gh-69214: Fix fcntl.ioctl() request type (#119498)

Use an 'unsigned long' instead of an 'unsigned int' for the request
parameter of fcntl.ioctl() to support requests larger than UINT_MAX.

(cherry picked from commit 92fab3356f)
2024-05-24 12:53:41 +00:00
Eric Snow
0d5fe2c7b4
[3.12] gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across Interpreters (gh-119331) (gh-119425)
_PyArg_Parser holds static global data generated for modules by Argument Clinic.  The _PyArg_Parser.kwtuple field is a tuple object, even though it's stored within a static global.  In some cases the tuple is statically allocated and thus it's okay that it gets shared by multiple interpreters.  However, in other cases the tuple is set lazily, allocated from the heap using the active interprepreter at the point the tuple is needed.

This is a problem once that interpreter is destroyed since _PyArg_Parser.kwtuple becomes at dangling pointer, leading to crashes.  It isn't a problem if the tuple is allocated under the main interpreter, since its lifetime is bound to the lifetime of the runtime.  The solution here is to temporarily switch to the main interpreter.  The alternative would be to always statically allocate the tuple.

This change also fixes a bug where only the most recent parser was added to the global linked list.

(cherry picked from commit 81865002ae)
2024-05-22 22:26:58 +00:00
Nice Zombies
874a4f7d08
gh-118507 : Refactor ntpath native functions (gh-119381)
This refactoring will make future backports easier without changing behaviours,
apart from correcting a bug when passing a pipe to `ntpath.isfile`.
2024-05-22 15:49:26 +01:00
Miss Islington (bot)
8c96850161
[3.12] gh-118643: Fix AttributeError in the email module (GH-119099) (GH-119390)
Fix regression introduced in gh-100884: AttributeError when re-fold a long
address list.

Also fix more cases of incorrect encoding of the address separator in the
address list missed in gh-100884.
(cherry picked from commit 858b9e85fc)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-22 14:08:05 +03:00
Miss Islington (bot)
f31ce5e364
[3.12] Fix typos in documentation (GH-119295) (#119338)
Co-authored-by: Xie Yanbo <xieyanbo@gmail.com>
2024-05-21 22:33:32 +00:00
Hugo van Kemenade
22bef96237
[3.12] Docs: Ensure no warnings are found in the NEWS file before a given line number (GH-119221) (#119266) 2024-05-21 08:40:16 -06:00
Miss Islington (bot)
8b6175c261
[3.12] gh-119174: Fix high DPI causes turtledemo(turtle-graphics examples) windows blurry (GH-119175) (#119290)
gh-119174: Fix high DPI causes turtledemo(turtle-graphics examples) windows blurry (GH-119175)

------

(cherry picked from commit 538ed5e481)

Co-authored-by: Wulian233 <71213467+Wulian233@users.noreply.github.com>
2024-05-21 04:09:30 +00:00
Victor Stinner
ec5743b5f2
[3.12] gh-119050: Add XML support to libregrtest refleak checker (#119148) (#119272)
gh-119050: Add XML support to libregrtest refleak checker (#119148)

regrtest test runner: Add XML support to the refleak checker
(-R option).

* run_unittest() now stores XML elements as string, rather than
  objects, in support.junit_xml_list.
* runtest_refleak() now saves/restores XML strings before/after
  checking for reference leaks. Save XML into a temporary file.

(cherry picked from commit 9257731f5d)
2024-05-20 22:56:34 +00:00
Miss Islington (bot)
ffe9ba0477
[3.12] gh-92081: Fix for email.generator.Generator with whitespace between encoded words. (GH-92281) (#119246)
* Fix for email.generator.Generator with whitespace between encoded words.

email.generator.Generator currently does not handle whitespace between
encoded words correctly when the encoded words span multiple lines.  The
current generator will create an encoded word for each line.  If the end
of the line happens to correspond with the end real word in the
plaintext, the generator will place an unencoded space at the start of
the subsequent lines to represent the whitespace between the plaintext
words.

A compliant decoder will strip all the whitespace from between two
encoded words which leads to missing spaces in the round-tripped
output.

The fix for this is to make sure that whitespace between two encoded
words ends up inside of one or the other of the encoded words.  This
fix places the space inside of the second encoded word.

A second problem happens with continuation lines.  A continuation line that
starts with whitespace and is followed by a non-encoded word is fine because
the newline between such continuation lines is defined as condensing to
a single space character.  When the continuation line starts with whitespace
followed by an encoded word, however, the RFCs specify that the word is run
together with the encoded word on the previous line.  This is because normal
words are filded on syntactic breaks by encoded words are not.

The solution to this is to add the whitespace to the start of the encoded word
on the continuation line.

Test cases are from GH-92081

* Rename a variable so it's not confused with the final variable.
(cherry picked from commit a6fdb31b67)

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
2024-05-20 20:10:49 +00:00
Victor Stinner
bd1e9509a4
[3.12] gh-118997: Fix _Py_ClearImmortal() assertion (#119001)
Fix _Py_ClearImmortal() assertion: use _Py_IsImmortal() to tolerate
reference count lower than _Py_IMMORTAL_REFCNT. Fix the assertion for
the stable ABI, when a C extension is built with Python 3.11 or
lower.
2024-05-18 16:56:27 -04:00
Miss Islington (bot)
fa359dfe07
[3.12] Fix typos in documentation (GH-119092) (#119117)
Fix typos in documentation (GH-119092)
(cherry picked from commit 65de194dd8)

Co-authored-by: Xie Yanbo <xieyanbo@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-05-17 06:57:34 -04:00
Miss Islington (bot)
387ff96e95
[3.12] gh-67693: Fix urlunparse() and urlunsplit() for URIs with path starting with multiple slashes and no authority (GH-113563) (GH-119024)
(cherry picked from commit e237b25a4f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-14 09:47:11 +00:00
Tian Gao
fcdd20ef83
[3.12] gh-58933: Make pdb return to caller frame correctly when f_trace is not set (GH-118979) (#119008)
* [3.12] gh-58933: Make pdb return to caller frame correctly when f_trace is not set (GH-118979)
(cherry picked from commit f526314194)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-05-13 20:21:15 +01:00
Miss Islington (bot)
35649dfe05
[3.12] gh-87106: Fix inspect.signature.bind() handling of positional-only arguments with **kwargs (GH-103404) (GH-118984)
(cherry picked from commit 9c15202441)

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2024-05-13 08:29:47 +00:00
Steve Dower
eb29e2f590
gh-118486: Support mkdir(mode=0o700) on Windows (GH-118488) 2024-05-09 19:18:56 +01:00
Miss Islington (bot)
0d626760a4
[3.12] gh-103956: Fix trace output in case of missing source line (GH-103958) (GH-118832)
Print only filename with lineno if linecache.getline() returns an empty string.
(cherry picked from commit 7c87ce777b)

Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
2024-05-09 12:51:03 +00:00
Miss Islington (bot)
e9539568be
[3.12] gh-118033: Fix __weakref__ not set for generic dataclasses (GH-118099) (#118822)
gh-118033: Fix `__weakref__` not set for generic dataclasses (GH-118099)
(cherry picked from commit fa9b9cb113)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-05-09 09:09:40 +00:00
Serhiy Storchaka
530c3bb271
[3.12] Format None, True, False and NotImplemented as literals (GH-118758) (GH-118794)
(cherry picked from commit 05c2fe1acd)
2024-05-08 19:55:13 +00:00
Miss Islington (bot)
56c61cc564
[3.12] gh-118314: Fix padding edge case in binascii.a2b_base64 strict mode (GH-118320) (GH-118691)
gh-118314: Fix padding edge case in binascii.a2b_base64 strict mode (GH-118320)

Fix an edge case in `binascii.a2b_base64` strict mode, where
excessive padding was not detected when no padding is necessary.

(cherry picked from commit fe47d9bee3)

Co-authored-by: Youfu Zhang <1315097+zhangyoufu@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2024-05-07 09:35:49 +00:00
Miss Islington (bot)
a4812fd8f7
[3.12] gh-118164: Break a loop between _pydecimal and _pylong and optimize int to str conversion (GH-118483) (GH-118590)
For converting large ints to strings, CPython invokes a function in _pylong.py,
which uses the decimal module to implement an asymptotically waaaaay
sub-quadratic algorithm. But if the C decimal module isn't available, CPython
uses _pydecimal.py instead. Which in turn frequently does str(int). If the int
is very large, _pylong ends up doing the work, which in turn asks decimal to do
"big" arithmetic, which in turn calls str(big_int), which in turn ... it can
become infinite mutual recursion.

This change introduces a different int->str function that doesn't use decimal.
It's asymptotically worse, "Karatsuba time" instead of quadratic time, so
still a huge improvement. _pylong switches to that when the C decimal isn't
available. It is also used for not too large integers (less than 450_000 bits),
where it is faster (up to 2 times for 30_000 bits) than the asymptotically
better implementation that uses the C decimal.

(cherry picked from commit 711c80bfca)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Tim Peters <tim.peters@gmail.com>
2024-05-06 12:10:05 +03:00
Miss Islington (bot)
6abf8401db
[3.12] gh-78955: Use user-selected color theme for Help => IDLE Doc (GH-9502) (#118632)
gh-78955: Use user-selected color theme for Help => IDLE Doc (GH-9502)
(cherry picked from commit 7758be4318)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-05-06 08:12:39 +00:00
Miss Islington (bot)
0c605244a8
[3.12] gh-118164: str(10**10000) hangs if the C _decimal module is missing (GH-118503) (GH-118584)
Serhiy and I independently concluded that exact powers of 10
aren't possible in these contexts, so just checking the
string length is sufficient.

(cherry picked from commit 999f0c5122)

Co-authored-by: Tim Peters <tim.peters@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-05 09:34:43 +03:00