FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-123165: correct tests for `dis.dis(func, show_positions=True)` by picnixz · Pull Request #123220 · python/cpython · GitHub

/ cpython Public

gh-123165: correct tests for dis.dis(func, show_positions=True) - #123220

Merged
iritkatriel merged 2 commits into
python:mainfrom
picnixz:simplify-fake-positions
Aug 22, 2024
Merged

gh-123165: correct tests for dis.dis(func, show_positions=True)#123220
iritkatriel merged 2 commits into
python:mainfrom
picnixz:simplify-fake-positions

Conversation

picnixz commented Aug 22, 2024
edited
Loading

Copy link
Copy Markdown
Member

Mark suggested simplifying the faking of positions information via ast manipulation so here it is.

cc @iritkatriel @markshannon

Copy link
Copy Markdown
Member

Note: if someone knows a way to include partial positions information as well as no position information (but only for a single instruction, and not for the entire code object otherwise we cannot test the -- rendering) by changing AST nodes only, please tell me.

The same way that dis tests '--' for line numbers should work. It inputs python code that gets compiled into something that needs '--'.

picnixz commented Aug 22, 2024

Copy link
Copy Markdown
Member Author

It inputs python code that gets compiled into something that needs '--'.

Mmh, yes it was dumb of me. I'll try this approach now.

picnixz requested a review from iritkatriel August 22, 2024 09:58

picnixz commented Aug 22, 2024
edited
Loading

Copy link
Copy Markdown
Member Author

The tests are a bit longer (in length) but at least I don't need some magical construction that I would forget about tomorrow :D Thank you all for the tips.

picnixz requested a review from markshannon August 22, 2024 09:59

iritkatriel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

iritkatriel merged commit 31acc4d into python:main Aug 22, 2024
picnixz deleted the simplify-fake-positions branch August 22, 2024 13:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL