Avoid EncodingWarning. Fixes #3695.#3696
Conversation
cooperlees
left a comment
There was a problem hiding this comment.
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. |
JelleZijlstra
left a comment
There was a problem hiding this comment.
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