summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
Commit message (Collapse)AuthorAgeFilesLines
* GH-130396: Work around for broken `pthread_get_stackaddr_np` on Emscripten ↵Hood Chatham2025-03-131-0/+59
| | | | | | (#131088) Implements a workaround implementation of `pthread_get_stackaddr_np` for Emscripten. This will be replaced by an implementation that will be included in Emscripten 4.0.6.
* gh-130382: add missing `_PyReftracerTrack` to ceval `Py_DECREF` (#130689)Tomasz Pytel2025-03-131-0/+1
|
* gh-130396: Fix thread sanitizer crashes on stack overflow tests (gh-130966)Sam Gross2025-03-111-0/+5
| | | | Thread sanitizer will often crash if a test uses more than half the stack.
* GH-127705: Use `_PyStackRef`s in the default build. (GH-127875)Mark Shannon2025-03-101-20/+38
|
* gh-130163: Fix crashes related to PySys_GetObject() (GH-130503)Serhiy Storchaka2025-02-251-1/+7
| | | | | | | | 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-130396: Use computed stack limits on linux (GH-130398)Mark Shannon2025-02-251-32/+106
| | | | | | | | | | | * 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-241-90/+32
| | | | | | | | | 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-91079: Implement C stack limits using addresses, not counters. (GH-130007)Mark Shannon2025-02-191-32/+90
| | | | | | | | | | | | * 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
* gh-129989: Change Py_TAIL_CALL_INTERP ifndef to ! (#130269)Ken Jin2025-02-181-1/+1
| | | Change Py_TAIL_CALL_INTERP ifndef to !
* gh-129989: Properly disable tailcall interp in configure (GH-129991)Ken Jin2025-02-151-4/+4
| | | Co-authored-by: Zanie Blue <contact@zanie.dev>
* GH-128682: Account for escapes in `DECREF_INPUTS` (GH-129953)Mark Shannon2025-02-121-4/+5
| | | | | | | | * Handle escapes in DECREF_INPUTS * Mark a few more functions as escaping * Replace DECREF_INPUTS with PyStackRef_CLOSE where possible
* gh-129244: Only remove the workaround when MSVC has the bugfix (#130011)Michael Droettboom2025-02-111-0/+1
|
* gh-130004: Disable PGO for ceval.c on MSVC for default build (GH-130009)Ken Jin2025-02-111-7/+2
| | | Disable PGO for ceval.c on MSVC on default build
* gh-130004: Revert commit 9e52e55 (GH-130005)Ken Jin2025-02-111-0/+21
| | | Revert commit 9e52e55
* gh-100239: replace BINARY_SUBSCR & family by BINARY_OP with oparg NB_SUBSCR ↵Irit Katriel2025-02-071-0/+1
| | | | (#129700)
* GH-129709: Clean up tier two (GH-129710)Brandt Bucher2025-02-071-33/+1
|
* GH-129763: Remove the LLTRACE macro (GH-129764)Brandt Bucher2025-02-071-7/+2
|
* gh-128563: A new tail-calling interpreter (GH-128718)Ken Jin2025-02-061-5/+18
| | | | | 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-128682: Mark two more macros as escaping. (GH-129645)Mark Shannon2025-02-041-0/+1
| | | Expand out SETLOCAL so that code generator can see the decref. Mark Py_CLEAR as escaping
* GH-128563: Move some labels, to simplify implementing tailcalling ↵Mark Shannon2025-01-311-41/+29
| | | | interpreter. (GH-129525)
* GH-128563: Simplify recursion check in `_PyEval_EvalFrameDefault` (GH-129481)Mark Shannon2025-01-311-6/+5
| | | Simplify recursion check in _PyEval_EvalFrameDefault
* gh-128563: Move labels in ceval.c to bytecodes.c (GH-129112)Ken Jin2025-01-271-134/+0
|
* gh-128799: Add frame of except* to traceback when wrapping a naked exception ↵Irit Katriel2025-01-251-2/+12
| | | | (#128971)
* gh-129244: Remove workaround for MSVC compiler crash (#129263)Michael Droettboom2025-01-251-21/+0
| | | | | * Remove compiler workaround * Remote _Py_USING_PGO
* Remove unused DPRINTF in ceval.c (GH-129282)Chris Eibl2025-01-251-7/+0
| | | remove unused DPRINTF in ceval.c
* GH-128682: Change a couple of functions to only steal references on success. ↵Mark Shannon2025-01-221-1/+6
| | | | | (GH-129132) Change PyTuple_FromStackRefSteal and PyList_FromStackRefSteal to only steal on success to avoid escaping
* gh-128563: Move lltrace into the frame struct (GH-129113)Ken Jin2025-01-211-10/+13
|
* GH-128563: Add new frame owner type for interpreter entry frames (GH-129078)Mark Shannon2025-01-211-5/+5
| | | Add new frame owner type for interpreter entry frames
* gh-128955: Fix goto if tlbc creation fails when throwing into a generator ↵mpage2025-01-171-1/+1
| | | | | | (#128957) We don't have the correct copy of the bytecode and can't update next_instr appropriately, so just unwind.
* gh-128717: Stop-the-world when setting the recursion limit (#128741)Peter Bierma2025-01-121-0/+2
|
* gh-128049: Fix type confusion bug with the return value of a custom ↵Nico-Posada2024-12-201-2/+19
| | | | ExceptionGroup split function (#128079)
* GH-127705: Add debug mode for `_PyStackRef`s inspired by HPy debug mode ↵Mark Shannon2024-12-201-14/+53
| | | | (GH-128121)
* gh-128030: Avoid error from PyModule_GetFilenameObject for non-module (#128047)Shantanu2024-12-201-1/+1
| | | | | I missed the extra `PyModule_Check` in #127660 because I was looking at 3.12 as the base implementation for import from. This meant that I missed the `PyModuleCheck` introduced in #112661.
* GH-126833: Dumps graphviz representation of executor graph. (GH-126880)Mark Shannon2024-12-131-0/+1
|
* gh-127651: Use __file__ in diagnostics if origin is missing (#127660)Shantanu2024-12-101-3/+19
| | | | | | | See the left hand side in https://github.com/python/cpython/pull/123929/files#diff-c22186367cbe20233e843261998dc027ae5f1f8c0d2e778abfa454ae74cc59deL2840-L2849 --------- Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-115999: Specialize `LOAD_SUPER_ATTR` in free-threaded builds (gh-127128)Neil Schemenauer2024-12-031-1/+0
| | | | | | Use existing helpers to atomically modify the bytecode. Add unit tests to ensure specializing is happening as expected. Add test_specialize.py that can be used with ThreadSanitizer to detect data races. Fix thread safety issue with cell_set_contents().
* GH-126491: GC: Mark objects reachable from roots before doing cycle ↵Mark Shannon2024-12-021-0/+1
| | | | | | | | | | | | | collection (GH-127110) * Mark almost all reachable objects before doing collection phase * Add stats for objects marked * Visit new frames before each increment * Update docs * Clearer calculation of work to do.
* gh-127022: Remove `_PyEvalFramePushAndInit_UnTagged` (gh-127168)Sam Gross2024-11-251-31/+4
| | | | | The interpreter now handles `_PyStackRef`s pointing to immortal objects without the deferred bit set, so `_PyEvalFramePushAndInit_UnTagged` is no longer necessary.
* gh-114940: Add _Py_FOR_EACH_TSTATE_UNLOCKED(), and Friends (gh-127077)Eric Snow2024-11-211-1/+2
| | | This is a precursor to the actual fix for gh-114940, where we will change these macros to use the new lock. This change is almost entirely mechanical; the exceptions are the loops in codeobject.c and ceval.c, which now hold the "head" lock. Note that almost all of the uses of _Py_FOR_EACH_TSTATE_UNLOCKED() here will change to _Py_FOR_EACH_TSTATE_BEGIN() once we add the new per-interpreter lock.
* gh-126076: Account for relocated objects in tracemalloc (#126077)Pablo Galindo Salgado2024-11-191-5/+1
|
* Revert "GH-126491: GC: Mark objects reachable from roots before doing cycle ↵Hugo van Kemenade2024-11-191-1/+0
| | | | collection (GH-126502)" (#126983)
* GH-126491: GC: Mark objects reachable from roots before doing cycle ↵Mark Shannon2024-11-181-0/+1
| | | | | | | | | | | | | | | | collection (GH-126502) * Mark almost all reachable objects before doing collection phase * Add stats for objects marked * Visit new frames before each increment * Remove lazy dict tracking * Update docs * Clearer calculation of work to do.
* gh-115999: Implement thread-local bytecode and enable specialization for ↵mpage2024-11-041-4/+19
| | | | | | | | | `BINARY_OP` (#123926) Each thread specializes a thread-local copy of the bytecode, created on the first RESUME, in free-threaded builds. All copies of the bytecode for a code object are stored in the co_tlbc array on the code object. Threads reserve a globally unique index identifying its copy of the bytecode in all co_tlbc arrays at thread creation and release the index at thread destruction. The first entry in every co_tlbc array always points to the "main" copy of the bytecode that is stored at the end of the code object. This ensures that no bytecode is copied for programs that do not use threads. Thread-local bytecode can be disabled at runtime by providing either -X tlbc=0 or PYTHON_TLBC=0. Disabling thread-local bytecode also disables specialization. Concurrent modifications to the bytecode made by the specializing interpreter and instrumentation use atomics, with specialization taking care not to overwrite an instruction that was instrumented concurrently.
* gh-123930: Better error for "from imports" when script shadows module (#123929)Shantanu2024-10-241-47/+103
|
* gh-124218: Avoid refcount contention on builtins module (GH-125847)Sam Gross2024-10-241-2/+4
| | | | | | | This replaces `_PyEval_BuiltinsFromGlobals` with `_PyDict_LoadBuiltinsFromGlobals`, which returns a new reference instead of a borrowed reference. Internally, the new function uses per-thread reference counting when possible to avoid contention on the refcount fields on the builtins module.
* gh-125703: Correctly honour tracemalloc hooks on more PyDECREF specialized ↵Pablo Galindo Salgado2024-10-211-0/+5
| | | | paths (#125712)
* gh-125604: Move _Py_AuditHookEntry, etc. Out of pycore_runtime.h (gh-125605)Eric Snow2024-10-181-1/+1
| | | | | | | | | | | | This is essentially a cleanup, moving a handful of API declarations to the header files where they fit best, creating new ones when needed. We do the following: * add pycore_debug_offsets.h and move _Py_DebugOffsets, etc. there * inline struct _getargs_runtime_state and struct _gilstate_runtime_state in _PyRuntimeState * move struct _reftracer_runtime_state to the existing pycore_object_state.h * add pycore_audit.h and move to it _Py_AuditHookEntry , _PySys_Audit(), and _PySys_ClearAuditHooks * add audit.h and cpython/audit.h and move the existing audit-related API there *move the perfmap/trampoline API from cpython/sysmodule.h to cpython/ceval.h, and remove the now-empty cpython/sysmodule.h
* gh-123153: Fix PGO builds with free-threading on Windows (#125607)Michael Droettboom2024-10-171-6/+14
| | | | | * gh-123153: Fix PGO builds with free-threading * Redo how the #define works
* gh-125217: Turn off optimization around_PyEval_EvalFrameDefault to avoid ↵Michael Droettboom2024-10-161-0/+14
| | | | MSVC crash (#125477)
* gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_STR) (#125194)Victor Stinner2024-10-091-1/+1
| | | | | Replace PyUnicode_New(0, 0), PyUnicode_FromString("") and PyUnicode_FromStringAndSize("", 0) with Py_GetConstant(Py_CONSTANT_EMPTY_STR).