Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Doc/c-api/buffer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,11 @@ Buffer-related functions
*indices* must point to an array of ``view->ndim`` indices.


.. c:function:: int PyBuffer_FromContiguous(const Py_buffer *view, const void *buf, Py_ssize_t len, char fort)
.. c:function:: int PyBuffer_FromContiguous(const Py_buffer *view, const void *buf, Py_ssize_t len, char order)

Copy contiguous *len* bytes from *buf* to *view*.
*fort* can be ``'C'`` or ``'F'`` (for C-style or Fortran-style ordering).
*order* can be ``'C'`` or ``'F'`` or ``'A'`` (for C-style or Fortran-style
ordering or either one).
``0`` is returned on success, ``-1`` on error.


Expand Down
7 changes: 5 additions & 2 deletions Doc/c-api/file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,12 @@ the :mod:`io` APIs instead.
Write object *obj* to file object *p*. The only supported flag for *flags* is
:c:macro:`Py_PRINT_RAW`; if given, the :func:`str` of the object is written
instead of the :func:`repr`. Return ``0`` on success or ``-1`` on failure; the
appropriate exception will be set.
instead of the :func:`repr`.
If *obj* is ``NULL``, write the string ``"<NULL>"``.
Return ``0`` on success or ``-1`` on failure; the
appropriate exception will be set.
.. c:function:: int PyFile_WriteString(const char *s, PyObject *p)
Expand Down
8 changes: 8 additions & 0 deletions Doc/c-api/object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ Object Protocol
representation on success, ``NULL`` on failure. This is the equivalent of the
Python expression ``repr(o)``. Called by the :func:`repr` built-in function.

If argument is ``NULL``, return the string ``'<NULL>'``.

.. versionchanged:: 3.4
This function now includes a debug assertion to help ensure that it
does not silently discard an active exception.
Expand All @@ -377,6 +379,8 @@ Object Protocol
a string similar to that returned by :c:func:`PyObject_Repr` in Python 2.
Called by the :func:`ascii` built-in function.

If argument is ``NULL``, return the string ``'<NULL>'``.

.. index:: string; PyObject_Str (C function)


Expand All @@ -387,6 +391,8 @@ Object Protocol
Python expression ``str(o)``. Called by the :func:`str` built-in function
and, therefore, by the :func:`print` function.

If argument is ``NULL``, return the string ``'<NULL>'``.

.. versionchanged:: 3.4
This function now includes a debug assertion to help ensure that it
does not silently discard an active exception.
Expand All @@ -402,6 +408,8 @@ Object Protocol
a TypeError is raised when *o* is an integer instead of a zero-initialized
bytes object.

If argument is ``NULL``, return the :class:`bytes` object ``b'<NULL>'``.


.. c:function:: int PyObject_IsSubclass(PyObject *derived, PyObject *cls)

Expand Down
4 changes: 3 additions & 1 deletion Doc/c-api/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,7 @@ object.
On success, return ``0``.
On error, set an exception, leave the writer unchanged, and return ``-1``.

.. c:function:: int PyUnicodeWriter_WriteUCS4(PyUnicodeWriter *writer, Py_UCS4 *str, Py_ssize_t size)
.. c:function:: int PyUnicodeWriter_WriteUCS4(PyUnicodeWriter *writer, const Py_UCS4 *str, Py_ssize_t size)

Writer the UCS4 string *str* into *writer*.

Expand All @@ -1887,6 +1887,8 @@ object.

Call :c:func:`PyObject_Repr` on *obj* and write the output into *writer*.

If *obj* is ``NULL``, write the string ``"<NULL>"`` into *writer*.

On success, return ``0``.
On error, set an exception, leave the writer unchanged, and return ``-1``.

Expand Down
16 changes: 9 additions & 7 deletions Doc/tools/extensions/c_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,27 +308,27 @@ def _unstable_api_annotation() -> nodes.admonition:
def _threadsafety_annotation(level: str) -> nodes.emphasis:
match level:
case "incompatible":
display = sphinx_gettext("Not safe to call from multiple threads.")
display = sphinx_gettext("Not safe to call from multiple threads")
reftarget = "threadsafety-level-incompatible"
case "compatible":
display = sphinx_gettext(
"Safe to call from multiple threads"
" with external synchronization only."
" with external synchronization only"
)
reftarget = "threadsafety-level-compatible"
case "distinct":
display = sphinx_gettext(
"Safe to call without external synchronization"
" on distinct objects."
" on distinct objects"
)
reftarget = "threadsafety-level-distinct"
case "shared":
display = sphinx_gettext(
"Safe for concurrent use on the same object."
"Safe for concurrent use on the same object"
)
reftarget = "threadsafety-level-shared"
case "atomic":
display = sphinx_gettext("Atomic.")
display = sphinx_gettext("Atomic")
reftarget = "threadsafety-level-atomic"
case _:
raise AssertionError(f"Unknown thread safety level {level!r}")
Expand All @@ -340,9 +340,11 @@ def _threadsafety_annotation(level: str) -> nodes.emphasis:
reftype="ref",
refexplicit="True",
)
prefix = sphinx_gettext("Thread safety:") + " "
prefix = " " + sphinx_gettext("Thread safety:") + " "
classes = ["threadsafety", f"threadsafety-{level}"]
return nodes.emphasis("", prefix, ref_node, classes=classes)
return nodes.emphasis(
"", prefix, ref_node, nodes.Text("."), classes=classes
)


def _return_value_annotation(result_refs: int | None) -> nodes.emphasis:
Expand Down
2 changes: 1 addition & 1 deletion Include/cpython/unicodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ PyAPI_FUNC(int) PyUnicodeWriter_WriteWideChar(
Py_ssize_t size);
PyAPI_FUNC(int) PyUnicodeWriter_WriteUCS4(
PyUnicodeWriter *writer,
Py_UCS4 *str,
const Py_UCS4 *str,
Py_ssize_t size);

PyAPI_FUNC(int) PyUnicodeWriter_WriteStr(
Expand Down
4 changes: 2 additions & 2 deletions Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading