Commit Graph

29522 Commits

Author SHA1 Message Date
Miss Islington (bot) 032b6467fa
[3.13] gh-122081: fixed crash in decimal.IEEEContext() (GH-122082) (#123136)
gh-122081: fixed crash in decimal.IEEEContext() (GH-122082)

* gh-122081: fixed crash in decimal.IEEEContext()

Now

$ ./configure CFLAGS=-DEXTRA_FUNCTIONALITY -q && make -s && \
     ./python -m test test_decimal

- PASS

* Apply suggestions from code review



* Update Misc/NEWS.d/next/Library/2024-07-21-10-45-24.gh-issue-122081.dNrYMq.rst

* Apply suggestions from code review

---------

(cherry picked from commit b9e10d1a0f)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-08-19 14:14:11 +05:30
Miss Islington (bot) ff58c3cb48
[3.13] gh-123022: Fix crash with `Py_Initialize` in background thread (GH-123052) (#123114)
Check that the current default heap is initialized in
`_mi_os_get_aligned_hint` and `mi_os_claim_huge_pages`.

The mimalloc function `_mi_os_get_aligned_hint` assumes that there is an
initialized default heap. This is true for our main thread, but not for
background threads. The problematic code path is usually called during
initialization (i.e., `Py_Initialize`), but it may also be called if the
program allocates large amounts of memory in total.

The crash only affected the free-threaded build.
(cherry picked from commit d061ffea7b)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-08-17 20:38:02 +00:00
Miss Islington (bot) 0dd89a7f40
[3.13] gh-116622: Android logging fixes (GH-122698) (#122719)
gh-116622: Android logging fixes (GH-122698)

Modifies the handling of stdout/stderr redirection on Android to accomodate
the rate and buffer size limits imposed by Android's logging infrastructure.
(cherry picked from commit b0c48b8fd8)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
2024-08-16 16:07:42 +08:00
Miss Islington (bot) 69cf92fbca
[3.13] gh-116622: Don't expose `FICLONE` ioctl on Android (GH-122522) (#122539)
gh-116622: Don't expose `FICLONE` ioctl on Android (GH-122522)

Don't expose `FICLONE` ioctl on Android

(cherry picked from commit 06656e259b)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2024-08-16 16:07:27 +08:00
Miss Islington (bot) 55aede7342
[3.13] gh-122888: Fix crash on certain calls to str() (GH-122889) (#122947)
Fixes GH-122888
(cherry picked from commit 53ebb6232a)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-08-12 16:53:05 +00:00
Miss Islington (bot) 59d0d335cf
[3.13] gh-122903: Honor directories in zipfile.Path.glob. (GH-122908) (#122926)
(cherry picked from commit 6aa35f3002)
2024-08-12 01:02:10 +00:00
Miss Islington (bot) 8c7348939d
[3.13] gh-122905: Sanitize names in zipfile.Path. (GH-122906) (#122922) 2024-08-11 20:35:04 -04:00
Miss Islington (bot) 42005c77a0
[3.13] gh-116622: Rename build variable MODULE_LDFLAGS back to LIBPYTHON (GH-122764) (GH-122842)
gh-116622: Rename build variable MODULE_LDFLAGS back to LIBPYTHON (GH-122764)

(LIBPYTHON was renamed MODULE_LDFLAGS in commit 7f5e3f04f.)
(cherry picked from commit 2f5c3b09e4)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
2024-08-09 14:45:04 -07:00
Miss Islington (bot) bcce4cc466
[3.13] gh-105376: Restore deprecated logging warn() method (GH-122775) (#122856)
gh-105376: Restore deprecated logging warn() method (GH-122775)

This reverts commit dcc028d924 and
commit 6c54e5d721.

Keep the deprecated logging warn() method in Python 3.13.

(cherry picked from commit d3239976a8)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-08-09 17:15:30 +02:00
Peter Bierma e8fb088dba
[3.13] gh-122695: Fix double-free when using `gc.get_referents` with a freed `_asyncio.FutureIter` (#122837)
* Backport #122834 for 3.13
2024-08-09 19:36:36 +05:30
Miss Islington (bot) 862bead237
[3.13] GH-118943: Remove regen-jit from the regen-all make target (GH-122840)
cherry picked from commit 8c9d1742de)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Éric <merwok@netwok.org>
2024-08-08 14:14:49 -07:00
Miss Islington (bot) 27a5292774
[3.13] GH-118943: Handle races when moving jit_stencils.h (GH-122709)
(cherry picked from commit 44659d3927)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-08-08 13:37:49 -07:00
Miss Islington (bot) 84c8cd0f3d
[3.13] gh-87320: In the code module, handle exceptions raised in sys.excepthook (GH-122456) (GH-122514)
Before, the exception caused by calling non-default sys.excepthook
in code.InteractiveInterpreter bubbled up to the caller, ending the REPL.
(cherry picked from commit bd3d31f380)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
2024-08-08 07:26:52 +00:00
Serhiy Storchaka 1fd1c6c738
[3.13] gh-118814: Fix the TypeVar constructor when name is passed by keyword (GH-122664) (GH-122806)
Fix _PyArg_UnpackKeywordsWithVararg for the case when argument for
positional-or-keyword parameter is passed by keyword.
There was only one such case in the stdlib -- the TypeVar constructor.
(cherry picked from commit 540fcc62f5)
2024-08-08 09:49:21 +03:00
Miss Islington (bot) 5c161cb832
[3.13] gh-122728: Fix SystemError in PyEval_GetLocals() (GH-122735) (#122757)
gh-122728: Fix SystemError in PyEval_GetLocals() (GH-122735)

Fix PyEval_GetLocals() to avoid SystemError ("bad argument to
internal function"). Don't redefine the 'ret' variable in the if
block.

Add an unit test on PyEval_GetLocals().
(cherry picked from commit 4767a6e31c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-08-06 23:37:10 +02:00
Pradyun Gedam f0e5ebfcd5
[3.13] gh-122744: Bump bundled pip to 24.2 (#122746)
(cherry picked from commit 5b8a6c5186)

Co-authored-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
2024-08-06 18:50:12 +00:00
Miss Islington (bot) 4aaa4259b5
[3.13] gh-121650: Encode newlines in headers, and verify headers are sound (GH-122233) (#122484)
gh-121650: Encode newlines in headers, and verify headers are sound (GH-122233)

GH-GH- Encode header parts that contain newlines

Per RFC 2047:

> [...] these encoding schemes allow the
> encoding of arbitrary octet values, mail readers that implement this
> decoding should also ensure that display of the decoded data on the
> recipient's terminal will not cause unwanted side-effects

It seems that the "quoted-word" scheme is a valid way to include
a newline character in a header value, just like we already allow
undecodable bytes or control characters.
They do need to be properly quoted when serialized to text, though.

GH-GH- Verify that email headers are well-formed

This should fail for custom fold() implementations that aren't careful
about newlines.

(cherry picked from commit 0976339818)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Bas Bloemsaat <bas@bloemsaat.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-08-06 19:06:41 +02:00
Miss Islington (bot) d5e7d0a468
[3.13] gh-122573: Require Python 3.10 or newer for Windows builds (GH-122574) (#122674)
gh-122573: Require Python 3.10 or newer for Windows builds (GH-122574)

Match statements in tooling require a more recent Python. Tools/cases_generator/*.py (and `Tools/jit/*.py` in 3.13+).

(cherry picked from commit d0b92dd5ca)

Co-authored-by: Jonathan Protzenko <protz@microsoft.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-08-06 18:53:12 +02:00
Irit Katriel 545a328eae
[3.13] gh-122445: populate only modified fields in __static_attributes__ (#122446) (#122621)
gh-122445: populate only modified fields in __static_attributes__ (#122446)

(cherry picked from commit 498376d7a7)
2024-08-02 19:26:57 +01:00
Miss Islington (bot) b20893b5c2
[3.13] gh-122334: Fix crash when importing ssl after re-initialization (GH-122481) (#122614)
gh-122334: Fix crash when importing ssl after re-initialization (GH-122481)

* Fix crash when importing ssl after re-initialization
(cherry picked from commit 9fc1c992d6)

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
2024-08-02 14:07:16 +00:00
Miss Islington (bot) 56435a88c4
[3.13] gh-121723: Relax constraints on queue objects for `logging.handlers.QueueHandler`. (GH-122154) (GH-122603)
(cherry picked from commit fb864c76cd)
2024-08-02 13:07:27 +01:00
Thomas Wouters e4a3e786a5 Python 3.13.0rc1 2024-07-31 20:18:39 +02:00
Petr Viktorin 8c8c43e1dc
[3.13] gh-120906: Support arbitrary hashable keys in FrameLocalsProxy (GH-122309) (#122488)
[3.13] gh-120906: Support arbitrary hashable keys in FrameLocalsProxy  (GH-122309)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
(cherry picked from commit 5912487938)
2024-07-31 09:31:44 +00:00
Miss Islington (bot) 5212624c42
[3.13] gh-116622: Fix testPyObjectPrintOSError on Android (GH-122487) (#122490)
gh-116622: Fix testPyObjectPrintOSError on Android (GH-122487)

Adds extra handling for way BSD/Android return errors from calls to fwrite.
(cherry picked from commit 82db572813)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
2024-07-31 00:49:14 +00:00
Miss Islington (bot) a21317f07b
[3.13] GH-122482: Make About IDLE direct discussion to DPO (GH-122483) (#122485)
Currently, idle-dev@python.org and idle-dev mailing list
serve to collect spam (90+%).  Change About IDLE to direct
discussions to discuss.python.org.  Users are already
doing so.
(cherry picked from commit 29c04dfa27)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-07-30 22:54:01 +00:00
Dino Viehland 11292ab935
[3.13] gh-122208: Don't delivery PyDict_EVENT_ADDED until it can't fail (#122326)
Don't delivery PyDict_EVENT_ADDED until it can't fail
2024-07-30 09:13:31 -07:00
Miss Islington (bot) 202cfbfb7c
[3.13] gh-121474: Add threading.Barrier parties arg sanity check. (GH-121480) (GH-122444)
(cherry picked from commit d27a53fc02)

Co-authored-by: Clinton <pygeek@users.noreply.github.com>
2024-07-30 09:24:35 +00:00
Miss Islington (bot) 466bb0d7ea
[3.13] gh-122400: Handle ValueError in filecmp (GH-122401) (GH-122441)
(cherry picked from commit 3a9b2aae61)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-30 09:17:35 +00:00
Miss Islington (bot) a4c7eb54bd
[3.13] gh-105733: Soft-deprecate ctypes.ARRAY, rather than hard-deprecating it. (GH-122281) (GH-122440)
gh-105733: Soft-deprecate ctypes.ARRAY, rather than hard-deprecating it. (GH-122281)

Soft-deprecate ctypes.ARRAY, rather than hard-deprecating it.

Partially reverts 2211454fe2
(cherry picked from commit 3833d27f98)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-07-30 08:05:09 +00:00
Miss Islington (bot) b252317956
[3.13] gh-122133: Authenticate socket connection for `socket.socketpair()` fallback (GH-122134) (GH-122424)
Authenticate socket connection for `socket.socketpair()` fallback when the platform does not have a native `socketpair` C API.  We authenticate in-process using `getsocketname` and `getpeername` (thanks to Nathaniel J Smith for that suggestion).

(cherry picked from commit 78df1043db)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-07-30 03:40:02 +00:00
Brandt Bucher 55554fd215
[3.13] GH-116090: Fire RAISE events from _FOR_ITER_TIER_TWO (GH-122419)
(cherry picked from commit 15d4cd0967)
2024-07-29 14:51:19 -07:00
Miss Islington (bot) c26dd270f7
[3.13] gh-122311: Fix some error messages in pickle (GH-122386) (GH-122387)
(cherry picked from commit 3b034d26eb)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-07-29 12:27:14 +03:00
Pablo Galindo Salgado c8f3c1daa4
[3.13] gh-122300: Preserve AST nodes for format specifiers with single elements (GH-122308) (#122364)
(cherry picked from commit db2d8b6db1)
2024-07-27 19:27:01 +00:00
Miss Islington (bot) 3648a945e4
[3.13] gh-122170: Handle ValueError raised by os.stat() in linecache (GH-122176) (GH-122348)
(cherry picked from commit 7a6d4ccf0e)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-27 10:54:49 +00:00
Miss Islington (bot) 6b9a5af72f
[3.13] gh-122332: Fix missing `NULL` check in `asyncio.Task.get_coro` (GH-122338) (#122344)
gh-122332: Fix missing `NULL` check in `asyncio.Task.get_coro` (GH-122338)
(cherry picked from commit c08696286f)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-07-27 12:36:50 +05:30
Miss Islington (bot) dd270f610c
[3.13] gh-121489: Export private _PyBytes_Join() again (GH-122267) (#122287)
gh-121489: Export private _PyBytes_Join() again (GH-122267)
(cherry picked from commit aef95eb107)

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2024-07-25 16:06:31 +00:00
Miss Islington (bot) 984f8aaa2f
[3.13] gh-82951: Fix serializing by name in pickle protocols < 4 (GH-122149) (GH-122264)
Serializing objects with complex __qualname__ (such as unbound methods and
nested classes) by name no longer involves serializing parent objects by value
in pickle protocols < 4.
(cherry picked from commit dc07f65a53)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-07-25 13:44:55 +03:00
Miss Islington (bot) 6933c4ace9
[3.13] gh-113785: csv: fields starting with escapechar are not quoted (GH-122110) (GH-122258)
(cherry picked from commit a3327dbfd4)

Co-authored-by: Mikołaj Kuranowski <mkuranowski@gmail.com>
2024-07-25 07:29:36 +00:00
Serhiy Storchaka 4e7716554b
[3.13] gh-122087: Restore ismethoddescriptor() and isroutine() for partial objects (GH-122218)
Now they return False again.
2024-07-25 10:11:47 +03:00
Miss Islington (bot) 40cdec6a8a
[3.13] gh-122029: Log call events in sys.setprofile when it's a method with c function (GH-122072) (GH-122205)
gh-122029: Log call events in sys.setprofile when it's a method with c function (GH-122072)

Log call events in sys.setprofile when it is a method with a C function.
(cherry picked from commit e91ef13861)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-07-23 22:49:36 +00:00
Miss Islington (bot) 7767534df9
[3.13] gh-122088: Copy the coroutine status of the underlying callable in `@warnings.deprecated` (GH-122086) (#122156)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-23 10:24:07 +00:00
Miss Islington (bot) f00ba7335a
[3.13] gh-99242 Ignore error when running regression tests under certain conditions. (GH-121663) (GH-121669)
(cherry picked from commit 0759cecd9d)

Co-authored-by: Bas Bloemsaat <bas@bloemsaat.com>
Co-authored-by: Kevin Diem <kg.diem@gmail.com>
2024-07-22 14:53:46 +02:00
Miss Islington (bot) 148beb6de9
[3.13] gh-121957: Emit audit events for `python -i` and `python -m asyncio` (GH-121958) (GH-122115)
Relatedly, emit the `cpython.run_startup` event from the Python version of
`PYTHONSTARTUP` handling.
(cherry picked from commit dc93d1125f)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-22 13:36:57 +02:00
Miss Islington (bot) 587a8f84ed
[3.13] gh-120522: Apply App Store compliance patch during installation (GH-121947) (#122105)
gh-120522: Apply App Store compliance patch during installation (GH-121947)

Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.
(cherry picked from commit 728432c804)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2024-07-22 08:13:34 +08:00
Miss Islington (bot) a6c1081cbe
[3.13] gh-122026: Fix identification of mismatched parentheses inside f-strings (GH-122028) (#122041) 2024-07-19 17:32:34 +00:00
Miss Islington (bot) 9a332f260d
[3.13] gh-120930: Remove extra blank occuring in wrapped encoded words in email headers (GH-121747) (GH-121963)
gh-120930: Remove extra blank occuring in wrapped encoded words in email headers (GH-121747)
(cherry picked from commit cecaceea31)

Co-authored-by: Matthieu Caneill <matthieucan@users.noreply.github.com>
2024-07-19 19:21:53 +02:00
Miss Islington (bot) 963e97d901
[3.13] gh-59022: Added tests for `pkgutil.extend_path` (GH-121673) (GH-121951)
This adds tests for the documented behaviour of `pkgutil.extend_path`
regarding different argument types as well as for `*.pkg` files.
(cherry picked from commit 8f2532168b)

Co-authored-by: Andreas Stocker <andreas@stocker.co.it>
2024-07-19 16:35:51 +02:00
Serhiy Storchaka a45d9051ed
[3.13] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122012)
(cherry picked from commit 1a0c7b9ba4)
2024-07-19 09:13:08 +00:00
Miss Islington (bot) 721a7dde11
[3.13] gh-120289: Disallow disable() and clear() in external timer to prevent use-after-free (GH-120297) (#121984)
gh-120289: Disallow disable() and clear() in external timer to prevent use-after-free (GH-120297)
(cherry picked from commit 1ab1778283)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-07-18 13:26:47 -07:00
Miss Islington (bot) 233ed46e6d
[3.13] gh-118934: Make PyEval_GetLocals return borrowed reference (GH-119769) (#121869)
gh-118934: Make PyEval_GetLocals return borrowed reference (GH-119769)
(cherry picked from commit e65cb4c6f0)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-07-19 01:38:28 +10:00
Thomas Wouters 567c38b4eb Python 3.13.0b4 2024-07-18 11:41:38 +02:00
T. Wouters ea364204db
[3.13] Move misplaced blurb entries (#121919)
Move misplaced blurb entries from "C_API" to "C API", and from "Core_and_Builtins" to "Core and Builtins".
2024-07-17 15:33:30 +00:00
Miss Islington (bot) 3d9692dbf8
[3.13] gh-120678: pyrepl: Include globals from modules passed with `-i` (GH-120904) (#121916)
(cherry picked from commit ac07451116)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-17 16:52:46 +02:00
Miss Islington (bot) 5a8e1373fe
[3.13] gh-78889: Stop IDLE Shell freezes from sys.stdout.shell.xyz (GH-121876) (#121911)
gh-78889: Stop IDLE Shell freezes from sys.stdout.shell.xyz (GH-121876)

Problem occurred when attribute xyz could not be pickled.
Since this is not trivial to selectively fix, block all
attributes (other than 'width').  IDLE does not access them
and they are private implementation details.
(cherry picked from commit 58753f33e4)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-07-17 14:10:13 +00:00
Petr Viktorin 4395d68c70
[3.13] gh-113993: Don't immortalize in PyUnicode_InternInPlace; keep immortalizing in other API (GH-121364) (GH-121854)
* Switch PyUnicode_InternInPlace to _PyUnicode_InternMortal, clarify docs

* Document immortality in some functions that take `const char *`

This is PyUnicode_InternFromString;
PyDict_SetItemString, PyObject_SetAttrString;
PyObject_DelAttrString; PyUnicode_InternFromString;
and the PyModule_Add convenience functions.

Always point out a non-immortalizing alternative.

* Don't immortalize user-provided attr names in _ctypes
(cherry picked from commit b4aedb23ae)
2024-07-17 14:51:42 +02:00
Miss Islington (bot) 2e34591f1b
[3.13] GH-120371: Add WASI SDK 22 support (GH-121870) (GH-121873)
GH-120371: Add WASI SDK 22 support (GH-121870)

Required disabling stub functions now provided by wasi-libc.
(cherry picked from commit f589f263bc)

Co-authored-by: Brett Cannon <brett@python.org>
2024-07-16 14:49:55 -07:00
Miss Islington (bot) 6613029084
[3.13] gh-121860: Fix crash when materializing managed dict (GH-121866) (#121867)
The object's inline values may be marked invalid if the materialized
dict was already initialized and then deleted.
(cherry picked from commit 162b41f577)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-16 19:26:01 +00:00
Pablo Galindo Salgado d24ec8a47c
[3.13] gh-121130: Fix f-string format specifiers with debug expressions (GH-121150) (#121868)
(cherry picked from commit c46d64e0ef)
2024-07-16 19:25:04 +00:00
Miss Islington (bot) 54db42fe2c
[3.13] gh-121814: Only check f_trace_opcodes if Python frame exists (GH-121818) (#121861)
gh-121814: Only check f_trace_opcodes if Python frame exists (GH-121818)
(cherry picked from commit 2b1b68939b)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
Co-authored-by: Matt Wozniski <godlygeek@gmail.com>
2024-07-16 10:13:28 -07:00
Miss Islington (bot) 7c9861f9d9
[3.13] gh-121160: Add some tests for readline.set_history_length (GH-121326) (GH-121856)
(cherry picked from commit 263c7e611b)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-07-16 17:15:51 +02:00
Miss Islington (bot) 281ffb60cc
[3.13] gh-113993: For string interning, do not rely on (or assert) _Py_IsImmortal (GH-121358) (GH-121851)
gh-113993: For string interning, do not rely on (or assert) _Py_IsImmortal (GH-121358)

Older stable ABI extensions are allowed to make immortal objects mortal.
Instead, use `_PyUnicode_STATE` (`interned` and `statically_allocated`).
(cherry picked from commit 956270d08d)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-07-16 13:42:49 +00:00
Miss Islington (bot) f0e4b02c39
[3.13] gh-120522: Revert "Add a `--with-app-store-compliance` configure option to patch out problematic code" (GH-121844) (#121845)
This reverts commit 0dfb437a32 prior
to the release of 3.13.0b4 to allow for additional review time.
(cherry picked from commit f27593a87c)

Co-authored-by: Ned Deily <nad@python.org>
2024-07-16 11:14:19 +00:00
Miss Islington (bot) d02adecb42
[3.13] gh-119189: Fix the power operator for Fraction (GH-119242) (GH-119836)
When using the ** operator or pow() with Fraction as the base
and an exponent that is not rational, a float, or a complex, the
fraction is no longer converted to a float.
(cherry picked from commit b9965ef282)

Co-authored-by: Joshua Herman <30265+zitterbewegung@users.noreply.github.com>
2024-07-16 10:44:23 +03:00
Miss Islington (bot) 4a62fdf35d
[3.13] gh-121295: Fix blocked console after interrupting a long paste (GH-121815) (GH-121826)
(cherry picked from commit 498a94c198)

Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
2024-07-16 08:29:04 +02:00
Miss Islington (bot) a1505afd39
[3.13] gh-120831: Increase the default minimum supported iOS version to 13.0 (GH-121250) (#121833)
gh-120831: Increase the default minimum supported iOS version to 13.0 (GH-121250)

Increases the default minimum iOS version to 13.0.

(cherry picked from commit 7e91e0dcfe)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-07-16 12:57:05 +08:00
Miss Islington (bot) 0794220a69
[3.13] gh-121794: Don't set `ob_tid` to zero in fast-path dealloc (GH-121799) (#121821)
We should maintain the invariant that a zero `ob_tid` implies the
refcount fields are merged.

* Move the assignment in `_Py_MergeZeroLocalRefcount` to immediately
  before the refcount merge.
* Update `_PyTrash_thread_destroy_chain` to set `ob_ref_shared` to
  `_Py_REF_MERGED` when setting `ob_tid` to zero.

Also check this invariant with assertions in the GC in debug builds.
That uncovered a bug when running out of memory during GC.
(cherry picked from commit d23be3947c)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-15 22:15:23 +00:00
Miss Islington (bot) b506de4eb5
[3.13] gh-121245: Refactor site.register_readline() (GH-121659) (GH-121816)
(cherry picked from commit 05d413764c)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-15 22:49:18 +02:00
Kirill Podoprigora c4daec4319
[3.13] gh-121657: Display correct error message for yield from outsid… (GH-121768)
(cherry picked from commit 178e44de8f)

Co-authored-by: Gregor <36135323+gege-hoho@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-15 21:25:54 +02:00
Miss Islington (bot) 308857b82a
[3.13] gh-121746: Bind Alt+Enter to "accept" in the REPL (GH-121754) (GH-121803)
(cherry picked from commit 6522f0e438)

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2024-07-15 20:14:50 +02:00
Miss Islington (bot) 55ff124b9c
[3.13] gh-57141: Make shallow argument to filecmp.dircmp keyword-only (GH-121767) (#121777)
It is our general practice to make new optional parameters keyword-only,
even if the existing parameters are all positional-or-keyword. Passing
this parameter as positional would look confusing and could be error-prone
if additional parameters are added in the future.
(cherry picked from commit 50eec501fe)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-07-14 23:17:26 +00:00
Miss Islington (bot) 767f71466d
[3.13] gh-121731: Fix mimalloc compile error on GNU/Hurd (GH-121732) (#121773)
(cherry picked from commit d005f2c186)

Co-authored-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2024-07-14 17:14:30 +00:00
Miss Islington (bot) f672ee2242
[3.13] gh-121749: Fix discrepancy in docs for `PyModule_AddObjectRef` (GH-121750) (GH-121752)
(cherry picked from commit 26dfb27712)

Co-authored-by: Dominic H <dom@dominic.sk>
2024-07-14 12:31:46 +02:00
Miss Islington (bot) dfedbdba40
[3.13] gh-120012: clarify the behaviour of `multiprocessing.Queue.empty` on closed queues. (GH-120102) (#120469)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-07-14 04:24:58 -06:00
Miss Islington (bot) e28f863bd5
[3.13] gh-121609: Fix pasting of characters containing unicode character joiner (GH-121667) (#121733)
Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
2024-07-14 03:02:46 -06:00
Miss Islington (bot) 62572f10aa
[3.13] gh-121497: Make Pyrepl respect correctly the history with input hook set (GH-121498) (#121703)
gh-121497: Make Pyrepl respect correctly the history with input hook set (GH-121498)
(cherry picked from commit 4e36dd7d87)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-07-13 14:28:49 +00:00
Miss Islington (bot) de51ee0c23
[3.13] gh-121499: Fix multi-line history rendering in the REPL (GH-121531) (#121679)
gh-121499: Fix multi-line history rendering in the REPL (GH-121531)
(cherry picked from commit 4b9e10d0ea)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-07-13 15:56:56 +02:00
Hugo van Kemenade fcc4a537b9
[3.13] NEWS: Fix Sphinx warnings and increase threshold for new news nits (GH-121482) (#121513)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-07-13 12:55:43 +00:00
Miss Islington (bot) 15c875a57c
[3.13] Update retroactive comments from GH-117741 (segfault in `FutureIter_dealloc`) (GH-121638) (GH-121642)
Update retroactive comments from GH-117741 (segfault in `FutureIter_dealloc`) (GH-121638)

Address comments
(cherry picked from commit 65fededf9c)

Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
2024-07-12 09:00:09 +00:00
Miss Islington (bot) 35f7155bc3
[3.13] gh-121103: Put free-threaded libraries in `lib/python3.14t` (GH-121293) (#121631)
On POSIX systems, excluding macOS framework installs, the lib directory
for the free-threaded build now includes a "t" suffix to avoid conflicts
with a co-located default build installation.
(cherry picked from commit e8c91d90ba)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-11 21:00:28 +00:00
Miss Islington (bot) c6dbfbbe3c
[3.13] gh-117482: Fix Builtin Types Slot Wrappers (gh-121630)
When builtin static types are initialized for a subinterpreter, various "tp" slots have already been inherited (for the main interpreter).  This was interfering with the logic in add_operators() (in Objects/typeobject.c), causing a wrapper to get created when it shouldn't.  This change fixes that by preserving the original data from the static type struct and checking that.

(cherry picked from commit 5250a03133, AKA gh-121602)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-07-11 20:47:38 +00:00
Jelle Zijlstra 38c4028dd9
[3.13] gh-121332: Make AST node constructor check _attributes instead of hardcoding attributes (GH-121334) (#121625)
(cherry picked from commit 58e8cf2bb6)
2024-07-11 15:51:32 +00:00
Miss Islington (bot) 0504f45b79
[3.13] gh-89364: Export PySignal_SetWakeupFd() function (GH-121537) (#121582)
gh-89364: Export PySignal_SetWakeupFd() function (GH-121537)

Export the PySignal_SetWakeupFd() function. Previously, the function
was documented but it couldn't be used in 3rd party code.
(cherry picked from commit ca0fb3423c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-10 14:14:09 +00:00
Miss Islington (bot) a1fc8d31a7
[3.13] GH-121439: Allow PyTupleObjects with an ob_size of 20 in the free_list to be reused (gh-121428) (gh-121565)
GH-121439: Allow PyTupleObjects with an ob_size of 20 in the free_list to be reused (gh-121428)
(cherry picked from commit 9585a1a2a2)

Co-authored-by: satori1995 <132636720+satori1995@users.noreply.github.com>
2024-07-10 08:12:54 +00:00
Miss Islington (bot) c128718f30
[3.13] gh-121368: Fix seq lock memory ordering in _PyType_Lookup (GH-121388) (#121505)
The `_PySeqLock_EndRead` function needs an acquire fence to ensure that
the load of the sequence happens after any loads within the read side
critical section. The missing fence can trigger bugs on macOS arm64.

Additionally, we need a release fence in `_PySeqLock_LockWrite` to
ensure that the sequence update is visible before any modifications to
the cache entry.
(cherry picked from commit 1d3cf79a50)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-08 19:15:58 +00:00
Miss Islington (bot) eef5c6443b
[3.13] gh-121487: Fix deprecation warning for ATOMIC_VAR_INIT in mimalloc (gh-121488) (#121504)
(cherry picked from commit 31873bea47)

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2024-07-08 18:59:25 +00:00
Miss Islington (bot) 2f8919ee3c
[3.13] GH-121012: Set index to -1 when list iterators become exhausted in tier 2 (GH-121483) (GH-121494) 2024-07-08 18:09:54 +01:00
Miss Islington (bot) 78437b74ad
[3.13] gh-121467: Fix makefile to include mimalloc headers (GH-121469) (#121471)
gh-121467: Fix makefile to include mimalloc headers (GH-121469)
(cherry picked from commit 5aa1e60e0c)

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2024-07-08 01:10:17 +00:00
Miss Islington (bot) abefbcba8a
[3.13] gh-121084: Fix test_typing random leaks (GH-121360) (#121373)
gh-121084: Fix test_typing random leaks (GH-121360)

Clear typing ABC caches when running tests for refleaks (-R option):
call _abc_caches_clear() on typing abstract classes and their
subclasses.
(cherry picked from commit 5f660e8e2c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-04 18:07:07 +00:00
Steve Dower 868e9ab031
gh-118507: Amend news entry to mention ntpath.isfile bugfix (GH-120817) 2024-07-04 15:15:22 +00:00
Miss Islington (bot) 678fb82cd5
[3.13] gh-121201: Disable perf_trampoline on riscv64 for now (GH-121328) (#121336)
gh-121201: Disable perf_trampoline on riscv64 for now (GH-121328)

Disable perf_trampoline on riscv64 for now

Until support is added in perf_jit_trampoline.c

gh-120089 was incomplete.
(cherry picked from commit ca2e876500)

Co-authored-by: Stefano Rivera <stefano@rivera.za.net>
2024-07-04 08:57:52 +00:00
Miss Islington (bot) 65ed1b7429
[3.13] gh-117983: Defer import of threading for lazy module loading (GH-120233) (GH-121349)
gh-117983: Defer import of threading for lazy module loading (GH-120233)

As noted in gh-117983, the import importlib.util can be triggered at
interpreter startup under some circumstances, so adding threading makes
it a potentially obligatory load.
Lazy loading is not used in the stdlib, so this removes an unnecessary
load for the majority of users and slightly increases the cost of the
first lazily loaded module.

An obligatory threading load breaks gevent, which monkeypatches the
stdlib. Although unsupported, there doesn't seem to be an offsetting
benefit to breaking their use case.

For reference, here are benchmarks for the current main branch:

```
❯ hyperfine -w 8 './python -c "import importlib.util"'
Benchmark 1: ./python -c "import importlib.util"
  Time (mean ± σ):       9.7 ms ±   0.7 ms    [User: 7.7 ms, System: 1.8 ms]
  Range (min … max):     8.4 ms …  13.1 ms    313 runs
```

And with this patch:

```
❯ hyperfine -w 8 './python -c "import importlib.util"'
Benchmark 1: ./python -c "import importlib.util"
  Time (mean ± σ):       8.4 ms ±   0.7 ms    [User: 6.8 ms, System: 1.4 ms]
  Range (min … max):     7.2 ms …  11.7 ms    352 runs
```

Compare to:

```
❯ hyperfine -w 8 './python -c pass'
Benchmark 1: ./python -c pass
  Time (mean ± σ):       7.6 ms ±   0.6 ms    [User: 5.9 ms, System: 1.6 ms]
  Range (min … max):     6.7 ms …  11.3 ms    390 runs
```

This roughly halves the import time of importlib.util.
(cherry picked from commit 94f50f8ee6)

Co-authored-by: Chris Markiewicz <effigies@gmail.com>
2024-07-03 21:14:42 +00:00
Miss Islington (bot) e7008d78f3
[3.13] gh-118714: Make the pdb post-mortem restart/quit behavior more reasonable (GH-118725) (#121346)
gh-118714: Make the pdb post-mortem restart/quit behavior more reasonable (GH-118725)
(cherry picked from commit e245ed7d1e)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-07-03 12:15:53 -07:00
Miss Islington (bot) 3d4e533be5
[3.13] gh-112136: Restore removed _PyArg_Parser (GH-121262) (#121344)
gh-112136: Restore removed _PyArg_Parser (GH-121262)

Restore the private _PyArg_Parser structure and the private
_PyArg_ParseTupleAndKeywordsFast() function, previously removed
in Python 3.13 alpha 1.

Recreate Include/cpython/modsupport.h header file.
(cherry picked from commit f8373db153)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-03 18:29:00 +00:00
Miro Hrončok dacf4ffa79
[3.13] gh-121279: Re-add prematurely removed import warnings to importlib.abc (#121281)
Fixup for 51724620e8

Fixes https://github.com/python/cpython/issues/121279
2024-07-03 11:06:20 +02:00
neonene 2c3aa527fd
[3.13] gh-120782: Update internal type cache when reloading datetime (GH-120829) (#120855)
* [3.13] gh-120782: Update internal type cache when reloading datetime

When reloading _datetime module, the single-phase version did not invoke the PyInit__datetime function, whereas the current multi-phase version updates the static types through the module init. The outdated static type cache in the interpreter state needs to be invalidated at the end of reloading the multi-phase module.
2024-07-03 13:52:51 +05:30
Miss Islington (bot) 78e96bdf24
[3.13] gh-121245: Correct pyrepl import in site.py (GH-121255) (#121261)
(cherry picked from commit 7a807c3efa)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2024-07-02 13:40:05 +02:00
Miss Islington (bot) 010bf92779
[3.13] gh-121200: Fix test_expanduser_pwd2() of test_posixpath (GH-121228) (#121232)
gh-121200: Fix test_expanduser_pwd2() of test_posixpath (GH-121228)

Call getpwnam() to get pw_dir, since it can be different than
getpwall() pw_dir.
(cherry picked from commit 02cb5fdee3)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-01 16:13:41 +00:00
Miss Islington (bot) 1f2f9c4ff5
[3.13] gh-121188: Sanitize invalid XML characters in regrtest (GH-121195) (#121204)
gh-121188: Sanitize invalid XML characters in regrtest (GH-121195)

When creating the JUnit XML file, regrtest now escapes characters
which are invalid in XML, such as the chr(27) control character used
in ANSI escape sequences.
(cherry picked from commit af8c3d7a26)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-01 08:55:38 +00:00
Miss Islington (bot) 82777cd024
[3.13] gh-113565: Improve and harden detection of curses dependencies (GH-119816) (#121202)
1. Use pkg-config to check for ncursesw/panelw. If that fails, use
   pkg-config to check for ncurses/panel.
2. Regardless of pkg-config output, search for curses/panel headers, so
   we're sure we have all defines in pyconfig.h.
3. Regardless of pkg-config output, check if libncurses or libncursesw
   contains the 'initscr' symbol; if it does _and_ pkg-config failed
   earlier, add the resulting -llib linker option to CURSES_LIBS.
   Ditto for 'update_panels' and PANEL_LIBS.
4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're
   using updated LIBS and CPPFLAGS for those.

Add the PY_CHECK_CURSES convenience macro.
(cherry picked from commit f80376b129)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-07-01 08:35:38 +00:00
Miss Islington (bot) d481d4b767
[3.13] gh-87744: fix waitpid race while calling send_signal in asyncio (GH-121126) (#121194)
gh-87744: fix waitpid race while calling send_signal in asyncio (GH-121126)

asyncio earlier relied on subprocess module to send signals to the process, this has some drawbacks one being that subprocess module unnecessarily calls waitpid on child processes and hence it races with asyncio implementation which internally uses child watchers. To mitigate this, now asyncio sends signals directly to the process without going through the subprocess on non windows systems. On Windows it fallbacks to subprocess module handling but on windows there are no child watchers so this issue doesn't exists altogether.

(cherry picked from commit bd473aa598)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-07-01 05:11:47 +00:00