aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python
Commit message (Collapse)AuthorAge
* gh-130091: Reorder `_PyThreadState_Attach` to avoid data race (gh-130092)Sam Gross2025-02-27
| | | | | | | | | | | | This moves `tstate_activate()` down to avoid a data race in the free threading build on the `_PyRuntime`'s thread-local `autoTSSkey`. This key is deleted during runtime finalization, which may happen concurrently with a call to `_PyThreadState_Attach`. The earlier `tstate_try/wait_attach` ensures that the thread is blocked before it attempts to access the deleted `autoTSSkey`. This fixes a TSAN reported data race in `test_threading.test_import_from_another_thread`.
* gh-130421: Fix data race on timebase initialization (gh-130592)Sam Gross2025-02-27
| | | | | | Windows and macOS require precomputing a "timebase" in order to convert OS timestamps into nanoseconds. Retrieve and compute this value during runtime initialization to avoid data races when accessing the time.
* GH-128534: Instrument branches for `async for` loops. (GH-130569)Mark Shannon2025-02-27
|
* gh-111178: Fix function signatures in instruction_sequence.c (#130591)Victor Stinner2025-02-26
|
* gh-111178: Fix function signatures in symtable.c (#130589)Victor Stinner2025-02-26
|
* gh-130595: Keep traceback alive for WITH_EXCEPT_START (#130562)Dino Viehland2025-02-26
| | | Keep traceback alive for WITH_EXCEPT_START
* gh-130163: Fix crashes related to PySys_GetObject() (GH-130503)Serhiy Storchaka2025-02-25
| | | | | | | | The use of PySys_GetObject() and _PySys_GetAttr(), which return a borrowed reference, has been replaced by using one of the following functions, which return a strong reference and distinguish a missing attribute from an error: _PySys_GetOptionalAttr(), _PySys_GetOptionalAttrString(), _PySys_GetRequiredAttr(), and _PySys_GetRequiredAttrString().
* gh-122029: Move monitoring after method expand for CALL_KW (GH-130488)Tian Gao2025-02-25
|
* gh-87790: support thousands separators for formatting fractional part of ↵Sergey B Kirpichev2025-02-25
| | | | | | | | | | | | | | floats (#125304) ```pycon >>> f"{123_456.123_456:_._f}" # Whole and fractional '123_456.123_456' >>> f"{123_456.123_456:_f}" # Integer component only '123_456.123456' >>> f"{123_456.123_456:._f}" # Fractional component only '123456.123_456' >>> f"{123_456.123_456:.4_f}" # with precision '123456.1_235' ```
* gh-129173: refactor `PyCodec_ReplaceErrors` into separate functions (#129893)Bénédikt Tran2025-02-25
| | | | The logic of `PyCodec_ReplaceErrors` is now split into separate functions, each of which handling a specific exception type.
* GH-130396: Use computed stack limits on linux (GH-130398)Mark Shannon2025-02-25
| | | | | | | | | | | * Implement C recursion protection with limit pointers for Linux, MacOS and Windows * Remove calls to PyOS_CheckStack * Add stack protection to parser * Make tests more robust to low stacks * Improve error messages for stack overflow
* GH-91079: Revert "GH-91079: Implement C stack limits using addresses, not ↵Petr Viktorin2025-02-24
| | | | | | | | | counters. (GH-130007)" for now (GH130413) Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now Unfortunatlely, the change broke some buildbots. This reverts commit 2498c22fa0a2b560491bc503fa676585c1a603d0.
* gh-128627: Skip wasm-gc on iOS Safari where it's broken (#130418)Łukasz Langa2025-02-24
| | | | | | As of iOS 18.3.1, enabling wasm-gc breaks the interpreter. This disables the wasm-gc trampoline on iOS. Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
* gh-126835: Move constant unaryop & binop folding to CFG (#129550)Yan Yanchii2025-02-21
|
* gh-111924: Fix data races when swapping allocators (gh-130287)Sam Gross2025-02-20
| | | | | | | | | | | | | | | CPython current temporarily changes `PYMEM_DOMAIN_RAW` to the default allocator during initialization and shutdown. The motivation is to ensure that core runtime structures are allocated and freed using the same allocator. However, modifying the current allocator changes global state and is not thread-safe even with the GIL. Other threads may be allocating or freeing objects use PYMEM_DOMAIN_RAW; they are not required to hold the GIL to call PyMem_RawMalloc/PyMem_RawFree. This adds new internal-only functions like `_PyMem_DefaultRawMalloc` that aren't affected by calls to `PyMem_SetAllocator()`, so they're appropriate for Python runtime initialization and finalization. Use these calls in places where we previously swapped to the default raw allocator.
* gh-129173: Use `_PyUnicodeError_GetParams` in ↵Bénédikt Tran2025-02-20
| | | | `PyCodec_SurrogateEscapeErrors` (GH-129175)
* GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)Mark Shannon2025-02-19
| | | | | | | | | | | | * Implement C recursion protection with limit pointers * Remove calls to PyOS_CheckStack * Add stack protection to parser * Make tests more robust to low stacks * Improve error messages for stack overflow
* bpo-45325: Add a new 'p' parameter to Py_BuildValue to convert an integer ↵Pablo Galindo Salgado2025-02-18
| | | | into a Python bool (#28634)
* gh-129989: Change Py_TAIL_CALL_INTERP ifndef to ! (#130269)Ken Jin2025-02-18
| | | Change Py_TAIL_CALL_INTERP ifndef to !
* gh-130139: always check ast node type in ast.parse() with ast input (#130140)Irit Katriel2025-02-16
|
* gh-129989: Properly disable tailcall interp in configure (GH-129991)Ken Jin2025-02-16
| | | Co-authored-by: Zanie Blue <contact@zanie.dev>
* gh-129173: Use `_PyUnicodeError_GetParams` in `PyCodec_SurrogatePassErrors` ↵Bénédikt Tran2025-02-14
| | | | (GH-129134)
* gh-126835: Set location for noped out instructions after constant folding in ↵Yan Yanchii2025-02-14
| | | | CFG. (#130109)
* gh-128130: Fix unhandled keyboard interrupt data race (gh-129975)Sam Gross2025-02-13
| | | | | | | | | | Use an atomic operation when setting `_PyRuntime.signals.unhandled_keyboard_interrupt`. We now only clear the variable at the start of `_PyRun_Main`, which is the same function where we check it. This avoids race conditions where previously another thread might call `run_eval_code_obj()` and erroneously clear the unhandled keyboard interrupt.
* gh-130019: Fix data race in _PyType_AllocNoTrack (gh-130058)Sam Gross2025-02-13
| | | | | | | The reference count fields, such as `ob_tid` and `ob_ref_shared`, may be accessed concurrently in the free threading build by a `_Py_TryXGetRef` or similar operation. The PyObject header fields will be initialized by `_PyObject_Init`, so only call `memset()` to zero-initialize the remainder of the allocation.
* gh-126835: Move const folding of lists & sets from ast_opt.c to flowgraph.c ↵Yan Yanchii2025-02-13
| | | | (#130032)
* gh-130030: Fix crash on 32-bit Linux with free threading (gh-130043)Sam Gross2025-02-12
| | | | | | | | | The `gc_get_refs` assertion needs to be after we check the alive and unreachable bits. Otherwise, `ob_tid` may store the actual thread id instead of the computed `gc_refs`, which may trigger the assertion if the `ob_tid` looks like a negative value. Also fix a few type warnings on 32-bit systems.
* gh-129819: Allow tier2/JIT and tailcall (GH-129820)Ken Jin2025-02-13
|
* GH-129715: Don't project traces that return to an unknown caller (GH-130024)Brandt Bucher2025-02-12
|
* GH-128682: Account for escapes in `DECREF_INPUTS` (GH-129953)Mark Shannon2025-02-12
| | | | | | | | * Handle escapes in DECREF_INPUTS * Mark a few more functions as escaping * Replace DECREF_INPUTS with PyStackRef_CLOSE where possible
* gh-129889: Support context manager protocol by contextvars.Token (#129888)Andrew Svetlov2025-02-12
|
* Update manpage environment variables and command line arguments (#129623)Stefano Rivera2025-02-12
| | | | Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* gh-129244: Only remove the workaround when MSVC has the bugfix (#130011)Michael Droettboom2025-02-11
|
* gh-130004: Disable PGO for ceval.c on MSVC for default build (GH-130009)Ken Jin2025-02-12
| | | Disable PGO for ceval.c on MSVC on default build
* gh-130004: Revert commit 9e52e55 (GH-130005)Ken Jin2025-02-11
| | | Revert commit 9e52e55
* gh-126835: Make CFG optimizer skip over NOP's when looking for const ↵Yan Yanchii2025-02-09
| | | | | sequence construction (#129703) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* gh-129173: Use `_PyUnicodeError_GetParams` in `PyCodec_NameReplaceErrors` ↵Bénédikt Tran2025-02-08
| | | | (GH-129135)
* gh-100239: replace BINARY_SUBSCR & family by BINARY_OP with oparg NB_SUBSCR ↵Irit Katriel2025-02-07
| | | | (#129700)
* GH-129715: Remove _DYNAMIC_EXIT (GH-129716)Brandt Bucher2025-02-07
|
* GH-129709: Clean up tier two (GH-129710)Brandt Bucher2025-02-07
|
* GH-129763: Remove the LLTRACE macro (GH-129764)Brandt Bucher2025-02-07
|
* gh-128563: Move assignment of opcode into ifdef (GH-129803)Ken Jin2025-02-07
|
* gh-129766: Fix crash on calling `warnings._release_lock` with no lock (#129771)sobolevn2025-02-07
|
* gh-129533: Update PyGC_Enable/Disable/IsEnabled to use atomic operation ↵Donghee Na2025-02-07
| | | | (gh-129563)
* gh-128002: use per threads tasks linked list in asyncio (#128869)Kumar Aditya2025-02-06
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-129732: Fix race on `shared->array` in qsbr code under free-threading ↵Peter Hawkins2025-02-06
| | | | | | (gh-129738) The read of `shared->array` should happen under the lock to avoid a race.
* gh-128563: A new tail-calling interpreter (GH-128718)Ken Jin2025-02-06
| | | | | Co-authored-by: Garrett Gu <garrettgu777@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* gh-129201: Use prefetch in GC mark alive phase. (gh-129203)Neil Schemenauer2025-02-05
| | | For the free-threaded version of the cyclic GC, restructure the "mark alive" phase to use software prefetch instructions. This gives a speedup in most cases when the number of objects is large enough. The prefetching is enabled conditionally based on the number of long-lived objects the GC finds.
* gh-129354: Use PyErr_FormatUnraisable() function (#129523)Victor Stinner2025-02-05
| | | | | | | | | | Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable(). Update tests: * test_coroutines * test_exceptions * test_generators * test_struct
* gh-128911: Use PyImport_ImportModuleAttr() function (#129657)Victor Stinner2025-02-05
| | | | | | * Replace PyImport_ImportModule() + PyObject_GetAttr() with PyImport_ImportModuleAttr(). * Replace PyImport_ImportModule() + PyObject_GetAttrString() with PyImport_ImportModuleAttrString().