-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Avoid EncodingWarning. Fixes #3695. #3696
Conversation
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.
Makes sense to me, as we assume source we parse is UTF8 compatible ...
I don't think we can assume Python source is UTF-8. However, seems like this is parsing the grammar files for blib2to3, which should be in UTF-8. I want to check the code some more, though. |
According to PEP 597 (motivation), UTF-8 is the default encoding on non-Windows systems, so by specifying it, you provide clarity and consistent behavior across platforms. You could specify |
Users shouldn't put anything in the grammar files, we control all the grammar files and we don't support users providing their own. My hesitation is only about verifying that this codepath is purely about opening the internal grammar files, not user code. |
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.
We only call this with our own files Grammar.txt
and PatternGrammar.txt
, which are ASCII.
Thanks @jaraco! |
commit eedfc38 Author: Jason R. Coombs <jaraco@jaraco.com> Date: Fri May 19 13:00:29 2023 -0400 Avoid EncodingWarning in blib2to3 (psf#3696) commit 2fd9d8b Author: Jonathan Berthias <jvberthias@gmail.com> Date: Fri May 19 01:57:17 2023 +0200 Remove blank lines before class docstring (psf#3692) commit db3668a Author: Ray Bell <rayjohnbell0@gmail.com> Date: Tue May 16 22:47:45 2023 -0400 Sort DEFAULT_EXCLUDES and add .vscode, .pytest_cache and .ruff_cache (psf#3691) Co-authored-by: Ray Bell <ray.bell@dtn.com>
Fixes #3695