Josh Rosenberg <shadowranger+pyt...@gmail.com> added the comment: On rereading the docs for Python 3 codecs.open, it doesn't seem to document the whole "no encoding means no codecs.StreamReaderWriter wrapping behavior" at all.
First off, any fix would only apply to Python 3 (I've removed 2.7 from the versions). Both Python 2 and Python 3 have the behavior of calling the plain builtin open function with just filename, mode, and buffering when no encoding is provided. On Python 2, it's impossible to use the errors keyword (because plain built-in open doesn't do decoding, it doesn't accept an errors parameter); on Python 3, you could, but you'd be adding to the behavioral discrepancies with Python 2. The docs (just above codecs.open) already state: "the builtin open() and the associated io module are the recommended approach for working with encoded text files"; personally, I'm inclined to just wash my hands of codecs.open (perhaps moving the note about builtin open down inside codecs.open's docs, so people who get a direct link don't have to scroll up to notice the note). codecs.open was and is underspecified, never worked right (e.g. #8260, which despite the status, is not really fixed https://stackoverflow.com/a/46438434/364696 ), and the code which uses it is likely already working around its quirks, making fixes difficult. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32723> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com