Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-151022: Fix remote debugging linetable reads#151036

Open
goutamadwant wants to merge 1 commit into
python:mainpython/cpython:mainfrom
goutamadwant:gh-151022-remote-debugging-linetablegoutamadwant/cpython:gh-151022-remote-debugging-linetableCopy head branch name to clipboard
Open

gh-151022: Fix remote debugging linetable reads#151036
goutamadwant wants to merge 1 commit into
python:mainpython/cpython:mainfrom
goutamadwant:gh-151022-remote-debugging-linetablegoutamadwant/cpython:gh-151022-remote-debugging-linetableCopy head branch name to clipboard

Conversation

@goutamadwant
Copy link
Copy Markdown

Fixes gh-151022.

_remote_debugging reads a code object's line table from the target process
with a fixed 4096 byte limit. Valid code objects can exceed that. For example,
Lib/html/entities.py currently compiles to a line table of 37445 bytes, so
RemoteUnwinder.get_stack_trace() fails with RuntimeError: Invalid bytes length.

This keeps the generic remote bytes reader bounded, but gives code object line
tables their own larger limit before parsing. The parser already bounds the
number of line table entries it will scan.

Added a regression test that builds a code object with a line table larger than
4096 bytes and verifies that a same-process stack trace succeeds.

Tests:

./python.exe -m unittest -v test.test_external_inspection.TestSelfStackTrace.test_self_trace_with_large_linetable
./python.exe -m test test_external_inspection -v
make patchcheck

@goutamadwant goutamadwant requested a review from pablogsal as a code owner June 6, 2026 22:13
@python-cla-bot
Copy link
Copy Markdown

python-cla-bot Bot commented Jun 6, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

@goutamadwant goutamadwant force-pushed the gh-151022-remote-debugging-linetable branch from 34645da to 9b0f3ba Compare June 6, 2026 22:19
@pablogsal
Copy link
Copy Markdown
Member

@maurycy can you review this? :)

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.

_remote_debugging: raising Invalid bytes length on codeobjects with linetable > 4096

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.