summaryrefslogtreecommitdiffstats
path: root/Include
Commit message (Collapse)AuthorAgeFilesLines
* Python 3.14.0a0Thomas Wouters2024-05-081-4/+4
|
* Python 3.13.0b1v3.13.0b1Thomas Wouters2024-05-081-3/+3
|
* gh-116322: Enable the GIL while loading C extension modules (#118560)Brett Simmers2024-05-073-3/+73
| | | | | | | | | | Add the ability to enable/disable the GIL at runtime, and use that in the C module loading code. We can't know before running a module init function if it supports free-threading, so the GIL is temporarily enabled before doing so. If the module declares support for running without the GIL, the GIL is later disabled. Otherwise, the GIL is permanently enabled, and will never be disabled again for the life of the current interpreter.
* gh-112075: use per-thread dict version pool (#118676)Dino Viehland2024-05-072-2/+20
| | | use thread state set of dict versions
* gh-118527: Intern code consts in free-threaded build (#118667)Sam Gross2024-05-073-0/+14
| | | | | | We already intern and immortalize most string constants. In the free-threaded build, other constants can be a source of reference count contention because they are shared by all threads running the same code objects.
* gh-112075: Fix race in constructing dict for instance (#118499)Dino Viehland2024-05-061-1/+1
|
* GH-115709: Invalidate executors when a local variable is changed via ↵Mark Shannon2024-05-061-3/+9
| | | | | frame.f_locals (#118639) Also fix unrelated assert in debug Tier2/JIT builds.
* gh-118362: Fix thread safety around lookups from the type cache in the face ↵Dino Viehland2024-05-067-0/+33
| | | | | | | of concurrent mutators (#118454) Add _PyType_LookupRef and use incref before setting attribute on type Makes setting an attribute on a class and signaling type modified atomic Avoid adding re-entrancy exposing the type cache in an inconsistent state by decrefing after type is updated
* gh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL ↵Petr Viktorin2024-05-061-1/+1
| | | | (GH-118645)
* gh-118465: Add __firstlineno__ attribute to class (GH-118475)Serhiy Storchaka2024-05-064-0/+6
| | | | It is set by compiler with the line number of the first line of the class definition.
* gh-117549: Don't use designated initializers in headers (#118580)Guido van Rossum2024-05-051-2/+7
| | | | | | | The designated initializer syntax in static inline functions in pycore_backoff.h causes problems for C++ or MSVC users who aren't yet using C++20. While internal, pycore_backoff.h is included (indirectly, via pycore_code.h) by some key 3rd party software that does so for speed.
* gh-110850: Remove _PyTime_TimeUnchecked() function (#118552)Victor Stinner2024-05-051-26/+2
| | | | | | | | | | | | | Use the new public Raw functions: * _PyTime_PerfCounterUnchecked() with PyTime_PerfCounterRaw() * _PyTime_TimeUnchecked() with PyTime_TimeRaw() * _PyTime_MonotonicUnchecked() with PyTime_MonotonicRaw() Remove internal functions: * _PyTime_PerfCounterUnchecked() * _PyTime_TimeUnchecked() * _PyTime_MonotonicUnchecked()
* gh-118518: Allow perf to work without frame pointers (#112254)Pablo Galindo Salgado2024-05-052-0/+3
|
* gh-109617: fix ncurses incompatibility on macOS with Xcode 15 (#111258)Davide Rizzo2024-05-041-5/+14
| | | | Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-117953: Track Extra Details in Global Extensions Cache (gh-118532)Eric Snow2024-05-041-1/+11
| | | | | | | | | | | | We have only been tracking each module's PyModuleDef. However, there are some problems with that. For example, in some cases we load single-phase init extension modules from def->m_base.m_init or def->m_base.m_copy, but if multiple modules share a def then we can end up with unexpected behavior. With this change, we track the following: * PyModuleDef (same as before) * for some modules, its init function or a copy of its __dict__, but specific to that module * whether it is a builtin/core module or a "dynamic" extension * the interpreter (ID) that owns the cached __dict__ (only if cached) This also makes it easier to remember the module's kind (e.g. single-phase init) and if loading it previously failed, which I'm doing separately.
* gh-117139: Fix missing semicolon (GH-118573)Ken Jin2024-05-041-1/+1
|
* gh-74929: Implement PEP 667 (GH-115153)Tian Gao2024-05-044-8/+17
|
* GH-118095: Use broader specializations of CALL in tier 1, for better tier 2 ↵Mark Shannon2024-05-045-194/+245
| | | | | | | | | | support of calls. (GH-118322) * Add CALL_PY_GENERAL, CALL_BOUND_METHOD_GENERAL and call CALL_NON_PY_GENERAL specializations. * Remove CALL_PY_WITH_DEFAULTS specialization * Use CALL_NON_PY_GENERAL in more cases when otherwise failing to specialize
* gh-111997: C-API for signalling monitoring events (#116413)Irit Katriel2024-05-044-32/+269
|
* GH-113464: Remove the extra jump via `_SIDE_EXIT` in `_EXIT_TRACE` (GH-118545)Mark Shannon2024-05-042-24/+19
|
* gh-117657: Disable the function/code cache in free-threaded builds (#118301)mpage2024-05-031-0/+7
| | | | This is only used by the specializing interpreter and the tier 2 optimizer, both of which are disabled in free-threaded builds.
* gh-116322: Add Py_mod_gil module slot (#116882)Brett Simmers2024-05-032-1/+18
| | | | | | | | | | | | | | This PR adds the ability to enable the GIL if it was disabled at interpreter startup, and modifies the multi-phase module initialization path to enable the GIL when loading a module, unless that module's spec includes a slot indicating it can run safely without the GIL. PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148. A warning will be issued up to once per interpreter for the first GIL-using module that is loaded. If `-v` is given, a shorter message will be printed to stderr every time a GIL-using module is loaded (including the first one that issues a warning).
* gh-116126: Implement PEP 696 (#116129)Jelle Zijlstra2024-05-034-9/+17
| | | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* gh-116738: Make `_codecs` module thread-safe (#117530)Brett Simmers2024-05-022-4/+33
| | | | | | | | | | | | | | | The module itself is a thin wrapper around calls to functions in `Python/codecs.c`, so that's where the meaningful changes happened: - Move codecs-related state that lives on `PyInterpreterState` to a struct declared in `pycore_codecs.h`. - In free-threaded builds, add a mutex to `codecs_state` to synchronize operations on `search_path`. Because `search_path_mutex` is used as a normal mutex and not a critical section, we must be extremely careful with operations called while holding it. - The codec registry is explicitly initialized as part of `_PyUnicode_InitEncodings` to simplify thread-safety.
* gh-117657: Fix TSAN list set failure (#118260)Dino Viehland2024-05-021-0/+4
| | | | | | | | | | | * Fix TSAN list set failure * Relaxed atomic is sufficient, add targetted test * More list * Remove atomic assign in list * Fixup white space
* gh-93502: Add new C-API functions to trace object creation and destruction ↵Pablo Galindo Salgado2024-05-024-1/+22
| | | | (#115945)
* GH-117442: Check eval-breaker at start (rather than end) of tier 2 loops ↵Mark Shannon2024-05-024-112/+107
| | | | (GH-118482)
* gh-117953: Work Relative to Specific Extension Kinds in the Import Machinery ↵Eric Snow2024-05-011-1/+31
| | | | | (gh-118205) This change will make some later changes simpler.
* GH-118095: Make sure that progress is made if there are pending calls being ↵Mark Shannon2024-05-011-1/+1
| | | | handled. (GH-118484)
* gh-110850: Add PyTime_TimeRaw() function (#118394)Victor Stinner2024-05-011-0/+4
| | | | | | | | | | | | | | | | | Add "Raw" variant of PyTime functions: * PyTime_MonotonicRaw() * PyTime_PerfCounterRaw() * PyTime_TimeRaw() Changes: * Add documentation and tests. Tests release the GIL while calling raw clock functions. * py_get_system_clock() and py_get_monotonic_clock() now check that the GIL is hold by the caller if raise_exc is non-zero. * Reimplement "Unchecked" functions with raw clock functions. Co-authored-by: Petr Viktorin <encukou@gmail.com>
* GH-115802: Use the GHC calling convention in JIT code (GH-118287)Brandt Bucher2024-05-011-0/+1
|
* gh-116767: fix crash on 'async with' with many context managers (GH-118348)Irit Katriel2024-05-011-1/+1
| | | | | | | Account for `add_stopiteration_handler` pushing a block for `async with`. To allow generator functions that previously almost hit the `CO_MAXBLOCKS` limit by nesting non-async blocks, the limit is increased by 1. This increase allows one more block in non-generator functions.
* GH-118095: Make invalidating and clearing executors memory safe (GH-118459)Mark Shannon2024-05-011-1/+2
|
* gh-118335: Configure Tier 2 interpreter at build time (#118339)Guido van Rossum2024-05-012-3/+3
| | | | | | | | | | | | | | | | | | | | | | The code for Tier 2 is now only compiled when configured with `--enable-experimental-jit[=yes|interpreter]`. We drop support for `PYTHON_UOPS` and -`Xuops`, but you can disable the interpreter or JIT at runtime by setting `PYTHON_JIT=0`. You can also build it without enabling it by default using `--enable-experimental-jit=yes-off`; enable with `PYTHON_JIT=1`. On Windows, the `build.bat` script supports `--experimental-jit`, `--experimental-jit-off`, `--experimental-interpreter`. In the C code, `_Py_JIT` is defined as before when the JIT is enabled; the new variable `_Py_TIER2` is defined when the JIT *or* the interpreter is enabled. It is actually a bitmask: 1: JIT; 2: default-off; 4: interpreter.
* gh-117139: Add header for tagged pointers (GH-118330)Ken Jin2024-04-301-0/+195
| | | | | --------- Co-authored-by: Sam Gross <655866+colesbury@users.noreply.github.com>
* gh-118422: Fix run_fileexflags() test (#118429)Victor Stinner2024-04-301-0/+3
| | | | | Don't test the undefined behavior of fileno() on a closed file, but use fstat() as a reliable test if the file was closed or not.
* gh-118124: Use static_assert() in Py_BUILD_ASSERT() on C11 (#118398)Victor Stinner2024-04-301-16/+33
| | | | | | Use static_assert() in Py_BUILD_ASSERT() and Py_BUILD_ASSERT_EXPR() on C11 and newer and C++11 and newer. Add tests to test_cext and test_cppext.
* [gh-117657] Fix some issues with TSAN in typeobject (#118249)Dino Viehland2024-04-301-0/+8
| | | Fix some racing reads in typebobject.c
* gh-118332: Fix deadlock involving stop the world (#118412)Sam Gross2024-04-301-2/+4
| | | | | | Avoid detaching thread state when stopping the world. When re-attaching the thread state, the thread would attempt to resume the top-most critical section, which might now be held by a thread paused for our stop-the-world request.
* gh-117657: Fix small issues with instrumentation and TSAN (#118064)Dino Viehland2024-04-301-2/+9
| | | Small TSAN fixups for instrumentation
* gh-118272: Clear generator frame's locals when the generator is closed (#118277)Irit Katriel2024-04-301-0/+3
| | | Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* GH-118095: Add tier 2 support for YIELD_VALUE (GH-118380)Mark Shannon2024-04-303-0/+6
|
* gh-118331: Handle errors in _PyObject_SetManagedDict (#118334)Sam Gross2024-04-291-1/+1
| | | | | When detaching a dict, the `copy_values` call may fail due to out-of-memory errors. This can be triggered by test_no_memory in test_repl.
* gh-117953: Share More Machinery Code Between Builtin and Dynamic Extensions ↵Eric Snow2024-04-291-0/+3
| | | | | (gh-118204) This change will make some later changes simpler. It also brings more consistent behavior and lower maintenance costs.
* gh-117783: Immortalize objects that use deferred reference counting (#118112)Sam Gross2024-04-291-0/+17
| | | | | | | | | Deferred reference counting is not fully implemented yet. As a temporary measure, we immortalize objects that would use deferred reference counting to avoid multi-threaded scaling bottlenecks. This is only performed in the free-threaded build once the first non-main thread is started. Additionally, some tests, including refleak tests, suppress this behavior.
* gh-117953: Split Up _PyImport_LoadDynamicModuleWithSpec() (gh-118203)Eric Snow2024-04-293-7/+11
| | | | | | | Basically, I've turned most of _PyImport_LoadDynamicModuleWithSpec() into two new functions (_PyImport_GetModInitFunc() and _PyImport_RunModInitFunc()) and moved the rest of it out into _imp_create_dynamic_impl(). There shouldn't be any changes in behavior. This change makes some future changes simpler. This is particularly relevant to potentially calling each module init function in the main interpreter first. Thus the critical part of the PR is the addition of _PyImport_RunModInitFunc(), which is strictly focused on running the init func and validating the result. A later PR will take it a step farther by capturing error information rather than raising exceptions. FWIW, this change also helps readers by clarifying a bit more about what happens when an extension/builtin module is imported.
* GH-118095: Allow a variant of RESUME_CHECK in tier 2 (GH-118286)Mark Shannon2024-04-292-102/+112
|
* gh-110693: Use a Larger Queue for Per-Interpreter Pending Calls (gh-118302)Eric Snow2024-04-271-2/+4
| | | This is an improvement over the status quo, reducing the likelihood of completely filling the pending calls queue. However, the problem won't go away completely unless we move to an unbounded linked list or add a mechanism for waiting until the queue isn't full.
* GH-118095: Add dynamic exit support and FOR_ITER_GEN support to tier 2 ↵Mark Shannon2024-04-263-104/+114
| | | | (GH-118279)
* gh-117657: Fix race data race in `_Py_IsOwnedByCurrentThread()` (#118258)mpage2024-04-261-0/+4
|