]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
11 months ago[3.12] gh-127347: Document `traceback.print_list` (GH-127348) (#127570)
Miss Islington (bot) [Wed, 4 Dec 2024 08:29:10 +0000 (09:29 +0100)] 
[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>
11 months agoPost 3.12.8
Thomas Wouters [Tue, 3 Dec 2024 21:35:54 +0000 (22:35 +0100)] 
Post 3.12.8

11 months agoPython 3.12.8 v3.12.8
Thomas Wouters [Tue, 3 Dec 2024 18:40:02 +0000 (19:40 +0100)] 
Python 3.12.8

11 months ago[3.12] gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (gh-125205)
Miss Islington (bot) [Tue, 3 Dec 2024 17:26:25 +0000 (18:26 +0100)] 
[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 f2cb39947093feda3ff85b8dc820922cc5e5f954, AKA gh-124865)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
11 months ago[3.12] gh-126876: Fix socket internal_select() for large timeout (GH-126968) (#127003)
Miss Islington (bot) [Tue, 3 Dec 2024 14:12:59 +0000 (15:12 +0100)] 
[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 b3687ad454c4ac54c8599a10f3ace8a13ca48915)

Co-authored-by: Victor Stinner <vstinner@python.org>
11 months ago[3.12] gh-127253: Note that Stable ABI is about ABI stability (GH-127254) (GH-127558)
Miss Islington (bot) [Tue, 3 Dec 2024 12:57:58 +0000 (13:57 +0100)] 
[3.12] gh-127253: Note that Stable ABI is about ABI stability (GH-127254) (GH-127558)

(cherry picked from commit 35d37d6592d1be71ea76042165f6cbfa6c4c3a17)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
11 months agogh-119826: Improved fallback for ntpath.abspath() on Windows (GH-119938)
Miss Islington (bot) [Mon, 2 Dec 2024 20:03:44 +0000 (21:03 +0100)] 
gh-119826: Improved fallback for ntpath.abspath() on Windows (GH-119938)

(cherry picked from commit 4b00aba42e4d9440d22e399ec2122fe8601bbe54)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
11 months ago[3.12] gh-113841: fix possible undefined division by 0 in _Py_c_pow() (GH-127211...
Miss Islington (bot) [Mon, 2 Dec 2024 19:47:42 +0000 (20:47 +0100)] 
[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 f7bb658124aba74be4c13f498bf46cfded710ef9)

(cherry picked from commit f41d8d89e79d634895868656f50a0e16e339f9d6)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
11 months ago[3.12] gh-126618: fix repr(itertools.count(sys.maxsize)) (GH-127048) (#127510)
Sergey B Kirpichev [Mon, 2 Dec 2024 14:19:59 +0000 (17:19 +0300)] 
[3.12] gh-126618: fix repr(itertools.count(sys.maxsize)) (GH-127048) (#127510)

(cherry picked from commit 930ba0ce605eee9e3b992fa368b00a3f2b7dc4c1)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
11 months ago[3.12] gh-126699: allow AsyncIterator to be used as a base for Protocols (GH-126702...
Miss Islington (bot) [Mon, 2 Dec 2024 14:18:53 +0000 (15:18 +0100)] 
[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 feb3e0b19cb03f06364a3f5e970f0861b8883d1c)

Co-authored-by: Stephen Morton <github@tungol.org>
11 months ago[3.12] gh-101100: Fix Sphinx warnings about list methods (GH-127054) (#127512)
Miss Islington (bot) [Mon, 2 Dec 2024 14:01:46 +0000 (15:01 +0100)] 
[3.12] gh-101100: Fix Sphinx warnings about list methods (GH-127054) (#127512)

Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
11 months ago[3.12] add missing gc_collect() calls in sqlite3 tests (GH-127446) (#127501)
Miss Islington (bot) [Mon, 2 Dec 2024 13:57:51 +0000 (14:57 +0100)] 
[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 2a373da7700cf928e0a5ce3998d19351a3565df4)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
11 months ago[3.12] Docs: Miscellaneous corrections to simple statements in the language reference...
Carol Willing [Mon, 2 Dec 2024 13:55:31 +0000 (05:55 -0800)] 
[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 94a7a4e22fb8f567090514785c69e65298acca42)

Co-authored-by: Beomsoo Kim <beoms424@gmail.com>
11 months ago[3.12] gh-99880: document rounding mode for new-style formatting (GH-121481) (#126335)
Miss Islington (bot) [Mon, 2 Dec 2024 13:52:49 +0000 (14:52 +0100)] 
[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 7d7d56d8b1147a6b85e1c09d01b164df7c5c4942)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
11 months ago[3.12] Fix Unicode encode_wstr_utf8() (#127420) (#127504)
Bénédikt Tran [Mon, 2 Dec 2024 12:24:26 +0000 (13:24 +0100)] 
[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>
11 months ago[3.12] gh-127443: Fix some entries in `Doc/data/refcounts.dat` (GH-127451) (#127497)
Miss Islington (bot) [Mon, 2 Dec 2024 08:29:34 +0000 (09:29 +0100)] 
[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 1f8267b85dda655282922ba20df90d0ac6bea634)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
11 months ago[3.12] gh-127356: Fix prepend doctrees directory for gettext target (GH-127357) ...
Miss Islington (bot) [Sun, 1 Dec 2024 09:24:18 +0000 (10:24 +0100)] 
[3.12] gh-127356: Fix prepend doctrees directory for gettext target (GH-127357) (#127471)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
11 months ago[3.12] Docs: Fix incorrect indents in `c-api/type.rst` (GH-127449) (#127461)
Yuki Kobayashi [Sun, 1 Dec 2024 08:51:46 +0000 (17:51 +0900)] 
[3.12] Docs: Fix incorrect indents in `c-api/type.rst` (GH-127449) (#127461)

(cherry picked from commit 33ce8dcf791721fea563715f681dc1593a35b83b)

11 months ago[3.12] Add the missing `f` on an f-string error message in multiprocessing. (GH-12746...
Miss Islington (bot) [Sun, 1 Dec 2024 07:50:33 +0000 (08:50 +0100)] 
[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 11c01092d5fa8f02c867a7f1f3c135ce63db4838)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
11 months ago[3.12] Link to correct class methods in asyncio primitives docs (GH-127270) (#127438)
Bénédikt Tran [Sat, 30 Nov 2024 10:02:07 +0000 (11:02 +0100)] 
[3.12] Link to correct class methods in asyncio primitives docs (GH-127270) (#127438)

11 months ago[3.12] gh-88110: Clear concurrent.futures.thread._threads_queues after fork to avoid...
Miss Islington (bot) [Sat, 30 Nov 2024 09:05:46 +0000 (10:05 +0100)] 
[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 1848ce61f349533ae5892a8c24c2e0e3c364fc8a)

Co-authored-by: Andrei Bodrov <Drino@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
11 months ago[3.12] gh-127208: Reject null character in _imp.create_dynamic() (#127400) (#127419)
Victor Stinner [Fri, 29 Nov 2024 16:03:24 +0000 (17:03 +0100)] 
[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 b14fdadc6c620875a20b7ccc3c9b069e85d8557a)

11 months ago[3.12] gh-127359: Pin Tcl/Tk to 8 (8.6) for testing macOS (GH-127365) (#127394)
Hugo van Kemenade [Fri, 29 Nov 2024 11:02:41 +0000 (13:02 +0200)] 
[3.12] gh-127359: Pin Tcl/Tk to 8 (8.6) for testing macOS (GH-127365) (#127394)

11 months ago[3.12] gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (GH-127358)...
Miss Islington (bot) [Fri, 29 Nov 2024 10:59:22 +0000 (11:59 +0100)] 
[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 bfabf96b50b7d6a9c15b298a86ba3633b05a1fd7)

Co-authored-by: Victor Stinner <vstinner@python.org>
11 months ago[3.12] gh-127303: Add docs for token.EXACT_TOKEN_TYPES (GH-127304) (#127391)
Miss Islington (bot) [Fri, 29 Nov 2024 09:22:27 +0000 (10:22 +0100)] 
[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 dd3a87d2a8f8750978359a99de2c5cb2168351d1)

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>
11 months ago[3.12] gh-127190: Fix local_setattro() error handling (GH-127366) (#127368)
Miss Islington (bot) [Thu, 28 Nov 2024 17:32:50 +0000 (18:32 +0100)] 
[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 20657fbdb14d50ca4ec115da0cbef155871d8d33)

Co-authored-by: Victor Stinner <vstinner@python.org>
11 months ago[3.12] gh-123967: Fix faulthandler for trampoline frames (#127329) (#127363)
Victor Stinner [Thu, 28 Nov 2024 13:57:35 +0000 (14:57 +0100)] 
[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 58e334e1431b2ed6b70ee42501ea73e08084e769)

11 months ago[3.12] gh-124008: Fix calculation of the number of written bytes for the Windows...
Miss Islington (bot) [Wed, 27 Nov 2024 14:00:30 +0000 (15:00 +0100)] 
[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 3cf83d91a5baf3600dd60f7aaaf4fb6d73c4b8a9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
11 months ago[3.12] gh-109746: Fix race condition in test_start_new_thread_failed (GH-127299)...
Miss Islington (bot) [Wed, 27 Nov 2024 12:22:32 +0000 (13:22 +0100)] 
[3.12] gh-109746: Fix race condition in test_start_new_thread_failed (GH-127299) (GH-127324)

(cherry picked from commit 83926d3b4c7847394b5e2531e9566d7fc9fbea0f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
11 months ago[3.12] gh-101100: Fix sphinx warnings in `howto/*` (GH-127084) (#127311)
Yuki Kobayashi [Wed, 27 Nov 2024 09:46:42 +0000 (18:46 +0900)] 
[3.12] gh-101100: Fix sphinx warnings in `howto/*` (GH-127084) (#127311)

11 months ago[3.12] gh-127183: Add `_ctypes.CopyComPointer` tests (GH-127184) (GH-127252)
Miss Islington (bot) [Tue, 26 Nov 2024 10:13:29 +0000 (11:13 +0100)] 
[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 c7f1e3e150ca181f4b4bd1e5b59d492749f00be6)

Co-authored-by: Jun Komoda <45822440+junkmd@users.noreply.github.com>
11 months ago[3.12] gh-127265: Remove single quotes from 'arrow's in tutorial/errors.rst (GH-127268)
Miss Islington (bot) [Mon, 25 Nov 2024 21:42:34 +0000 (22:42 +0100)] 
[3.12] gh-127265: Remove single quotes from 'arrow's in tutorial/errors.rst (GH-127268)

(cherry picked from commit 26ff32b30553e1f7b0cc822835ad2da8890c180c)

Co-authored-by: funkyrailroad <funkyrailroad@users.noreply.github.com>
11 months ago[3.12] Fix a few typos found in the docs (GH-127126) (GH-127185)
Rafael Fontenelle [Mon, 25 Nov 2024 19:48:00 +0000 (16:48 -0300)] 
[3.12] Fix a few typos found in the docs (GH-127126) (GH-127185)

(cherry picked from commit 39e60aeb3837f1f23d8b7f30d3b8d9faf805ef88)

11 months ago[3.12] gh-127182: Fix `io.StringIO.__setstate__` crash when `None` is the first value...
Miss Islington (bot) [Mon, 25 Nov 2024 17:51:21 +0000 (18:51 +0100)] 
[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 a2ee89968299fc4f0da4b5a4165025b941213ba5)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Victor Stinner <vstinner@python.org>
11 months ago[3.12] gh-126384: Add tests to verify the behavior of basic COM methods. (GH-126610...
Miss Islington (bot) [Mon, 25 Nov 2024 12:18:35 +0000 (13:18 +0100)] 
[3.12] gh-126384: Add tests to verify the behavior of basic COM methods. (GH-126610) (GH-127160)

(cherry picked from commit 7725c0371a93be3ccfaff4871014a80bdf0ea274)

Co-authored-by: Jun Komoda <45822440+junkmd@users.noreply.github.com>
11 months ago[3.12] gh-101100: Fix sphinx warnings of removed opcodes (GH-127222) (#127240)
Yuki Kobayashi [Mon, 25 Nov 2024 08:51:48 +0000 (17:51 +0900)] 
[3.12] gh-101100: Fix sphinx warnings of removed opcodes (GH-127222) (#127240)

11 months ago[3.12] gh-127217: Fix pathname2url() for paths starting with multiple slashes on...
Miss Islington (bot) [Sun, 24 Nov 2024 18:13:23 +0000 (19:13 +0100)] 
[3.12] gh-127217: Fix pathname2url() for paths starting with multiple slashes on Posix (GH-127218) (GH-127231)

(cherry picked from commit 97b2ceaaaf88a73a45254912a0e972412879ccbf)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
11 months ago[3.12] Improve `pathname2url()` and `url2pathname()` docs (GH-127125) (#127233)
Miss Islington (bot) [Sun, 24 Nov 2024 17:48:12 +0000 (18:48 +0100)] 
[3.12] Improve `pathname2url()` and `url2pathname()` docs (GH-127125) (#127233)

Improve `pathname2url()` and `url2pathname()` docs (GH-127125)

These functions have long sown confusion among Python developers. The
existing documentation says they deal with URL path components, but that
doesn't fit the evidence on Windows:

    >>> pathname2url(r'C:\foo')
    '///C:/foo'
    >>> pathname2url(r'\\server\share')
    '////server/share'  # or '//server/share' as of quite recently

If these were URL path components, they would imply complete URLs like
`file://///C:/foo` and `file://////server/share`. Clearly this isn't right.
Yet the implementation in `nturl2path` is deliberate, and the
`url2pathname()` function correctly inverts it.

On non-Windows platforms, the behaviour until quite recently is to simply
quote/unquote the path without adding or removing any leading slashes. This
behaviour is compatible with *both* interpretations -- 1) the value is a
URL path component (existing docs), and 2) the value is everything
following `file:` (this commit)

The conclusion I draw is that these functions operate on everything after
the `file:` prefix, which may include an authority section. This is the
only explanation that fits both the  Windows and non-Windows behaviour.
It's also a better match for the function names.
(cherry picked from commit 307c63358681d669ae39e5ecd814bded4a93443a)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
11 months ago[3.12] Fix "useable" typo in docs (GH-127200) (#127206)
Miss Islington (bot) [Sat, 23 Nov 2024 21:45:47 +0000 (22:45 +0100)] 
[3.12] Fix "useable" typo in docs (GH-127200) (#127206)

Fix "useable" typo in docs (GH-127200)

Fix typo in docs
(cherry picked from commit dbd23790dbd662169905be6300259992639d4e69)

Co-authored-by: Stan U <89152624+StanFromIreland@users.noreply.github.com>
11 months ago[3.12] Doc: C API: Fix `Py_NewInterpreterFromConfig` example code (GH-126667) (#127202)
Miss Islington (bot) [Sat, 23 Nov 2024 19:55:55 +0000 (20:55 +0100)] 
[3.12] Doc: C API: Fix `Py_NewInterpreterFromConfig` example code (GH-126667) (#127202)

Doc: C API: Fix `Py_NewInterpreterFromConfig` example code (GH-126667)
(cherry picked from commit e3038e976b25a58f512d8c7083a752c89436eb0d)

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
11 months ago[3.12] gh-109746: Make _thread.start_new_thread delete state of new thread on its...
Serhiy Storchaka [Fri, 22 Nov 2024 19:56:39 +0000 (21:56 +0200)] 
[3.12] gh-109746: Make _thread.start_new_thread delete state of new thread on its startup failure (GH-109761) (GH-127173)

If Python fails to start newly created thread
due to failure of underlying PyThread_start_new_thread() call,
its state should be removed from interpreter' thread states list
to avoid its double cleanup.

(cherry picked from commit ca3ea9ad05c3d876a58463595e5b4228fda06936)

Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
11 months ago[3.12] gh-127001: Fix PATHEXT issues in shutil.which() on Windows (GH-127035) (GH...
Serhiy Storchaka [Fri, 22 Nov 2024 16:33:50 +0000 (18:33 +0200)] 
[3.12] gh-127001: Fix PATHEXT issues in shutil.which() on Windows (GH-127035) (GH-127158)

* Name without a PATHEXT extension is only searched if the mode does not
  include X_OK.
* Support multi-component PATHEXT extensions (e.g. ".foo.bar").
* Support files without extensions in PATHEXT contains dot-only extension
  (".", "..", etc).
* Support PATHEXT extensions that end with a dot (e.g. ".foo.").
(cherry picked from commit 8899e85de100557899da05f0b37867a371a73800)

11 months ago[3.12] GH-122679: Add `register()` to argparse docs (GH-126939) (GH-127148)
Miss Islington (bot) [Fri, 22 Nov 2024 14:13:43 +0000 (15:13 +0100)] 
[3.12] GH-122679: Add `register()` to argparse docs (GH-126939) (GH-127148)

(cherry picked from commit fcfdb55465636afc256bc29781b283404d88e6ca)

Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
11 months ago[3.12] gh-127082: Replace "Windows only" with the `availability: Windows` in `ctypes...
Jun Komoda [Fri, 22 Nov 2024 13:08:37 +0000 (22:08 +0900)] 
[3.12] gh-127082: Replace "Windows only" with the `availability: Windows` in `ctypes` doc (GH-127099) (#127145)

(cherry picked from commit 3c770e3f0978d825c5ebea98fcd654660e7e135f)

11 months ago[3.12] GH-127078: `url2pathname()`: handle extra slash before UNC drive in URL path...
Miss Islington (bot) [Fri, 22 Nov 2024 04:37:51 +0000 (05:37 +0100)] 
[3.12] GH-127078: `url2pathname()`: handle extra slash before UNC drive in URL path (GH-127132) (#127136)

GH-127078: `url2pathname()`: handle extra slash before UNC drive in URL path (GH-127132)

Decode a file URI like `file://///server/share` as a UNC path like
`\\server\share`. This form of file URI is created by software the simply
prepends `file:///` to any absolute Windows path.
(cherry picked from commit 8c98ed846a7d7e50c4cf06f823d94737144dcf6a)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
11 months ago[3.12] GH-126766: `url2pathname()`: handle 'localhost' authority (GH-127129) (#127131)
Miss Islington (bot) [Fri, 22 Nov 2024 03:42:46 +0000 (04:42 +0100)] 
[3.12] GH-126766: `url2pathname()`: handle 'localhost' authority (GH-127129) (#127131)

GH-126766: `url2pathname()`: handle 'localhost' authority (GH-127129)

Discard any 'localhost' authority from the beginning of a `file:` URI. As a
result, file URIs like `//localhost/etc/hosts` are correctly decoded as
`/etc/hosts`.
(cherry picked from commit ebf564a1d3e2e81b9846535114e481d6096443d2)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
11 months ago[3.12] gh-126727: Fix locale.nl_langinfo(locale.ERA) (GH-126730) (GH-127098)
Serhiy Storchaka [Thu, 21 Nov 2024 11:44:37 +0000 (13:44 +0200)] 
[3.12] gh-126727: Fix locale.nl_langinfo(locale.ERA) (GH-126730) (GH-127098)

It now returns multiple era description segments separated by semicolons.
Previously it only returned the first segment on platforms with Glibc.
(cherry picked from commit 4803cd0244847f286641c85591fda08b513cea52)

11 months ago[3.12] gh-126997: Fix support of non-ASCII strings in pickletools (GH-127062) (GH...
Miss Islington (bot) [Thu, 21 Nov 2024 11:32:16 +0000 (12:32 +0100)] 
[3.12] gh-126997: Fix support of non-ASCII strings in pickletools (GH-127062) (GH-127095)

* Fix support of STRING and GLOBAL opcodes with non-ASCII arguments.
* dis() now outputs non-ASCII bytes in STRING, BINSTRING and
  SHORT_BINSTRING arguments as escaped (\xXX).
(cherry picked from commit eaf217108226633c03cc5c4c90f0b6e4587c8803)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
11 months ago[3.12] Run `apt update` before `apt install git` in autoconf CI job (GH-127071)
Miss Islington (bot) [Wed, 20 Nov 2024 19:37:24 +0000 (20:37 +0100)] 
[3.12] Run `apt update` before `apt install git` in autoconf CI job (GH-127071)

(cherry picked from commit 0af4ec30bd2e3a52350344d1011c0c125d6dcd71)

Co-authored-by: Zachary Ware <zach@python.org>
11 months ago[3.12] gh-126991: Add tests for unpickling bad object state (GH-127031) (GH-127064)
Miss Islington (bot) [Wed, 20 Nov 2024 15:49:58 +0000 (16:49 +0100)] 
[3.12] gh-126991: Add tests for unpickling bad object state (GH-127031) (GH-127064)

This catches a memory leak in loading the BUILD opcode.
(cherry picked from commit addb225f3823b03774cddacce35214dd471bec46)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
11 months ago[3.12] GH-85168: Use filesystem encoding when converting to/from `file` URIs (GH...
Miss Islington (bot) [Tue, 19 Nov 2024 21:55:10 +0000 (22:55 +0100)] 
[3.12] GH-85168: Use filesystem encoding when converting to/from `file` URIs (GH-126852) (#127040)

GH-85168: Use filesystem encoding when converting to/from `file` URIs (GH-126852)

Adjust `urllib.request.url2pathname()` and `pathname2url()` to use the
filesystem encoding when quoting and unquoting file URIs, rather than
forcing use of UTF-8.

No changes are needed in the `nturl2path` module because Windows always
uses UTF-8, per PEP 529.
(cherry picked from commit c9b399fbdb01584dcfff0d7f6ad484644ff269c3)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
11 months ago[3.12] gh-126991: Fix reference leak in loading pickle's opcode BUILD (GH-126990...
Miss Islington (bot) [Tue, 19 Nov 2024 18:19:18 +0000 (19:19 +0100)] 
[3.12] gh-126991: Fix reference leak in loading pickle's opcode BUILD (GH-126990) (GH-127019)

If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable.
(cherry picked from commit 29cbcbd73bbfd8c953c0b213fb33682c289934ff)

Co-authored-by: Justin Applegate <70449145+Legoclones@users.noreply.github.com>
11 months ago[3.12] Update docs 'make serve' to suggest 'make htmllive' (GH-126969) (#127016)
Miss Islington (bot) [Tue, 19 Nov 2024 15:41:41 +0000 (16:41 +0100)] 
[3.12] Update docs 'make serve' to suggest 'make htmllive' (GH-126969) (#127016)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
11 months ago[3.12] gh-126789: Correct sysconfig test exclusions for iOS and Android. (GH-126941...
Russell Keith-Magee [Tue, 19 Nov 2024 10:01:54 +0000 (18:01 +0800)] 
[3.12] gh-126789: Correct sysconfig test exclusions for iOS and Android. (GH-126941) (GH-126959)

(cherry picked from commit 3938fd60c0c88891b213097380aeea91a45bcd77)

11 months ago[3.12] gh-126594: Fix typeobject.c wrap_buffer() cast (GH-126754) (#127005)
Miss Islington (bot) [Tue, 19 Nov 2024 08:33:18 +0000 (09:33 +0100)] 
[3.12] gh-126594: Fix typeobject.c wrap_buffer() cast (GH-126754) (#127005)

gh-126594: Fix typeobject.c wrap_buffer() cast (GH-126754)

Reject flags smaller than INT_MIN.

(cherry picked from commit 84f07c3a4cbcfe488ccfb4030571be0bc4de7e45)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
11 months ago[3.12] gh-126911: Update credits output (GH-126913) (#126974)
Miss Islington (bot) [Mon, 18 Nov 2024 15:58:22 +0000 (16:58 +0100)] 
[3.12] gh-126911: Update credits output (GH-126913) (#126974)

Co-authored-by: Stan U <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
11 months ago[3.12] gh-126909: Fix running xattr tests on systems with lower limits (GH-126930...
Miss Islington (bot) [Mon, 18 Nov 2024 13:22:58 +0000 (14:22 +0100)] 
[3.12] gh-126909: Fix running xattr tests on systems with lower limits (GH-126930) (#126964)

gh-126909: Fix running xattr tests on systems with lower limits (GH-126930)

Modify the extended attribute tests to write fewer and smaller extended
attributes, in order to fit within filesystems with total xattr limit
of 1 KiB (e.g. ext4 with 1 KiB blocks).  Previously, the test would
write over 2 KiB, making it fail with ENOSPC on such systems.
(cherry picked from commit 2c0a21c1aad65ab8362491acf856eb574b1257ad)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
11 months ago[3.12] gh-101955: Fix SystemError in possesive quantifier with alternative and group...
Miss Islington (bot) [Mon, 18 Nov 2024 12:03:19 +0000 (13:03 +0100)] 
[3.12] gh-101955: Fix SystemError in possesive quantifier with alternative and group (GH-111362) (GH-126963)

(cherry picked from commit f9c5573dedcb2f2e9ae152672ce157987cdea612)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
11 months ago[3.12] gh-67877: Fix memory leaks in terminated RE matching (GH-126840) (GH-126961)
Serhiy Storchaka [Mon, 18 Nov 2024 11:24:13 +0000 (13:24 +0200)] 
[3.12] gh-67877: Fix memory leaks in terminated RE matching (GH-126840) (GH-126961)

If SRE(match) function terminates abruptly, either because of a signal
or because memory allocation fails, allocated SRE_REPEAT blocks might
be never released.

(cherry picked from commit 7538e7f5696408fa0aa02fce8a413a7dfac76a04)

11 months ago[3.12] gh-124452: Fix header mismatches when folding/unfolding with email message...
Miss Islington (bot) [Sun, 17 Nov 2024 20:12:29 +0000 (21:12 +0100)] 
[3.12] gh-124452: Fix header mismatches when folding/unfolding with email message (GH-125919) (#126916)

gh-124452: Fix header mismatches when folding/unfolding with email message (GH-125919)

The header-folder of the new email API has a long standing known buglet where
if the first token is longer than max_line_length, it puts that token on the next
line.  It turns out there is also a *parsing* bug when parsing such a header:
the space prefixing that first, non-empty line gets preserved and tacked on to
the start of the header value, which is not the expected behavior per the RFCs.
The bug arises from the fact that the parser assumed that there would be at
least one token on the line with the header, which is going to be true for
probably every email producer other than the python email library with its
folding buglet.  Clearly, though, this is a case that needs to be handled
correctly.  The fix is simple: strip the blanks off the start of the whole
value, not just the first physical line of the value.

(cherry picked from commit ed81971e6b26c34445f06850192b34458b029337)

Co-authored-by: RanKKI <hliu86.me@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
11 months ago[3.12] GH-126789: fix some sysconfig data on late site initializations
Miss Islington (bot) [Sun, 17 Nov 2024 00:26:59 +0000 (01:26 +0100)] 
[3.12] GH-126789: fix some sysconfig data on late site initializations

Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
11 months ago[3.12] gh-126476: Raise IllegalMonthError for calendar.formatmonth() when the input...
Miss Islington (bot) [Fri, 15 Nov 2024 23:20:10 +0000 (00:20 +0100)] 
[3.12] gh-126476: Raise IllegalMonthError for calendar.formatmonth() when the input month is not correct (GH-126484) (GH-126878)

gh-126476: Raise IllegalMonthError for calendar.formatmonth() when the input month is not correct (GH-126484)
(cherry picked from commit 3be7498d2450519d5d8f63a35ef298db3b3d935b)

Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
11 months ago[3.12] Added a warning to the urljoin docs, indicating that it is not safe to use...
Miss Islington (bot) [Fri, 15 Nov 2024 23:17:37 +0000 (00:17 +0100)] 
[3.12] Added a warning to the urljoin docs, indicating that it is not safe to use with attacker controlled URLs (GH-126659) (#126889)

Added a warning to the urljoin docs, indicating that it is not safe to use with attacker controlled URLs (GH-126659)

This was flagged to me at a party today by someone who works in red-teaming as a frequently encountered footgun. Documenting the potentially unexpected behavior seemed like a good place to start.
(cherry picked from commit d6bcc154e93a0a20ab97187d3e8b726fffb14f8f)

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
11 months ago[3.12] gh-71936: Fix race condition in multiprocessing.Pool (GH-124973) (GH-126870)
Miss Islington (bot) [Fri, 15 Nov 2024 14:04:35 +0000 (15:04 +0100)] 
[3.12] gh-71936: Fix race condition in multiprocessing.Pool (GH-124973) (GH-126870)

Proxes of shared objects register a Finalizer in BaseProxy._incref(), and it
will call BaseProxy._decref() when it is GCed. This may cause a race condition
with Pool(maxtasksperchild=None) on Windows.

A connection would be closed and raised TypeError when a GC occurs between
_ConnectionBase._check_writable() and _ConnectionBase._send_bytes() in
_ConnectionBase.send() in the second or later task, and a new object
is allocated that shares the id() of a previously deleted one.

Instead of using the id() of the token (or the proxy), use a unique,
non-reusable number.

(cherry picked from commit ba088c8f9cf7163b0f28c507cb1343befe21997e)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Akinori Hattori <hattya@gmail.com>
11 months ago[3.12] gh-123832: Adjust `socket.getaddrinfo` docs for better POSIX compliance (GH...
Miss Islington (bot) [Fri, 15 Nov 2024 13:07:04 +0000 (14:07 +0100)] 
[3.12] gh-123832: Adjust `socket.getaddrinfo` docs for better POSIX compliance (GH-126182) (GH-126824)

gh-123832: Adjust `socket.getaddrinfo` docs for better POSIX compliance (GH-126182)

* gh-123832: Adjust `socket.getaddrinfo` docs for better POSIX compliance

This changes nothing changes for CPython supported platforms,
but hints how to deal with platforms that stick to the letter of
the spec.
It also marks `socket.getaddrinfo` as a wrapper around `getaddrinfo(3)`;
specifically, workarounds to make the function work consistently across
platforms are out of scope in its code.

Include wording similar to the POSIX's “by providing options and by
limiting the returned information”, which IMO suggests that the
hints limit the resulting list compared to the defaults, *but* can
be interpreted differently. Details are added in a note.

Specifically say that this wraps the underlying C function. So, the
details are in OS docs. The “full range of results” bit goes away.

Use `AF_UNSPEC` rather than zero for the *family* default, although
I don't think a system where it's nonzero would be very usable.

Suggest setting proto and/or type (with examples, as the appropriate
values aren't obvious). Say why you probably want to do that that
on all systems; mention the behavior on the “letter of the spec”
systems.

Suggest that the results should be tried in order, which is,
AFAIK best practice -- see RFC 6724 section 2, and its predecessor
from 2003 (which are specific to IP, but indicate how people use this):

> Well-behaved applications SHOULD iterate through the list of
> addresses returned from `getaddrinfo()` until they find a working address.

(cherry picked from commit ff0ef0a54bef26fc507fbf9b7a6009eb7d3f17f5)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
11 months ago[3.12] gh-126413: Add translation tests for getopt and optparse (GH-126698) (GH-126756)
Tomas R. [Fri, 15 Nov 2024 11:07:16 +0000 (12:07 +0100)] 
[3.12] gh-126413: Add translation tests for getopt and optparse (GH-126698) (GH-126756)

(cherry picked from commit dff074d1446bab23578a6b228b0c59a17006299c)

11 months ago[3.12] GH-126766: `url2pathname()`: handle empty authority section. (GH-126767) ...
Miss Islington (bot) [Thu, 14 Nov 2024 23:52:46 +0000 (00:52 +0100)] 
[3.12] GH-126766: `url2pathname()`: handle empty authority section. (GH-126767) (#126837)

GH-126766: `url2pathname()`: handle empty authority section. (GH-126767)

Discard two leading slashes from the beginning of a `file:` URI if they
introduce an empty authority section. As a result, file URIs like
`///etc/hosts` are correctly parsed as `/etc/hosts`.
(cherry picked from commit cae9d9d20f61cdbde0765efa340b6b596c31b67f)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
11 months ago[3.12] gh-126807: pygettext: Do not attempt to extract messages from function definit...
Miss Islington (bot) [Thu, 14 Nov 2024 22:35:35 +0000 (23:35 +0100)] 
[3.12] gh-126807: pygettext: Do not attempt to extract messages from function definitions. (GH-126808) (GH-126847)

Fixes a bug where pygettext would attempt
to extract a message from a code like this:

def _(x): pass

This is because pygettext only looks at one
token at a time and '_(x)' looks like a
function call.

However, since 'x' is not a string literal,
it would erroneously issue a warning.
(cherry picked from commit 9a456383bed52010b90bd491277ea855626a7bba)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
11 months ago[3.12] Document that return-less user-defined functions return None (GH-126769) ...
Miss Islington (bot) [Thu, 14 Nov 2024 09:46:26 +0000 (10:46 +0100)] 
[3.12] Document that return-less user-defined functions return None (GH-126769) (#126823)

Document that return-less user-defined functions return None (GH-126769)
(cherry picked from commit e0692f11650acb6c2eed940eb94650b4703c072e)

Co-authored-by: John Marshall <jmarshall@hey.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
11 months ago[3.12] gh-126731: Update outdated project information in `pprint.pp` doc (GH-126732...
Miss Islington (bot) [Thu, 14 Nov 2024 05:08:18 +0000 (06:08 +0100)] 
[3.12] gh-126731: Update outdated project information in `pprint.pp` doc (GH-126732) (#126819)

gh-126731: Update outdated project information in `pprint.pp` doc (GH-126732)
(cherry picked from commit 6a93a1adbb56a64ec6d20e8aab911439998502c9)

Co-authored-by: Wulian <xiguawulian@gmail.com>
11 months ago[3.12] gh-124448: Update bundled Tcl/Tk in macOS installer to 8.6.15. (GH-125800)
Miss Islington (bot) [Thu, 14 Nov 2024 05:06:14 +0000 (06:06 +0100)] 
[3.12] gh-124448: Update bundled Tcl/Tk in macOS installer to 8.6.15. (GH-125800)

(cherry picked from commit fc9e6bf53d1c9ce2b5f802864e0da265a77c111f)

Co-authored-by: Ned Deily <nad@python.org>
11 months ago[3.12] Docs: re-create pages for removed modules to document their removal, based...
Ned Batchelder [Thu, 14 Nov 2024 00:02:09 +0000 (19:02 -0500)] 
[3.12] Docs: re-create pages for removed modules to document their removal, based on GH-126622 (#126781)

[3.12] Docs: re-create pages for removed modules to document their removal, based on #126622

11 months ago[3.12] gh-126188: Update bundled pip to 24.3.1 (gh-126805) (gh-126813)
Stéphane Bidoul [Wed, 13 Nov 2024 23:42:54 +0000 (00:42 +0100)] 
[3.12] gh-126188: Update bundled pip to 24.3.1 (gh-126805) (gh-126813)

Update bundled pip to 24.3.1
(cherry picked from commit f6b0361c17552197f44be16435e4a5cb4b1d60ca)

11 months ago[3.12] GH-126606: don't write incomplete pyc files (GH-126627) (GH-126810)
Miss Islington (bot) [Wed, 13 Nov 2024 22:49:47 +0000 (23:49 +0100)] 
[3.12] GH-126606: don't write incomplete pyc files (GH-126627) (GH-126810)

GH-126606: don't write incomplete pyc files (GH-126627)
(cherry picked from commit c695e37a3f95c225ee08d1e882d23fa200b5ec34)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Brett Cannon <brett@python.org>
11 months ago[3.12] gh-126623: Update libexpat to 2.6.4, make future updates easier (GH-126792...
Miss Islington (bot) [Wed, 13 Nov 2024 18:50:29 +0000 (19:50 +0100)] 
[3.12] gh-126623: Update libexpat to 2.6.4, make future updates easier (GH-126792) (GH-126797)

gh-126623: Update libexpat to 2.6.4, make future updates easier (GH-126792)

Update libexpat to 2.6.4, make future updates easier.
(cherry picked from commit 3c9996909402fadc98e6ca2a64e75a71a7427352)

Co-authored-by: Seth Michael Larson <seth@python.org>
11 months ago[3.12] gh-126341: add release check to `__iter__` method of `memoryview` (GH-126759...
Miss Islington (bot) [Wed, 13 Nov 2024 18:44:01 +0000 (19:44 +0100)] 
[3.12] gh-126341: add release check to `__iter__` method of `memoryview` (GH-126759) (#126779)

gh-126341: add release check to `__iter__` method of `memoryview` (GH-126759)
(cherry picked from commit a12690ef49e8fc8a3af4c5f1757eb3caffb35e03)

Co-authored-by: Ritvik Pasham <ritvikpasham@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: sobolevn <mail@sobolevn.me>
11 months ago[3.12] bpo-46128: Strip IsolatedAsyncioTestCase frames from reported stacktraces...
Miss Islington (bot) [Wed, 13 Nov 2024 09:20:47 +0000 (10:20 +0100)] 
[3.12] bpo-46128: Strip IsolatedAsyncioTestCase frames from reported stacktraces (GH-30196) (#126771)

bpo-46128: Strip IsolatedAsyncioTestCase frames from reported stacktraces (GH-30196)

---------

(cherry picked from commit 2e39d77ddeb51505d65fd54ccfcd72615c6b1927)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
11 months ago[3.12] gh-104745: Limit starting a patcher more than once without stopping it (GH...
Miss Islington (bot) [Wed, 13 Nov 2024 08:37:34 +0000 (09:37 +0100)] 
[3.12] gh-104745: Limit starting a patcher more than once without stopping it (GH-126649) (#126773)

gh-104745: Limit starting a patcher more than once without stopping it (GH-126649)

Previously, this would cause an `AttributeError` if the patch stopped more than once after this, and would also disrupt the original patched object.

---------

(cherry picked from commit 1e40c5ba47780ddd91868abb3aa064f5ba3015e4)

Co-authored-by: Red4Ru <39802734+Red4Ru@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
11 months ago[3.12] GH-120423: `pathname2url()`: handle forward slashes in Windows paths (GH-12659...
Miss Islington (bot) [Tue, 12 Nov 2024 21:53:58 +0000 (22:53 +0100)] 
[3.12] GH-120423: `pathname2url()`: handle forward slashes in Windows paths (GH-126593) (#126763)

GH-120423: `pathname2url()`: handle forward slashes in Windows paths (GH-126593)

Adjust `urllib.request.pathname2url()` so that forward slashes in Windows
paths are handled identically to backward slashes.
(cherry picked from commit bf224bd7cef5d24eaff35945ebe7ffe14df7710f)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
11 months ago[3.12] gh-126595: fix a crash when calling `itertools.count(sys.maxsize)` (GH-126617...
Bénédikt Tran [Tue, 12 Nov 2024 14:05:23 +0000 (15:05 +0100)] 
[3.12] gh-126595: fix a crash when calling `itertools.count(sys.maxsize)` (GH-126617) (#126740)

gh-126595: fix a crash when calling `itertools.count(sys.maxsize)` (#126617)

11 months ago[3.12] gh-126405: fix use-after-free in `_asyncio.Future.remove_done_callback` (GH...
Miss Islington (bot) [Tue, 12 Nov 2024 13:04:25 +0000 (14:04 +0100)] 
[3.12] gh-126405: fix use-after-free in `_asyncio.Future.remove_done_callback` (GH-126733) (#126737)

gh-126405: fix use-after-free in `_asyncio.Future.remove_done_callback` (GH-126733)
(cherry picked from commit 37c57dfad12744608091653fd753a1f770e2479b)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
11 months ago[3.12] gh-126451: Revert backports of ABC registrations for contextvars.Context and...
Alex Waygood [Tue, 12 Nov 2024 12:26:23 +0000 (12:26 +0000)] 
[3.12] gh-126451: Revert backports of ABC registrations for contextvars.Context and multiprocessing proxies (#126735)

11 months ago[3.12] gh-126525: Fix `makeunicodedata.py` output on macOS and Windows (GH-126526...
Miss Islington (bot) [Tue, 12 Nov 2024 10:41:28 +0000 (11:41 +0100)] 
[3.12] gh-126525: Fix `makeunicodedata.py` output on macOS and Windows (GH-126526) (#126726)

gh-126525: Fix `makeunicodedata.py` output on macOS and Windows (GH-126526)
(cherry picked from commit f223efb2a2d6a3e86556be7295cbbd3ef839f489)

Co-authored-by: sobolevn <mail@sobolevn.me>
11 months ago[3.12] Fix error message of "Check if Autoconf files are up to date" job (GH-126683...
Miss Islington (bot) [Tue, 12 Nov 2024 08:10:55 +0000 (09:10 +0100)] 
[3.12] Fix error message of "Check if Autoconf files are up to date" job (GH-126683) (#126718)

Fix error message of "Check if Autoconf files are up to date" job (GH-126683)
(cherry picked from commit 0052a8c638518447baf39ae02b6ff6a309efd4ce)

Co-authored-by: sobolevn <mail@sobolevn.me>
11 months agoUpdate documentation links to Microsoft's documentation pages (GH-126379)
Miss Islington (bot) [Mon, 11 Nov 2024 17:20:33 +0000 (18:20 +0100)] 
Update documentation links to Microsoft's documentation pages (GH-126379)

(cherry picked from commit 6e25eb15410f781f632d536d555f38879432522c)

Co-authored-by: 谭九鼎 <109224573@qq.com>
11 months ago[3.12] gh-126505: Fix bugs in compiling case-insensitive character classes (GH-126557...
Miss Islington (bot) [Mon, 11 Nov 2024 16:47:37 +0000 (17:47 +0100)] 
[3.12] gh-126505: Fix bugs in compiling case-insensitive character classes (GH-126557) (GH-126690)

* upper-case non-BMP character was ignored
* the ASCII flag was ignored when matching a character range whose
  upper bound is beyond the BMP region
(cherry picked from commit 819830f34a11ecaa3aada174ca8eedeb3f260630)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
11 months ago[3.12] gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHan...
Miss Islington (bot) [Mon, 11 Nov 2024 14:26:10 +0000 (15:26 +0100)] 
[3.12] gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (GH-126503) (GH-126572)

gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (GH-126503)

If `read()` in the ConnectionHandler thread raises `OSError` (except `ConnectionError`),
the ConnectionHandler shuts down the entire ThreadedEchoServer,
preventing further connections.
It also does that for `EPROTOTYPE` in `wrap_conn`.

As far as I can see, this is done to avoid the server thread getting stuck,
forgotten, in its accept loop. However, since 2011 (5b95eb90a7167285b6544b50865227c584943c9a)
the server is used as a context manager, and its `__exit__` does `stop()` and `join()`.
(I'm not sure if we *always* used `with` since that commit, but currently we do.)

Make sure that the context manager *is* used, and remove the `server.stop()`
calls from ConnectionHandler.
(cherry picked from commit c9cda1608edf7664c10f4f467e24591062c2fe62)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
11 months ago[3.12] gh-126499: test_ssl: Don't assume err.reason is a string (GH-126501) (GH-126573)
Miss Islington (bot) [Mon, 11 Nov 2024 12:56:08 +0000 (13:56 +0100)] 
[3.12] gh-126499: test_ssl: Don't assume err.reason is a string (GH-126501) (GH-126573)

gh-126499: test_ssl: Don't assume err.reason is a string (GH-126501)

The skipping machinery called `getattr(err, "reason", "")` on an arbitrary
exception. As intermittent Buildbot failures show, sometimes it's set
to None.

Convert it to string for this specific check.
(cherry picked from commit 78ad7e632248dc989378cabeb797b9f3d940d9f2)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
11 months ago[3.12] Add missing fullstop `.` to whatsnew/3.8.rst (GH-126553) (#126673)
Miss Islington (bot) [Mon, 11 Nov 2024 07:08:37 +0000 (08:08 +0100)] 
[3.12] Add missing fullstop `.` to whatsnew/3.8.rst (GH-126553) (#126673)

Add missing fullstop `.` to whatsnew/3.8.rst (GH-126553)
(cherry picked from commit 82269c7d580e1aad71ff11fe891cf7f97eb45703)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
11 months ago[3.12] gh-126664: Use `else` instead of `finally` in "The with statement" documentati...
Miss Islington (bot) [Mon, 11 Nov 2024 06:57:15 +0000 (07:57 +0100)] 
[3.12] gh-126664: Use `else` instead of `finally` in "The with statement" documentation. (GH-126665) (#126671)

gh-126664: Use `else` instead of `finally` in "The with statement" documentation. (GH-126665)
(cherry picked from commit 25257d61cfccc3b4189f96390a5c4db73fd5302c)

Co-authored-by: vivodi <103735539+vivodi@users.noreply.github.com>
11 months ago[3.12] gh-117378: Clear up the NEWS entry wording (GH-126634) (#126669)
Miss Islington (bot) [Mon, 11 Nov 2024 06:48:23 +0000 (07:48 +0100)] 
[3.12] gh-117378: Clear up the NEWS entry wording (GH-126634) (#126669)

gh-117378: Clear up the NEWS entry wording (GH-126634)

gh-117378: Clear up the NEWS entry wording.

Docs are hard.  Lets go shopping!
(cherry picked from commit 5c488caeb858690a696bc9f74fc74a274a3aa51c)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
11 months ago[3.12] gh-126543: Docs: change "bound type var" to "bounded" when used in the context...
Miss Islington (bot) [Mon, 11 Nov 2024 02:52:20 +0000 (03:52 +0100)] 
[3.12] gh-126543: Docs: change "bound type var" to "bounded" when used in the context of the 'bound' kw argument to TypeVar (GH-126584) (#126658)

(cherry picked from commit 434b29767f2fdef9f35c8e93303cf6aca4a66a80)

Co-authored-by: Pedro Fonini <fonini@protonmail.ch>
11 months ago[3.12] gh-117378: Only run the new multiprocessing SysPath test when appropriate...
Miss Islington (bot) [Sun, 10 Nov 2024 21:33:26 +0000 (22:33 +0100)] 
[3.12] gh-117378: Only run the new multiprocessing SysPath test when appropriate (GH-126635) (GH-126653)

gh-117378: Only run the new multiprocessing SysPath test when appropriate (GH-126635)

The first version had it running two forkserver and one spawn tests underneath each of the _fork, _forkserver, and _spawn test suites that build off the generic one.

This adds to the existing complexity of the multiprocessing test suite by offering BaseTestCase classes another attribute to control which suites they are invoked under. Practicality vs purity here. :/

Net result: we don't over-run the new test and their internal logic is simplified.
(cherry picked from commit ca878b6e45f9c7934842f7bb94274e671b155e09)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
11 months ago[3.12] Skip test in test_socket.py if `sys.getrefcount` isn't available (GH-126640...
Miss Islington (bot) [Sun, 10 Nov 2024 15:34:52 +0000 (16:34 +0100)] 
[3.12] Skip test in test_socket.py if `sys.getrefcount` isn't available (GH-126640) (#126646)

Skip test in test_socket.py if `sys.getrefcount` isn't available (GH-126640)

Skip `testMakefileCloseSocketDestroy` test if `sys.getrefcount` isn't available. This is necessary for  PyPy and other Python implementations that do not have `sys.getrefcount`.
(cherry picked from commit 0f6bb28ff3ba152faf7523ea9aaf0094cc39bdda)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
11 months ago[3.12] gh-126565: Skip `zipfile.Path.exists` check in write mode (GH-126576) (#126643)
Miss Islington (bot) [Sun, 10 Nov 2024 15:14:48 +0000 (16:14 +0100)] 
[3.12] gh-126565: Skip `zipfile.Path.exists` check in write mode (GH-126576) (#126643)

gh-126565: Skip `zipfile.Path.exists` check in write mode (GH-126576)

When `zipfile.Path.open` is called, the implementation will check
whether the path already exists in the ZIP file. However, this check is
only required when the ZIP file is in read mode. By swapping arguments
of the `and` operator, the short-circuiting will prevent the check from
being run in write mode.

This change will improve the performance of `open()`, because checking
whether a file exists is slow in write mode, especially when the archive
has many members.
(cherry picked from commit 160758a574d12bf0d965d8206136e7da4f4fd6c3)

Co-authored-by: Jan Hicken <janhicken@users.noreply.github.com>
11 months ago[3.12] Postpone `module.__loader__` deprecation to Python 3.16 (GH-126482) (#126637)
Miss Islington (bot) [Sun, 10 Nov 2024 00:57:54 +0000 (01:57 +0100)] 
[3.12] Postpone `module.__loader__` deprecation to Python 3.16 (GH-126482) (#126637)

Postpone `module.__loader__` deprecation to Python 3.16 (GH-126482)
(cherry picked from commit 450db61a78989c5a1f1106be01e071798c783cf9)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
11 months ago[3.12] gh-117378: Fix multiprocessing forkserver preload sys.path inheritance. (GH...
Gregory P. Smith [Sun, 10 Nov 2024 00:13:26 +0000 (16:13 -0800)] 
[3.12] gh-117378: Fix multiprocessing forkserver preload sys.path inheritance. (GH-126538) (GH-126633)

gh-117378: Fix multiprocessing forkserver preload sys.path inheritance.

`sys.path` was not properly being sent from the parent process when launching
the multiprocessing forkserver process to preload imports.  This bug has been
there since the forkserver start method was introduced in Python 3.4.  It was
always _supposed_ to inherit `sys.path` the same way the spawn method does.

Observable behavior change: A `''` value in `sys.path` will now be replaced in
the forkserver's `sys.path` with an absolute pathname
`os.path.abspath(os.getcwd())` saved at the time that `multiprocessing` was
imported in the parent process as it already was when using the spawn start
method. **This will only be observable during forkserver preload imports**.

The code invoked before calling things in another process already correctly sets `sys.path`.
Which is likely why this went unnoticed for so long as a mere performance issue in
some configurations.

A workaround for the bug on impacted Pythons is to set PYTHONPATH in the
environment before multiprocessing's forkserver process was started. Not perfect
as that is then inherited by other children, etc, but likely good enough for many
people's purposes.

(cherry picked from commit 9d08423b6e0fa89ce9cfea08e580ed72e5db8c70)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
12 months ago[3.12] GH-126212: Fix removal of slashes in file URIs on Windows (GH-126214) (#126591)
Miss Islington (bot) [Fri, 8 Nov 2024 17:21:42 +0000 (18:21 +0100)] 
[3.12] GH-126212: Fix removal of slashes in file URIs on Windows (GH-126214) (#126591)

GH-126212: Fix removal of slashes in file URIs on Windows (GH-126214)

Adjust `urllib.request.pathname2url()` and `url2pathname()` so that they
don't remove slashes from Windows DOS drive paths and URLs. There was no
basis for this behaviour, and it conflicts with how UNC and POSIX paths are
handled.
(cherry picked from commit 54c63a32d06cb5f07a66245c375eac7d7efb964a)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
12 months agogh-125298: Remove misleading text in os.kill documentation (GH-125749)
Miss Islington (bot) [Fri, 8 Nov 2024 15:47:46 +0000 (16:47 +0100)] 
gh-125298: Remove misleading text in os.kill documentation (GH-125749)

Windows has not accepted process handles in many releases.
(cherry picked from commit 75ffac296ef24758b7e5bd9316f32a8170ade37f)

Co-authored-by: RUANG (James Roy) <longjinyii@outlook.com>
12 months ago[3.12] gh-126171: fix possible null dereference in _imp_find_frozen_impl (GH-126566...
Miss Islington (bot) [Fri, 8 Nov 2024 10:56:08 +0000 (11:56 +0100)] 
[3.12] gh-126171: fix possible null dereference in _imp_find_frozen_impl (GH-126566) (#126568)

gh-126171: fix possible null dereference in _imp_find_frozen_impl (GH-126566)
(cherry picked from commit 9ecd8f7f40e6724a1c1d46c2665147aaabceb2d2)

Co-authored-by: Valery Fedorenko <federicovalenso@gmail.com>