mirror of
https://github.com/python/cpython.git
synced 2025-08-15 22:30:42 +00:00
[3.11] gh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (GH-97768) (#97924)
:c:type:`<C type>` -> :c:expr:`<C type>`
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 0031e62973
)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
parent
61183b95ae
commit
83ad76275c
34 changed files with 241 additions and 241 deletions
|
@ -58,7 +58,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
|
||||
|
@ -935,11 +935,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.
|
||||
|
@ -947,13 +947,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.
|
||||
|
||||
|
@ -963,9 +963,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_Alloc` (use
|
||||
|
@ -976,7 +976,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.
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue