Issue 18818: Empty PYTHONIOENCODING is not the same as nonexistent (original) (raw)

Issue18818

Created on 2013-08-23 06:45 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
empty_pythonioencoding.patch serhiy.storchaka,2013-08-23 06:55 review
empty_pythonioencoding_2.patch serhiy.storchaka,2013-08-23 08:04 review
empty_pythonioencoding_3.patch serhiy.storchaka,2013-08-23 19:11 review
Messages (9)
msg195946 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-08-23 06:45
$ PYTHONIOENCODING= ./python Fatal Python error: Py_Initialize: can't initialize sys standard streams LookupError: unknown encoding: Aborted (core dumped) As a consequence we can't set only the error handler. $ PYTHONIOENCODING=:surrogateescape ./python Fatal Python error: Py_Initialize: can't initialize sys standard streams LookupError: unknown encoding: Aborted (core dumped) Here is a patch which allows accepting empty encoding as default encoding.
msg195947 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2013-08-23 07:44
Patch looks good to me.
msg195950 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-08-23 08:01
Patch looks good to me, but you have to update Doc/using/cmdline.rst, at least to add a versionchanged section. Tests would also be nice :-) I really like the the "PYTHONIOENCODING=:surrogateescape" use case!
msg195951 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-08-23 08:04
Second variant of the patch also supports empty error handler as the default error handler (i.e. strict). $ PYTHONIOENCODING=ascii: ./python Python 3.4.0a1+ (default:5b5ef012cd4e+, Aug 23 2013, 10🔞51) [GCC 4.6.3] on linux Type "help", "copyright", "credits" or "license" for more information. >>> print('\xbd') Traceback (most recent call last): File "", line 1, in UnicodeEncodeError: 'ascii' codec can't encode character '\xbd' in position 0: ordinal not in range(128) Without it different error is raised: Traceback (most recent call last): File "", line 1, in LookupError: unknown error handler name ''
msg196007 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-08-23 19:11
Here is a patch with tests and documentation. For the documentation I hope on your help.
msg197501 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-09-11 18:29
Nick, could you help me with documentation? I'm sure my wording needs improving. And there is one question left. Is this change appropriate for 2.7 and 3.3, or only for 3.4?
msg197560 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-09-13 08:46
New changeset c7fdb0637d0b by Serhiy Storchaka in branch 'default': Issue #18818: The "encodingname" part of PYTHONIOENCODING is now optional. http://hg.python.org/cpython/rev/c7fdb0637d0b
msg197561 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-09-13 08:48
Thank you Ezio and Vajrasky for the review.
msg212186 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-02-25 15:55
New changeset 8ac9c3754d33 by R David Murray in branch 'default': whatsnew: encoding is now optional in PYTHONIOENCODING (#18818) http://hg.python.org/cpython/rev/8ac9c3754d33
History
Date User Action Args
2022-04-11 14:57:49 admin set github: 63018
2014-02-25 15:55:52 python-dev set messages: +
2013-09-13 08:48:41 serhiy.storchaka set status: open -> closedversions: - Python 2.7, Python 3.3type: behavior -> enhancementmessages: + resolution: fixedstage: patch review -> resolved
2013-09-13 08:46:52 python-dev set nosy: + python-devmessages: +
2013-09-11 18:29:49 serhiy.storchaka set messages: +
2013-09-02 15:41:48 serhiy.storchaka set keywords: + needs review
2013-08-23 19:11:14 serhiy.storchaka set files: + empty_pythonioencoding_3.patchmessages: +
2013-08-23 09:10:00 Arfrever set nosy: + Arfrever
2013-08-23 08:04:34 serhiy.storchaka set files: + empty_pythonioencoding_2.patchmessages: +
2013-08-23 08:01:17 vstinner set messages: +
2013-08-23 07:44:43 ncoghlan set messages: +
2013-08-23 06:55:05 serhiy.storchaka set files: + empty_pythonioencoding.patch
2013-08-23 06:54:45 serhiy.storchaka set files: - empty_pythonioencoding.patch
2013-08-23 06:46:35 serhiy.storchaka link issue18713 dependencies
2013-08-23 06:45:48 serhiy.storchaka create