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

GH-103082: Turn on branch events for FOR_ITER instructions. by markshannon · Pull Request #103507 · python/cpython · GitHub

/ cpython Public

GH-103082: Turn on branch events for FOR_ITER instructions. - #103507

Merged
markshannon merged 1 commit into
python:mainfrom
faster-cpython:branch-events-for-iter
Apr 13, 2023
Merged

GH-103082: Turn on branch events for FOR_ITER instructions.#103507
markshannon merged 1 commit into
python:mainfrom
faster-cpython:branch-events-for-iter

Conversation

markshannon commented Apr 13, 2023
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

Turn on BRANCH events for FOR_ITER instruction, and add test.

Skipping news as this will be covered by the main news/what's new and documentation for PEP 669.

('jump', 'func', 6, 2),
('branch', 'func', 2, 2),
('branch', 'func', 3, 4),
('jump', 'func', 4, 2),

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

is this the jump over the else?

Copy link
Copy Markdown
Member Author

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

No, this is the jump back to the start of the loop.

('line', 'func', 4),
('jump', 'func', 4, 2),
('branch', 'func', 2, 2),
('line', 'func', 2),

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

isn't the line event suppose to come before the branch on that line?

Copy link
Copy Markdown
Member Author

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

The line event becomes before any other events for that instruction, but the jumps and branches are for other instructions.

The jump 4 -> 2 is the jump back to the FOR_ITER. The FOR_ITER instruction isn't the first instruction on line 2. The branch 2 -> 2 is the exit from the FOR_ITER.
The final "line 2" event is from the implicit return None which has line number 2.
It is marked as a line event because the previous instruction has a different line number.

TBH, line events aren't that useful for this sort of tracing, their use case is for debuggers.

markshannon merged commit 70e0a28 into python:main Apr 13, 2023
markshannon deleted the branch-events-for-iter branch April 13, 2023 12:56
carljm added a commit to carljm/cpython that referenced this pull request Apr 13, 2023
* main:
  pythongh-103479: [Enum] require __new__ to be considered a data type (pythonGH-103495)
  pythongh-103365: [Enum] STRICT boundary corrections (pythonGH-103494)
  pythonGH-103488: Use return-offset, not yield-offset. (pythonGH-103502)
  pythongh-103088: Fix test_venv error message to avoid bytes/str warning (pythonGH-103500)
  pythonGH-103082: Turn on branch events for FOR_ITER instructions. (python#103507)
  pythongh-102978: Fix mock.patch function signatures for class and staticmethod decorators (python#103228)
  pythongh-103462: Ensure SelectorSocketTransport.writelines registers a writer when data is still pending (python#103463)
  pythongh-95299: Rework test_cppext.py to not invoke setup.py directly (python#103316)
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL