summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/structures.rst
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-04-21 20:07:19 (GMT)
committerGitHub <noreply@github.com>2022-04-21 20:07:19 (GMT)
commiteaa85cb22fa2d9e7cd31c2eac29a56cd3a8f2f65 (patch)
treeaf608caa1e93136eb244a107ba069714ec035b89 /Doc/c-api/structures.rst
parent128d6241176a879ea9b6e34ea67f1d113d22a1b8 (diff)
downloadcpython-eaa85cb22fa2d9e7cd31c2eac29a56cd3a8f2f65.zip
cpython-eaa85cb22fa2d9e7cd31c2eac29a56cd3a8f2f65.tar.gz
cpython-eaa85cb22fa2d9e7cd31c2eac29a56cd3a8f2f65.tar.bz2
gh-91768: C API no longer use "const PyObject*" type (#91769)
Py_REFCNT(), Py_TYPE(), Py_SIZE() and Py_IS_TYPE() functions argument type is now "PyObject*", rather than "const PyObject*". * Replace also "const PyObject*" with "PyObject*" in functions: * _Py_strhex_impl() * _Py_strhex_with_sep() * _Py_strhex_bytes_with_sep() * Remove _PyObject_CAST_CONST() and _PyVarObject_CAST_CONST() macros. * Py_IS_TYPE() can now use Py_TYPE() in its implementation.
Diffstat (limited to 'Doc/c-api/structures.rst')
-rw-r--r--Doc/c-api/structures.rst19
1 files changed, 12 insertions, 7 deletions
diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst
index aa74f6c..ff5ecf2 100644
--- a/Doc/c-api/structures.rst
+++ b/Doc/c-api/structures.rst
@@ -62,14 +62,14 @@ the definition of all other Python objects.
See documentation of :c:type:`PyVarObject` above.
-.. c:function:: int Py_Is(const PyObject *x, const PyObject *y)
+.. c:function:: int Py_Is(PyObject *x, PyObject *y)
Test if the *x* object is the *y* object, the same as ``x is y`` in Python.
.. versionadded:: 3.10
-.. c:function:: int Py_IsNone(const PyObject *x)
+.. c:function:: int Py_IsNone(PyObject *x)
Test if an object is the ``None`` singleton,
the same as ``x is None`` in Python.
@@ -77,7 +77,7 @@ the definition of all other Python objects.
.. versionadded:: 3.10
-.. c:function:: int Py_IsTrue(const PyObject *x)
+.. c:function:: int Py_IsTrue(PyObject *x)
Test if an object is the ``True`` singleton,
the same as ``x is True`` in Python.
@@ -85,7 +85,7 @@ the definition of all other Python objects.
.. versionadded:: 3.10
-.. c:function:: int Py_IsFalse(const PyObject *x)
+.. c:function:: int Py_IsFalse(PyObject *x)
Test if an object is the ``False`` singleton,
the same as ``x is False`` in Python.
@@ -93,7 +93,7 @@ the definition of all other Python objects.
.. versionadded:: 3.10
-.. c:function:: PyTypeObject* Py_TYPE(const PyObject *o)
+.. c:function:: PyTypeObject* Py_TYPE(PyObject *o)
Get the type of the Python object *o*.
@@ -103,6 +103,7 @@ the definition of all other Python objects.
.. versionchanged:: 3.11
:c:func:`Py_TYPE()` is changed to an inline static function.
+ The parameter type is no longer :c:type:`const PyObject*`.
.. c:function:: int Py_IS_TYPE(PyObject *o, PyTypeObject *type)
@@ -120,12 +121,15 @@ the definition of all other Python objects.
.. versionadded:: 3.9
-.. c:function:: Py_ssize_t Py_REFCNT(const PyObject *o)
+.. c:function:: Py_ssize_t Py_REFCNT(PyObject *o)
Get the reference count of the Python object *o*.
Use the :c:func:`Py_SET_REFCNT()` function to set an object reference count.
+ .. versionchanged:: 3.11
+ The parameter type is no longer :c:type:`const PyObject*`.
+
.. versionchanged:: 3.10
:c:func:`Py_REFCNT()` is changed to the inline static function.
@@ -137,7 +141,7 @@ the definition of all other Python objects.
.. versionadded:: 3.9
-.. c:function:: Py_ssize_t Py_SIZE(const PyVarObject *o)
+.. c:function:: Py_ssize_t Py_SIZE(PyVarObject *o)
Get the size of the Python object *o*.
@@ -145,6 +149,7 @@ the definition of all other Python objects.
.. versionchanged:: 3.11
:c:func:`Py_SIZE()` is changed to an inline static function.
+ The parameter type is no longer :c:type:`const PyVarObject*`.
.. c:function:: void Py_SET_SIZE(PyVarObject *o, Py_ssize_t size)