gh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (#97768)

:c:type:`<C type>` -> :c:expr:`<C type>`

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
Adam Turner 2022-10-05 19:01:14 +01:00 committed by GitHub
parent aeb28f5130
commit 0031e62973
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 241 additions and 241 deletions

View file

@ -44,7 +44,7 @@ Python:
.. c:type:: Py_UNICODE
This is a typedef of :c:type:`wchar_t`, which is a 16-bit type or 32-bit type
This is a typedef of :c:expr:`wchar_t`, which is a 16-bit type or 32-bit type
depending on the platform.
.. versionchanged:: 3.3
@ -788,11 +788,11 @@ conversion function:
wchar_t Support
"""""""""""""""
:c:type:`wchar_t` support for platforms which support it:
:c:expr:`wchar_t` support for platforms which support it:
.. c:function:: PyObject* PyUnicode_FromWideChar(const wchar_t *w, Py_ssize_t size)
Create a Unicode object from the :c:type:`wchar_t` buffer *w* of the given *size*.
Create a Unicode object from the :c:expr:`wchar_t` buffer *w* of the given *size*.
Passing ``-1`` as the *size* indicates that the function must itself compute the length,
using wcslen.
Return ``NULL`` on failure.
@ -800,13 +800,13 @@ wchar_t Support
.. c:function:: Py_ssize_t PyUnicode_AsWideChar(PyObject *unicode, wchar_t *w, Py_ssize_t size)
Copy the Unicode object contents into the :c:type:`wchar_t` buffer *w*. At most
*size* :c:type:`wchar_t` characters are copied (excluding a possibly trailing
null termination character). Return the number of :c:type:`wchar_t` characters
copied or ``-1`` in case of an error. Note that the resulting :c:type:`wchar_t*`
Copy the Unicode object contents into the :c:expr:`wchar_t` buffer *w*. At most
*size* :c:expr:`wchar_t` characters are copied (excluding a possibly trailing
null termination character). Return the number of :c:expr:`wchar_t` characters
copied or ``-1`` in case of an error. Note that the resulting :c:expr:`wchar_t*`
string may or may not be null-terminated. It is the responsibility of the caller
to make sure that the :c:type:`wchar_t*` string is null-terminated in case this is
required by the application. Also, note that the :c:type:`wchar_t*` string
to make sure that the :c:expr:`wchar_t*` string is null-terminated in case this is
required by the application. Also, note that the :c:expr:`wchar_t*` string
might contain null characters, which would cause the string to be truncated
when used with most C functions.
@ -816,9 +816,9 @@ wchar_t Support
Convert the Unicode object to a wide character string. The output string
always ends with a null character. If *size* is not ``NULL``, write the number
of wide characters (excluding the trailing null termination character) into
*\*size*. Note that the resulting :c:type:`wchar_t` string might contain
*\*size*. Note that the resulting :c:expr:`wchar_t` string might contain
null characters, which would cause the string to be truncated when used with
most C functions. If *size* is ``NULL`` and the :c:type:`wchar_t*` string
most C functions. If *size* is ``NULL`` and the :c:expr:`wchar_t*` string
contains null characters a :exc:`ValueError` is raised.
Returns a buffer allocated by :c:func:`PyMem_New` (use
@ -829,7 +829,7 @@ wchar_t Support
.. versionadded:: 3.2
.. versionchanged:: 3.7
Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:type:`wchar_t*`
Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*`
string contains null characters.