summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* gh-115727: Reduce confidence even on 100% predicted jumps (#115748)Guido van Rossum2024-02-221-7/+13
| | | | | | | | The theory is that even if we saw a jump go in the same direction the last 16 times we got there, we shouldn't be overly confident that it's still going to go the same way in the future. This PR makes it so that in the extreme cases, the confidence is multiplied by 0.9 instead of remaining unchanged. For unpredictable jumps, there is no difference (still 0.5). For somewhat predictable jumps, we interpolate.
* GH-115651: Convert `LOAD_MODULE_ATTR` into `LOAD_INLINE_CONST` when the ↵Mark Shannon2024-02-226-95/+182
| | | | module is itself a constant. (GH-115711)
* gh-115796: fix exception table construction in ↵Irit Katriel2024-02-221-6/+11
| | | | _testinternalcapi.assemble_code_object (#115797)
* gh-110850: Cleanup PyTime API: PyTime_t are nanoseconds (#115753)Victor Stinner2024-02-214-59/+26
| | | | | | | | | | PyTime_t no longer uses an arbitrary unit, it's always a number of nanoseconds (64-bit signed integer). * Rename _PyTime_FromNanosecondsObject() to _PyTime_FromLong(). * Rename _PyTime_AsNanosecondsObject() to _PyTime_AsLong(). * Remove pytime_from_nanoseconds(). * Remove pytime_as_nanoseconds(). * Remove _PyTime_FromNanoseconds().
* gh-110850: Replace private _PyTime_MAX with public PyTime_MAX (#115751)Victor Stinner2024-02-211-2/+2
| | | | | | | Remove references to the old names _PyTime_MIN and _PyTime_MAX, now that PyTime_MIN and PyTime_MAX are public. Replace also _PyTime_MIN with PyTime_MIN.
* Delete unused sym_clear_flag function. (#115744)Benjamin Peterson2024-02-211-6/+0
|
* gh-110850: Use public PyTime functions (#115746)Victor Stinner2024-02-202-2/+2
| | | | | Replace private _PyTime functions with public PyTime functions. random_seed_time_pid() now reports errors to its caller.
* gh-110850: Rename internal PyTime C API functions (#115734)Victor Stinner2024-02-208-32/+30
| | | | | | | | | | | | | | | | | Rename functions: * _PyTime_GetSystemClock() => _PyTime_TimeUnchecked() * _PyTime_GetPerfCounter() => _PyTime_PerfCounterUnchecked() * _PyTime_GetMonotonicClock() => _PyTime_MonotonicUnchecked() * _PyTime_GetSystemClockWithInfo() => _PyTime_TimeWithInfo() * _PyTime_GetMonotonicClockWithInfo() => _PyTime_MonotonicWithInfo() * _PyTime_GetMonotonicClockWithInfo() => _PyTime_MonotonicWithInfo() Changes: * Remove "typedef PyTime_t PyTime_t;" which was "typedef PyTime_t _PyTime_t;" before a previous rename. * Update comments of "Unchecked" functions. * Remove invalid PyTime_Time() comment.
* Tier 2 cleanups and tweaks (#115534)Guido van Rossum2024-02-204-44/+109
| | | | | | | | | * Rename `_testinternalcapi.get_{uop,counter}_optimizer` to `new_*_optimizer` * Use `_PyUOpName()` instead of` _PyOpcode_uop_name[]` * Add `target` to executor iterator items -- `list(ex)` now returns `(opcode, oparg, target, operand)` quadruples * Add executor methods `get_opcode()` and `get_oparg()` to get `vmdata.opcode`, `vmdata.oparg` * Define a helper for printing uops, and unify various places where they are printed * Add a hack to summarize_stats.py to fix legacy uop names (e.g. `POP_TOP` -> `_POP_TOP`) * Define helpers in `test_opt.py` for accessing the set or list of opnames of an executor
* gh-115733: Fix crash involving exhausted list iterator (#115740)Sam Gross2024-02-203-2/+4
| | | | | * gh-115733: Fix crash involving exhausted iterator * Add blurb
* gh-115735: Fix current executor NULL before _START_EXECUTOR (#115736)Ken Jin2024-02-201-2/+2
| | | This fixes level 3 or higher lltrace debug output `--with-pydebug` runs.
* gh-115103: Implement delayed free mechanism for free-threaded builds (#115367)Sam Gross2024-02-202-0/+9
| | | | | | This adds `_PyMem_FreeDelayed()` and supporting functions. The `_PyMem_FreeDelayed()` function frees memory with the same allocator as `PyMem_Free()`, but after some delay to ensure that concurrent lock-free readers have finished.
* gh-110850: Cleanup pycore_time.h includes (#115724)Victor Stinner2024-02-207-8/+15
| | | | | <pycore_time.h> include is no longer needed to get the PyTime_t type in internal header files. This type is now provided by <Python.h> include. Add <pycore_time.h> includes to C files instead.
* gh-115491: Keep some fields valid across allocations (free-threading) (#115573)Sam Gross2024-02-201-0/+15
| | | | | This avoids filling the memory occupied by ob_tid, ob_ref_local, and ob_ref_shared with debug bytes (e.g., 0xDD) in mimalloc in the free-threaded build.
* gh-110850: Replace _PyTime_t with PyTime_t (#115719)Victor Stinner2024-02-2010-182/+182
| | | | | Run command: sed -i -e 's!\<_PyTime_t\>!PyTime_t!g' $(find -name "*.c" -o -name "*.h")
* gh-112175: Add `eval_breaker` to `PyThreadState` (#115194)Brett Simmers2024-02-2012-130/+218
| | | | | | | | | | | This change adds an `eval_breaker` field to `PyThreadState`. The primary motivation is for performance in free-threaded builds: with thread-local eval breakers, we can stop a specific thread (e.g., for an async exception) without interrupting other threads. The source of truth for the global instrumentation version is stored in the `instrumentation_version` field in PyInterpreterState. Threads usually read the version from their local `eval_breaker`, where it continues to be colocated with the eval breaker bits.
* gh-110850: PyTime_Time() return 0 on success (GH-115713)Victor Stinner2024-02-201-1/+1
| | | Thanks!
* gh-115687: Split up guards from COMPARE_OP (GH-115688)Ken Jin2024-02-205-55/+88
|
* GH-115457: Support splitting and replication of micro ops. (GH-115558)Mark Shannon2024-02-206-51/+422
|
* 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)