[Python-Dev] cpython: Issue #16129: Add `Py_SetStandardStreamEncoding`
Georg Brandl
g.brandl at gmx.net
Fri Oct 18 07:19:45 CEST 2013
Am 17.10.2013 17:36, schrieb Antoine Pitrou:
> On Thu, 17 Oct 2013 15:22:03 +0200 (CEST)
> nick.coghlan <python-checkins at python.org> wrote:
>>
>> +.. c:function:: int Py_SetStandardStreamEncoding(char *encoding, char *errors)
>> +
>> + .. index::
>> + single: Py_Initialize()
>> + single: main()
>> + triple: stdin; stdout; sdterr
>> +
>> + This function should be called before :c:func:`Py_Initialize`. It
>> + specifies which encoding and error handling to use with standard io,
>> + with the same meanings as in :func:`str.encode`.
>> +
>> + It overrides :envvar:`PYTHONIOENCODING` values, and allows embedding code
>> + to control io encoding when the environment variable does not work.
>> +
>> + ``encoding`` and/or ``errors`` may be NULL to use
>> + :envvar:`PYTHONIOENCODING` and/or default values (depending on other
>> + settings).
>> +
>> + Note that :data:`sys.stderr` always uses the "backslashreplace" error
>> + handler, regardless of this (or any other) setting.
>> +
>> + If :c:func:`Py_Finalize` is called, this function will need to be called
>> + again in order to affect subsequent calls to :c:func:`Py_Initialize`.
>> +
>> + Returns 0 if successful.
>> +
>> +
>
> Needs a versionadded tag.
Also, shouldn't it be excluded from the stable/limited API?
Georg
More information about the Python-Dev
mailing list