diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2023-08-22 18:33:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-22 18:33:07 (GMT) |
commit | 3ca9264aba054672e8a33c2e0d9cf32cb4e17a86 (patch) | |
tree | 2d0d7471921ab9112e4d95eba9b22993481bcc37 /Doc/c-api | |
parent | 80c7ae00f10a374e1d79d1c2719056951fdd3421 (diff) | |
download | cpython-3ca9264aba054672e8a33c2e0d9cf32cb4e17a86.zip cpython-3ca9264aba054672e8a33c2e0d9cf32cb4e17a86.tar.gz cpython-3ca9264aba054672e8a33c2e0d9cf32cb4e17a86.tar.bz2 |
[3.11] gh-107298: Fix numerous ref errors and typos in the C API docs (GH-108258) (#108290)
(cherry picked from commit d7202e4879bf4e7e00a69500ddcb3143864139b4)
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/exceptions.rst | 14 | ||||
-rw-r--r-- | Doc/c-api/init_config.rst | 4 | ||||
-rw-r--r-- | Doc/c-api/module.rst | 2 | ||||
-rw-r--r-- | Doc/c-api/unicode.rst | 2 |
4 files changed, 16 insertions, 6 deletions
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index ae45aae..8205084 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -211,17 +211,21 @@ For convenience, some of these functions will always return a .. c:function:: PyObject* PyErr_SetFromWindowsErrWithFilename(int ierr, const char *filename) - Similar to :c:func:`PyErr_SetFromWindowsErrWithFilenameObject`, but the - filename is given as a C string. *filename* is decoded from the filesystem - encoding (:func:`os.fsdecode`). + Similar to :c:func:`PyErr_SetFromWindowsErr`, with the additional behavior + that if *filename* is not ``NULL``, it is decoded from the filesystem + encoding (:func:`os.fsdecode`) and passed to the constructor of + :exc:`OSError` as a third parameter to be used to define the + :attr:`!filename` attribute of the exception instance. .. availability:: Windows. .. c:function:: PyObject* PyErr_SetExcFromWindowsErrWithFilenameObject(PyObject *type, int ierr, PyObject *filename) - Similar to :c:func:`PyErr_SetFromWindowsErrWithFilenameObject`, with an - additional parameter specifying the exception type to be raised. + Similar to :c:func:`PyErr_SetExcFromWindowsErr`, with the additional behavior + that if *filename* is not ``NULL``, it is passed to the constructor of + :exc:`OSError` as a third parameter to be used to define the + :attr:`!filename` attribute of the exception instance. .. availability:: Windows. diff --git a/Doc/c-api/init_config.rst b/Doc/c-api/init_config.rst index c6798d6..ad1cd3f 100644 --- a/Doc/c-api/init_config.rst +++ b/Doc/c-api/init_config.rst @@ -82,6 +82,8 @@ PyWideStringList If *length* is non-zero, *items* must be non-``NULL`` and all strings must be non-``NULL``. + .. c:namespace:: NULL + Methods: .. c:function:: PyStatus PyWideStringList_Append(PyWideStringList *list, const wchar_t *item) @@ -101,6 +103,8 @@ PyWideStringList Python must be preinitialized to call this function. + .. c:namespace:: PyWideStringList + Structure fields: .. c:member:: Py_ssize_t length diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst index 6ef4eea..71a079a 100644 --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -338,6 +338,7 @@ The available slot types are: The *value* pointer of this slot must point to a function of the signature: .. c:function:: PyObject* create_module(PyObject *spec, PyModuleDef *def) + :noindex: The function receives a :py:class:`~importlib.machinery.ModuleSpec` instance, as defined in :PEP:`451`, and the module definition. @@ -372,6 +373,7 @@ The available slot types are: The signature of the function is: .. c:function:: int exec_module(PyObject* module) + :noindex: If multiple ``Py_mod_exec`` slots are specified, they are processed in the order they appear in the *m_slots* array. diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst index 3d6b4c4..146511b 100644 --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -1391,7 +1391,7 @@ the user settings on the machine running the codec. Encode the Unicode object using the specified code page and return a Python bytes object. Return ``NULL`` if an exception was raised by the codec. Use - :c:macro:`CP_ACP` code page to get the MBCS encoder. + :c:macro:`!CP_ACP` code page to get the MBCS encoder. .. versionadded:: 3.3 |