125207 Commits

Author SHA1 Message Date
Pablo Galindo Salgado
3a3a6b86f4
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>
2025-01-24 21:36:32 +01:00
Kumar Aditya
e635bf2e49
gh-128002: fix test_all_tasks_different_thread in asyncio (#129267) 2025-01-24 23:10:24 +05:30
Serhiy Storchaka
7907203bc0
Improve tests for _colorize.can_colorize() (#129234)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-01-24 18:33:40 +02:00
Kumar Aditya
8e0b36006c
gh-128002: use _PyObject_SetMaybeWeakref when creating tasks in asyncio (#128885) 2025-01-24 21:12:56 +05:30
Victor Stinner
fc6bc1e4e3
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.
2025-01-24 14:29:36 +01:00
Sergey B Kirpichev
233fd00f0a
gh-128863: Deprecate _PyLong_FromDigits() function (#127939) 2025-01-24 13:17:10 +01:00
Sergey B Kirpichev
3d8fc8b9ae
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>
2025-01-24 11:05:52 +00:00
Victor Stinner
6e63c4736b
gh-119182: Use public PyUnicodeWriter in _json.c (#129249)
Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API.
2025-01-24 11:38:13 +01:00
Victor Stinner
c005ea4951
gh-129185: Use PyMutex in tracemalloc (#129246) 2025-01-24 11:25:24 +01:00
Bénédikt Tran
36bb229933
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.
2025-01-24 11:25:03 +01:00
Victor Stinner
732670d93b
gh-119182: Use public PyUnicodeWriter in stringio.c (#129243)
Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API.
2025-01-23 23:31:49 +00:00
Jeong, YunWon
bab8918f9a
gh-109975: Add list of 3.13 removed library replacements (#127816)
Add list of 3.13 removed library replacements
2025-01-23 22:20:40 +01:00
Łukasz Langa
fc3d400165
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>
2025-01-23 19:26:36 +01:00
Terry Jan Reedy
dbb25ce037
gh-71339: Use new assertion methods in test_idle (#129213)
Revise 10 tests in 7 files, with 1 test split into 2.
2025-01-23 13:25:14 -05:00
sobolevn
c05a851ac5
gh-91048: Improve example in asyncio-graph.rst doc (#129224) 2025-01-23 23:38:51 +05:30
Andy Fiddaman
0b15d9c0d2
gh-128330: Terminal control characters should be restored on repl exit (#128331) 2025-01-23 17:30:08 +00:00
Thomas Grainger
ec91e1c276
gh-128479: fix asyncio staggered race leaking tasks, and logging unhandled exception.append exception (#128475)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-01-23 16:53:53 +01:00
Bénédikt Tran
cf0b2da1e6
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.
2025-01-23 16:06:16 +01:00
Victor Stinner
b23b27bc55
gh-128690: Update test_embed for getpath.py exec_prefix change (#129137) 2025-01-23 15:50:04 +01:00
Bénédikt Tran
a95dca7b98
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`.
2025-01-23 14:49:36 +00:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)
ab353b31bb
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>
2025-01-23 14:36:52 +00:00
Sergey B Kirpichev
75f59bb629
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>
2025-01-23 13:55:25 +00:00
Bénédikt Tran
25a614a502
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.
2025-01-23 14:28:33 +01:00
Sergey B Kirpichev
5c9a63f62c
gh-128863: Deprecate _PyLong_New() function (#129212) 2025-01-23 13:50:34 +01:00
Victor Stinner
e579cdb21e
gh-129185: Remove internal TRACE_RAW_MALLOC macro (#129218)
Always build tracemalloc with PyMem_RawMalloc() hooks.
2025-01-23 13:49:35 +01:00
Victor Stinner
46c7e13c05
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().
2025-01-23 12:07:34 +01:00
Bénédikt Tran
225296cd5b
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.
2025-01-23 11:44:18 +01:00
Bénédikt Tran
70dcc847df
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.
2025-01-23 11:42:38 +01:00
Sam Gross
a10f99375e
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.
2025-01-23 09:26:25 +00:00
Sergey B Kirpichev
d7d066c3ab
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>
2025-01-23 02:54:23 +00:00
Victor Stinner
1d485db953
gh-128863: Deprecate _PyLong_Sign() function (#129176)
Replace _PyLong_Sign() with PyLong_GetSign().
2025-01-23 03:11:53 +01:00
Victor Stinner
0093a31273
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().
2025-01-23 00:57:37 +00:00
Victor Stinner
8eb9e76b5b
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().
2025-01-23 01:44:43 +01:00
Victor Stinner
327a257e6a
gh-119182: Use public PyUnicodeWriter in wrap_strftime() (#129206)
Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API.
2025-01-23 01:18:26 +01:00
Victor Stinner
719c9dd72f
gh-119182: Use public PyUnicodeWriter in time_strftime() (#129207)
Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API.
2025-01-23 01:18:03 +01:00
Hood Chatham
960936fe90
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.
2025-01-23 08:02:04 +08:00
Hugo van Kemenade
298dda5770
Add colour to GitHub Actions output (#129196) 2025-01-22 21:22:21 +00:00
Kirill Podoprigora
fc6d4b71eb
gh-129192: Use EnvironmentVarGuard to restore environment variables (#129193)
Co-authored-by: Cody Maloney <cmaloney@theoreticalchaos.com>
2025-01-22 20:39:26 +00:00
Łukasz Langa
67d804b494
GH-91048: Don't attempt to run on FreeBSD (#129189) 2025-01-22 19:27:58 +01:00
Yury Selivanov
188598851d
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>
2025-01-22 17:25:29 +01:00
Pablo Galindo Salgado
60a3a0dd6f
gh-124363: Treat debug expressions in f-string as raw strings (#128399)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2025-01-22 16:24:54 +00:00
Tomas R.
ba9a4b6215
gh-128636: Fix crash in PyREPL when os.environ is overwritten with an invalid value (#128653) 2025-01-22 16:15:23 +00:00
Łukasz Langa
2ed5ee9a50
gh-129158: Fix unwanted trailing whitespace in test_asyncio.test_subprocess (#129181) 2025-01-22 13:52:45 +00:00
Mikhail Efimov
8e20e42cc6
gh-125723: Fix crash with f_locals when generator frame outlive their generator (#126956)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2025-01-22 15:50:01 +03:00
Thomas Grainger
24c84d816f
gh-128770: fix ResourceWarning in test_pyrepl (#128906) 2025-01-22 12:48:33 +00:00
sobolevn
a16ded10ad
gh-128894: Fix TracebackException._format_syntax_error on custom SyntaxError metadata (#128946) 2025-01-22 12:47:03 +00:00
Pablo Galindo Salgado
a9f5edbf5f
gh-129158: Ensure we restore unix_events.can_use_pidfd after SubprocessThreadedWatcherTests finishes (#129160) 2025-01-22 12:25:42 +00:00
Victor Stinner
9012fa741d
gh-128863: Deprecate private C API functions (#128864)
Deprecate private C API functions:

* _PyBytes_Join()
* _PyDict_GetItemStringWithError()
* _PyDict_Pop()
* _PyThreadState_UncheckedGet()
* _PyUnicode_AsString()
* _Py_HashPointer()
* _Py_fopen_obj()

Replace _Py_HashPointer() with Py_HashPointer().

Remove references to deprecated functions.
2025-01-22 11:04:19 +00:00
Mark Shannon
470a0a68eb
GH-128682: Change a couple of functions to only steal references on success. (GH-129132)
Change PyTuple_FromStackRefSteal and PyList_FromStackRefSteal to only steal on success to avoid escaping
2025-01-22 10:51:37 +00:00
Petr Viktorin
a65f802692
gh-61103: Add What's New entry for complex types in ctypes (GH-129129)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-01-22 10:59:20 +01:00