PEP 741: Fix typos (#3924)
This commit is contained in:
parent
d4c9efc883
commit
eb67885d22
|
@ -68,7 +68,7 @@ Security fix
|
||||||
|
|
||||||
To fix `CVE-2020-10735
|
To fix `CVE-2020-10735
|
||||||
<https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10735>`_,
|
<https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10735>`_,
|
||||||
a denial-of-service when converting very a large string to an integer (in base
|
a denial-of-service when converting a very large string to an integer (in base
|
||||||
10), it was discussed to add a new ``PyConfig`` member to stable
|
10), it was discussed to add a new ``PyConfig`` member to stable
|
||||||
branches which affects the ABI.
|
branches which affects the ABI.
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ These C API functions are excluded from the limited C API.
|
||||||
PyInitConfig structure
|
PyInitConfig structure
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
The ``PyInitConfig`` structure is implemented by combining the four
|
The ``PyInitConfig`` structure is implemented by combining the three
|
||||||
structures of the ``PyConfig`` API and has an ``inittab`` member as
|
structures of the ``PyConfig`` API and has an ``inittab`` member as
|
||||||
well:
|
well:
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ dictionary (``key: str`` → ``value: str | True``).
|
||||||
Read-only configuration options
|
Read-only configuration options
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Following options can be get ``PyConfig_Get()``, but cannot be set by
|
Following options can be get by ``PyConfig_Get()``, but cannot be set by
|
||||||
``PyConfig_Set()``.
|
``PyConfig_Set()``.
|
||||||
|
|
||||||
.. list-table::
|
.. list-table::
|
||||||
|
@ -427,7 +427,7 @@ Following options can be get ``PyConfig_Get()``, but cannot be set by
|
||||||
-
|
-
|
||||||
* - ``legacy_windows_stdio``
|
* - ``legacy_windows_stdio``
|
||||||
- ``bool``
|
- ``bool``
|
||||||
- Windows only
|
- Windows only.
|
||||||
* - ``malloc_stats``
|
* - ``malloc_stats``
|
||||||
- ``bool``
|
- ``bool``
|
||||||
-
|
-
|
||||||
|
@ -667,9 +667,7 @@ Error Handling
|
||||||
* Return ``0`` if *config* has no exit code set.
|
* Return ``0`` if *config* has no exit code set.
|
||||||
|
|
||||||
Only the ``Py_InitializeFromInitConfig()`` function can set an exit
|
Only the ``Py_InitializeFromInitConfig()`` function can set an exit
|
||||||
code if the ``parse_argv`` option is non-zero. For example, an
|
code if the ``parse_argv`` option is non-zero.
|
||||||
isolated configuration cannot set an exit code by default, since
|
|
||||||
``parse_argv`` is zero by default.
|
|
||||||
|
|
||||||
An exit code can be set when parsing the command line failed (exit
|
An exit code can be set when parsing the command line failed (exit
|
||||||
code 2) or when a command line option asks to display the command
|
code 2) or when a command line option asks to display the command
|
||||||
|
@ -758,8 +756,8 @@ Examples
|
||||||
Initialize Python
|
Initialize Python
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Example initializing Python, set configuration options of different types,
|
Example initializing Python, set configuration options of various types,
|
||||||
return -1 on error:
|
return ``-1`` on error:
|
||||||
|
|
||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
|
|
||||||
|
@ -777,7 +775,6 @@ return -1 on error:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set a list of UTF-8 strings (argv)
|
// Set a list of UTF-8 strings (argv)
|
||||||
// Preinitialize implicitly Python to decode the bytes string.
|
|
||||||
char *argv[] = {"my_program", "-c", "pass"};
|
char *argv[] = {"my_program", "-c", "pass"};
|
||||||
if (PyInitConfig_SetStrList(config, "argv",
|
if (PyInitConfig_SetStrList(config, "argv",
|
||||||
Py_ARRAY_LENGTH(argv), argv) < 0) {
|
Py_ARRAY_LENGTH(argv), argv) < 0) {
|
||||||
|
@ -789,13 +786,6 @@ return -1 on error:
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set a list of UTF-8 strings (xoptions).
|
|
||||||
char* xoptions[] = {"faulthandler"};
|
|
||||||
if (PyInitConfig_SetStrList(config, "xoptions",
|
|
||||||
Py_ARRAY_LENGTH(xoptions), xoptions) < 0) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize Python with the configuration
|
// Initialize Python with the configuration
|
||||||
if (Py_InitializeFromInitConfig(config) < 0) {
|
if (Py_InitializeFromInitConfig(config) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -824,7 +814,7 @@ configuration:
|
||||||
|
|
||||||
int config_bytes_warning(PyInitConfig *config)
|
int config_bytes_warning(PyInitConfig *config)
|
||||||
{
|
{
|
||||||
int bytes_warning;
|
int64_t bytes_warning;
|
||||||
if (PyInitConfig_GetInt(config, "bytes_warning", &bytes_warning)) {
|
if (PyInitConfig_GetInt(config, "bytes_warning", &bytes_warning)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue