PEP 741: Fix small mistakes (#3713)
This commit is contained in:
parent
a0e3011518
commit
e98d6c00e4
|
@ -388,7 +388,7 @@ configuration option.
|
||||||
|
|
||||||
All C API functions are added to the limited C API version 3.13.
|
All C API functions are added to the limited C API version 3.13.
|
||||||
|
|
||||||
The ``PyInitConfig`` structure is implemented by combining the three
|
The ``PyInitConfig`` structure is implemented by combining the four
|
||||||
structures of the ``PyConfig`` API and has an ``inittab`` member as
|
structures of the ``PyConfig`` API and has an ``inittab`` member as
|
||||||
well:
|
well:
|
||||||
|
|
||||||
|
@ -502,6 +502,11 @@ Some option names are different than ``sys`` attributes, such as
|
||||||
``optimization_level`` option and ``sys.flags.optimize`` attribute.
|
``optimization_level`` option and ``sys.flags.optimize`` attribute.
|
||||||
``PyConfig_Set()`` sets the corresponding ``sys`` attribute.
|
``PyConfig_Set()`` sets the corresponding ``sys`` attribute.
|
||||||
|
|
||||||
|
The ``xoptions`` is a list of strings in ``PyInitConfig`` where each
|
||||||
|
string has the format ``key`` (*value* is ``True`` implicitly) or
|
||||||
|
``key=value``. In the current runtime configuration, it becomes a
|
||||||
|
dictionary (``key: str`` → ``value: str | True``).
|
||||||
|
|
||||||
Read-only configuration options
|
Read-only configuration options
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
@ -681,8 +686,8 @@ example, it sets the memory allocator, and can configure the
|
||||||
``LC_CTYPE`` locale and configure the standard C streams such as
|
``LC_CTYPE`` locale and configure the standard C streams such as
|
||||||
``stdin`` and ``stdout``.
|
``stdin`` and ``stdout``.
|
||||||
|
|
||||||
The following option names can only be set during the Python
|
The following options can only be set during the Python
|
||||||
preconfiguration:
|
preinitialization:
|
||||||
|
|
||||||
* ``allocator``,
|
* ``allocator``,
|
||||||
* ``coerce_c_locale``,
|
* ``coerce_c_locale``,
|
||||||
|
@ -1067,7 +1072,9 @@ Example getting the current runtime value of the configuration option
|
||||||
return verbose;
|
return verbose;
|
||||||
}
|
}
|
||||||
|
|
||||||
On error, the function silently ignores the error and returns ``-1``.
|
On error, the function silently ignores the error and returns ``-1``. In
|
||||||
|
practice, getting the ``verbose`` option cannot fail, unless a future
|
||||||
|
Python version removes the option.
|
||||||
|
|
||||||
|
|
||||||
Implementation
|
Implementation
|
||||||
|
@ -1179,8 +1186,10 @@ strings encoded and only initialize the ``LC_CTYPE`` locale and
|
||||||
decode the strings in ``Py_InitializeFromInitConfig()``.
|
decode the strings in ``Py_InitializeFromInitConfig()``.
|
||||||
|
|
||||||
The problem is that users asked for ``PyInitConfig_Get*()`` functions.
|
The problem is that users asked for ``PyInitConfig_Get*()`` functions.
|
||||||
|
For example, ``PyInitConfig_GetStr()`` must decode the string from the
|
||||||
|
locale encoding and then encode it to the UTF-8 encoding.
|
||||||
|
|
||||||
Also, if ``PyInitConfig_SetStrLocale()`` and
|
However, if ``PyInitConfig_SetStrLocale()`` and
|
||||||
``PyInitConfig_SetStrLocaleList()`` strings are decoded as designed by
|
``PyInitConfig_SetStrLocaleList()`` strings are decoded as designed by
|
||||||
the PEP, there is no risk of mojibake: ``PyInitConfig_GetStr()`` returns
|
the PEP, there is no risk of mojibake: ``PyInitConfig_GetStr()`` returns
|
||||||
the expected decoded strings.
|
the expected decoded strings.
|
||||||
|
@ -1198,8 +1207,8 @@ Python, so have a Python-like program but with a different default
|
||||||
configuration. The ``PyInitConfig_CreatePython()`` function is needed
|
configuration. The ``PyInitConfig_CreatePython()`` function is needed
|
||||||
for that.
|
for that.
|
||||||
|
|
||||||
The Python configuration is also part of the :pep:`587` design,
|
Moreover, the Python configuration is also part of the :pep:`587`
|
||||||
implemented in Python 3.8.
|
design, implemented in Python 3.8.
|
||||||
|
|
||||||
Disallow setting the ``"configure_locale"`` option has similar issues.
|
Disallow setting the ``"configure_locale"`` option has similar issues.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue