Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Addshow_positions keyword argument todis.dis and related functions #123165

Closed
Assignees
picnixz
Labels
easystdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement
@markshannon

Description

@markshannon

Feature or enhancement

Proposal:

dis.dis is a useful debugging tool when trying to debug minor bytecode compiler errors.
However it lacks one important feature, the ability to see the exact positions attached to instructions. It can only show line numbers.

We should add ashow_positions keyword argument to show positions.
For example, the function:

deffoo(x):ifx==2:return1

disassembles to:

  2           RESUME                   0  3           LOAD_FAST                0 (x)              LOAD_CONST               1 (2)              COMPARE_OP              88 (bool(==))              POP_JUMP_IF_FALSE        1 (to L1)  4           RETURN_CONST             2 (1)  3   L1:     RETURN_CONST             0 (None)

withshow_positions it would disassemble to something like:

2:0-2:0                RESUME                   03:7-3:8                LOAD_FAST                0 (x)3:12-3:13              LOAD_CONST               1 (2)3:7-3:13               COMPARE_OP              88 (bool(==))3:7-3:13               POP_JUMP_IF_FALSE        1 (to L1)4:15-4:16              RETURN_CONST             2 (1)3:7-3:13       L1:     RETURN_CONST             0 (None)

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

Labels

easystdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp