Skip to content

Conversation

serhiy-storchaka
Copy link
Member

… numbers and

instruction offsets.

Add tests for widths of opcode names.

…mbers and

instruction offsets.

Add tests for widths of opcode names.
@serhiy-storchaka serhiy-storchaka added the type-feature A feature request or enhancement label Apr 15, 2017
@mention-bot
Copy link

@serhiy-storchaka, thanks for your PR! By analyzing the history of the files in this pull request, we identified @ncoghlan, @benjaminp and @tim-one to be potential reviewers.

Copy link
Contributor

@ncoghlan ncoghlan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a nice improvement to me.

One inline comment regarding the opcodes that are already more than 20 letters long, but that's really a question for a separate issue.

def test_widths(self):
for opcode, opname in enumerate(dis.opname):
if opname in ('BUILD_MAP_UNPACK_WITH_CALL',
'BUILD_TUPLE_UNPACK_WITH_CALL'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I don't think it should block this change (since it's an existing problem) I wonder if it might it be worth special-casing these for display purposes using something like:

BUILD_MAP_UNPACK_WITH_CALL
...MAP_UNPACK+CALL
12345678901234567890

BUILD_TUPLE_UNPACK_WITH_CALL
...TUPLE_UNPACK+CALL
12345678901234567890

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't understand your idea. This already is special-cased, the test is skipped for these names.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant in the actual display code, as I assume the columns are currently misaligned for rows containing these two opcodes, whereas they wouldn't be given the abbreviations (...TUPLE_UNPACK+CALL is 20 characters, while ...MAP_UNPACK+CALL is 18).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to misalign columns than output corrupted opcode names.

It may be worth to rename these two opcodes, but this is different issue.

@serhiy-storchaka serhiy-storchaka merged commit d90045f into python:master Apr 19, 2017
@serhiy-storchaka serhiy-storchaka deleted the dis-adjust-width branch April 19, 2017 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants