From eb67885d228b42e105103f77328579848d0b7f71 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 26 Aug 2024 19:25:51 +0200 Subject: [PATCH] PEP 741: Fix typos (#3924) --- peps/pep-0741.rst | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/peps/pep-0741.rst b/peps/pep-0741.rst index 0f18ac534..95af790c8 100644 --- a/peps/pep-0741.rst +++ b/peps/pep-0741.rst @@ -68,7 +68,7 @@ Security fix To fix `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 branches which affects the ABI. @@ -230,7 +230,7 @@ These C API functions are excluded from the limited C API. 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 well: @@ -352,7 +352,7 @@ dictionary (``key: str`` → ``value: str | True``). 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()``. .. list-table:: @@ -427,7 +427,7 @@ Following options can be get ``PyConfig_Get()``, but cannot be set by - * - ``legacy_windows_stdio`` - ``bool`` - - Windows only + - Windows only. * - ``malloc_stats`` - ``bool`` - @@ -667,9 +667,7 @@ Error Handling * Return ``0`` if *config* has no exit code set. Only the ``Py_InitializeFromInitConfig()`` function can set an exit - code if the ``parse_argv`` option is non-zero. For example, an - isolated configuration cannot set an exit code by default, since - ``parse_argv`` is zero by default. + code if the ``parse_argv`` option is non-zero. 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 @@ -758,8 +756,8 @@ Examples Initialize Python ----------------- -Example initializing Python, set configuration options of different types, -return -1 on error: +Example initializing Python, set configuration options of various types, +return ``-1`` on error: .. code-block:: c @@ -777,7 +775,6 @@ return -1 on error: } // Set a list of UTF-8 strings (argv) - // Preinitialize implicitly Python to decode the bytes string. char *argv[] = {"my_program", "-c", "pass"}; if (PyInitConfig_SetStrList(config, "argv", Py_ARRAY_LENGTH(argv), argv) < 0) { @@ -789,13 +786,6 @@ return -1 on 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 if (Py_InitializeFromInitConfig(config) < 0) { goto error; @@ -824,7 +814,7 @@ configuration: int config_bytes_warning(PyInitConfig *config) { - int bytes_warning; + int64_t bytes_warning; if (PyInitConfig_GetInt(config, "bytes_warning", &bytes_warning)) { return -1; }