Commit graph

29793 commits

Author SHA1 Message Date
Ethan Furman
875e49fb63
[3.13] gh-112328: Make EnumDict usable on its own and document it (GH-123669) (GH-128142)
Co-authored-by: Petr Viktorin <pviktori@redhat.com>
2024-12-24 10:50:23 -08:00
Miss Islington (bot)
e1a0c40658
[3.13] gh-127847: Fix position in the special-cased zipfile seek (GH-127856) (#128225)
gh-127847: Fix position in the special-cased zipfile seek (GH-127856)

---------
(cherry picked from commit 7ed6c5c696)

Co-authored-by: Dima Ryazanov <dima@bucket.xxx>
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: Jason R. Coombs <jaraco@jaraco.com>
2024-12-24 16:20:58 +00:00
Miss Islington (bot)
6f3c2c8d04
[3.13] gh-126180: Remove getopt and optparse deprecation notices (GH-128191)
* Remove getopt and optparse deprecation notices
* Add new docs sections for command line app helper libraries
* Add guidance on choosing a CLI parsing library to the optparse docs
* Link to the new guidance from the argparse and getopt docs
* Reword intro in docs section for superseded stdlib modules
* Reframe the optparse->argparse guide as a migration guide
  rather than as an upgrade guide

---------
(cherry picked from commit 831b6de6d7)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-12-23 04:40:59 +00:00
Miss Islington (bot)
09d15aa9a8
[3.13] gh-128049: Fix type confusion bug with the return value of a custom ExceptionGroup split function (GH-128079) (#128139)
gh-128049: Fix type confusion bug with the return value of a custom ExceptionGroup split function (GH-128079)
(cherry picked from commit 3879ca0100)

Co-authored-by: Nico-Posada <102486290+Nico-Posada@users.noreply.github.com>
2024-12-20 20:18:44 +00:00
Miss Islington (bot)
f320f747da
[3.13] gh-128030: Avoid error from PyModule_GetFilenameObject for non-module (GH-128047) (#128114)
gh-128030: Avoid error from PyModule_GetFilenameObject for non-module (GH-128047)

I missed the extra `PyModule_Check` in GH-127660 because I was looking at
3.12 as the base implementation for import from. This meant that I
missed the `PyModuleCheck` introduced in GH-112661.
(cherry picked from commit 45e6dd63b8)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-12-20 08:46:54 +00:00
Miss Islington (bot)
a0f1f120f2
[3.13] gh-128062: Fix the font size and shortcut display of the turtledemo menu (GH-128063) (#128101)
gh-128062: Fix the font size and shortcut display of the turtledemo menu (GH-128063)

Leave the font of the menu bar the default to keep it consistent with the rest of the world. Display the shortcut keys in the right way, using the 'accelerator' option.
---------

(cherry picked from commit e163e8d4e1)

Co-authored-by: Zhikang Yan <2951256653@qq.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-12-19 20:47:24 +00:00
Miss Islington (bot)
d699ce3961
[3.13] gh-126742: add NEWS entry for fix of localized error messages (GH-128025) (GH-128059)
(cherry picked from commit 2610bccfdf)
2024-12-19 14:52:32 +01:00
Miss Islington (bot)
f8b4e20137
[3.13] gh-127060: Disable traceback colors in IDLE (GH-128028) (#128052)
Set TERM environment variable to "dumb" to disable traceback colors
in IDLE, since IDLE doesn't understand ANSI escape sequences.

(cherry picked from commit 559b0e7013)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-18 05:58:57 +00:00
Miss Islington (bot)
90ae4b6f5a
[3.13] gh-127353: Allow to force color output on Windows V2 (GH-127926) (#127944)
gh-127353: Allow to force color output on Windows V2 (GH-127926)
(cherry picked from commit 0ac40acec0)

Co-authored-by: Andrey Efremov <duxus@yandex.ru>
2024-12-15 10:41:11 +02:00
Miss Islington (bot)
78095c9052
[3.13] gh-127906: Test the limited C API in test_cppext (GH-127916) (#127919)
gh-127906: Test the limited C API in test_cppext (GH-127916)
(cherry picked from commit d05a4e6a0d)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-13 14:12:07 +00:00
Miss Islington (bot)
0f38b897f9
[3.13] gh-127870: Detect recursive calls in ctypes _as_parameter_ handling (GH-127872) (#127917)
gh-127870: Detect recursive calls in ctypes _as_parameter_ handling (GH-127872)
(cherry picked from commit 6ff38fc4e2)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-13 13:19:41 +00:00
Miss Islington (bot)
f21b38c1a2
[3.13] gh-127865: Fix build failure for systems without thread local support (GH-127866) (GH-127882)
This PR fixes the build issue introduced by the commit 628f6eb from
GH-112207 on systems without thread local support.
(cherry picked from commit f823910bbd)

Co-authored-by: velemas <10437413+velemas@users.noreply.github.com>
2024-12-12 18:32:10 +00:00
Miss Islington (bot)
2a78663870
[3.13] gh-127257: ssl: Raise OSError for ERR_LIB_SYS (GH-127361) (GH-127812)
gh-127257: ssl: Raise OSError for ERR_LIB_SYS (GH-127361)

From the ERR_raise manpage:

    ERR_LIB_SYS

        This "library code" indicates that a system error is
        being reported.  In this case, the reason code given
        to `ERR_raise()` and `ERR_raise_data()` *must* be
        `errno(3)`.

This PR only handles ERR_LIB_SYS for the high-lever error types
SSL_ERROR_SYSCALL and SSL_ERROR_SSL, i.e., not the ones where
OpenSSL indicates it has some more information about the issue.
(cherry picked from commit f4b31edf2d)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-12-12 12:44:53 +01:00
Miss Islington (bot)
a94e20e4f1
[3.13] gh-123401: Fix http.cookies module to support obsolete RFC 850 date format (GH-123405) (#127828)
gh-123401: Fix http.cookies module to support obsolete RFC 850 date format (GH-123405)
(cherry picked from commit 359389ed51)

Co-authored-by: Nano <nanoapezlk@gmail.com>
Co-authored-by: Wulian <1055917385@qq.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-11 15:38:09 +00:00
Peter Bierma
bcdd10d0c8
[3.13] gh-127791: Fix, document, and test PyUnstable_AtExit (GH-127793) (#127819)
* Fix merge conflicts.

* [3.13] gh-127791: Fix, document, and test `PyUnstable_AtExit` (GH-127793)
(cherry picked from commit d5d84c3f13)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-12-11 13:40:45 +00:00
Pablo Galindo Salgado
eb692d945e
[3.13] gh-126076: Account for relocated objects in tracemalloc (GH-126077) (#127823)
(cherry picked from commit 30aeb00d36)
2024-12-11 14:15:37 +01:00
Bénédikt Tran
8bf5b89212
[3.13] gh-127637: add tests for dis command-line interface (#127759) (#127781) 2024-12-10 12:32:32 +00:00
Miss Islington (bot)
9d0252ff2e
[3.13] gh-126775: make linecache.checkcache threadsafe and GC re-entrency safe (GH-126776) (#127778)
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:06:26 +00:00
Shantanu
6441d42f92
[3.13] gh-127651: Use __file__ in diagnostics if origin is missing (#127660) (#127775)
gh-127651: Use __file__ in diagnostics if origin is missing (#127660)

See the left hand side in https://github.com/python/cpython/pull/123929/files#diff-c22186367cbe20233e843261998dc027ae5f1f8c0d2e778abfa454ae74cc59deL2840-L2849

---------

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit 3983527c3a)
2024-12-10 05:21:55 +00:00
Miss Islington (bot)
310efdabf5
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:50:34 +00:00
Russell Keith-Magee
075c41d5f5
[3.13] gh-126925: Modify how iOS test results are gathered (GH-127592) (#127754)
Adds a `use_system_log` config item to enable stdout/stderr redirection for
Apple platforms. This log streaming is then used by a new iOS test runner
script, allowing the display of test suite output at runtime. The iOS test
runner script can be used by any Python project, not just the CPython test
suite.
(cherry picked from commit 2041a95e68)
2024-12-09 14:39:11 +08:00
Miss Islington (bot)
71e8429ac8
[3.13] gh-127655: Ensure _SelectorSocketTransport.writelines pauses the protocol if needed (GH-127656) (#127663)
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:23 +05:30
Sam Gross
69bb1c6c41
[3.13] gh-127582: Make object resurrection thread-safe for free threading. (GH-127612) (GH-127659)
Objects may be temporarily "resurrected" in destructors when calling
finalizers or watcher callbacks. We previously undid the resurrection
by decrementing the reference count using `Py_SET_REFCNT`. This was not
thread-safe because other threads might be accessing the object
(modifying its reference count) if it was exposed by the finalizer,
watcher callback, or temporarily accessed by a racy dictionary or list
access.

This adds internal-only thread-safe functions for temporary object
resurrection during destructors.
(cherry picked from commit f4f530804b)
2024-12-05 18:49:33 -05:00
Miss Islington (bot)
468e8dad7e
[3.13] gh-122431: Disallow negative values in readline.append_history_file (GH-122469) (#127641)
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:44 +01:00
Miss Islington (bot)
3e11b5c2ba
[3.13] gh-93312: Include <sys/pidfd.h> to get PIDFD_NONBLOCK (GH-127593) (#127630)
gh-93312: Include <sys/pidfd.h> to get PIDFD_NONBLOCK (GH-127593)
(cherry picked from commit fcbe6ecdb6)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-05 10:02:17 +00:00
Russell Keith-Magee
1182c64181
[3.13] gh-127434: Fix iOS xcrun --sdk clang/ar scripts to allow arguments with spaces (GH-127575) (#127624)
Added shell escaping to ensure iOS compiler shims can accept arguments with spaces.
(cherry picked from commit 6cf77949fb)

Co-authored-by: Feodor Fitsner <feodor@appveyor.com>
2024-12-05 03:28:21 +00:00
Sam Gross
4060ef36e1
[3.13] gh-127536: Add missing locks in listobject.c (GH-127580) (GH-127613)
We were missing locks around some list operations in the free threading
build.
(cherry picked from commit e51da64ac3)
2024-12-04 15:17:19 -05:00
Thomas Wouters
0671451779 Python 3.13.1 2024-12-03 18:59:52 +01:00
Miss Islington (bot)
dddea7c232
[3.13] gh-122907: Fix Builds Without HAVE_DYNAMIC_LOADING Set (gh-122952) (#122984)
gh-122907: Fix Builds Without HAVE_DYNAMIC_LOADING Set (gh-122952)

As of 529a160 (gh-118204), building with HAVE_DYNAMIC_LOADING stopped working.  This is a minimal fix just to get builds working again.  There are actually a number of long-standing deficiencies with HAVE_DYNAMIC_LOADING builds that need to be resolved separately.
(cherry picked from commit ee1b8ce26e)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-12-03 16:46:30 +00:00
Miss Islington (bot)
ae3f347dc0
[3.13] gh-123935: Fix typo in _get_slots in dataclasses.py (GH-123941) (#123991)
gh-123935: Fix typo in `_get_slots` in `dataclasses.py` (GH-123941)
(cherry picked from commit ac918ccad7)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-12-03 17:17:25 +01:00
Miss Islington (bot)
a63e06d95b
[3.13] gh-122792: Make IPv4-mapped IPv6 address properties consistent with IPv4 (GH-122793) (GH-123815)
Make IPv4-mapped IPv6 address properties consistent with IPv4.
(cherry picked from commit 76a1c5d183)

Co-authored-by: Seth Michael Larson <seth@python.org>
2024-12-03 17:12:36 +01:00
Miss Islington (bot)
a853610282
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:11:16 +00:00
Miss Islington (bot)
f41d8d89e7
[3.13] gh-113841: fix possible undefined division by 0 in _Py_c_pow() (GH-127211) (#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)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-12-02 15:42:02 +01:00
Miss Islington (bot)
a5672bec68
[3.13] gh-126699: allow AsyncIterator to be used as a base for Protocols (GH-126702) (#126762)
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 15:10:25 +01:00
Miss Islington (bot)
fd48d98df9
[3.13] gh-125666: Avoid PyREPL exiting when a null byte is in input (GH-125732) (#126023)
gh-125666: Avoid PyREPL exiting when a null byte is in input (GH-125732)
(cherry picked from commit 44becb8cba)

Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
2024-12-02 15:04:51 +01:00
Peter Bierma
b1051577de
[3.13] gh-124984: Enhance ssl thread safety (GH-124993) (#125780)
Make SSL objects thread safe in Free Theaded build by
using critical sections.

(cherry picked from commit 4c53b25775)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-02 15:03:44 +01:00
Miss Islington (bot)
d9ac6b3ef7
[3.13] gh-125703: Correctly honour tracemalloc hooks on specialized DECREF paths (GH-125704) (#125705)
gh-125703: Correctly honour tracemalloc hooks on specialized DECREF paths (GH-125704)
(cherry picked from commit f8ba9fb2ce)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-12-02 15:02:20 +01:00
Miss Islington (bot)
4bafce0912
[3.13] gh-126618: fix repr(itertools.count(sys.maxsize)) (GH-127048) (#127508)
gh-126618: fix repr(itertools.count(sys.maxsize)) (GH-127048)
(cherry picked from commit 930ba0ce60)

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 13:38:13 +00:00
Tian Gao
dd2ad70b29
[3.13] gh-127321: Avoid stopping at an opcode without an associated line number for breakpoint() (GH-127457) (#127487)
(cherry picked from commit 1bc4f076d1)
2024-12-01 17:58:08 -05:00
Miss Islington (bot)
d2d1055129
[3.13] gh-124008: Fix calculation of the number of written bytes for the Windows console (GH-124059) (GH-127325)
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-30 09:16:45 +00:00
Miss Islington (bot)
089d70614e
[3.13] gh-123967: Fix faulthandler for trampoline frames (GH-127329) (#127362)
gh-123967: Fix faulthandler for trampoline frames (GH-127329)

If the top-most frame is a trampoline frame, skip it.
(cherry picked from commit 58e334e143)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-30 09:14:29 +00:00
Miss Islington (bot)
c711deb803
[3.13] gh-127217: Fix pathname2url() for paths starting with multiple slashes on Posix (GH-127218) (GH-127230)
(cherry picked from commit 97b2ceaaaf)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-30 09:11:24 +00:00
Miss Islington (bot)
4cba0e66c2
[3.13] gh-127303: Add docs for token.EXACT_TOKEN_TYPES (GH-127304) (#127390)
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-30 08:13:13 +00:00
Miss Islington (bot)
47b0f8f297
[3.13] gh-126881: fix finalization of dtoa state (GH-126904) (#127395)
gh-126881: fix finalization of dtoa state (GH-126904)
(cherry picked from commit 762c603a86)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-11-29 10:52:21 +00:00
Victor Stinner
a5741d63bc
[3.13] gh-122273: Support PyREPL history on Windows (#127141) (#127289)
gh-122273: Support PyREPL history on Windows (#127141)

Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
(cherry picked from commit 3c7a90a831)
2024-11-26 11:17:13 +00:00
Victor Stinner
9187ac3f2d
[3.13] gh-126316: Make grp.getgrall() thread-safe: add a mutex (#127055) (#127104)
* gh-126316: Make grp.getgrall() thread-safe: add a mutex (#127055)

grpmodule.c is no longer built with the limited C API, since PyMutex
is excluded from the limited C API.

(cherry picked from commit 3c2bd66e21)

* Revert ABI changes

Don't use Argument Clinic for grp.getgrgid() to avoid changing the
ABI (change PyInterpreterState structure by adding an "id"
identifier).
2024-11-26 12:01:50 +01:00
Miss Islington (bot)
a1b9663c41
[3.13] gh-127182: Fix io.StringIO.__setstate__ crash when None is the first value (GH-127219) (#127262)
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:56:42 +00:00
Miss Islington (bot)
9291095a74
[3.13] Fix a few typos found in the docs (GH-127126) (GH-127181)
Fix a few typos found in the docs (GH-127126)
(cherry picked from commit 39e60aeb38)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2024-11-23 00:09:35 +00:00
Serhiy Storchaka
75ef92da29
[3.13] gh-109746: Make _thread.start_new_thread delete state of new thread on its startup failure (GH-109761) (GH-127171)
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 ca3ea9ad05)

Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
2024-11-22 19:55:44 +00:00
Miss Islington (bot)
329865b883
[3.13] gh-88110: Clear concurrent.futures.thread._threads_queues after fork to avoid joining parent process' threads (GH-126098) (GH-127163)
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-22 17:08:18 +00:00