]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
9 months agogh-127119: Faster check for small ints in long_dealloc (GH-127620)
Pieter Eendebak [Wed, 29 Jan 2025 15:22:18 +0000 (16:22 +0100)] 
gh-127119: Faster check for small ints in long_dealloc (GH-127620)

9 months agogh-129296: Fix `pyatomic.h` include paths (#129320)
Zanie Blue [Wed, 29 Jan 2025 15:06:19 +0000 (09:06 -0600)] 
gh-129296: Fix `pyatomic.h` include paths (#129320)

Use relative includes in Include/cpython/pyatomic.h for
pyatomic_gcc.h, pyatomic_std.h and pyatomic_msc.h.

Do a similar change in Include/cpython/pythread.h for
pthread_stubs.h include.

9 months agogh-129345: null check for indent syslogmodule (#129348)
Burkov Egor [Wed, 29 Jan 2025 13:49:23 +0000 (16:49 +0300)] 
gh-129345: null check for indent syslogmodule (#129348)

9 months agoCI: Change job name to 'build arm64' on Windows (#129434)
Hugo van Kemenade [Wed, 29 Jan 2025 13:18:19 +0000 (15:18 +0200)] 
CI: Change job name to 'build arm64' on Windows (#129434)

9 months agogh-129409: Fix Integer overflow - SEGV while writing data more than 2GB in CSV file...
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) [Wed, 29 Jan 2025 11:15:47 +0000 (16:45 +0530)] 
gh-129409: Fix Integer overflow -  SEGV while writing data more than 2GB in CSV file (#129413)

9 months agogh-100239: specialize bitwise logical binary ops on ints (#128927)
Irit Katriel [Wed, 29 Jan 2025 09:28:21 +0000 (09:28 +0000)] 
gh-100239: specialize bitwise logical binary ops on ints (#128927)

9 months agoMerge TSAN test matrices in CI (#123278)
🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) [Wed, 29 Jan 2025 09:16:51 +0000 (10:16 +0100)] 
Merge TSAN test matrices in CI (#123278)

9 months agogh-126703: Add freelists for list and tuple iterators (GH-128592)
Pieter Eendebak [Wed, 29 Jan 2025 09:15:24 +0000 (10:15 +0100)] 
gh-126703: Add freelists for list and tuple iterators (GH-128592)

9 months agoGH-128563: Don't leave frame->lltrace uninitialized (GH-129417)
Brandt Bucher [Wed, 29 Jan 2025 00:26:46 +0000 (16:26 -0800)] 
GH-128563: Don't leave frame->lltrace uninitialized (GH-129417)

9 months agoGH-126599: Remove the PyOptimizer API (GH-129194)
Brandt Bucher [Wed, 29 Jan 2025 00:10:51 +0000 (16:10 -0800)] 
GH-126599: Remove the PyOptimizer API (GH-129194)

9 months agogh-115999: Enable free-threaded specialization of LOAD_CONST (#129365)
T. Wouters [Wed, 29 Jan 2025 00:07:56 +0000 (01:07 +0100)] 
gh-115999: Enable free-threaded specialization of LOAD_CONST (#129365)

Enable free-threaded specialization of LOAD_CONST.

9 months agogh-127146: Skip test_readinto_non_blocking on Emscripten (#129421)
Hood Chatham [Tue, 28 Jan 2025 23:30:42 +0000 (23:30 +0000)] 
gh-127146: Skip test_readinto_non_blocking on Emscripten (#129421)

Skips an additional test due to non_blocking not working reliably on Emscripten.

9 months agogh-112075: Remove critical section in dict.get (gh-129336)
Pieter Eendebak [Tue, 28 Jan 2025 21:55:45 +0000 (22:55 +0100)] 
gh-112075: Remove critical section in dict.get (gh-129336)

The `dict.get` implementation uses `_Py_dict_lookup_threadsafe`, which is
thread-safe, so we remove the critical section from the argument clinic.

Add a test for concurrent dict get and set operations.

9 months agoGH-127381: pathlib ABCs: remove `JoinablePath.match()` (#129147)
Barney Gale [Tue, 28 Jan 2025 20:22:55 +0000 (20:22 +0000)] 
GH-127381: pathlib ABCs: remove `JoinablePath.match()` (#129147)

Unlike `ReadablePath.[r]glob()` and `JoinablePath.full_match()`, the
`JoinablePath.match()` method doesn't support the recursive wildcard `**`,
and matches from the right when a fully relative pattern is given. These
quirks means its probably unsuitable for inclusion in the pathlib ABCs,
especially given `full_match()` handles the same use case.

9 months agogh-128844: Make `_Py_TryIncref` public as an unstable API. (#128926)
Sam Gross [Tue, 28 Jan 2025 19:32:27 +0000 (14:32 -0500)] 
gh-128844: Make `_Py_TryIncref` public as an unstable API. (#128926)

This exposes `_Py_TryIncref` as `PyUnstable_TryIncref()` and the helper
function `_PyObject_SetMaybeWeakref` as `PyUnstable_EnableTryIncRef`.

These are helpers for dealing with unowned references in a safe way,
particularly in the free threading build.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
9 months agogh-129408: http: Fix typo 'RFF' to RFC' in documentation (#129411)
Samuel GIFFARD [Tue, 28 Jan 2025 18:25:51 +0000 (19:25 +0100)] 
gh-129408: http: Fix typo 'RFF' to RFC' in documentation (#129411)

9 months agogh-129005: Avoid copy in _pyio.FileIO.readinto() (#129324)
Cody Maloney [Tue, 28 Jan 2025 11:40:44 +0000 (03:40 -0800)] 
gh-129005: Avoid copy in _pyio.FileIO.readinto() (#129324)

`os.read()` allocated and filled a buffer by calling `read(2)`, than that
data was copied into the user provied buffer. Read directly into the
caller's buffer instead by using `os.readinto()`.

`os.readinto()` uses `PyObject_GetBuffer()` to make sure the passed
in buffer is writeable and bytes-like, drop the manual check.

9 months agogh-112064: Fix incorrect handling of negative read sizes in `HTTPResponse.read()...
Yury Manushkin [Tue, 28 Jan 2025 11:37:32 +0000 (12:37 +0100)] 
gh-112064: Fix incorrect handling of negative read sizes in `HTTPResponse.read()` (#128270)

The parameter `amt` of `HTTPResponse.read()`, which could be a negative integer,
has not been handled before and led to waiting for the connection to close
for `keep-alive connections`. Now, this has been fixed, and passing negative values
to `HTTPResponse().read()` works the same as passing `None` value.

9 months agogh-127146: Update test skips for Emscripten 4.0.1 (#129375)
Hood Chatham [Tue, 28 Jan 2025 01:05:21 +0000 (01:05 +0000)] 
gh-127146: Update test skips for Emscripten 4.0.1 (#129375)

Updates the Emscripten test skips to reflect recent changes in Emscripten capabilities.

9 months agogh-85046: Document errno constants (#126420)
RUANG (James Roy) [Tue, 28 Jan 2025 00:12:45 +0000 (08:12 +0800)] 
gh-85046: Document errno constants (#126420)

9 months agogh-129346: Handle allocation errors for SQLite aggregate context (#129347)
Erlend E. Aasland [Mon, 27 Jan 2025 17:16:19 +0000 (18:16 +0100)] 
gh-129346: Handle allocation errors for SQLite aggregate context (#129347)

9 months agogh-128954: Reorder _PyInterpreterFrame fields for reduced memory usage (#128958)
Sam Gross [Mon, 27 Jan 2025 17:14:51 +0000 (12:14 -0500)] 
gh-128954: Reorder _PyInterpreterFrame fields for reduced memory usage (#128958)

This reduces the size of _PyInterpreterFrame by 8 bytes on 64-bit
platforms using the free threading build due to alignment requirements.

This allows for slightly more recursive calls into the interpreter (from
C), but `test_call.test_super_deep` still crashes.

9 months agogh-129205: Modernize test_eintr (#129316)
Victor Stinner [Mon, 27 Jan 2025 17:04:45 +0000 (18:04 +0100)] 
gh-129205: Modernize test_eintr (#129316)

* Use f-string.
* Fix grammar: replace 'datas' with 'data' (and replace 'data' with
  'item').
* Remove unused variables: 'pid' and 'old_mask'.
* Factorize test_read() and test_readinto() code.

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
9 months agoGH-128914: Remove all but one conditional stack effects (GH-129226)
Mark Shannon [Mon, 27 Jan 2025 16:24:48 +0000 (16:24 +0000)] 
GH-128914: Remove all but one conditional stack effects (GH-129226)

* Remove all 'if (0)' and 'if (1)' conditional stack effects

* Use array instead of conditional for BUILD_SLICE args

* Refactor LOAD_GLOBAL to use a common conditional uop

* Remove conditional stack effects from LOAD_ATTR specializations

* Replace conditional stack effects in LOAD_ATTR with a 0 or 1 sized array.

* Remove conditional stack effects from CALL_FUNCTION_EX

9 months agogh-128427: Add `uuid.NIL` and `uuid.MAX` (#128429)
Nick Pope [Mon, 27 Jan 2025 16:17:17 +0000 (16:17 +0000)] 
gh-128427: Add `uuid.NIL` and `uuid.MAX` (#128429)

9 months agoCleanup What's New in Python 3.14 (C API changes) (#129341)
Victor Stinner [Mon, 27 Jan 2025 15:06:07 +0000 (16:06 +0100)] 
Cleanup What's New in Python 3.14 (C API changes) (#129341)

* Document PyDictObject.ma_version_tag removal.
* Add "Limited C API Changes" section.
* Move entries from New Features to Porting to Python 3.14.
* Include Pending removal documents at the right place.

9 months agogh-119786: Fix small typo in AST to CFG to bytecode section in compiler.md (#129322)
Sergey Miryanov [Mon, 27 Jan 2025 14:36:09 +0000 (06:36 -0800)] 
gh-119786: Fix small typo in AST to CFG to bytecode section in compiler.md (#129322)

9 months agogh-129061: Fix `FORCE_COLOR` and `NO_COLOR` when empty strings (#129140)
Hugo van Kemenade [Mon, 27 Jan 2025 14:24:10 +0000 (16:24 +0200)] 
gh-129061: Fix `FORCE_COLOR` and `NO_COLOR` when empty strings (#129140)

9 months agogh-111178: fix UBSan failures in `Modules/_decimal` (GH-129074)
Bénédikt Tran [Mon, 27 Jan 2025 14:15:42 +0000 (15:15 +0100)] 
gh-111178: fix UBSan failures in `Modules/_decimal` (GH-129074)

* Introduce & use cast macros
* fix UBSan failures for `PyDecContextObject`
* fix UBSan failures for `PyDecContextManagerObject`
* remove redundant casts for `PyDecObject`

9 months agogh-111178: fix UBSan failures in `Python/traceback.c` (GH-128259)
Bénédikt Tran [Mon, 27 Jan 2025 14:07:39 +0000 (15:07 +0100)] 
gh-111178: fix UBSan failures in `Python/traceback.c` (GH-128259)

9 months agogh-111178: fix UBSan failures in `Modules/socketmodule.c` (GH-128249)
Bénédikt Tran [Mon, 27 Jan 2025 14:06:10 +0000 (15:06 +0100)] 
gh-111178: fix UBSan failures in `Modules/socketmodule.c` (GH-128249)

9 months agogh-111178: fix UBSan failures in `Modules/{blake2,md5,sha1,sha2,sha3}module.c` (GH...
Bénédikt Tran [Mon, 27 Jan 2025 13:50:58 +0000 (14:50 +0100)] 
gh-111178: fix UBSan failures in `Modules/{blake2,md5,sha1,sha2,sha3}module.c` (GH-128248)

- fix UBSan failures in `blake2module.c`
- fix UBSan failures in `md5module.c`
- fix UBSan failures in `sha1module.c`
- fix UBSan failures in `sha2module.c`
- fix UBSan failures in `sha3module.c`

Cosmetics:

- suppress unused return values
- remove redundant casts in constructors
- suppress unused parameters in `{md5,sha*,blake2}module.c`

9 months agogh-119511: Fix a potential denial of service in imaplib (#119514)
Serhiy Storchaka [Mon, 27 Jan 2025 13:44:00 +0000 (15:44 +0200)] 
gh-119511: Fix a potential denial of service in imaplib (#119514)

The IMAP4 client could consume an arbitrary amount of memory when trying
to connect to a malicious server, because it read a "literal" data with a
single read(size) call, and BufferedReader.read() allocates the bytes
object of the specified size before reading. Now the IMAP4 client reads data
by chunks, therefore the amount of used memory is limited by the
amount of the data actually been sent by the server.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
9 months agogh-128509: Add `PyUnstable_IsImmortal` for finding immortal objects (GH-129182)
Peter Bierma [Mon, 27 Jan 2025 13:36:33 +0000 (08:36 -0500)] 
gh-128509: Add `PyUnstable_IsImmortal` for finding immortal objects (GH-129182)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
9 months agogh-102471: Change PyLongWriter_Discard(NULL) to do nothing (#129339)
Victor Stinner [Mon, 27 Jan 2025 10:51:16 +0000 (11:51 +0100)] 
gh-102471: Change PyLongWriter_Discard(NULL) to do nothing (#129339)

It's convenient to be able to call PyLongWriter_Discard(NULL) in
error handling code.

9 months agogh-102471: Credit Sergey B Kirpichev for PEP 757 (#129338)
Victor Stinner [Mon, 27 Jan 2025 10:44:13 +0000 (11:44 +0100)] 
gh-102471: Credit Sergey B Kirpichev for PEP 757 (#129338)

9 months agogh-128563: Move labels in ceval.c to bytecodes.c (GH-129112)
Ken Jin [Mon, 27 Jan 2025 10:30:20 +0000 (18:30 +0800)] 
gh-128563: Move labels in ceval.c to bytecodes.c (GH-129112)

9 months agogh-124703: Do not raise an exception when quitting pdb (#124704)
Tian Gao [Mon, 27 Jan 2025 03:29:16 +0000 (22:29 -0500)] 
gh-124703: Do not raise an exception when quitting pdb (#124704)

9 months agogh-129156: Fix variable quoting in `android-env.sh` script (#129321)
Zanie Blue [Mon, 27 Jan 2025 02:53:24 +0000 (20:53 -0600)] 
gh-129156: Fix variable quoting in `android-env.sh` script (#129321)

Adds quoting to `android-env.sh` to protect against spaces in paths.

9 months agogh-115911: Ignore PermissionError during import from cwd (#116131)
Alex Willmer [Sun, 26 Jan 2025 19:00:28 +0000 (19:00 +0000)] 
gh-115911: Ignore PermissionError during import from cwd (#116131)

Ignore PermissionError when checking cwd during import

On macOS `getcwd(3)` can return EACCES if a path component isn't readable,
resulting in PermissionError. `PathFinder.find_spec()` now catches these and
ignores them - the same treatment as a missing/deleted cwd.

Introduces `test.support.os_helper.save_mode(path, ...)`, a context manager
that restores the mode of a path on exit.

This is allows finer control of exception handling and robust environment
restoration across platforms in `FinderTests.test_permission_error_cwd()`.

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Brett Cannon <brett@python.org>
9 months agogh-127096: Do not recreate unnamed section on every read in ConfigParser (#127228)
Andrey Efremov [Sun, 26 Jan 2025 18:33:07 +0000 (01:33 +0700)] 
gh-127096: Do not recreate unnamed section on every read in ConfigParser (#127228)

* Do not recreate unnamed section on every read in ConfigParser

* Remove duplicate section creation code

9 months agogh-126107: Remove copyright block from Modules/config.c.in (#126982)
donBarbos [Sun, 26 Jan 2025 16:57:32 +0000 (16:57 +0000)] 
gh-126107: Remove copyright block from Modules/config.c.in (#126982)

chore: remove copyright block from config.c.in

9 months agogh-123987: Fix NotADirectoryError in NamespaceReader when sentinel present (#124018)
Jason R. Coombs [Sun, 26 Jan 2025 16:23:54 +0000 (11:23 -0500)] 
gh-123987: Fix NotADirectoryError in NamespaceReader when sentinel present (#124018)

9 months agogh-129195: use `future_add_to_awaited_by/future_discard_from_awaited_by` in `asyncio...
Thomas Grainger [Sun, 26 Jan 2025 15:44:16 +0000 (15:44 +0000)] 
gh-129195: use `future_add_to_awaited_by/future_discard_from_awaited_by` in `asyncio.staggered.staggered_race` (#129253)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
9 months agogh-126022: Remove zope.org from the permitted linkcheck redirects (#129308)
partev [Sun, 26 Jan 2025 14:46:00 +0000 (09:46 -0500)] 
gh-126022: Remove zope.org from the permitted linkcheck redirects (#129308)

9 months agogh-129205: Add os.readinto() API for reading data into a caller provided buffer ...
Cody Maloney [Sun, 26 Jan 2025 13:21:03 +0000 (05:21 -0800)] 
gh-129205: Add os.readinto() API for reading data into a caller provided buffer (#129211)

Add a new OS API which will read data directly into a caller provided
writeable buffer protocol object.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
9 months agoGH-121970: Remove pyspecific ``PyDecoratorMixin`` patches (#129306)
Adam Turner [Sun, 26 Jan 2025 03:43:23 +0000 (03:43 +0000)] 
GH-121970: Remove pyspecific ``PyDecoratorMixin`` patches (#129306)

9 months agogh-128421: make exception group methods thread safe (#129298)
Kumar Aditya [Sat, 25 Jan 2025 18:20:09 +0000 (23:50 +0530)] 
gh-128421: make exception group methods thread safe (#129298)

9 months agogh-129223: Raise KeyError in search_map_for_section() if not found (#129262)
Victor Stinner [Sat, 25 Jan 2025 17:19:48 +0000 (18:19 +0100)] 
gh-129223: Raise KeyError in search_map_for_section() if not found (#129262)

9 months agogh-129271: Fix reference leak with unicode writer in fast path in the json module...
Pablo Galindo Salgado [Sat, 25 Jan 2025 16:54:20 +0000 (16:54 +0000)] 
gh-129271: Fix reference leak with unicode writer in fast path in the json module (#129272)

9 months agogh-126022: make license.rst consistent with LICENSE: fix underline (#129292)
Hugo van Kemenade [Sat, 25 Jan 2025 13:36:58 +0000 (15:36 +0200)] 
gh-126022: make license.rst consistent with LICENSE: fix underline (#129292)

9 months agogh-128799: Add frame of except* to traceback when wrapping a naked exception (#128971)
Irit Katriel [Sat, 25 Jan 2025 13:00:23 +0000 (13:00 +0000)] 
gh-128799: Add frame of except* to traceback when wrapping a naked exception (#128971)

9 months agogh-129244: Remove workaround for MSVC compiler crash (#129263)
Michael Droettboom [Sat, 25 Jan 2025 12:56:13 +0000 (07:56 -0500)] 
gh-129244: Remove workaround for MSVC compiler crash (#129263)

* Remove compiler workaround

* Remote _Py_USING_PGO

9 months agogh-126022: make license.rst consistent with LICENSE (#128516)
partev [Sat, 25 Jan 2025 11:41:32 +0000 (06:41 -0500)] 
gh-126022: make license.rst consistent with LICENSE (#128516)

9 months agoRemove unused DPRINTF in ceval.c (GH-129282)
Chris Eibl [Sat, 25 Jan 2025 10:33:26 +0000 (11:33 +0100)] 
Remove unused DPRINTF in ceval.c (GH-129282)

remove unused DPRINTF in ceval.c

9 months agoReplace `strict_concatenate = True` with `extra_checks = True` (#126391)
sobolevn [Sat, 25 Jan 2025 09:44:23 +0000 (12:44 +0300)] 
Replace `strict_concatenate = True` with `extra_checks = True` (#126391)

9 months agogh-129248: Filter out the iOS log prefix from testbed runner output. (#129252)
Russell Keith-Magee [Sat, 25 Jan 2025 08:49:39 +0000 (16:49 +0800)] 
gh-129248: Filter out the iOS log prefix from testbed runner output. (#129252)

Filter out the iOS log prefix from testbed runner output.

9 months agoGH-125722: Remove Sphinx patches (#129277)
Adam Turner [Sat, 25 Jan 2025 03:47:55 +0000 (03:47 +0000)] 
GH-125722: Remove Sphinx patches (#129277)

9 months agogh-111178: fix UBSan failures in `Modules/cjkcodecs/multibytecodec.c` (gh-129090)
Bénédikt Tran [Sat, 25 Jan 2025 01:04:31 +0000 (02:04 +0100)] 
gh-111178: fix UBSan failures in `Modules/cjkcodecs/multibytecodec.c` (gh-129090)

9 months agogh-112713 : Add support for 'partitioned' attribute in http.cookies (GH-112714)
Giles Copp [Fri, 24 Jan 2025 22:31:52 +0000 (17:31 -0500)] 
gh-112713 : Add support for 'partitioned' attribute in http.cookies (GH-112714)

* Add support for 'partitioned' attribute in http.cookies

Co-authored-by: Giles Copp <gilesc@dropbox.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
9 months agogh-129223: Do not allow the compiler to optimise away symbols for debug sections...
Pablo Galindo Salgado [Fri, 24 Jan 2025 20:36:32 +0000 (20:36 +0000)] 
gh-129223: Do not allow the compiler to optimise away symbols for debug sections (#129225)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
9 months agogh-128002: fix `test_all_tasks_different_thread` in asyncio (#129267)
Kumar Aditya [Fri, 24 Jan 2025 17:40:24 +0000 (23:10 +0530)] 
gh-128002: fix `test_all_tasks_different_thread` in asyncio (#129267)

9 months agoImprove tests for _colorize.can_colorize() (#129234)
Serhiy Storchaka [Fri, 24 Jan 2025 16:33:40 +0000 (18:33 +0200)] 
Improve tests for _colorize.can_colorize() (#129234)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
9 months agogh-128002: use `_PyObject_SetMaybeWeakref` when creating tasks in asyncio (#128885)
Kumar Aditya [Fri, 24 Jan 2025 15:42:56 +0000 (21:12 +0530)] 
gh-128002: use `_PyObject_SetMaybeWeakref` when creating tasks in asyncio (#128885)

9 months agogh-129185: Simplify PyTraceMalloc_Track() (#129256)
Victor Stinner [Fri, 24 Jan 2025 13:29:36 +0000 (14:29 +0100)] 
gh-129185: Simplify PyTraceMalloc_Track() (#129256)

Since tracemalloc uses PyMutex, it becomes safe to use TABLES_LOCK()
even after _PyTraceMalloc_Fini(): remove the "pre-check" in
PyTraceMalloc_Track() and PyTraceMalloc_Untrack().

PyTraceMalloc_Untrack() no longer needs to acquire the GIL.

_PyTraceMalloc_Fini() can be called earlier during Python
finalization.

9 months agogh-128863: Deprecate _PyLong_FromDigits() function (#127939)
Sergey B Kirpichev [Fri, 24 Jan 2025 12:17:10 +0000 (15:17 +0300)] 
gh-128863: Deprecate _PyLong_FromDigits() function (#127939)

9 months agogh-127937: Convert decimal to use PEP 757 import API (#127925)
Sergey B Kirpichev [Fri, 24 Jan 2025 11:05:52 +0000 (14:05 +0300)] 
gh-127937: Convert decimal to use PEP 757 import API (#127925)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
9 months agogh-119182: Use public PyUnicodeWriter in _json.c (#129249)
Victor Stinner [Fri, 24 Jan 2025 10:38:13 +0000 (11:38 +0100)] 
gh-119182: Use public PyUnicodeWriter in _json.c (#129249)

Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API.

9 months agogh-129185: Use PyMutex in tracemalloc (#129246)
Victor Stinner [Fri, 24 Jan 2025 10:25:24 +0000 (11:25 +0100)] 
gh-129185: Use PyMutex in tracemalloc (#129246)

9 months agogh-129173: Use `_PyUnicodeError_GetParams` in `PyCodec_IgnoreErrors` (#129174)
Bénédikt Tran [Fri, 24 Jan 2025 10:25:03 +0000 (11:25 +0100)] 
gh-129173: Use `_PyUnicodeError_GetParams` in `PyCodec_IgnoreErrors` (#129174)

We also cleanup `PyCodec_StrictErrors` and the error message rendered
when an object of incorrect type is passed to codec error handlers.

9 months agogh-119182: Use public PyUnicodeWriter in stringio.c (#129243)
Victor Stinner [Thu, 23 Jan 2025 23:31:49 +0000 (00:31 +0100)] 
gh-119182: Use public PyUnicodeWriter in stringio.c (#129243)

Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API.

9 months agogh-109975: Add list of 3.13 removed library replacements (#127816)
Jeong, YunWon [Thu, 23 Jan 2025 21:20:40 +0000 (06:20 +0900)] 
gh-109975: Add list of 3.13 removed library replacements (#127816)

Add list of 3.13 removed library replacements

9 months agogh-91048: Also clear and set ts->asyncio_running_task with eager tasks (#129197)
Łukasz Langa [Thu, 23 Jan 2025 18:26:36 +0000 (19:26 +0100)] 
gh-91048: Also clear and set ts->asyncio_running_task with eager tasks (#129197)

This was missing from gh-124640. It's already covered by the new
test_asyncio/test_free_threading.py in combination with the runtime
assertion in set_ts_asyncio_running_task.

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
9 months agogh-71339: Use new assertion methods in test_idle (#129213)
Terry Jan Reedy [Thu, 23 Jan 2025 18:25:14 +0000 (13:25 -0500)] 
gh-71339: Use new assertion methods in test_idle (#129213)

Revise 10 tests in 7 files, with 1 test split into 2.

9 months agogh-91048: Improve example in `asyncio-graph.rst` doc (#129224)
sobolevn [Thu, 23 Jan 2025 18:08:51 +0000 (21:08 +0300)] 
gh-91048: Improve example in `asyncio-graph.rst` doc (#129224)

9 months agogh-128330: Terminal control characters should be restored on repl exit (#128331)
Andy Fiddaman [Thu, 23 Jan 2025 17:30:08 +0000 (17:30 +0000)] 
gh-128330: Terminal control characters should be restored on repl exit (#128331)

9 months agogh-128479: fix asyncio staggered race leaking tasks, and logging unhandled exception...
Thomas Grainger [Thu, 23 Jan 2025 15:53:53 +0000 (15:53 +0000)] 
gh-128479: fix asyncio staggered race leaking tasks, and logging unhandled exception.append exception (#128475)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
9 months agogh-126004: Remove redundant safeguards for codecs handlers tests (#127680)
Bénédikt Tran [Thu, 23 Jan 2025 15:06:16 +0000 (16:06 +0100)] 
gh-126004: Remove redundant safeguards for codecs handlers tests (#127680)

We remove the safeguards that were added in `Lib/test/test_capi/test_codecs.py`
since they are now redundant (see 32e07fd377f81cbeb8c108fc791a3e7d631319b6
for additional context).

Indeed, the codecs handlers now correctly handle the `start` and `end` positions
of `UnicodeError` objects and thus should not crash.

9 months agogh-128690: Update test_embed for getpath.py exec_prefix change (#129137)
Victor Stinner [Thu, 23 Jan 2025 14:50:04 +0000 (15:50 +0100)] 
gh-128690: Update test_embed for getpath.py exec_prefix change (#129137)

9 months agogh-118761: Improve import time for `pstats` and `zipfile` (#128981)
Bénédikt Tran [Thu, 23 Jan 2025 14:49:36 +0000 (15:49 +0100)] 
gh-118761: Improve import time for `pstats` and `zipfile` (#128981)

Importing `pstats` or `zipfile` is now roughly 20% faster.

This is achieved by removing type annotations depending on `typing`.

9 months agogh-129149: Add fast path in PYLONG_FROM_UINT macro for compact integers (#129168)
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) [Thu, 23 Jan 2025 14:36:52 +0000 (20:06 +0530)] 
gh-129149: Add fast path in PYLONG_FROM_UINT macro for compact integers (#129168)

Add fast path in PyLong_From*() functions for compact integers.

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
9 months agogh-101410: support custom messages for domain errors in the math module (#124299)
Sergey B Kirpichev [Thu, 23 Jan 2025 13:55:25 +0000 (16:55 +0300)] 
gh-101410: support custom messages for domain errors in the math module (#124299)

This adds basic support to override default messages for domain errors
in the math_1() helper.  The sqrt(), atanh(), log2(), log10() and log()
functions were modified as examples.  New macro supports gradual
changing of error messages in other 1-arg functions.

Co-authored-by: CharlieZhao <zhaoyu_hit@qq.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
9 months agogh-126004: Fix positions handling in `codecs.backslashreplace_errors` (#127676)
Bénédikt Tran [Thu, 23 Jan 2025 13:28:33 +0000 (14:28 +0100)] 
gh-126004: Fix positions handling in `codecs.backslashreplace_errors` (#127676)

This fixes how `PyCodec_BackslashReplaceErrors` handles the `start` and `end`
attributes of `UnicodeError` objects via the `_PyUnicodeError_GetParams` helper.

9 months agogh-128863: Deprecate _PyLong_New() function (#129212)
Sergey B Kirpichev [Thu, 23 Jan 2025 12:50:34 +0000 (15:50 +0300)] 
gh-128863: Deprecate _PyLong_New() function (#129212)

9 months agogh-129185: Remove internal TRACE_RAW_MALLOC macro (#129218)
Victor Stinner [Thu, 23 Jan 2025 12:49:35 +0000 (13:49 +0100)] 
gh-129185: Remove internal TRACE_RAW_MALLOC macro (#129218)

Always build tracemalloc with PyMem_RawMalloc() hooks.

9 months agogh-129185: Fix PyTraceMalloc_Untrack() at Python exit (#129191)
Victor Stinner [Thu, 23 Jan 2025 11:07:34 +0000 (12:07 +0100)] 
gh-129185: Fix PyTraceMalloc_Untrack() at Python exit (#129191)

Support calling PyTraceMalloc_Track() and PyTraceMalloc_Untrack()
during late Python finalization.

* Call _PyTraceMalloc_Fini() later in Python finalization.
* Test also PyTraceMalloc_Untrack() without the GIL
* PyTraceMalloc_Untrack() now gets the GIL.
* Test also PyTraceMalloc_Untrack() in test_tracemalloc_track_race().

9 months agogh-126004: Fix positions handling in `codecs.replace_errors` (#127674)
Bénédikt Tran [Thu, 23 Jan 2025 10:44:18 +0000 (11:44 +0100)] 
gh-126004: Fix positions handling in `codecs.replace_errors` (#127674)

This fixes how `PyCodec_ReplaceErrors` handles the `start` and `end` attributes
of `UnicodeError` objects via the `_PyUnicodeError_GetParams` helper.

9 months agogh-126004: Fix positions handling in `codecs.xmlcharrefreplace_errors` (#127675)
Bénédikt Tran [Thu, 23 Jan 2025 10:42:38 +0000 (11:42 +0100)] 
gh-126004: Fix positions handling in `codecs.xmlcharrefreplace_errors` (#127675)

This fixes how `PyCodec_XMLCharRefReplaceErrors` handles the `start` and `end`
attributes of `UnicodeError` objects via the `_PyUnicodeError_GetParams` helper.

9 months agoRevert "GH-128914: Remove conditional stack effects from `bytecodes.c` and the code...
Sam Gross [Thu, 23 Jan 2025 09:26:25 +0000 (04:26 -0500)] 
Revert "GH-128914: Remove conditional stack effects from `bytecodes.c` and the code generators (GH-128918)" (GH-129202)

The commit introduced a ~2.5-3% regression in the free threading build.

This reverts commit ab61d3f4303d14a413bc9ae6557c730ffdf7579e.

9 months agogh-127936, PEP 757: Convert marshal module to use import/export API for ints (#128530)
Sergey B Kirpichev [Thu, 23 Jan 2025 02:54:23 +0000 (05:54 +0300)] 
gh-127936, PEP 757: Convert marshal module to use import/export API for ints (#128530)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
9 months agogh-128863: Deprecate _PyLong_Sign() function (#129176)
Victor Stinner [Thu, 23 Jan 2025 02:11:53 +0000 (03:11 +0100)] 
gh-128863: Deprecate _PyLong_Sign() function (#129176)

Replace _PyLong_Sign() with PyLong_GetSign().

9 months agogh-119182: Use public PyUnicodeWriter in Python-ast.c (#129209)
Victor Stinner [Thu, 23 Jan 2025 00:57:37 +0000 (01:57 +0100)] 
gh-119182: Use public PyUnicodeWriter in Python-ast.c (#129209)

Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API.

Use PyUnicodeWriter_WriteRepr() in ast_repr_list().

9 months agogh-119182: Use public PyUnicodeWriter in ast_unparse.c (#129208)
Victor Stinner [Thu, 23 Jan 2025 00:44:43 +0000 (01:44 +0100)] 
gh-119182: Use public PyUnicodeWriter in ast_unparse.c (#129208)

Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API.

* Add append_char() function.
* Add APPEND_CHAR() and APPEND_CHAR_FINISH() macros.
* Replace APPEND_STR() and APPEND_STR_FINISH() of single character
  with APPEND_CHAR() and APPEND_CHAR_FINISH().

9 months agogh-119182: Use public PyUnicodeWriter in wrap_strftime() (#129206)
Victor Stinner [Thu, 23 Jan 2025 00:18:26 +0000 (01:18 +0100)] 
gh-119182: Use public PyUnicodeWriter in wrap_strftime() (#129206)

Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API.

9 months agogh-119182: Use public PyUnicodeWriter in time_strftime() (#129207)
Victor Stinner [Thu, 23 Jan 2025 00:18:03 +0000 (01:18 +0100)] 
gh-119182: Use public PyUnicodeWriter in time_strftime() (#129207)

Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API.

9 months agogh-128627: Emscripten: Fix address calculation for wasm-gc trampoline (#128782)
Hood Chatham [Thu, 23 Jan 2025 00:02:04 +0000 (00:02 +0000)] 
gh-128627: Emscripten: Fix address calculation for wasm-gc trampoline (#128782)

Modifies the memory calculation to divide the entire memory address by 4, not just the base address.

9 months agoAdd colour to GitHub Actions output (#129196)
Hugo van Kemenade [Wed, 22 Jan 2025 21:22:21 +0000 (23:22 +0200)] 
Add colour to GitHub Actions output (#129196)

9 months agogh-129192: Use `EnvironmentVarGuard` to restore environment variables (#129193)
Kirill Podoprigora [Wed, 22 Jan 2025 20:39:26 +0000 (22:39 +0200)] 
gh-129192: Use `EnvironmentVarGuard` to restore environment variables (#129193)

Co-authored-by: Cody Maloney <cmaloney@theoreticalchaos.com>
9 months agoGH-91048: Don't attempt to run on FreeBSD (#129189)
Łukasz Langa [Wed, 22 Jan 2025 18:27:58 +0000 (19:27 +0100)] 
GH-91048: Don't attempt to run on FreeBSD (#129189)

9 months agoGH-91048: Add utils for capturing async call stack for asyncio programs and enable...
Yury Selivanov [Wed, 22 Jan 2025 16:25:29 +0000 (08:25 -0800)] 
GH-91048: Add utils for capturing async call stack for asyncio programs and enable profiling (#124640)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
Co-authored-by: Jacob Coffee <jacob@z7x.org>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>