-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
bpo-41137: Use utf-8 encoding while reading .pdbrc files #21263
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.
good catch :)
Thank you for your PR @srinivasreddy, but it needs more changes:
|
@serhiy-storchaka Not sure why windows build is failing. Any idea why? |
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.
Please do not forget about What's New.
Lib/test/test_pdb.py
Outdated
try: | ||
with support.temp_cwd(): | ||
with open('.pdbrc', 'w') as f: | ||
f.write("Fran\u00E7ais\n") |
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.
It will not work on locales with encoding which does not allow to encode \u00E7
. You need to find characters which are encodable with the locale encoding.
Also, it would be better to use more realistic example. Use a command which takes a non-ASCII argument and check that it works correctly.
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.
Now the build is passing. And I would like to keep this negative test case as it would, in utf-8 encoding gives "NameError: name 'Française' is not defined". Or do you still want me write the test you commented above?
@@ -1448,6 +1447,40 @@ def test_readrc_homedir(self): | |||
if save_home is not None: | |||
os.environ["HOME"] = save_home | |||
|
|||
def test_read_pdbrc_with_ascii_encoding(self): |
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 am not sure this test case is worth enough.
…es with 'utf-8' encoding
…ise' to .pdbrc file and try to read the file with ascii encoding. And test the read failure in stderr
https://bugs.python.org/issue41137