PEP 741: Fix small mistakes (#3713)

This commit is contained in:
Victor Stinner 2024-03-10 08:35:56 +01:00 committed by GitHub
parent a0e3011518
commit e98d6c00e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 7 deletions

View File

@ -388,7 +388,7 @@ configuration option.
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
well:
@ -502,6 +502,11 @@ Some option names are different than ``sys`` attributes, such as
``optimization_level`` option and ``sys.flags.optimize`` 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
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -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
``stdin`` and ``stdout``.
The following option names can only be set during the Python
preconfiguration:
The following options can only be set during the Python
preinitialization:
* ``allocator``,
* ``coerce_c_locale``,
@ -1067,7 +1072,9 @@ Example getting the current runtime value of the configuration option
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
@ -1179,8 +1186,10 @@ strings encoded and only initialize the ``LC_CTYPE`` locale and
decode the strings in ``Py_InitializeFromInitConfig()``.
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
the PEP, there is no risk of mojibake: ``PyInitConfig_GetStr()`` returns
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
for that.
The Python configuration is also part of the :pep:`587` design,
implemented in Python 3.8.
Moreover, the Python configuration is also part of the :pep:`587`
design, implemented in Python 3.8.
Disallow setting the ``"configure_locale"`` option has similar issues.