Skip to content

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Aug 31, 2025

Please, note this change:

if sys.version_info < (3, 10):
    print("ERROR: using pegen requires at least Python 3.10!", file=sys.stderr)

Technically we did not test python3.8 for a long time and used python_version = 3.10 for mypy, so I am pretty sure that 3.8 was not supported already.

I also removed topsort which was not used.

@vstinner
Copy link
Member

vstinner commented Sep 3, 2025

You might change the Python minimum version and remove topsort() in a separated change.

@sobolevn
Copy link
Member Author

sobolevn commented Sep 3, 2025

@vstinner done! I removed all semantic changes, now there are only ruff check changes.

Comment on lines 18 to 23
"UP011",
# Use format specifiers instead of %-style formatting.
# Doesn't always make code more readable.
"UP031",
# Use f-strings instead of format specifiers.
# Doesn't always make code more readable.
Copy link
Member

Choose a reason for hiding this comment

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

Fine to ignore these.

If you like, you could temporarily enable the locally, do a test run and see if it does make any of them more readable, and just commit those changes?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we have a lot of cases where not using f-strings is worse, but checking won't hurt indeed 👍

I am happy if most of the changes are an improvement in any case :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, there were two cases, where f string is better :)

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -52,7 +53,7 @@ def main() -> None:
try:
grammar, parser, tokenizer = build_parser(args.filename)
except Exception as err:
print("ERROR: Failed to parse grammar file", file=sys.stderr)
print("ERROR: Failed to parse grammar file", err, file=sys.stderr)
Copy link
Member

Choose a reason for hiding this comment

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

This change should be backported to stable Python versions.

@sobolevn sobolevn enabled auto-merge (squash) September 3, 2025 17:19
@sobolevn sobolevn merged commit 0d1f4e1 into python:main Sep 3, 2025
51 checks passed
@miss-islington-app
Copy link

Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @sobolevn, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 0d1f4e163990cb7e08b21d1fd88ff54bac5b0699 3.14

@miss-islington-app
Copy link

Sorry, @sobolevn, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 0d1f4e163990cb7e08b21d1fd88ff54bac5b0699 3.13

@sobolevn
Copy link
Member Author

sobolevn commented Sep 3, 2025

I will handle backports. Thanks everyone!

sobolevn added a commit to sobolevn/cpython that referenced this pull request Sep 3, 2025
…-138282)

(cherry picked from commit 0d1f4e1)

Co-authored-by: sobolevn <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Sep 3, 2025

GH-138469 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Sep 3, 2025
sobolevn added a commit to sobolevn/cpython that referenced this pull request Sep 3, 2025
…-138282)

(cherry picked from commit 0d1f4e1)

Co-authored-by: sobolevn <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Sep 3, 2025

GH-138472 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Sep 3, 2025
sobolevn added a commit that referenced this pull request Sep 3, 2025
…38472)

(cherry picked from commit 0d1f4e1)

Co-authored-by: Adam Turner <[email protected]>
hugovk pushed a commit that referenced this pull request Sep 4, 2025
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.

7 participants