summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] GH-127953: Make line number lookup O(1) regardless of the size of the ↵Mark Shannon2025-04-071-2/+4
| | | | | code object (#129127) GH-127953: Make line number lookup O(1) regardless of the size of the code object (GH-128350)
* [3.13] gh-130382: add missing `_PyReftracerTrack` to ceval `Py_DECREF` ↵Sam Gross2025-03-141-0/+1
| | | | | | | (GH-130689) (#131195) (cherry picked from commit c5abded09995f208b21ebaf012185ca5acb0180b) Co-authored-by: Tomasz Pytel <tompytel@gmail.com>
* [3.13] gh-130163: Fix crashes related to PySys_GetObject() (GH-130503) ↵Serhiy Storchaka2025-02-251-1/+7
| | | | | | | | | | (GH-130556) 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(). (cherry picked from commit 0ef4ffeefd1737c18dc9326133c7894d58108c2e)
* [3.13] gh-128799: Add frame of except* to traceback when wrapping a naked ↵Irit Katriel2025-01-301-0/+12
| | | | exception (#128971) (#129299)
* [3.13] gh-128717: Stop-the-world when setting the recursion limit ↵Peter Bierma2025-01-141-0/+4
| | | | | | | | | | (GH-128741) (#128757) [3.13] gh-128717: Stop-the-world when setting the recursion limit (GH-128741) (cherry picked from commit f6c61bf2d7d8b66ccd9f16e723546bdcc251a3d0) Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* [3.13] gh-128049: Fix type confusion bug with the return value of a custom ↵Miss Islington (bot)2024-12-201-2/+19
| | | | | | | | ExceptionGroup split function (GH-128079) (#128139) gh-128049: Fix type confusion bug with the return value of a custom ExceptionGroup split function (GH-128079) (cherry picked from commit 3879ca0100942ae15a09ac22889cbe3e46d424eb) Co-authored-by: Nico-Posada <102486290+Nico-Posada@users.noreply.github.com>
* [3.13] gh-128030: Avoid error from PyModule_GetFilenameObject for non-module ↵Miss Islington (bot)2024-12-201-1/+1
| | | | | | | | | | | | (GH-128047) (#128114) gh-128030: Avoid error from PyModule_GetFilenameObject for non-module (GH-128047) I missed the extra `PyModule_Check` in GH-127660 because I was looking at 3.12 as the base implementation for import from. This meant that I missed the `PyModuleCheck` introduced in GH-112661. (cherry picked from commit 45e6dd63b88a782f2ec96ab1da54eb5a074d8f4c) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* [3.13] gh-126076: Account for relocated objects in tracemalloc (GH-126077) ↵Pablo Galindo Salgado2024-12-111-5/+1
| | | | | (#127823) (cherry picked from commit 30aeb00d367d0cc9e5a7603371636cddea09f1c0)
* [3.13] gh-127651: Use __file__ in diagnostics if origin is missing (#127660) ↵Shantanu2024-12-101-3/+19
| | | | | | | | | | | | (#127775) gh-127651: Use __file__ in diagnostics if origin is missing (#127660) 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> (cherry picked from commit 3983527c3a6b389e373a233e514919555853ccb3)
* [3.13] gh-125703: Correctly honour tracemalloc hooks on more PyDECREF ↵Pablo Galindo Salgado2024-10-281-0/+5
| | | | | specialized paths (GH-125712) (#125791) (cherry picked from commit 3d1df3d84e5c75a52b6f1379cd7f2809fc50befa)
* [3.13] gh-123930: Better error for "from imports" when script shadows module ↵Shantanu2024-10-241-45/+103
| | | | | | | (GH-123929) (#125937) gh-123930: Better error for "from imports" when script shadows module (#123929) (cherry picked from commit 500f5338a8fe13719478589333fcd296e8e8eb02)
* [3.13] gh-122728: Fix SystemError in PyEval_GetLocals() (GH-122735) (#122757)Miss Islington (bot)2024-08-061-1/+1
| | | | | | | | | | | | gh-122728: Fix SystemError in PyEval_GetLocals() (GH-122735) Fix PyEval_GetLocals() to avoid SystemError ("bad argument to internal function"). Don't redefine the 'ret' variable in the if block. Add an unit test on PyEval_GetLocals(). (cherry picked from commit 4767a6e31c0550836b2af45d27e374e721f0c4e6) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] GH-116090: Fire RAISE events from _FOR_ITER_TIER_TWO (GH-122419)Brandt Bucher2024-07-291-6/+3
| | | (cherry picked from commit 15d4cd096758ca089c6bd6ed808c34cca676d9bb)
* [3.13] gh-118934: Make PyEval_GetLocals return borrowed reference ↵Miss Islington (bot)2024-07-181-1/+32
| | | | | | | | | (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] gh-121338: Remove GH-pragma optimize (GH-121340) (#121492)Miss Islington (bot)2024-07-081-10/+0
| | | | | | gh-121338: Remove GH-pragma optimize (GH-121340) (cherry picked from commit d69529d31ccd1510843cfac1ab53bb8cb027541f) Co-authored-by: Michael Droettboom <mdboom@gmail.com>
* [3.13] gh-118692: Avoid creating unnecessary StopIteration instances for ↵Miss Islington (bot)2024-05-241-3/+11
| | | | | | | | | | monitoring (GH-119216) (#119497) * gh-118692: Avoid creating unnecessary StopIteration instances for monitoring (GH-119216) (cherry picked from commit 6e9863d7a3516cc76d6ce13923b15620499f3855) --------- Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* gh-118613: Fix error handling of `_PyEval_GetFrameLocals` in `ceval.c` (#118614)Nikita Sobolev2024-05-061-4/+8
|
* gh-74929: Implement PEP 667 (GH-115153)Tian Gao2024-05-041-7/+41
|
* GH-118095: Use broader specializations of CALL in tier 1, for better tier 2 ↵Mark Shannon2024-05-041-5/+3
| | | | | | | | | | 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-107674: Improve performance of `sys.settrace` (GH-117133)Tian Gao2024-05-031-11/+17
| | | | | | * Check tracing in RESUME_CHECK * Only change to RESUME_CHECK if not tracing
* gh-118335: Configure Tier 2 interpreter at build time (#118339)Guido van Rossum2024-05-011-1/+4
| | | | | | | | | | | | | | | | | | | | | | The code for Tier 2 is now only compiled when configured with `--enable-experimental-jit[=yes|interpreter]`. We drop support for `PYTHON_UOPS` and -`Xuops`, but you can disable the interpreter or JIT at runtime by setting `PYTHON_JIT=0`. You can also build it without enabling it by default using `--enable-experimental-jit=yes-off`; enable with `PYTHON_JIT=1`. On Windows, the `build.bat` script supports `--experimental-jit`, `--experimental-jit-off`, `--experimental-interpreter`. In the C code, `_Py_JIT` is defined as before when the JIT is enabled; the new variable `_Py_TIER2` is defined when the JIT *or* the interpreter is enabled. It is actually a bitmask: 1: JIT; 2: default-off; 4: interpreter.
* gh-117657: Fix small issues with instrumentation and TSAN (#118064)Dino Viehland2024-04-301-1/+1
| | | Small TSAN fixups for instrumentation
* GH-118095: Add dynamic exit support and FOR_ITER_GEN support to tier 2 ↵Mark Shannon2024-04-261-0/+4
| | | | (GH-118279)
* gh-116818: Make `sys.settrace`, `sys.setprofile`, and monitoring thread-safe ↵Dino Viehland2024-04-191-0/+1
| | | | | | | (#116775) Makes sys.settrace, sys.setprofile, and monitoring generally thread-safe. Mostly uses a stop-the-world approach and synchronization around the code object's _co_instrumentation_version. There may be a little bit of extra synchronization around the monitoring data that's required to be TSAN clean.
* GH-118036: Fix a bug with CALL_STAT_INC (#117933)Guido van Rossum2024-04-181-2/+0
| | | | | | | We were under-counting calls in `_PyEvalFramePushAndInit` because the `CALL_STAT_INC` macro was redefined to a no-op for the Tier 2 interpreter. The fix is not to `#undef` it at all. This results in ~37% more "Frames pushed" reported under "Call stats".
* gh-115178: Add Counts of UOp Pairs to pystats (GH-115181)Jeff Glass2024-04-161-0/+2
|
* GH-117457: Correct pystats uop "miss" counts (GH-117477)Michael Droettboom2024-04-041-2/+0
|
* gh-116968: Reimplement Tier 2 counters (#117144)Guido van Rossum2024-04-041-2/+3
| | | | | | | | | | | | Introduce a unified 16-bit backoff counter type (``_Py_BackoffCounter``), shared between the Tier 1 adaptive specializer and the Tier 2 optimizer. The API used for adaptive specialization counters is changed but the behavior is (supposed to be) identical. The behavior of the Tier 2 counters is changed: - There are no longer dynamic thresholds (we never varied these). - All counters now use the same exponential backoff. - The counter for ``JUMP_BACKWARD`` starts counting down from 16. - The ``temperature`` in side exits starts counting down from 64.
* Fix successor opcode name printing in Tier 2 DEOPT debug message (#117471)Guido van Rossum2024-04-021-1/+1
|
* gh-117323: Make `cell` thread-safe in free-threaded builds (#117330)Sam Gross2024-03-291-0/+1
| | | Use critical sections to lock around accesses to cell contents. The critical sections are no-ops in the default (with GIL) build.
* GH-117121: Add pystats to JIT builds (GH-117346)Michael Droettboom2024-03-281-1/+1
|
* GH-116422: Tier2 hot/cold splitting (GH-116813)Mark Shannon2024-03-261-38/+19
| | | | | Splits the "cold" path, deopts and exits, from the "hot" path, reducing the size of most jitted instructions, at the cost of slower exits.
* gh-115756: make PyCode_GetFirstFree an unstable API (GH-115781)Bogdan Romanyuk2024-03-191-1/+1
|
* Cleanup tier2 debug output (#116920)Guido van Rossum2024-03-181-2/+7
| | | Various tweaks, including a slight refactor of the special cases for `_PUSH_FRAME`/`_POP_FRAME` to show the actual operand emitted.
* gh-116098: Revert "gh-107674: Improve performance of `sys.settrace` ↵Tian Gao2024-03-011-17/+11
| | | | | | | (GH-114986)" (GH-116178) Revert "gh-107674: Improve performance of `sys.settrace` (GH-114986)" This reverts commit 0a61e237009bf6b833e13ac635299ee063377699.
* GH-115802: JIT "small" code for Windows (GH-115964)Brandt Bucher2024-02-291-0/+6
|
* gh-107674: Improve performance of `sys.settrace` (GH-114986)Tian Gao2024-02-281-11/+17
|
* Tier 2 cleanups and tweaks (#115534)Guido van Rossum2024-02-201-21/+40
| | | | | | | | | * 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-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-112175: Add `eval_breaker` to `PyThreadState` (#115194)Brett Simmers2024-02-201-1/+1
| | | | | | | | | | | 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-115457: Support splitting and replication of micro ops. (GH-115558)Mark Shannon2024-02-201-1/+1
|
* GH-112354: Initial implementation of warm up on exits and trace-stitching ↵Mark Shannon2024-02-201-20/+27
| | | | (GH-114142)
* GH-113464: Add a JIT backend for tier 2 (GH-113465)Brandt Bucher2024-01-291-1/+19
| | | | | | | Add an option (--enable-experimental-jit for configure-based builds or --experimental-jit for PCbuild-based ones) to build an *experimental* just-in-time compiler, based on copy-and-patch (https://fredrikbk.com/publications/copy-and-patch.pdf). See Tools/jit/README.md for more information on how to install the required build-time tooling.
* GH-113860: Get rid of `_PyUOpExecutorObject` (GH-113954)Brandt Bucher2024-01-121-2/+1
|
* GH-113486: Do not emit spurious PY_UNWIND events for optimized calls to ↵Mark Shannon2024-01-051-0/+3
| | | | classes. (GH-113680)
* GH-111485: Generate instruction and uop metadata (GH-113287)Mark Shannon2023-12-201-0/+1
|
* GH-112354: Treat _EXIT_TRACE like an unconditional side exit (GH-113104)Mark Shannon2023-12-141-17/+2
|
* gh-112716: Fix SystemError when __builtins__ is not a dict (GH-112770)Serhiy Storchaka2023-12-141-2/+2
| | | | | | It was raised in two cases: * in the import statement when looking up __import__ * in pickling some builtin type when looking up built-ins iter, getattr, etc.
* A smattering of cleanups in uop debug output and lltrace (#112980)Guido van Rossum2023-12-121-8/+10
| | | | | | * Include destination T1 opcode in Error debug message * Include destination T1 opcode in DEOPT debug message * Remove obsolete comment from remove_unneeded_uops * Change lltrace_instruction() to print caller's opcode/oparg
* gh-112660: Do not clear arbitrary errors on import (GH-112661)Serhiy Storchaka2023-12-071-15/+31
| | | | | Previously arbitrary errors could be cleared during formatting error messages for ImportError or AttributeError for modules. Now all unexpected errors are reported.