summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_frame.h
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] gh-118934: Make PyEval_GetLocals return borrowed reference ↵Miss Islington (bot)2024-07-181-0/+4
| | | | | | | | | (GH-119769) (#121869) gh-118934: Make PyEval_GetLocals return borrowed reference (GH-119769) (cherry picked from commit e65cb4c6f01a687f451ad9db1600525e1c5832c4) Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com> Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
* [3.13] Fix typos in comments (GH-120481) (#120774)Miss Islington (bot)2024-06-201-1/+1
| | | | | (cherry picked from commit 656a1c81083b76b9d998c983f4329348a65985d3) Co-authored-by: Xie Yanbo <xieyanbo@gmail.com>
* gh-74929: Implement PEP 667 (GH-115153)Tian Gao2024-05-041-8/+5
|
* GH-118095: Use broader specializations of CALL in tier 1, for better tier 2 ↵Mark Shannon2024-05-041-0/+5
| | | | | | | | | | 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-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: Handle `RETURN_GENERATOR` in tier 2 (GH-118180)Mark Shannon2024-04-251-2/+12
|
* gh-117045: Add code object to function version cache (#117028)Guido van Rossum2024-03-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Changes to the function version cache: - In addition to the function object, also store the code object, and allow the latter to be retrieved even if the function has been evicted. - Stop assigning new function versions after a critical attribute (e.g. `__code__`) has been modified; the version is permanently reset to zero in this case. - Changes to `__annotations__` are no longer considered critical. (This fixes gh-109998.) Changes to the Tier 2 optimization machinery: - If we cannot map a function version to a function, but it is still mapped to a code object, we continue projecting the trace. The operand of the `_PUSH_FRAME` and `_POP_FRAME` opcodes can be either NULL, a function object, or a code object with the lowest bit set. This allows us to trace through code that calls an ephemeral function, i.e., a function that may not be alive when we are constructing the executor, e.g. a generator expression or certain nested functions. We will lose globals removal inside such functions, but we can still do other peephole operations (and even possibly [call inlining](https://github.com/python/cpython/pull/116290), if we decide to do it), which only need the code object. As before, if we cannot retrieve the code object from the cache, we stop projecting.
* gh-111354: remove comparisons with enum values, variable reuse, unused ↵Irit Katriel2023-11-091-0/+1
| | | | imports in genobject.c (#111708)
* gh-111354: Simplify _PyGen_yf by moving some of its work to the compiler and ↵Irit Katriel2023-11-031-2/+5
| | | | frame state (#111648)
* gh-109094: replace frame->prev_instr by frame->instr_ptr (#109095)Irit Katriel2023-10-261-16/+6
|
* gh-109094: remove redundant arg to _PyFrame_PushTrampolineUnchecked (GH-110759)Irit Katriel2023-10-121-2/+2
|
* gh-107149: Make PyUnstable_ExecutableKinds public (#108440)Victor Stinner2023-08-311-8/+0
| | | | | | Move PyUnstable_ExecutableKinds and associated macros from the internal C API to the public C API. Rename constants: replace "PY_" prefix with "PyUnstable_" prefix.
* gh-108220: Internal header files require Py_BUILD_CORE to be defined (#108221)Victor Stinner2023-08-211-0/+4
| | | | | | | | | * pycore_intrinsics.h does nothing if included twice (add #ifndef and #define). * Update Tools/cases_generator/generate_cases.py to generate the Py_BUILD_CORE test. * _bz2, _lzma, _opcode and zlib extensions now define the Py_BUILD_CORE_MODULE macro to use internal headers (pycore_code.h, pycore_intrinsics.h and pycore_blocks_output_buffer.h).
* GH-108035: Remove the `_PyCFrame` struct as it is no longer needed for ↵Mark Shannon2023-08-171-1/+1
| | | | performance. (GH-108036)
* gh-106869: Use new PyMemberDef constant names (#106871)Victor Stinner2023-07-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove '#include "structmember.h"'. * If needed, add <stddef.h> to get offsetof() function. * Update Parser/asdl_c.py to regenerate Python/Python-ast.c. * Replace: * T_SHORT => Py_T_SHORT * T_INT => Py_T_INT * T_LONG => Py_T_LONG * T_FLOAT => Py_T_FLOAT * T_DOUBLE => Py_T_DOUBLE * T_STRING => Py_T_STRING * T_OBJECT => _Py_T_OBJECT * T_CHAR => Py_T_CHAR * T_BYTE => Py_T_BYTE * T_UBYTE => Py_T_UBYTE * T_USHORT => Py_T_USHORT * T_UINT => Py_T_UINT * T_ULONG => Py_T_ULONG * T_STRING_INPLACE => Py_T_STRING_INPLACE * T_BOOL => Py_T_BOOL * T_OBJECT_EX => Py_T_OBJECT_EX * T_LONGLONG => Py_T_LONGLONG * T_ULONGLONG => Py_T_ULONGLONG * T_PYSSIZET => Py_T_PYSSIZET * T_NONE => _Py_T_NONE * READONLY => Py_READONLY * PY_AUDIT_READ => Py_AUDIT_READ * READ_RESTRICTED => Py_AUDIT_READ * PY_WRITE_RESTRICTED => _Py_WRITE_RESTRICTED * RESTRICTED => (READ_RESTRICTED | _Py_WRITE_RESTRICTED)
* gh-105340: include hidden fast-locals in locals() (#105715)Carl Meyer2023-07-051-0/+3
| | | * gh-105340: include hidden fast-locals in locals()
* GH-91095: Specialize calls to normal Python classes. (GH-99331)Mark Shannon2023-06-221-0/+24
|
* GH-100987: Allow objects other than code objects as the "executable" of an ↵Mark Shannon2023-06-141-7/+23
| | | | | | | | | | internal frame. (GH-105727) * Add table describing possible executable classes for out-of-process debuggers. * Remove shim code object creation code as it is no longer needed. * Make lltrace a bit more robust w.r.t. non-standard frames.
* Revert "Move observability-relevant structure fields to the top" (#105512)Pablo Galindo Salgado2023-06-081-9/+5
|
* Move observability-relevant structure fields to the top (#105271)Gabriele N. Tornetta2023-06-081-5/+9
|
* GH-103082: Filter LINE events in VM, to simplify tool implementation. ↵Mark Shannon2023-05-121-1/+0
| | | | | | | | (GH-104387) When monitoring LINE events, instrument all instructions that can have a predecessor on a different line. Then check that the a new line has been hit in the instrumentation code. This brings the behavior closer to that of 3.11, simplifying implementation and porting of tools.
* GH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque ↵Mark Shannon2023-05-051-2/+0
| | | | for users of PEP 523. (GH-96849)
* GH-103082: Code cleanup in instrumentation code (#103474)Mark Shannon2023-04-291-3/+3
|
* GH-103488: Use return-offset, not yield-offset. (GH-103502)Mark Shannon2023-04-131-2/+8
| | | | * Use return-offset, not yield-offset, so that instruction pointer is correct when sending to a generator or coroutine.
* GH-103082: Implementation of PEP 669: Low Impact Monitoring for CPython ↵Mark Shannon2023-04-121-1/+8
| | | | | | | | | | (GH-103083) * The majority of the monitoring code is in instrumentation.c * The new instrumentation bytecodes are in bytecodes.c * legacy_tracing.c adapts the new API to the old sys.setrace and sys.setprofile APIs
* GH-100719: Remove redundant `gi_code` field from generator object. (GH-100749)Mark Shannon2023-02-231-1/+1
|
* GH-100987: Refactor `_PyInterpreterFrame` a bit, to assist generator ↵Mark Shannon2023-02-131-4/+2
| | | | | improvement. (GH-100988) Refactor _PyInterpreterFrame a bit, to assist generator improvement.
* GH-100126: Skip incomplete frames in more places (GH-100613)Brandt Bucher2023-01-091-0/+15
|
* gh-100758: Refactor initialisation of frame headers into a single function ↵Irit Katriel2023-01-061-4/+8
| | | | (_PyFrame_Initialize) (GH-100759)
* gh-100720: refactor calculation of number of frame slots for a code object ↵Irit Katriel2023-01-041-1/+10
| | | | into the new function _PyFrame_NumSlotsForCodeObject (#100722)
* gh-99110: Initialize `frame->previous` in init_frame to fix segmentation ↵Bill Fisher2022-12-231-1/+4
| | | | fault when accessing `frame.f_back` (#100182)
* GH-96421: Insert shim frame on entry to interpreter (GH-96319)Mark Shannon2022-11-101-9/+8
| | | | | | * Adds EXIT_INTERPRETER instruction to exit PyEval_EvalDefault() * Simplifies RETURN_VALUE, YIELD_VALUE and RETURN_GENERATOR instructions as they no longer need to check for entry frames.
* GH-96793: Specialize FOR_ITER for generators. (GH-98772)Mark Shannon2022-11-071-0/+2
|
* GH-96569: Add two NULL checks to avoid undefined behavior. (GH-96585)Mark Shannon2022-09-061-2/+7
|
* GH-96237: Allow non-functions as reference-holder in frames. (GH-96238)Mark Shannon2022-08-251-2/+2
|
* GH-94262: Don't create frame objects for frames that aren't yet complete. ↵Mark Shannon2022-07-011-0/+17
| | | | (GH-94371)
* GH-93897: Store frame size in code object and de-opt if insufficient space ↵Mark Shannon2022-06-201-23/+27
| | | | on thread frame stack. (GH-93908)
* GH-89480: Document motivation, design and implementation of 3.11 frame ↵Mark Shannon2022-04-111-0/+8
| | | | stack. (GH-32304)
* bpo-47177: Replace `f_lasti` with `prev_instr` (GH-32208)Brandt Bucher2022-04-071-7/+10
|
* Revert "bpo-44800: Document internal frame naming conventions (GH-32281)" ↵Mark Shannon2022-04-041-69/+0
| | | | | (#32301) This reverts commit 124227c95f310d2ecd4b567271ab1919fc7000cb.
* bpo-44800: Document internal frame naming conventions (GH-32281)Nick Coghlan2022-04-031-0/+69
| | | | | | | | | | The fact interpreter frames were split out from full frame objects rather than always being part of the eval loop implementation means that it's tricky to infer the expected naming conventions simply from looking at the code. Documenting the de facto conventions in pycore_frame.h means future readers of the code will have a clear explanation of the rationale for those conventions (i.e. minimising non-functional code churn).
* bpo-42197: Don't create `f_locals` dictionary unless we actually need it. ↵Mark Shannon2022-03-251-0/+1
| | | | | | | | | | | (GH-32055) * `PyFrame_FastToLocalsWithError` and `PyFrame_LocalsToFast` are no longer called during profile and tracing. (Contributed by Fabio Zadrozny) * Make accesses to a frame's `f_locals` safe from C code, not relying on calls to `PyFrame_FastToLocals` or `PyFrame_LocalsToFast`. * Document new `PyFrame_GetLocals` C-API function.
* bpo-47045: Remove `f_state` field (GH-31963)Mark Shannon2022-03-221-26/+20
| | | | | * Remove the f_state field from _PyInterpreterFrame * Make ownership of the frame explicit, replacing the is_generator field with an owner field.
* bpo-45786: Remove _PyFrame_Fini() and _PyFrame_DebugMallocStats() (GH-31874)Victor Stinner2022-03-181-4/+0
| | | | Remove private empty _PyFrame_Fini() and _PyFrame_DebugMallocStats() functions.
* bpo-45431: Rename CFrame to _PyCFrame in the C API (GH-31584)Victor Stinner2022-02-281-1/+1
| | | | | | Rename also struct _cframe to struct _PyCFrame. Add a comment suggesting using public functions rather than using directly the private _PyCFrame structure.
* bpo-46836: Rename InterpreterFrame to _PyInterpreterFrame (GH-31583)Victor Stinner2022-02-251-29/+29
| | | | | Rename also struct _interpreter_frame to struct _PyInterpreterFrame. Reduce risk of name conflicts if a project includes pycore_frame.h.
* bpo-45316: Move private functions to internal C API (GH-31579)Victor Stinner2022-02-251-0/+2
| | | | | | | | | Move the unexported private functions to the internal C API: * pycore_frame.h: _PyFrame_New_NoTrack() * pycore_function.h: _PyFunction_GetVersionForCurrentState() * pycore_genobject.h: _PyAsyncGenValueWrapperNew() * pycore_genobject.h: _PyCoro_GetAwaitableIter() * pycore_genobject.h: _PyGen_yf()
* bpo-46836: Move PyFrameObject to pycore_frame.h (GH-31530)Victor Stinner2022-02-251-0/+12
| | | | Move the PyFrameObject type definition (struct _frame) to the internal C API pycore_frame.h header file.
* Pass reference to func, as well as args, when pushing frame. (GH-31100)Mark Shannon2022-02-031-4/+2
|
* bpo-46329: Split calls into precall and call instructions. (GH-30855)Mark Shannon2022-01-281-0/+3
| | | | | | | | | | | | | | * Add PRECALL_FUNCTION opcode. * Move 'call shape' varaibles into struct. * Replace CALL_NO_KW and CALL_KW with KW_NAMES and CALL instructions. * Specialize for builtin methods taking using the METH_FASTCALL | METH_KEYWORDS protocol. * Allow kwnames for specialized calls to builtin types. * Specialize calls to tuple(arg) and str(arg).