Skip to content

bpo-47212: Improve error messages for un-parenthesized generator expressions #32302

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

Merged
merged 11 commits into from
Apr 5, 2022

Conversation

MatthieuDartiailh
Copy link
Contributor

@MatthieuDartiailh MatthieuDartiailh commented Apr 4, 2022

Fixes the minor inconsistencies noticed in bpo-47212. Those could be backported to 3.10 but I have no idea what is the policy in that respect.

ping @pablogsal @lysnikolaou

https://bugs.python.org/issue47212

@pablogsal
Copy link
Member

@MatthieuDartiailh Can you add/modify some test cases?

@pablogsal pablogsal added the needs backport to 3.10 only security fixes label Apr 4, 2022
@pablogsal
Copy link
Member

Those could be backported to 3.10

Yeah, definitely we can backport these.

@MatthieuDartiailh
Copy link
Contributor Author

Sure if I can find them.

@MatthieuDartiailh
Copy link
Contributor Author

The tests in test_syntax.py do not track the start and end position of the SyntaxError, so I am not sure where to add a test. For the indentation error I found where to add it.

@pablogsal
Copy link
Member

The tests in test_syntax.py do not track the start and end position of the SyntaxError, so I am not sure where to add a test. For the indentation error I found where to add it.

I think you can add a case to test_exceptions.py::testSyntaxErrorOffset or a similar test in that file.

@MatthieuDartiailh
Copy link
Contributor Author

I tried to add some tests but did not get a chance to test locally.

@MatthieuDartiailh
Copy link
Contributor Author

check in test_exceptions does not check the end offset should I add a new method doing that ?

@pablogsal
Copy link
Member

Ah, that is because it precedes the changes I did in 3.10. Yeah, please, if you don't mind add a check for the end range. Thanks 🙏

@MatthieuDartiailh
Copy link
Contributor Author

Tests are now passing. What should I do exactly for bedevere/news ?

@AlexWaygood
Copy link
Member

Tests are now passing. What should I do exactly for bedevere/news ?

You can use https://blurb-it.herokuapp.com/ to add a NEWS entry :)

@MatthieuDartiailh
Copy link
Contributor Author

Thanks @AlexWaygood hopefully I did it right

…12.leF4pz.rst

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@pablogsal pablogsal merged commit aa0f056 into python:main Apr 5, 2022
@miss-islington
Copy link
Contributor

Thanks @MatthieuDartiailh for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @MatthieuDartiailh and @pablogsal, I could not cleanly backport this to 3.10 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker aa0f056a00c4bcaef83d729e042359ddae903382 3.10

@pablogsal
Copy link
Member

@MatthieuDartiailh Can you do the backport using the cherry_picker utility? Check the instructions in this comment:

#32302 (comment)

@MatthieuDartiailh
Copy link
Contributor Author

@pablogsal The cherry pick will be really messy because action_helpers.c does not exist on 3.10. Not sure it is worth backporting then.

@MatthieuDartiailh MatthieuDartiailh deleted the parser-fix branch April 5, 2022 14:12
@pablogsal
Copy link
Member

@pablogsal The cherry pick will be really messy because action_helpers.c does not exist on 3.10. Not sure it is worth backporting then.

The code for action_helpers.c is on pegen.c in 3.10. In the main branch was just split for better maintainability.

Don't worry if you find it too hard, I can cherry pick myself if you don't want to do it :)

@MatthieuDartiailh
Copy link
Contributor Author

Bacport is at #32334. Hopefully I got it right

@bedevere-bot
Copy link

GH-32334 is a backport of this pull request to the 3.10 branch.

miss-islington pushed a commit that referenced this pull request Apr 5, 2022
(cherry picked from commit aa0f056)

# Conflicts:
#	Grammar/python.gram
#	Parser/action_helpers.c

Automerge-Triggered-By: GH:pablogsal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants