This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author methane
Recipients methane, vstinner
Date 2021-03-30.12:07:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1617106055.65.0.114999374922.issue43510@roundup.psfhosted.org>
In-reply-to
Content
In bpo-43651, I found code pattern that it's difficult to use io.text_encoding():

    class OpenWrapper:
        def __new__(cls, *args, **kwargs):
            return open(*args, **kwargs)

`kwargs["encoding"] = text_encoding(kwargs.get("encoding)` doesn't work because `open(filename, "b", encoding="locale")` raises `ValueError: binary mode doesn't take an encoding argument`.

I think we should accept `encoding="locale"` even in binary mode. It makes easy to use `text_encoding()` and `encoding="locale"`.
History
Date User Action Args
2021-03-30 12:07:35methanesetrecipients: + methane, vstinner
2021-03-30 12:07:35methanesetmessageid: <1617106055.65.0.114999374922.issue43510@roundup.psfhosted.org>
2021-03-30 12:07:35methanelinkissue43510 messages
2021-03-30 12:07:35methanecreate