summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] GH-108390: Prevent non-local events being set with ↵Mark Shannon2023-09-051-15/+17
| | | | | | | | | | | `sys.monitoring.set_local_events()` (GH-108420) (#108899) * GH-108390: Prevent non-local events being set with `sys.monitoring.set_local_events()` (GH-108420) * Restore generated objects * Restore size of monitoring arrays in code object for 3.12 ABI compatibility. * Update ABI file
* [3.12] GH-107724: Fix the signature of `PY_THROW` callback functions. ↵Miss Islington (bot)2023-08-111-1/+1
| | | | | | | | (GH-107725) (#107802) GH-107724: Fix the signature of `PY_THROW` callback functions. (GH-107725) (cherry picked from commit 52fbcf61b5a70993c2d32332ff0ad9f369d968d3) Co-authored-by: Mark Shannon <mark@hotpy.org>
* [3.12] GH-107263: Increase C stack limit for most functions, except ↵Miss Islington (bot)2023-08-041-1/+7
| | | | | | | | | | `_PyEval_EvalFrameDefault()` (GH-107535) (#107618) GH-107263: Increase C stack limit for most functions, except `_PyEval_EvalFrameDefault()` (GH-107535) * Set C recursion limit to 1500, set cost of eval loop to 2 frames, and compiler mutliply to 2. (cherry picked from commit fa45958450aa3489607daf9855ca0474a2a20878) Co-authored-by: Mark Shannon <mark@hotpy.org>
* [3.12] GH-106898: Add the exception as an argument to the `PY_UNWIND` event ↵Mark Shannon2023-07-281-1/+1
| | | | callback function. (GH-107347) (GH-107382)
* [3.12] GH-106895: Raise a `ValueError` when attempting to disable events ↵Mark Shannon2023-07-281-5/+8
| | | | that cannot be disabled. (GH-107337) (GH-107351)
* [3.12] GH-106897: Add `RERAISE` event to `sys.monitoring`. (GH-107291) ↵Mark Shannon2023-07-281-1/+13
| | | | | | (GH-107346) * Ensures that exception handling events are balanced. Each [re]raise event has a matching unwind/handled event.
* [3.12] GH-103082: Rename PY_MONITORING_EVENTS to _PY_MONITORING_EVENTS ↵Victor Stinner2023-07-221-1/+1
| | | | | | | | | | | | (#107069) (#107075) GH-103082: Rename PY_MONITORING_EVENTS to _PY_MONITORING_EVENTS (#107069) Rename private C API constants: * Rename PY_MONITORING_UNGROUPED_EVENTS to _PY_MONITORING_UNGROUPED_EVENTS * Rename PY_MONITORING_EVENTS to _PY_MONITORING_EVENTS (cherry picked from commit 0927a2b25c059988e237108605ed8ab0c5459c53)
* [3.12] gh-105340: include hidden fast-locals in locals() (GH-105715) (#106470)Miss Islington (bot)2023-07-051-0/+13
| | | | | | | | gh-105340: include hidden fast-locals in locals() (GH-105715) * gh-105340: include hidden fast-locals in locals() (cherry picked from commit 104d7b760fed18055e4f04e5da3ca619e28bfc81) Co-authored-by: Carl Meyer <carl@oddbird.net>
* [3.12] gh-104812: Run Pending Calls in any Thread (gh-104813) (gh-105752)Eric Snow2023-06-141-0/+55
| | | | For a while now, pending calls only run in the main thread (in the main interpreter). This PR changes things to allow any thread run a pending call, unless the pending call was explicitly added for the main thread to run. (cherry picked from commit 757b402)
* GH-104580: Don't cache eval breaker in interpreter (GH-104581)Mark Shannon2023-05-181-1/+0
| | | Move eval-breaker to the front of the interpreter state.
* GH-103082: Filter LINE events in VM, to simplify tool implementation. ↵Mark Shannon2023-05-121-0/+35
| | | | | | | | (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-1/+2
| | | | for users of PEP 523. (GH-96849)
* gh-98003: Inline call frames for CALL_FUNCTION_EX (GH-98004)Ken Jin2023-04-301-0/+46
|
* gh-87729: add LOAD_SUPER_ATTR instruction for faster super() (#103497)Carl Meyer2023-04-241-0/+1
| | | | | This speeds up `super()` (by around 85%, for a simple one-level `super().meth()` microbenchmark) by avoiding allocation of a new single-use `super()` object on each use.
* gh-84436: Implement Immortal Objects (gh-19474)Eddie Elizondo2023-04-221-2/+8
| | | | | | | | | This is the implementation of PEP683 Motivation: The PR introduces the ability to immortalize instances in CPython which bypasses reference counting. Tagging objects as immortal allows up to skip certain operations when we know that the object will be around for the entire execution of the runtime. Note that this by itself will bring a performance regression to the runtime due to the extra reference count checks. However, this brings the ability of having truly immutable objects that are useful in other contexts such as immutable data sharing between sub-interpreters.
* GH-100530: Change the error message for non-class class patterns (GH-103576)Nikita Sobolev2023-04-181-1/+1
|
* GH-103488: Use return-offset, not yield-offset. (GH-103502)Mark Shannon2023-04-131-1/+2
| | | | * 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-537/+98
| | | | | | | | | | (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-100987: Don't cache references to the names and consts array in ↵Mark Shannon2023-03-131-7/+0
| | | | | | | `_PyEval_EvalFrameDefault`. (#102640) * Rename local variables, names and consts, from the interpeter loop. Will allow non-code objects in frames for better introspection of C builtins and extensions. * Remove unused dummy variables.
* gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives ↵Irit Katriel2023-03-131-23/+19
| | | | (#102631)
* gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives ↵Irit Katriel2023-02-281-33/+16
| | | | (in Python/) (#102193)
* gh-101101: Unstable C API tier (PEP 689) (GH-101102)Petr Viktorin2023-02-281-1/+1
|
* GH-100719: Remove redundant `gi_code` field from generator object. (GH-100749)Mark Shannon2023-02-231-37/+36
|
* gh-101903: Remove obsolete undefs for previously removed macros ↵Owain Davies2023-02-211-4/+0
| | | | Py_EnterRecursiveCall and Py_LeaveRecursiveCall (#101923)
* gh-101907: Stop using `_Py_OPCODE` and `_Py_OPARG` macros (GH-101912)Steve Dower2023-02-201-6/+6
| | | | | | * gh-101907: Removes use of non-standard C++ extension from Include/cpython/code.h * Make cases_generator correct on Windows
* gh-101967: add a missing error check (#101968)Eclips42023-02-181-1/+3
|
* gh-101758: Clean Up Uses of Import State (gh-101919)Eric Snow2023-02-151-1/+1
| | | | | | | | | | | | | | | This change is almost entirely moving code around and hiding import state behind internal API. We introduce no changes to behavior, nor to non-internal API. (Since there was already going to be a lot of churn, I took this as an opportunity to re-organize import.c into topically-grouped sections of code.) The motivation is to simplify a number of upcoming changes. Specific changes: * move existing import-related code to import.c, wherever possible * add internal API for interacting with import state (both global and per-interpreter) * use only API outside of import.c (to limit churn there when changing the location, etc.) * consolidate the import-related state of PyInterpreterState into a single struct field (this changes layout slightly) * add macros for import state in import.c (to simplify changing the location) * group code in import.c into sections *remove _PyState_AddModule() https://github.com/python/cpython/issues/101758
* gh-98831: Modernize CALL and family (#101508)Guido van Rossum2023-02-081-6/+0
| | | Includes a slight improvement to `DECREF_INPUTS()`.
* GH-101578: Normalize the current exception (GH-101607)Mark Shannon2023-02-081-7/+5
| | | | | | | | | | * Make sure that the current exception is always normalized. * Remove redundant type and traceback fields for the current exception. * Add new API functions: PyErr_GetRaisedException, PyErr_SetRaisedException * Add new API functions: PyException_GetArgs, PyException_SetArgs
* gh-101072: support default and kw default in PyEval_EvalCodeEx for 3.11+ ↵Matthieu Dartiailh2023-02-071-3/+0
| | | | | (#101127) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* Fix some comments in ceval.c and fix lltrace output (#101297)Guido van Rossum2023-01-241-6/+4
| | | | | The comment at the top was rather outdated. :-) Also added a note about the dangers of dump_stack().
* gh-98831: rewrite CHECK_EG_MATCH opcode in the instruction definition DSL ↵Irit Katriel2023-01-241-1/+1
| | | | (#101269)
* GH-98831: Move assorted macros from ceval.h to a new header (#101116)Guido van Rossum2023-01-181-348/+1
|
* GH-100892: consolidate `HEAD_LOCK/HEAD_UNLOCK` macros (#100953)Kumar Aditya2023-01-151-5/+0
|
* GH-100126: Skip incomplete frames in more places (GH-100613)Brandt Bucher2023-01-091-7/+4
|
* gh-100758: Refactor initialisation of frame headers into a single function ↵Irit Katriel2023-01-061-4/+1
| | | | (_PyFrame_Initialize) (GH-100759)
* GH-99005: Add `CALL_INTRINSIC_1` instruction (GH-100771)Mark Shannon2023-01-051-90/+1
| | | | | | | | * Remove PRINT_EXPR instruction * Remove STOPITERATION_ERROR instruction * Remove IMPORT_STAR instruction
* GH-100719: Remove the `co_nplaincellvars` field from code objects. (GH-100721)Mark Shannon2023-01-041-1/+1
|
* GH-100222: Redefine _Py_CODEUNIT as a union to clarify structure of code ↵Mark Shannon2022-12-141-2/+2
| | | | unit. (GH-100223)
* GH-99729: Unlink frames before clearing them (GH-100030)Brandt Bucher2022-12-061-9/+4
|
* gh-88226: Emit TARGET labels in Python/ceval.c when debugging, even if ↵Skip Montanaro2022-11-221-4/+21
| | | | | | | computed gotos aren't enabled (GH-98265) Keep target labels when debugging, but don't warn about lack of use. Co-authored-by: Eryk Sun <eryksun@gmail.com>
* Add a macro for "inlining" new frames (GH-99490)Brandt Bucher2022-11-171-0/+10
|
* GH-96421: Insert shim frame on entry to interpreter (GH-96319)Mark Shannon2022-11-101-39/+41
| | | | | | * 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-99300: Use Py_NewRef() in Python/ceval.c (#99318)Victor Stinner2022-11-101-16/+8
| | | | Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in Python/ceval.c and related files.
* GH-98686: Get rid of "adaptive" and "quick" instructions (GH-99182)Brandt Bucher2022-11-091-34/+64
|
* GH-98831: Simple input-output stack effects for bytecodes.c (#99120)Guido van Rossum2022-11-081-0/+9
|
* GH-96793: Specialize FOR_ITER for generators. (GH-98772)Mark Shannon2022-11-071-3/+36
|
* GH-98686: Fix compiler warning for HAS_ARG (GH-99106)Brandt Bucher2022-11-041-1/+1
|
* GH-98831: "Generate" the interpreter (#98830)Guido van Rossum2022-11-031-3850/+1
| | | | | | | | | | | The switch cases (really TARGET(opcode) macros) have been moved from ceval.c to generated_cases.c.h. That file is generated from instruction definitions in bytecodes.c (which impersonates a C file so the C code it contains can be edited without custom support in e.g. VS Code). The code generator lives in Tools/cases_generator (it has a README.md explaining how it works). The DSL used to describe the instructions is a work in progress, described in https://github.com/faster-cpython/ideas/blob/main/3.12/interpreter_definition.md. This is surely a work-in-progress. An easy next step could be auto-generating super-instructions. **IMPORTANT: Merge Conflicts** If you get a merge conflict for instruction implementations in ceval.c, your best bet is to port your changes to bytecodes.c. That file looks almost the same as the original cases, except instead of `TARGET(NAME)` it uses `inst(NAME)`, and the trailing `DISPATCH()` call is omitted (the code generator adds it automatically).
* GH-98686: Quicken everything (GH-98687)Brandt Bucher2022-11-021-21/+9
|