Skip to content

[3.14] gh-157660: Fix stale TLBC caches in _remote_debugging (GH-157732) - #158007

Open
liuzhijie-0614 wants to merge 1 commit into
python:3.14from
liuzhijie-0614:gh-157660-refresh-tlbc-cache-3.14-backport
Open

liuzhijie-0614 wants to merge 1 commit into
python:3.14from
liuzhijie-0614:gh-157660-refresh-tlbc-cache-3.14-backport

Conversation

@liuzhijie-0614

@liuzhijie-0614 liuzhijie-0614 commented Sep 23, 2026 •

Copy link
Copy Markdown

Backport of #157732 to 3.14; fixes #157660. The main-branch PR is still open.

In free-threaded builds, TLBC arrays can grow or gain entries without changing tlbc_generation, leaving _remote_debugging with stale cached data. This can cause persistent Invalid tlbc_index errors or incorrect line numbers.

Refresh the cached array when a frame’s index exceeds its capacity or points to a cached NULL slot, while retaining the existing bounds checks.

Adds regression tests based on both reproducers in the issue.

`profiling.sampling` reporting errors or incorrect line numbers in free-threaded
builds when a thread-local bytecode array grows or gains entries after being cached.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant