Commit graph

120094 commits

Author SHA1 Message Date
Hugo van Kemenade
381eb04c17
[3.12] Add zizmor to pre-commit and fix most findings (GH-127749) (#127788)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2024-12-10 15:55:00 +02:00
Miss Islington (bot)
8159d0c39e
[3.12] gh-101100: Fix sphinx warnings in whatsnew/3.0.rst (GH-127662) (#127784)
Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-12-10 10:52:22 +00:00
Miss Islington (bot)
8b4e7f8ec0
[3.12] gh-127552: Remove comment questioning 4-digit restriction for ‘Y’ in datetime.strptime patterns (GH-127590) (#127649)
gh-127552: Remove comment questioning 4-digit restriction for ‘Y’ in datetime.strptime patterns (GH-127590)

The code has required 4 digits for the year since its inclusion in the stdlib in 2002 (over 22 years ago as of this commit).
(cherry picked from commit 51cfa569e3)

Co-authored-by: Beomsoo Kim <beoms424@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-10 09:20:54 +01:00
Miss Islington (bot)
e881dd1c46
[3.12] gh-126775: make linecache.checkcache threadsafe and GC re-entrency safe (GH-126776) (#127779)
gh-126775: make linecache.checkcache threadsafe and GC re-entrency safe (GH-126776)

(cherry picked from commit 2233c303e4)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bartosz Sławecki <bartoszpiotrslawecki@gmail.com>
2024-12-10 08:02:22 +00:00
Miss Islington (bot)
fa935225a4
gh-127732: Add Windows Server 2025 detection to platform module (GH-127733)
(cherry picked from commit 5eb7fd4d0f)

Co-authored-by: Wulian <1055917385@qq.com>
2024-12-09 12:42:37 +00:00
Miss Islington (bot)
5f5624ddc8
[3.12] gh-127734: improve signature of urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ (GH-127735) (#127745)
gh-127734: improve signature of `urllib.request.HTTPPasswordMgrWithPriorAuth.__init__` (GH-127735)

improve signature of urllib.request.HTTPPasswordMgrWithPriorAuth.__init__
(cherry picked from commit a03efb533a)

Co-authored-by: Stephen Morton <git@tungol.org>
2024-12-08 12:16:03 -08:00
Miss Islington (bot)
87f912ac18
[3.12] Give poplib.POP3.rpop a proper docstring (GH-127370) (#127722)
Give `poplib.POP3.rpop` a proper docstring (GH-127370)

Previously `poplib.POP3.rpop` had a "Not sure what this does" docstring, now it has been fixed.
(cherry picked from commit 27d0d21413)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2024-12-07 16:33:04 +00:00
Miss Islington (bot)
cd46fb6006
[3.12] gh-101100: amend references starting with !~ in gh-127054 (GH-127684) (#127693)
gh-101100: amend references starting with `!~` in gh-127054 (GH-127684)
(cherry picked from commit 77a61c0465)

Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
2024-12-06 14:19:52 +00:00
Miss Islington (bot)
9aa0deb2ee
[3.12] gh-127655: Ensure _SelectorSocketTransport.writelines pauses the protocol if needed (GH-127656) (#127664)
gh-127655: Ensure `_SelectorSocketTransport.writelines` pauses the protocol if needed (GH-127656)

Ensure `_SelectorSocketTransport.writelines` pauses the protocol if it reaches the high water mark as needed.
(cherry picked from commit e991ac8f20)

Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-12-06 10:42:40 +05:30
Miss Islington (bot)
f8c0d806b9
[3.12] [Docs] GDB howto: Fix block type of a cast example (GH-127621) (#127654)
[Docs] GDB howto: Fix block type of a cast example (GH-127621)
(cherry picked from commit 657d0e99aa)

Co-authored-by: Maciej Olko <maciej.olko@affirm.com>
2024-12-05 21:01:23 +00:00
Miss Islington (bot)
675324de9a
[3.12] GH-126727: Fix test_era_nl_langinfo with Japanese ERAs on Solaris (GH-127327) (GH-127646)
(cherry picked from commit d958d9f4a1)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2024-12-05 19:01:25 +00:00
Miss Islington (bot)
a65475fb70
[3.12] gh-122431: Disallow negative values in readline.append_history_file (GH-122469) (#127642)
gh-122431: Disallow negative values in `readline.append_history_file` (GH-122469)
(cherry picked from commit 208b0fb645)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-05 18:15:30 +01:00
Victor Stinner
288d6d04ae
[3.12] gh-93312: Include <sys/pidfd.h> to get PIDFD_NONBLOCK (#127593) (#127631)
gh-93312: Include <sys/pidfd.h> to get PIDFD_NONBLOCK (#127593)

(cherry picked from commit fcbe6ecdb6)
2024-12-05 09:59:53 +00:00
Miss Islington (bot)
8e3c2d2425
[3.12] gh-127347: Document traceback.print_list (GH-127348) (#127570)
Add an documentation entry about `traceback.print_list`

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2024-12-04 10:29:10 +02:00
Thomas Wouters
f19c50a481 Post 3.12.8 2024-12-03 22:38:32 +01:00
Thomas Wouters
2dc476bcb9 Python 3.12.8 2024-12-03 19:42:41 +01:00
Miss Islington (bot)
49da170709
[3.12] gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (gh-125205)
Fix a crash caused by immortal interned strings being shared between
sub-interpreters that use basic single-phase init. In that case, the string
can be used by an interpreter that outlives the interpreter that created and
interned it. For interpreters that share obmalloc state, also share the
interned dict with the main interpreter.

This is an un-revert of gh-124646 that then addresses the Py_TRACE_REFS
failures identified by gh-124785 (i.e. backporting gh-125709 too).

(cherry picked from commit f2cb399470, AKA gh-124865)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-12-03 10:26:25 -07:00
Miss Islington (bot)
b49e902b81
[3.12] gh-126876: Fix socket internal_select() for large timeout (GH-126968) (#127003)
gh-126876: Fix socket internal_select() for large timeout (GH-126968)

If the timeout is larger than INT_MAX, replace it with INT_MAX, in
the poll() code path.

Add an unit test.
(cherry picked from commit b3687ad454)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-03 14:12:59 +00:00
Miss Islington (bot)
c40656eeff
[3.12] gh-127253: Note that Stable ABI is about ABI stability (GH-127254) (GH-127558)
(cherry picked from commit 35d37d6592)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-12-03 13:57:58 +01:00
Miss Islington (bot)
af2d24b5ad
gh-119826: Improved fallback for ntpath.abspath() on Windows (GH-119938)
(cherry picked from commit 4b00aba42e)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-12-02 20:03:44 +00:00
Miss Islington (bot)
8fffbb0982
[3.12] gh-113841: fix possible undefined division by 0 in _Py_c_pow() (GH-127211) (GH-127216) (GH-127530)
[3.13] gh-113841: fix possible undefined division by 0 in _Py_c_pow() (GH-127211) (GH-127216)

Note, that transformed expression is not an equivalent for original one (1/exp(-x) != exp(x) in general for floating-point numbers). Though, the difference seems to be ~1ULP for good libm implementations.

It's more interesting why division was used from beginning. Closest algorithm I've found (no error checks, of course;)) - it's Algorithm 190 from ACM: https://dl.acm.org/doi/10.1145/366663.366679. It uses subtraction in the exponent.

(cherry picked from commit f7bb658124)

(cherry picked from commit f41d8d89e7)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-12-02 19:47:42 +00:00
Sergey B Kirpichev
34fe4af8a2
[3.12] gh-126618: fix repr(itertools.count(sys.maxsize)) (GH-127048) (#127510)
(cherry picked from commit 930ba0ce60)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-02 15:19:59 +01:00
Miss Islington (bot)
34137cbd23
[3.12] gh-126699: allow AsyncIterator to be used as a base for Protocols (GH-126702) (#126761)
gh-126699: allow AsyncIterator to be used as a base for Protocols (GH-126702)
(cherry picked from commit feb3e0b19c)

Co-authored-by: Stephen Morton <github@tungol.org>
2024-12-02 14:18:53 +00:00
Miss Islington (bot)
179b134014
[3.12] gh-101100: Fix Sphinx warnings about list methods (GH-127054) (#127512)
Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
2024-12-02 14:01:46 +00:00
Miss Islington (bot)
97fd09fba1
[3.12] add missing gc_collect() calls in sqlite3 tests (GH-127446) (#127501)
add missing gc_collect() calls in sqlite3 tests (GH-127446)
(cherry picked from commit 2a373da770)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
2024-12-02 14:57:51 +01:00
Carol Willing
9295a1d033
[3.12] Docs: Miscellaneous corrections to simple statements in the language reference (GH-126720) (#126891)
* Replace: The :keyword:`global` -> The :keyword:`global` statement
Add :keyword: when it's needed

* Replace repeated links with duoble backticks
(cherry picked from commit 94a7a4e22f)

Co-authored-by: Beomsoo Kim <beoms424@gmail.com>
2024-12-02 14:55:31 +01:00
Miss Islington (bot)
22f8e430f8
[3.12] gh-99880: document rounding mode for new-style formatting (GH-121481) (#126335)
The CPython uses _Py_dg_dtoa(), which does rounding to nearest with half
to even tie-breaking rule.

If that functions is unavailable, PyOS_double_to_string() fallbacks to
system snprintf().  Since CPython 3.12, build requirements include C11
compiler *and* support for IEEE 754 floating point numbers (Annex F).
This means that FE_TONEAREST macro is available and, per default,
printf-like functions should use same rounding mode as _Py_dg_dtoa().

(cherry picked from commit 7d7d56d8b1)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-02 14:52:49 +01:00
Bénédikt Tran
9f0d6b71d6
[3.12] Fix Unicode encode_wstr_utf8() (#127420) (#127504)
Fix Unicode encode_wstr_utf8() (#127420)

Raise RuntimeError instead of RuntimeWarning.

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-02 13:24:26 +01:00
Miss Islington (bot)
828db9016b
[3.12] gh-127443: Fix some entries in Doc/data/refcounts.dat (GH-127451) (#127497)
gh-127443: Fix some entries in `Doc/data/refcounts.dat` (GH-127451)

Fix incorrect entries in `Doc/data/refcounts.dat`
(cherry picked from commit 1f8267b85d)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-02 08:29:34 +00:00
Miss Islington (bot)
87b712228e
[3.12] gh-127356: Fix prepend doctrees directory for gettext target (GH-127357) (#127471)
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2024-12-01 09:24:18 +00:00
Yuki Kobayashi
4000cbd46a
[3.12] Docs: Fix incorrect indents in c-api/type.rst (GH-127449) (#127461)
(cherry picked from commit 33ce8dcf79)
2024-12-01 10:51:46 +02:00
Miss Islington (bot)
f08c82ecad
[3.12] Add the missing f on an f-string error message in multiprocessing. (GH-127462) (#127465)
Add the missing `f` on an f-string error message in multiprocessing. (GH-127462)
(cherry picked from commit 11c01092d5)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-11-30 23:50:33 -08:00
Bénédikt Tran
ea8a85bb9e
[3.12] Link to correct class methods in asyncio primitives docs (GH-127270) (#127438) 2024-11-30 10:02:07 +00:00
Miss Islington (bot)
7c7ed49b51
[3.12] gh-88110: Clear concurrent.futures.thread._threads_queues after fork to avoid joining parent process' threads (GH-126098) (GH-127164)
Threads are gone after fork, so clear the queues too. Otherwise the
child process (here created via multiprocessing.Process) crashes on
interpreter exit.

(cherry picked from commit 1848ce61f3)

Co-authored-by: Andrei Bodrov <Drino@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-30 09:05:46 +00:00
Victor Stinner
e7ab97862d
[3.12] gh-127208: Reject null character in _imp.create_dynamic() (#127400) (#127419)
gh-127208: Reject null character in _imp.create_dynamic() (#127400)

_imp.create_dynamic() now rejects embedded null characters in the
path and in the module name.

Backport also the _PyUnicode_AsUTF8NoNUL() function.

(cherry picked from commit b14fdadc6c)
2024-11-29 17:03:24 +01:00
Hugo van Kemenade
fc0564b365
[3.12] gh-127359: Pin Tcl/Tk to 8 (8.6) for testing macOS (GH-127365) (#127394) 2024-11-29 13:02:41 +02:00
Miss Islington (bot)
fc6c2de6de
[3.12] gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (GH-127358) (#127402)
gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (GH-127358)

Replace the sleep(2) with a task which is blocked forever.
(cherry picked from commit bfabf96b50)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-29 10:59:22 +00:00
Miss Islington (bot)
91399c3984
[3.12] gh-127303: Add docs for token.EXACT_TOKEN_TYPES (GH-127304) (#127391)
gh-127303: Add docs for token.EXACT_TOKEN_TYPES (GH-127304)

---------

(cherry picked from commit dd3a87d2a8)

Co-authored-by: Илья Любавский <100635212+lubaskinc0de@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-29 09:22:27 +00:00
Miss Islington (bot)
7d175caf21
[3.12] gh-127190: Fix local_setattro() error handling (GH-127366) (#127368)
gh-127190: Fix local_setattro() error handling (GH-127366)

Don't make the assumption that the 'name' argument is a string. Use
repr() to format the 'name' argument instead.
(cherry picked from commit 20657fbdb1)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-28 17:32:50 +00:00
Victor Stinner
f4c9f39165
[3.12] gh-123967: Fix faulthandler for trampoline frames (#127329) (#127363)
gh-123967: Fix faulthandler for trampoline frames (#127329)

If the top-most frame is a trampoline frame, skip it.

(cherry picked from commit 58e334e143)
2024-11-28 13:57:35 +00:00
Miss Islington (bot)
c3bb32de9d
[3.12] gh-124008: Fix calculation of the number of written bytes for the Windows console (GH-124059) (GH-127326)
Since MultiByteToWideChar()/WideCharToMultiByte() is not reversible if
the data contains invalid UTF-8 sequences, use binary search to
calculate the number of written bytes from the number of written
characters.

Also fix writing incomplete UTF-8 sequences.

Also fix handling of memory allocation failures.
(cherry picked from commit 3cf83d91a5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-27 16:00:30 +02:00
Miss Islington (bot)
97ed21636c
[3.12] gh-109746: Fix race condition in test_start_new_thread_failed (GH-127299) (GH-127324)
(cherry picked from commit 83926d3b4c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-27 12:22:32 +00:00
Yuki Kobayashi
16e899d589
[3.12] gh-101100: Fix sphinx warnings in howto/* (GH-127084) (#127311) 2024-11-27 11:46:42 +02:00
Miss Islington (bot)
08531ac83f
[3.12] gh-127183: Add _ctypes.CopyComPointer tests (GH-127184) (GH-127252)
gh-127183: Add `_ctypes.CopyComPointer` tests (GH-127184)

* Make `create_shelllink_persist` top level function.

* Add `CopyComPointerTests`.

* Add more tests.

* Update tests.

* Add assertions for `Release`'s return value.
(cherry picked from commit c7f1e3e150)

Co-authored-by: Jun Komoda <45822440+junkmd@users.noreply.github.com>
2024-11-26 11:13:29 +01:00
Miss Islington (bot)
619037af1c
[3.12] gh-127265: Remove single quotes from 'arrow's in tutorial/errors.rst (GH-127268)
(cherry picked from commit 26ff32b305)

Co-authored-by: funkyrailroad <funkyrailroad@users.noreply.github.com>
2024-11-25 21:42:34 +00:00
Rafael Fontenelle
3806772b3d
[3.12] Fix a few typos found in the docs (GH-127126) (GH-127185)
(cherry picked from commit 39e60aeb38)
2024-11-25 11:48:00 -08:00
Miss Islington (bot)
a4d6b905dd
[3.12] gh-127182: Fix io.StringIO.__setstate__ crash when None is the first value (GH-127219) (#127263)
gh-127182: Fix `io.StringIO.__setstate__` crash when `None` is the first value (GH-127219)
(cherry picked from commit a2ee899682)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-25 17:51:21 +00:00
Miss Islington (bot)
f7e587d15c
[3.12] gh-126384: Add tests to verify the behavior of basic COM methods. (GH-126610) (GH-127160)
(cherry picked from commit 7725c0371a)

Co-authored-by: Jun Komoda <45822440+junkmd@users.noreply.github.com>
2024-11-25 13:18:35 +01:00
Yuki Kobayashi
7e901cbdd8
[3.12] gh-101100: Fix sphinx warnings of removed opcodes (GH-127222) (#127240) 2024-11-25 10:51:48 +02:00
Miss Islington (bot)
5bfacd26e8
[3.12] gh-127217: Fix pathname2url() for paths starting with multiple slashes on Posix (GH-127218) (GH-127231)
(cherry picked from commit 97b2ceaaaf)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-24 20:13:23 +02:00