Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve support of FORMAT_VALUE in dis #72504

Closed
serhiy-storchaka opened this issue Sep 30, 2016 · 2 comments
Closed

Improve support of FORMAT_VALUE in dis #72504

serhiy-storchaka opened this issue Sep 30, 2016 · 2 comments
Assignees
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 28317
Nosy @ericvsmith, @serhiy-storchaka
PRs
  • [Do Not Merge] Convert Misc/NEWS so that it is managed by towncrier #552
  • Files
  • dis_format_string.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2016-10-08.09:35:45.202>
    created_at = <Date 2016-09-30.14:21:20.517>
    labels = ['3.7', 'type-feature', 'library']
    title = 'Improve support of FORMAT_VALUE in dis'
    updated_at = <Date 2017-03-31.16:36:26.410>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2017-03-31.16:36:26.410>
    actor = 'dstufft'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2016-10-08.09:35:45.202>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2016-09-30.14:21:20.517>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['44892']
    hgrepos = []
    issue_num = 28317
    keywords = ['patch']
    message_count = 2.0
    messages = ['277754', '278288']
    nosy_count = 3.0
    nosy_names = ['eric.smith', 'python-dev', 'serhiy.storchaka']
    pr_nums = ['552']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue28317'
    versions = ['Python 3.6', 'Python 3.7']

    @serhiy-storchaka
    Copy link
    Member Author

    FORMAT_VALUE packs the information about conversion flags and boolean flag that denotes whether format specifier is passed on the stack in one integer argument. It is not easy to decode this information in disassemble output. Proposed patch makes disassembler producing human readable representation of FORMAT_VALUE argument.

    $ echo 'f"{a} {b:4} {c!r} {d!r:4}"' | ./python -m dis
      1           0 LOAD_NAME                0 (a)
                  2 FORMAT_VALUE             0
                  4 LOAD_CONST               0 (' ')
                  6 LOAD_NAME                1 (b)
                  8 LOAD_CONST               1 ('4')
                 10 FORMAT_VALUE             4 (with format)
                 12 LOAD_CONST               0 (' ')
                 14 LOAD_NAME                2 (c)
                 16 FORMAT_VALUE             2 (repr)
                 18 LOAD_CONST               0 (' ')
                 20 LOAD_NAME                3 (d)
                 22 LOAD_CONST               1 ('4')
                 24 FORMAT_VALUE             6 (repr, with format)
                 26 BUILD_STRING             7
                 28 POP_TOP
                 30 LOAD_CONST               2 (None)
                 32 RETURN_VALUE

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Sep 30, 2016
    @serhiy-storchaka serhiy-storchaka self-assigned this Oct 7, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 8, 2016

    New changeset 5e81d14a52f7 by Serhiy Storchaka in branch '3.6':
    Issue bpo-28317: The disassembler now decodes FORMAT_VALUE argument.
    https://hg.python.org/cpython/rev/5e81d14a52f7

    New changeset 085944763f3a by Serhiy Storchaka in branch 'default':
    Issue bpo-28317: The disassembler now decodes FORMAT_VALUE argument.
    https://hg.python.org/cpython/rev/085944763f3a

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant