Skip to content

Commit 74e3995

Browse files
committed
Deploying to gh-pages from @ 445d5a2 🚀
1 parent e250ed3 commit 74e3995

File tree

791 files changed

+38560
-38585
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

791 files changed

+38560
-38585
lines changed

.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: bdfb3041d251008c4c431e304e0b21c1
3+
config: 908a2225ab805924400df1aecc1bf46b
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

_sources/c-api/arg.rst.txt

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,48 @@ There are three ways strings and buffers can be converted to C:
152152
attempting any conversion. Raises :exc:`TypeError` if the object is not
153153
a :class:`bytearray` object. The C variable may also be declared as :c:expr:`PyObject*`.
154154

155+
``u`` (:class:`str`) [const Py_UNICODE \*]
156+
Convert a Python Unicode object to a C pointer to a NUL-terminated buffer of
157+
Unicode characters. You must pass the address of a :c:type:`Py_UNICODE`
158+
pointer variable, which will be filled with the pointer to an existing
159+
Unicode buffer. Please note that the width of a :c:type:`Py_UNICODE`
160+
character depends on compilation options (it is either 16 or 32 bits).
161+
The Python string must not contain embedded null code points; if it does,
162+
a :exc:`ValueError` exception is raised.
163+
164+
.. versionchanged:: 3.5
165+
Previously, :exc:`TypeError` was raised when embedded null code points
166+
were encountered in the Python string.
167+
168+
.. deprecated-removed:: 3.3 3.12
169+
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
170+
:c:func:`PyUnicode_AsWideCharString`.
171+
172+
``u#`` (:class:`str`) [const Py_UNICODE \*, :c:type:`Py_ssize_t`]
173+
This variant on ``u`` stores into two C variables, the first one a pointer to a
174+
Unicode data buffer, the second one its length. This variant allows
175+
null code points.
176+
177+
.. deprecated-removed:: 3.3 3.12
178+
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
179+
:c:func:`PyUnicode_AsWideCharString`.
180+
181+
``Z`` (:class:`str` or ``None``) [const Py_UNICODE \*]
182+
Like ``u``, but the Python object may also be ``None``, in which case the
183+
:c:type:`Py_UNICODE` pointer is set to ``NULL``.
184+
185+
.. deprecated-removed:: 3.3 3.12
186+
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
187+
:c:func:`PyUnicode_AsWideCharString`.
188+
189+
``Z#`` (:class:`str` or ``None``) [const Py_UNICODE \*, :c:type:`Py_ssize_t`]
190+
Like ``u#``, but the Python object may also be ``None``, in which case the
191+
:c:type:`Py_UNICODE` pointer is set to ``NULL``.
192+
193+
.. deprecated-removed:: 3.3 3.12
194+
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
195+
:c:func:`PyUnicode_AsWideCharString`.
196+
155197
``U`` (:class:`str`) [PyObject \*]
156198
Requires that the Python object is a Unicode object, without attempting
157199
any conversion. Raises :exc:`TypeError` if the object is not a Unicode
@@ -221,11 +263,6 @@ There are three ways strings and buffers can be converted to C:
221263
them. Instead, the implementation assumes that the byte string object uses the
222264
encoding passed in as parameter.
223265

224-
.. versionchanged:: 3.12
225-
``u``, ``u#``, ``Z``, and ``Z#`` are removed because they used a legacy
226-
``Py_UNICODE*`` representation.
227-
228-
229266
Numbers
230267
-------
231268

@@ -343,7 +380,7 @@ Other objects
343380
*items*. Format units for sequences may be nested.
344381

345382
It is possible to pass "long" integers (integers whose value exceeds the
346-
platform's :const:`LONG_MAX`) however no proper range checking is done --- the
383+
platform's :c:macro:`LONG_MAX`) however no proper range checking is done --- the
347384
most significant bits are silently truncated when the receiving field is too
348385
small to receive the value (actually, the semantics are inherited from downcasts
349386
in C --- your mileage may vary).
@@ -455,7 +492,7 @@ API Functions
455492
456493
A simpler form of parameter retrieval which does not use a format string to
457494
specify the types of the arguments. Functions which use this method to retrieve
458-
their parameters should be declared as :const:`METH_VARARGS` in function or
495+
their parameters should be declared as :c:macro:`METH_VARARGS` in function or
459496
method tables. The tuple containing the actual parameters should be passed as
460497
*args*; it must actually be a tuple. The length of the tuple must be at least
461498
*min* and no more than *max*; *min* and *max* may be equal. Additional

_sources/c-api/bool.rst.txt

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Boolean Objects
66
---------------
77

88
Booleans in Python are implemented as a subclass of integers. There are only
9-
two booleans, :c:data:`Py_False` and :c:data:`Py_True`. As such, the normal
9+
two booleans, :const:`Py_False` and :const:`Py_True`. As such, the normal
1010
creation and deletion functions don't apply to booleans. The following macros
1111
are available, however.
1212

@@ -19,32 +19,29 @@ are available, however.
1919
2020
.. c:var:: PyObject* Py_False
2121
22-
The Python ``False`` object. This object has no methods and is
23-
`immortal <https://peps.python.org/pep-0683/>`_.
24-
25-
.. versionchanged:: 3.12
26-
:c:data:`Py_False` is immortal.
22+
The Python ``False`` object. This object has no methods. It needs to be
23+
treated just like any other object with respect to reference counts.
2724
2825
2926
.. c:var:: PyObject* Py_True
3027
31-
The Python ``True`` object. This object has no methods and is
32-
`immortal <https://peps.python.org/pep-0683/>`_.
33-
34-
.. versionchanged:: 3.12
35-
:c:data:`Py_True` is immortal.
28+
The Python ``True`` object. This object has no methods. It needs to be treated
29+
just like any other object with respect to reference counts.
3630
3731
3832
.. c:macro:: Py_RETURN_FALSE
3933
40-
Return :c:data:`Py_False` from a function.
34+
Return :const:`Py_False` from a function, properly incrementing its reference
35+
count.
4136
4237
4338
.. c:macro:: Py_RETURN_TRUE
4439
45-
Return :c:data:`Py_True` from a function.
40+
Return :const:`Py_True` from a function, properly incrementing its reference
41+
count.
4642
4743
4844
.. c:function:: PyObject* PyBool_FromLong(long v)
4945
50-
Return :c:data:`Py_True` or :c:data:`Py_False`, depending on the truth value of *v*.
46+
Return a new reference to :const:`Py_True` or :const:`Py_False` depending on the
47+
truth value of *v*.

_sources/c-api/bytes.rst.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ called with a non-bytes parameter.
5858
5959
.. % XXX: This should be exactly the same as the table in PyErr_Format.
6060
.. % One should just refer to the other.
61+
.. % XXX: The descriptions for %zd and %zu are wrong, but the truth is complicated
62+
.. % because not all compilers support the %z width modifier -- we fake it
63+
.. % when necessary via interpolating PY_FORMAT_SIZE_T.
6164
6265
.. tabularcolumns:: |l|l|L|
6366

_sources/c-api/call.rst.txt

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,13 @@ This bears repeating:
5757
A class supporting vectorcall **must** also implement
5858
:c:member:`~PyTypeObject.tp_call` with the same semantics.
5959

60-
.. versionchanged:: 3.12
61-
62-
The :const:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class
63-
when the class's :py:meth:`~object.__call__` method is reassigned.
64-
(This internally sets :c:member:`~PyTypeObject.tp_call` only, and thus
65-
may make it behave differently than the vectorcall function.)
66-
In earlier Python versions, vectorcall should only be used with
67-
:const:`immutable <Py_TPFLAGS_IMMUTABLETYPE>` or static types.
68-
6960
A class should not implement vectorcall if that would be slower
7061
than *tp_call*. For example, if the callee needs to convert
7162
the arguments to an args tuple and kwargs dict anyway, then there is no point
7263
in implementing vectorcall.
7364

7465
Classes can implement the vectorcall protocol by enabling the
75-
:const:`Py_TPFLAGS_HAVE_VECTORCALL` flag and setting
66+
:c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag and setting
7667
:c:member:`~PyTypeObject.tp_vectorcall_offset` to the offset inside the
7768
object structure where a *vectorcallfunc* appears.
7869
This is a pointer to a function with the following signature:
@@ -84,7 +75,7 @@ This is a pointer to a function with the following signature:
8475
values of the keyword arguments.
8576
This can be *NULL* if there are no arguments.
8677
- *nargsf* is the number of positional arguments plus possibly the
87-
:const:`PY_VECTORCALL_ARGUMENTS_OFFSET` flag.
78+
:c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET` flag.
8879
To get the actual number of positional arguments from *nargsf*,
8980
use :c:func:`PyVectorcall_NARGS`.
9081
- *kwnames* is a tuple containing the names of the keyword arguments;
@@ -93,7 +84,7 @@ This is a pointer to a function with the following signature:
9384
and they must be unique.
9485
If there are no keyword arguments, then *kwnames* can instead be *NULL*.
9586

96-
.. data:: PY_VECTORCALL_ARGUMENTS_OFFSET
87+
.. c:macro:: PY_VECTORCALL_ARGUMENTS_OFFSET
9788
9889
If this flag is set in a vectorcall *nargsf* argument, the callee is allowed
9990
to temporarily change ``args[-1]``. In other words, *args* points to
@@ -104,7 +95,7 @@ This is a pointer to a function with the following signature:
10495
``args[0]`` may be changed.
10596

10697
Whenever they can do so cheaply (without additional allocation), callers
107-
are encouraged to use :const:`PY_VECTORCALL_ARGUMENTS_OFFSET`.
98+
are encouraged to use :c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`.
10899
Doing so will allow callables such as bound methods to make their onward
109100
calls (which include a prepended *self* argument) very efficiently.
110101

@@ -174,7 +165,7 @@ Vectorcall Support API
174165
175166
This is a specialized function, intended to be put in the
176167
:c:member:`~PyTypeObject.tp_call` slot or be used in an implementation of ``tp_call``.
177-
It does not check the :const:`Py_TPFLAGS_HAVE_VECTORCALL` flag
168+
It does not check the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag
178169
and it does not fall back to ``tp_call``.
179170
180171
.. versionadded:: 3.8
@@ -392,11 +383,11 @@ please see individual documentation for details.
392383
*args[0]*, and the *args* array starting at *args[1]* represents the arguments
393384
of the call. There must be at least one positional argument.
394385
*nargsf* is the number of positional arguments including *args[0]*,
395-
plus :const:`PY_VECTORCALL_ARGUMENTS_OFFSET` if the value of ``args[0]`` may
386+
plus :c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET` if the value of ``args[0]`` may
396387
temporarily be changed. Keyword arguments can be passed just like in
397388
:c:func:`PyObject_Vectorcall`.
398389
399-
If the object has the :const:`Py_TPFLAGS_METHOD_DESCRIPTOR` feature,
390+
If the object has the :c:macro:`Py_TPFLAGS_METHOD_DESCRIPTOR` feature,
400391
this will call the unbound method object with the full
401392
*args* vector as arguments.
402393

0 commit comments

Comments
 (0)