| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
| |
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`.
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
| |
Keep traceback alive for WITH_EXCEPT_START
|
|
|
|
|
|
|
|
| |
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().
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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'
```
|
|
|
|
| |
The logic of `PyCodec_ReplaceErrors` is now split into separate functions,
each of which handling a specific exception type.
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
`PyCodec_SurrogateEscapeErrors` (GH-129175)
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
| |
into a Python bool (#28634)
|
|
|
| |
Change Py_TAIL_CALL_INTERP ifndef to !
|
| |
|
|
|
| |
Co-authored-by: Zanie Blue <contact@zanie.dev>
|
|
|
|
| |
(GH-129134)
|
|
|
|
| |
CFG. (#130109)
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
(#130032)
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
* Handle escapes in DECREF_INPUTS
* Mark a few more functions as escaping
* Replace DECREF_INPUTS with PyStackRef_CLOSE where possible
|
| |
|
|
|
|
| |
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
|
| |
|
|
|
| |
Disable PGO for ceval.c on MSVC on default build
|
|
|
| |
Revert commit 9e52e55
|
|
|
|
|
| |
sequence construction (#129703)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
|
|
|
|
| |
(GH-129135)
|
|
|
|
| |
(#129700)
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
(gh-129563)
|
|
|
| |
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
|
|
|
|
|
| |
(gh-129738)
The read of `shared->array` should happen under the lock to avoid a race.
|
|
|
|
|
| |
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>
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().
Update tests:
* test_coroutines
* test_exceptions
* test_generators
* test_struct
|
|
|
|
|
|
| |
* Replace PyImport_ImportModule() + PyObject_GetAttr() with
PyImport_ImportModuleAttr().
* Replace PyImport_ImportModule() + PyObject_GetAttrString() with
PyImport_ImportModuleAttrString().
|