GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-43950: support some multi-line expressions for PEP 657 by isidentical · Pull Request #27339 · python/cpython

Conversation

@isidentical

@isidentical isidentical commented Jul 24, 2021 •
edited by miss-islington
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This is basically something that I noticed up while fixing test runs for another issue. It is really common to have multiline calls, and when they fail the display is kind of weird since we omit the annotations. E.g;

 $ ./python t.py
Traceback (most recent call last):
  File "/home/isidentical/cpython/cpython/t.py", line 11, in <module>
    frame_1()
    ^^^^^^^^^
  File "/home/isidentical/cpython/cpython/t.py", line 5, in frame_1
    frame_2(              
  File "/home/isidentical/cpython/cpython/t.py", line 2, in frame_2
    return a / 0 / b / c
           ~~^~~
ZeroDivisionError: division by zero

This patch basically adds support for annotating the rest of the line, if the instruction covers multiple lines (start_line != end_line).

https://bugs.python.org/issue43950

Automerge-Triggered-By: GH:isidentical

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@isidentical isidentical added the skip news label Jul 24, 2021
@isidentical
isidentical requested review from ammaraskar and pablogsal July 24, 2021 18:25
@bedevere-bot bedevere-bot added the awaiting core review label Jul 24, 2021
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Jul 24, 2021
@isidentical isidentical changed the title bpo-43950: support multi-line expressions if the intruction covers th… bpo-43950: support some multi-line expressions for PEP 657 Jul 24, 2021
@isidentical
bpo-43950: support multi-line expressions if the intruction covers th…
8d8136f
…e rest of the line
@isidentical
isidentical force-pushed the bpo-43950-multiline branch from ff6022e to 8d8136f Compare July 24, 2021 18:52
pablogsal
pablogsal reviewed Jul 24, 2021
View reviewed changes

@pablogsal pablogsal left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I recall they we had this version implemented but we did abandoned it because it looked weird in done scenarios. I am missing anything or is the fact that we are stopping in whitespace enough to account for the problems with the old approach?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@isidentical

isidentical commented Jul 24, 2021

Copy link
Copy Markdown
Member Author

The old approach was highlighting the whole line if the end_offset is greater than 256 (-1) but where the instruction was only covering a single line. This is about when an expression covers multiple lines (e.g the call above). Since we now the start point, and we know for a fact that the instruction continue to next lines we can just highlight the line to the end without any false positives.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal

pablogsal commented Jul 24, 2021

Copy link
Copy Markdown
Member

Can you add some extra tests with some specific cases like function calls spawning multiple lines as well as binops spawning multiple lines (for example)? I will like to cover this with more cases if possible,

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pablogsal
pablogsal approved these changes Jul 24, 2021
View reviewed changes

@pablogsal pablogsal left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM modulo my comment regarding more tests

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Jul 24, 2021
@isidentical
add more test cases
b6a2bd4
@isidentical isidentical added the 🤖 automerge label Jul 25, 2021
@miss-islington

miss-islington commented Jul 25, 2021

Copy link
Copy Markdown
Contributor

@isidentical: Status check is done, and it's a success ✅ .

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington
miss-islington merged commit 3e235e0 into python:main Jul 25, 2021
@bedevere-bot bedevere-bot removed the awaiting merge label Jul 25, 2021
@pablogsal pablogsal mentioned this pull request Apr 13, 2022
Include column offsets for bytecode instructions #88116
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pablogsal pablogsal pablogsal approved these changes
@ammaraskar ammaraskar Awaiting requested review from ammaraskar

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@isidentical @pablogsal @miss-islington @the-knights-who-say-ni @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.