FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add encoding="locale" support for TextIOWrapper by MegasKomnenos · Pull Request #4781 · RustPython/RustPython · GitHub

Add encoding="locale" support for TextIOWrapper - #4781

Merged
youknowone merged 2 commits into
RustPython:mainfrom
MegasKomnenos:io
Mar 28, 2023
Merged

Add encoding="locale" support for TextIOWrapper#4781
youknowone merged 2 commits into
RustPython:mainfrom
MegasKomnenos:io

Conversation

MegasKomnenos commented Mar 26, 2023
edited by youknowone
Loading

Copy link
Copy Markdown
Contributor

fix #4662

MegasKomnenos changed the title Add encoding='locale' Add encoding="locale" support for TextIOWrapper Mar 26, 2023

youknowone left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Comment thread vm/src/stdlib/sys.rs Outdated
Comment thread vm/src/vm/setting.rs Outdated
Comment thread vm/src/stdlib/io.rs Outdated

youknowone left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thank you for contributing!

I also changed the type from u8 to bool. No difference functionality-wise.
Comment thread 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),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
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),

youknowone added this pull request to the merge queue Mar 28, 2023
Merged via the queue into RustPython:main with commit 1a7df66 Mar 28, 2023
youknowone added C-compat A discrepancy between RustPython and CPython A-stdlib z-ca-2023 Tag to track contrubution-academy 2023 labels Mar 28, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-stdlib C-compat A discrepancy between RustPython and CPython z-ca-2023 Tag to track contrubution-academy 2023

Projects

None yet

Development

Successfully merging this pull request may close these issues.

io.TextIOWrapper.__init__ encoding="locale" support

2 participants


Back | FazBrowse Home | New Git URL