[3.12] gh-107298: Fix numerous ref errors and typos in the C API docs (GH-108258) (#108284)

gh-107298: Fix numerous ref errors and typos in the C API docs (GH-108258)
(cherry picked from commit d7202e4879)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2023-08-22 07:16:31 -07:00 committed by GitHub
parent a2b680d9e9
commit e5d779c0e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 103 additions and 92 deletions

View file

@ -222,17 +222,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.

View file

@ -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

View file

@ -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.
@ -380,6 +382,8 @@ The available slot types are:
Specifies one of the following values:
.. c:namespace:: NULL
.. c:macro:: Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED
The module does not support being imported in subinterpreters.

View file

@ -1299,7 +1299,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