-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add encoding="locale" support for TextIOWrapper #4781
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
Conversation
youknowone
left a comment
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.
And you fixed 2 more tests by this change!
UNEXPECTED SUCCESS: test__getitem___deprecation (test.test_fileinput.FileInputTests.test__getitem___deprecation)
UNEXPECTED SUCCESS: test_gz_ext_fake (test.test_fileinput.Test_hook_compressed.test_gz_ext_fake)
Please remove unittest.expectedFailure from those tests
youknowone
left a comment
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.
Thank you for contributing!
I also changed the type from u8 to bool. No difference functionality-wise.
vm/src/stdlib/io.rs
Outdated
| None => { | ||
| // TODO: try os.device_encoding(fileno) and then locale.getpreferredencoding() | ||
| PyStr::from(crate::codecs::DEFAULT_ENCODING).into_ref(&vm.ctx) | ||
| None if vm.state.settings.utf8_mode == 1 => PyStr::from("utf-8").into_ref(&vm.ctx), |
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.
| None if vm.state.settings.utf8_mode == 1 => PyStr::from("utf-8").into_ref(&vm.ctx), | |
| None if vm.state.settings.utf8_mode > 0 => PyStr::from("utf-8").into_ref(&vm.ctx), |
fix #4662