summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
...
* GH-112354: Initial implementation of warm up on exits and trace-stitching ↵Mark Shannon2024-02-2011-135/+580
| | | | (GH-114142)
* gh-96497: Mangle name before symtable lookup in ↵wookie1842024-02-171-4/+10
| | | | 'symtable_extend_namedexpr_scope' (GH-96561)
* gh-115103: Implement delayed memory reclamation (QSBR) (#115180)Sam Gross2024-02-163-0/+323
| | | | | | This adds a safe memory reclamation scheme based on FreeBSD's "GUS" and quiescent state based reclamation (QSBR). The API provides a mechanism for callers to detect when it is safe to free memory that may be concurrently accessed by readers.
* gh-115480: Type / constant propagation for float binary uops (GH-115550)Peter Lazorchak2024-02-162-6/+117
| | | Co-authored-by: Ken Jin <kenjin@python.org>
* gh-112529: Make the GC scheduling thread-safe (#114880)Sam Gross2024-02-161-15/+48
| | | | | | | | | | The GC keeps track of the number of allocations (less deallocations) since the last GC. This buffers the count in thread-local state and uses atomic operations to modify the per-interpreter count. The thread-local buffering avoids contention on shared state. A consequence is that the GC scheduling is not as precise, so "test_sneaky_frame_object" is skipped because it requires that the GC be run exactly after allocating a frame object.
* gh-115480: Minor fixups in int constant propagation (GH-115507)Ken Jin2024-02-163-132/+59
|
* gh-115503: Fix `run_presite` error handling (#115504)Nikita Sobolev2024-02-161-1/+0
|
* gh-111968: Split _Py_dictkeys_freelist out of _Py_dict_freelist (gh-115505)Donghee Na2024-02-162-16/+16
|
* gh-113743: Use per-interpreter locks for types (#115541)Dino Viehland2024-02-161-1/+1
| | | Move type-lock to per-interpreter lock to avoid heavy contention in interpreters test
* gh-113743: Make the MRO cache thread-safe in free-threaded builds (#113930)Dino Viehland2024-02-152-0/+74
| | | | | | | Makes _PyType_Lookup thread safe, including: Thread safety of the underlying cache. Make mutation of mro and type members thread safe Also _PyType_GetMRO and _PyType_GetBases are currently returning borrowed references which aren't safe.
* gh-115420: Fix translation of exception hander targets by ↵Irit Katriel2024-02-151-1/+1
| | | | _testinternalcapi.optimize_cfg. (#115425)
* gh-115376: fix segfault in _testinternalcapi.compiler_codegen on bad input ↵Irit Katriel2024-02-151-14/+28
| | | | (#115379)
* gh-115124: Use _PyObject_ASSERT() in gc.c (#115125)Victor Stinner2024-02-151-15/+22
| | | | Replace assert() with _PyObject_ASSERT() in gc.c to dump the object when an assertion fails.
* gh-115347: avoid emitting redundant NOP for the docstring with -OO (#115494)Irit Katriel2024-02-151-18/+20
|
* gh-114626: add PyCFunctionFast and PyCFunctionFastWithKeywords (GH-114627)David Hewitt2024-02-153-21/+21
| | | Co-authored-by: Petr Viktorin <encukou@gmail.com>
* gh-115480: Type and constant propagation for int BINARY_OPs (GH-115478)Ken Jin2024-02-153-16/+126
|
* gh-115482: Assume the Main Interpreter is Always Running "main" (gh-115484)Eric Snow2024-02-141-1/+8
| | | | | This is a temporary fix to unblock embedders that do not call Py_Main(). _PyInterpreterState_IsRunningMain() will always return true for the main interpreter, even in corner cases where it technically should not. The (future) full solution will do the right thing in those corner cases.
* gh-112087: Make __sizeof__ and listiter_{len, next} to be threadsafe (gh-114843)Donghee Na2024-02-143-6/+10
|
* gh-111968: Rename freelist related struct names to Eric's suggestion (gh-115329)Donghee Na2024-02-146-39/+39
|
* gh-76785: Improved Subinterpreters Compatibility with 3.12 (gh-115424)Eric Snow2024-02-133-665/+729
| | | | | For the most part, these changes make is substantially easier to backport subinterpreter-related code to 3.12, especially the related modules (e.g. _xxsubinterpreters). The main motivation is to support releasing a PyPI package with the 3.13 capabilities compiled for 3.12. A lot of the changes here involve either hiding details behind macros/functions or splitting up some files.
* GH-113710: Improve `_SET_IP` and `_CHECK_VALIDITY` (GH-115248)Mark Shannon2024-02-135-33/+74
|
* GH-113710: Backedge counter improvements. (GH-115166)Mark Shannon2024-02-135-50/+70
|
* gh-114058: Foundations of the Tier2 redundancy eliminator (GH-115085)Ken Jin2024-02-138-76/+2495
| | | | | | | --------- Co-authored-by: Mark Shannon <9448417+markshannon@users.noreply.github.com> Co-authored-by: Jules <57632293+JuliaPoo@users.noreply.github.com> Co-authored-by: Guido van Rossum <gvanrossum@users.noreply.github.com>
* gh-110850: Add PyTime_t C API (GH-115215)Petr Viktorin2024-02-121-32/+70
| | | | | | | | | | | | * gh-110850: Add PyTime_t C API Add PyTime_t API: * PyTime_t type. * PyTime_MIN and PyTime_MAX constants. * PyTime_AsSecondsDouble(), PyTime_Monotonic(), PyTime_PerfCounter() and PyTime_GetSystemClock() functions. Co-authored-by: Victor Stinner <vstinner@python.org>
* GH-113710: Fix updating of dict version tag and add watched dict stats ↵Mark Shannon2024-02-123-20/+15
| | | | (GH-115221)
* GH-114695: Add `sys._clear_internal_caches` (GH-115152)Brandt Bucher2024-02-125-65/+84
|
* gh-115011: Improve support of __index__() in setters of members with ↵Serhiy Storchaka2024-02-111-37/+44
| | | | | | | | | | | | | | unsigned integer type (GH-115029) Setters for members with an unsigned integer type now support the same range of valid values for objects that has a __index__() method as for int. Previously, Py_T_UINT, Py_T_ULONG and Py_T_ULLONG did not support objects that has a __index__() method larger than LONG_MAX. Py_T_ULLONG did not support negative ints. Now it supports them and emits a RuntimeWarning.
* gh-76763: Make chr() always raising ValueError for out-of-range values ↵Serhiy Storchaka2024-02-102-24/+22
| | | | | | (GH-114882) Previously it raised OverflowError for very large or very small values.
* gh-111968: Refactor _PyXXX_Fini to integrate with _PyObject_ClearFreeLists ↵Donghee Na2024-02-105-37/+9
| | | | (gh-114899)
* gh-110481: Implement inter-thread queue for biased reference counting (#114824)Sam Gross2024-02-095-2/+282
| | | | | | | | | Biased reference counting maintains two refcount fields in each object: `ob_ref_local` and `ob_ref_shared`. The true refcount is the sum of these two fields. In some cases, when refcounting operations are split across threads, the ob_ref_shared field can be negative (although the total refcount must be at least zero). In this case, the thread that decremented the refcount requests that the owning thread give up ownership and merge the refcount fields.
* gh-107944: Improve error message for getargs with bad keyword arguments ↵Shantanu2024-02-081-12/+58
| | | | (#114792)
* gh-112066: Use `PyDict_SetDefaultRef` in place of `PyDict_SetDefault`. (#112211)Sam Gross2024-02-071-12/+17
| | | | | This changes a number of internal usages of `PyDict_SetDefault` to use `PyDict_SetDefaultRef`. Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-114828: Fix __class__ in class-scope inlined comprehensions (#115139)Carl Meyer2024-02-071-0/+19
|
* GH-108362: Revert "GH-108362: Incremental GC implementation (GH-108038)" ↵Mark Shannon2024-02-073-531/+322
| | | | | | | (#115132) Revert "GH-108362: Incremental GC implementation (GH-108038)" This reverts commit 36518e69d74607e5f094ce55286188e4545a947d.
* gh-115035: Mark ThreadHandles as non-joinable earlier after forking (#115042)Sam Gross2024-02-063-14/+2
| | | | | | This marks dead ThreadHandles as non-joinable earlier in `PyOS_AfterFork_Child()` before we execute any Python code. The handles are stored in a global linked list in `_PyRuntimeState` because `fork()` affects the entire process.
* gh-114944: Fix race between `_PyParkingLot_Park` and ↵mpage2024-02-051-2/+2
| | | | | | | | | | | | | | | | | | | | | `_PyParkingLot_UnparkAll` when handling interrupts (#114945) Fix race between `_PyParkingLot_Park` and `_PyParkingLot_UnparkAll` when handling interrupts There is a potential race when `_PyParkingLot_UnparkAll` is executing in one thread and another thread is unblocked because of an interrupt in `_PyParkingLot_Park`. Consider the following scenario: 1. Thread T0 is blocked[^1] in `_PyParkingLot_Park` on address `A`. 2. Thread T1 executes `_PyParkingLot_UnparkAll` on address `A`. It finds the `wait_entry` for `T0` and unlinks[^2] its list node. 3. Immediately after (2), T0 is woken up due to an interrupt. It then segfaults trying to unlink[^3] the node that was previously unlinked in (2). To fix this we mark each waiter as unparking before releasing the bucket lock. `_PyParkingLot_Park` will wait to handle the coming wakeup, and not attempt to unlink the node, when this field is set. `_PyParkingLot_Unpark` does this already, presumably to handle this case.
* GH-108362: Incremental GC implementation (GH-108038)Mark Shannon2024-02-053-322/+531
|
* gh-114388: Fix an error in GH-114391 (GH-115000)Serhiy Storchaka2024-02-041-0/+2
|
* gh-114388: Fix warnings when assign an unsigned integer member (GH-114391)Serhiy Storchaka2024-02-041-28/+55
| | | | | | | * Fix a RuntimeWarning emitted when assign an integer-like value that is not an instance of int to an attribute that corresponds to a C struct member of type T_UINT and T_ULONG. * Fix a double RuntimeWarning emitted when assign a negative integer value to an attribute that corresponds to a C struct member of type T_UINT.
* gh-111417: Remove unused code block in math.trunc() and round() (GH-111454)Jason Zhang2024-02-031-5/+0
| | | _PyObject_LookupSpecial() now ensures that the type is ready.
* gh-104530: Enable native Win32 condition variables by default (GH-104531)Andrew Rogers2024-02-024-30/+35
|
* GH-113710: Add a "globals to constants" pass (GH-114592)Mark Shannon2024-02-025-37/+333
| | | Converts specializations of `LOAD_GLOBAL` into constants during tier 2 optimization.
* gh-107901: make compiler inline basic blocks with no line number and no ↵Irit Katriel2024-02-021-21/+54
| | | | fallthrough (#114750)
* gh-111968: Use per-thread freelists for dict in free-threading (gh-114323)Donghee Na2024-02-014-4/+7
|
* gh-112529: Remove PyGC_Head from object pre-header in free-threaded build ↵Sam Gross2024-02-012-6/+25
| | | | | | | | | | | | | | | | | (#114564) * gh-112529: Remove PyGC_Head from object pre-header in free-threaded build This avoids allocating space for PyGC_Head in the free-threaded build. The GC implementation for free-threaded CPython does not use the PyGC_Head structure. * The trashcan mechanism uses the `ob_tid` field instead of `_gc_prev` in the free-threaded build. * The GDB libpython.py file now determines the offset of the managed dict field based on whether the running process is a free-threaded build. Those are identified by the `ob_ref_local` field in PyObject. * Fixes `_PySys_GetSizeOf()` which incorrectly incorrectly included the size of `PyGC_Head` in the size of static `PyTypeObject`.
* GH-114806. Don't specialize calls to classes with metaclasses. (GH-114870)Mark Shannon2024-02-011-0/+5
|
* Remove unused Py_XDECREF from _PyFrame_ClearExceptCode (GH-106158)Anders Kaseorg2024-02-011-1/+0
| | | | | | frame->frame_obj was set to NULL a few lines earlier. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
* gh-114746: Avoid quadratic behavior in free-threaded GC (GH-114817)Sam Gross2024-02-011-73/+29
| | | | | | | | | | | | | | The free-threaded build's GC implementation is non-generational, but was scheduled as if it were collecting a young generation leading to quadratic behavior. This increases the minimum threshold and scales it to the number of live objects as we do for the old generation in the default build. Note that the scheduling is still not thread-safe without the GIL. Those changes will come in later PRs. A few tests, like "test_sneaky_frame_object" rely on prompt scheduling of the GC. For now, to keep that test passing, we disable the scaled threshold after calls like `gc.set_threshold(1, 0, 0)`.
* gh-112606: Use pthread_cond_timedwait_relative_np() in parking_lot.c when ↵Matt Prodani2024-01-301-1/+5
| | | | | | | available (#112616) Add a configure define for HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP and replaces pthread_cond_timedwait() with pthread_cond_timedwait_relative_np() for relative time when supported in semaphore waiting logic.
* gh-103323: Remove current_fast_get() unused parameter (#114593)Victor Stinner2024-01-301-26/+24
| | | | The current_fast_get() static inline function doesn't use its 'runtime' parameter, so just remove it.