Add support for Python 3.14 tail call interpreter in native stack trace analysis#836
Conversation
|
@copilot you need to change the cython pyx file to detect the eval functions that have LLVM names now. That is the most important part. |
I've already updated the Cython
Both functions now recognize symbols that start with |
|
@copilot You need a NEWS entry in news for towncrier |
|
@copilot We also need a new workflow that checks with Python from UV (3.14) that has the tail call activated. We can use the uv GitHub action: We just need 3.14. Check other workflows such as the coverage one or the valgrind one to know more or less how that must be done |
Added GitHub Actions workflow in commit 190f326. The workflow is in |
|
@copilot This is not running with Python from Also run all tests not just that one |
Updated in commit d8d8ee4:
|
|
@copilot you need to create a venv first: Ensure to use 3.14 there |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #836 +/- ##
==========================================
- Coverage 92.46% 92.39% -0.07%
==========================================
Files 99 99
Lines 11840 11842 +2
Branches 425 426 +1
==========================================
- Hits 10948 10942 -6
- Misses 892 900 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1222d0c to
a82ef86
Compare
Implement support for Python 3.14's tail call interpreter in Memray. The changes enable Memray to correctly identify Python frame boundaries when native stack traces contain LLVM-generated tail call functions. Signed-off-by: Pablo Galindo Salgado <pablogsal@gmail.com>
a82ef86 to
c6b56cb
Compare
Bumps the uv group with 3 updates in the /rust/dupekit directory: [pytest](https://github.com/pytest-dev/pytest), [memray](https://github.com/bloomberg/memray) and [idna](https://github.com/kjd/idna). Updates `pytest` from 9.0.2 to 9.0.3 <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/pytest-dev/pytest/releases">pytest's releases</a>.</em></p> <blockquote> <h2>9.0.3</h2> <h1>pytest 9.0.3 (2026-04-07)</h1> <h2>Bug fixes</h2> <ul> <li> <p><a href="https://redirect.github.com/pytest-dev/pytest/issues/12444">#12444</a>: Fixed <code>pytest.approx</code> which now correctly takes into account <code>~collections.abc.Mapping</code> keys order to compare them.</p> </li> <li> <p><a href="https://redirect.github.com/pytest-dev/pytest/issues/13634">#13634</a>: Blocking a <code>conftest.py</code> file using the <code>-p no:</code> option is now explicitly disallowed.</p> <p>Previously this resulted in an internal assertion failure during plugin loading.</p> <p>Pytest now raises a clear <code>UsageError</code> explaining that conftest files are not plugins and cannot be disabled via <code>-p</code>.</p> </li> <li> <p><a href="https://redirect.github.com/pytest-dev/pytest/issues/13734">#13734</a>: Fixed crash when a test raises an exceptiongroup with <code>__tracebackhide__ = True</code>.</p> </li> <li> <p><a href="https://redirect.github.com/pytest-dev/pytest/issues/14195">#14195</a>: Fixed an issue where non-string messages passed to <!-- raw HTML omitted -->unittest.TestCase.subTest()<!-- raw HTML omitted --> were not printed.</p> </li> <li> <p><a href="https://redirect.github.com/pytest-dev/pytest/issues/14343">#14343</a>: Fixed use of insecure temporary directory (CVE-2025-71176).</p> </li> </ul> <h2>Improved documentation</h2> <ul> <li><a href="https://redirect.github.com/pytest-dev/pytest/issues/13388">#13388</a>: Clarified documentation for <code>-p</code> vs <code>PYTEST_PLUGINS</code> plugin loading and fixed an incorrect <code>-p</code> example.</li> <li><a href="https://redirect.github.com/pytest-dev/pytest/issues/13731">#13731</a>: Clarified that capture fixtures (e.g. <code>capsys</code> and <code>capfd</code>) take precedence over the <code>-s</code> / <code>--capture=no</code> command-line options in <code>Accessing captured output from a test function <accessing-captured-output></code>.</li> <li><a href="https://redirect.github.com/pytest-dev/pytest/issues/14088">#14088</a>: Clarified that the default <code>pytest_collection</code> hook sets <code>session.items</code> before it calls <code>pytest_collection_finish</code>, not after.</li> <li><a href="https://redirect.github.com/pytest-dev/pytest/issues/14255">#14255</a>: TOML integer log levels must be quoted: Updating reference documentation.</li> </ul> <h2>Contributor-facing changes</h2> <ul> <li> <p><a href="https://redirect.github.com/pytest-dev/pytest/issues/12689">#12689</a>: The test reports are now published to Codecov from GitHub Actions. The test statistics is visible <a href="https://app.codecov.io/gh/pytest-dev/pytest/tests">on the web interface</a>.</p> <p>-- by <code>aleguy02</code></p> </li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/pytest-dev/pytest/commit/a7d58d7a21b78581e636bbbdea13c66ad1657c1e"><code>a7d58d7</code></a> Prepare release version 9.0.3</li> <li><a href="https://github.com/pytest-dev/pytest/commit/089d98199c253d8f89a040243bc4f2aa6cd5ab22"><code>089d981</code></a> Merge pull request <a href="https://redirect.github.com/pytest-dev/pytest/issues/14366">#14366</a> from bluetech/revert-14193-backport</li> <li><a href="https://github.com/pytest-dev/pytest/commit/8127eaf4ab7f6b2fdd0dc1b38343ec97aeef05ac"><code>8127eaf</code></a> Revert "Fix: assertrepr_compare respects dict insertion order (<a href="https://redirect.github.com/pytest-dev/pytest/issues/14050">#14050</a>) (<a href="https://redirect.github.com/pytest-dev/pytest/issues/14193">#14193</a>)"</li> <li><a href="https://github.com/pytest-dev/pytest/commit/99a7e6029e7a6e8d53e5df114b1346e035370241"><code>99a7e60</code></a> Merge pull request <a href="https://redirect.github.com/pytest-dev/pytest/issues/14363">#14363</a> from pytest-dev/patchback/backports/9.0.x/95d8423bd...</li> <li><a href="https://github.com/pytest-dev/pytest/commit/ddee02a578da30dd43aedc39c1c1f1aaadfcee95"><code>ddee02a</code></a> Merge pull request <a href="https://redirect.github.com/pytest-dev/pytest/issues/14343">#14343</a> from bluetech/cve-2025-71176-simple</li> <li><a href="https://github.com/pytest-dev/pytest/commit/74eac6916fee34726cb194f16c516e96fbd29619"><code>74eac69</code></a> doc: Update training info (<a href="https://redirect.github.com/pytest-dev/pytest/issues/14298">#14298</a>) (<a href="https://redirect.github.com/pytest-dev/pytest/issues/14301">#14301</a>)</li> <li><a href="https://github.com/pytest-dev/pytest/commit/f92dee777cfdb77d1c43633d02766ddf1f07c869"><code>f92dee7</code></a> Merge pull request <a href="https://redirect.github.com/pytest-dev/pytest/issues/14267">#14267</a> from pytest-dev/patchback/backports/9.0.x/d6fa26c62...</li> <li><a href="https://github.com/pytest-dev/pytest/commit/7ee58acc8777c31ac6cf388d01addf5a414a7439"><code>7ee58ac</code></a> Merge pull request <a href="https://redirect.github.com/pytest-dev/pytest/issues/12378">#12378</a> from Pierre-Sassoulas/fix-implicit-str-concat-and-d...</li> <li><a href="https://github.com/pytest-dev/pytest/commit/37da870d37e3a2f5177cae075c7b9ae279432bf8"><code>37da870</code></a> Merge pull request <a href="https://redirect.github.com/pytest-dev/pytest/issues/14259">#14259</a> from mitre88/patch-4 (<a href="https://redirect.github.com/pytest-dev/pytest/issues/14268">#14268</a>)</li> <li><a href="https://github.com/pytest-dev/pytest/commit/c34bfa3b7acb65b594707c714f1d8461b0304eed"><code>c34bfa3</code></a> Add explanation for string context diffs (<a href="https://redirect.github.com/pytest-dev/pytest/issues/14257">#14257</a>) (<a href="https://redirect.github.com/pytest-dev/pytest/issues/14266">#14266</a>)</li> <li>Additional commits viewable in <a href="https://github.com/pytest-dev/pytest/compare/9.0.2...9.0.3">compare view</a></li> </ul> </details> <br /> Updates `memray` from 1.19.1 to 1.19.2 <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/bloomberg/memray/releases">memray's releases</a>.</em></p> <blockquote> <h2>v1.19.2</h2> <h2>What's Changed</h2> <ul> <li>Add support for Python 3.14 tail call interpreter in native stack trace analysis by <a href="https://github.com/Copilot"><code>@Copilot</code></a> in <a href="https://redirect.github.com/bloomberg/memray/pull/836">bloomberg/memray#836</a></li> <li>Remove outdated note about supported arches for Linux by <a href="https://github.com/ofek"><code>@ofek</code></a> in <a href="https://redirect.github.com/bloomberg/memray/pull/848">bloomberg/memray#848</a></li> <li>Fix AssertionError when the the process outlives a <code>memray attach</code> TUI by <a href="https://github.com/pablogsal"><code>@pablogsal</code></a> in <a href="https://redirect.github.com/bloomberg/memray/pull/850">bloomberg/memray#850</a></li> <li>Fix broken --no-web flamegraph assets by <a href="https://github.com/pablogsal"><code>@pablogsal</code></a> in <a href="https://redirect.github.com/bloomberg/memray/pull/876">bloomberg/memray#876</a></li> <li>Upgrade D3 and drop d3-tooltip by <a href="https://github.com/lkollar"><code>@lkollar</code></a> in <a href="https://redirect.github.com/bloomberg/memray/pull/883">bloomberg/memray#883</a></li> <li>Document process attachment for containerized environments by <a href="https://github.com/hao-lee"><code>@hao-lee</code></a> in <a href="https://redirect.github.com/bloomberg/memray/pull/853">bloomberg/memray#853</a></li> <li>Fix escaping in HTML reports by <a href="https://github.com/godlygeek"><code>@godlygeek</code></a> in <a href="https://redirect.github.com/bloomberg/memray/pull/885">bloomberg/memray#885</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/ofek"><code>@ofek</code></a> made their first contribution in <a href="https://redirect.github.com/bloomberg/memray/pull/848">bloomberg/memray#848</a></li> <li><a href="https://github.com/hao-lee"><code>@hao-lee</code></a> made their first contribution in <a href="https://redirect.github.com/bloomberg/memray/pull/853">bloomberg/memray#853</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/bloomberg/memray/compare/v1.19.1...v1.19.2">https://github.com/bloomberg/memray/compare/v1.19.1...v1.19.2</a></p> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/bloomberg/memray/blob/main/NEWS.rst">memray's changelog</a>.</em></p> <blockquote> <h2>memray 1.19.2 (2026-03-12)</h2> <p>Bug Fixes</p> <pre><code> - Add support for Python 3.14's tail call interpreter. Memray now correctly identifies Python frame boundaries in native stack traces when Python 3.14 is built with the tail call interpreter enabled (``--with-tail-call-interp``), recognizing LLVM-generated tail call functions alongside traditional ``_PyEval_EvalFrameDefault`` functions. ([#836](bloomberg/memray#836)) - Prevent an ``AssertionError`` when the tracked process exits after the live TUI was closed. ([#849](bloomberg/memray#849)) - Ensure the command line is properly HTML escaped when writing it into flamegraph and table reports. ([#885](bloomberg/memray#885)) - Fix the ``--no-web`` option for ``memray flamegraph``, which was generating broken flame graphs. ([#876](bloomberg/memray#876)) </code></pre> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/bloomberg/memray/commit/87e7f620583329f548c71f2e455160538b9b9afc"><code>87e7f62</code></a> Prepare for 1.19.2 release</li> <li><a href="https://github.com/bloomberg/memray/commit/ba6e4e2e9930f9641bed7adfdf43c8e2545ce249"><code>ba6e4e2</code></a> Fix escaping in HTML reports</li> <li><a href="https://github.com/bloomberg/memray/commit/f4e7128acaf3bb8800e6f9ca87c81e6c2ac44347"><code>f4e7128</code></a> docs: Document more caveats for attaching</li> <li><a href="https://github.com/bloomberg/memray/commit/cb93af08a75b9cae30ab1739287ef6a2bf228f51"><code>cb93af0</code></a> Format flamegraph tooltip asset with prettier</li> <li><a href="https://github.com/bloomberg/memray/commit/73c372623a5475f1c168f4dcfb3d61b33b9a6a8a"><code>73c3726</code></a> Fix strict mypy errors in IPython flamegraph magic</li> <li><a href="https://github.com/bloomberg/memray/commit/c39776cffd53f147dea98f71917e01847369855d"><code>c39776c</code></a> Relax no-web flamegraph d3 asset assertion</li> <li><a href="https://github.com/bloomberg/memray/commit/385a06bf89c752309e00b11b0cb0e0dc54e1174b"><code>385a06b</code></a> Upgrade d3 v4 to v7</li> <li><a href="https://github.com/bloomberg/memray/commit/76737ea96ed7b96690bb34a5dd0e7573f623c72c"><code>76737ea</code></a> Regenerate flamegraph template assets</li> <li><a href="https://github.com/bloomberg/memray/commit/d0d4da5e0758d9ce825cd44941473066481c89c4"><code>d0d4da5</code></a> Replace d3-tip with floating-ui tooltips</li> <li><a href="https://github.com/bloomberg/memray/commit/d73cce4b9cba6b3d75b50980f53d227c40c3b90a"><code>d73cce4</code></a> build(deps): bump serialize-javascript, copy-webpack-plugin and terser-webpac...</li> <li>Additional commits viewable in <a href="https://github.com/bloomberg/memray/compare/v1.19.1...v1.19.2">compare view</a></li> </ul> </details> <br /> Updates `idna` from 3.11 to 3.15 <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/kjd/idna/blob/master/HISTORY.md">idna's changelog</a>.</em></p> <blockquote> <h2>3.15 (2026-05-12)</h2> <ul> <li>Enforce DNS-length cap on individual labels early in <code>check_label</code>, short-circuiting contextual-rule processing for oversized input while staying compatible with UTS 46 usage.</li> <li>Tidy core helpers: hoist bidi category sets to module-level frozensets (avoiding per-codepoint list construction), simplify length checks, and reuse the shared <code>_unicode_dots_re</code> from <code>idna.core</code> in the codec module.</li> <li>Use <code>raise ... from err</code> for proper exception chaining and switch internal string formatting to f-strings.</li> <li>Allow <code>flit_core</code> 4.x in the build backend.</li> <li>Expand the ruff lint set (flake8-bugbear, flake8-simplify, pyupgrade, perflint) and apply the surfaced fixes; pin lint CI to Python 3.14.</li> <li>Add Dependabot configuration for GitHub Actions.</li> <li>Convert README and HISTORY from reStructuredText to Markdown.</li> <li>Reference CVE-2026-45409 for the 3.14 advisory in place of the initial GHSA identifier.</li> </ul> <p>Thanks to Felix Yan, Stan Ulbrych, and metsw24-max for contributions to this release.</p> <h2>3.14 (2026-05-10)</h2> <ul> <li>Removed opportunity to process long inputs into quadratic time by rejecting oversize inputs up-front. Closes a bypass of the CVE-2024-3651 mitigation. [CVE-2026-45409]</li> </ul> <p>Thanks to Stan Ulbrych for reporting the issue.</p> <h2>3.13 (2026-04-22)</h2> <ul> <li>Correct classification error for codepoint U+A7F1</li> </ul> <h2>3.12 (2026-04-21)</h2> <ul> <li>Update to Unicode 17.0.0.</li> <li>Issue a deprecation warning for the transitional argument.</li> <li>Added lazy-loading to provide some performance improvements.</li> <li>Removed vestiges of code related to Python 2 support, including segmentation of data structures specific to Jython.</li> </ul> <p>Thanks to Rodrigo Nogueira for contributions to this release.</p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/kjd/idna/commit/af30a092e158181d0b35ac66dfa813788126bdd8"><code>af30a09</code></a> Release 3.15</li> <li><a href="https://github.com/kjd/idna/commit/30314d4628744ca14cf2b5820564e5127a9f86f2"><code>30314d4</code></a> Pre-release 3.15rc0</li> <li><a href="https://github.com/kjd/idna/commit/05d4b219aa9eddc47371fcbd2000f0301016f3e9"><code>05d4b21</code></a> Merge pull request <a href="https://redirect.github.com/kjd/idna/issues/237">#237</a> from kjd/convert-docs-to-markdown</li> <li><a href="https://github.com/kjd/idna/commit/2987fdba1962bbb2358399e0084ba062b98a0bee"><code>2987fdb</code></a> Convert README and HISTORY from reStructuredText to Markdown</li> <li><a href="https://github.com/kjd/idna/commit/59fa8002d514bf4a5ce7b58f67b9ec587d53fa9c"><code>59fa800</code></a> Merge pull request <a href="https://redirect.github.com/kjd/idna/issues/236">#236</a> from kjd/dependabot/github_actions/actions-f3e34333ea</li> <li><a href="https://github.com/kjd/idna/commit/def69834ced5d4b3c50439d8b99c4c856ec19ca2"><code>def6983</code></a> Merge branch 'master' into dependabot/github_actions/actions-f3e34333ea</li> <li><a href="https://github.com/kjd/idna/commit/bbd8004a797185d8c56bb555cd5c88fde05e0631"><code>bbd8004</code></a> Merge pull request <a href="https://redirect.github.com/kjd/idna/issues/234">#234</a> from StanFromIreland/patch-1</li> <li><a href="https://github.com/kjd/idna/commit/edd07c05024344a6ccb517414ccb36683aee99fc"><code>edd07c0</code></a> Bump github/codeql-action from 3.35.2 to 4.35.2 in the actions group</li> <li><a href="https://github.com/kjd/idna/commit/5557db030c11bdec50d62aa5f631d705d33ba123"><code>5557db0</code></a> Merge branch 'master' into patch-1</li> <li><a href="https://github.com/kjd/idna/commit/f11746cf4981d25123ef7830d3ee60f07de8ae3d"><code>f11746c</code></a> Merge pull request <a href="https://redirect.github.com/kjd/idna/issues/235">#235</a> from StanFromIreland/patch-2</li> <li>Additional commits viewable in <a href="https://github.com/kjd/idna/compare/v3.11...v3.15">compare view</a></li> </ul> </details> <br /> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/marin-community/marin/network/alerts). </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Plan to fix Python 3.14 tail call interpreter support
frame_tools.pythat identifies Python frame boundaries_is_cpython_internal_symbolfunction to recognize_TAIL_CALL_*.llvm.*patternsuv runand run all testsuv venvstep to create virtual environmentSummary
Successfully implemented support for Python 3.14's tail call interpreter in Memray. The changes enable Memray to correctly identify Python frame boundaries when native stack traces contain LLVM-generated tail call functions.
Changes Made
1. Pure Python Code (
src/memray/reporters/frame_tools.py)_TAIL_CALL_*.llvm.*symbols2. Cython Code (
src/memray/_memray.pyx)hybrid_stack_trace()to recognize tail call patterns in native stack correlationget_symbolic_support()to detect tail call patterns for symbolic support3. Tests (
tests/unit/test_frame_tools.py)_TAIL_CALL_INSTRUMENTED_CALL.llvm.*patterns_TAIL_CALL_POP_TOP.llvm.*patternsis_frame_interesting()to ensure proper filtering4. NEWS Entry (
news/822.bugfix)5. CI/CD Workflow (
.github/workflows/test_uv_python.yml)astral-sh/setup-uv@v6action to install Python 3.14uv venv --python 3.14uv run pytestto run all tests with UV's Python environmentPattern Detection Logic
A symbol is recognized as a Python frame boundary if:
_PyEval_EvalFrameDefaultorPyEval_EvalFrameEx(traditional), OR_TAIL_CALL_AND contains.llvm.(Python 3.14 tail call)Backward Compatibility
✓ Python 3.8-3.13: Traditional
_PyEval_EvalFrameDefaultdetection continues to work✓ Python 3.14 without tail call: Traditional detection continues to work
✓ Python 3.14 with tail call: New LLVM pattern detection is activated
✓ All patterns can coexist in mixed environments
Code Statistics
frame_tools.py(core logic)_memray.pyx(including comments)test_frame_tools.py(test coverage)The implementation is minimal, surgical, and maintains full backward compatibility.
Original prompt
Fixes #822
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.