summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-11-18 17:48:06 (GMT)
committerGitHub <noreply@github.com>2020-11-18 17:48:06 (GMT)
commit0e2ac21dd4960574e89561243763eabba685296a (patch)
tree62d5b28d9f66f40020d3fa403ac639a781d70d80 /Doc
parent2156d964a12285280c533af1c96eb273c58451e6 (diff)
downloadcpython-0e2ac21dd4960574e89561243763eabba685296a.zip
cpython-0e2ac21dd4960574e89561243763eabba685296a.tar.gz
cpython-0e2ac21dd4960574e89561243763eabba685296a.tar.bz2
bpo-39573: Convert Py_TYPE() and Py_SIZE() back to macros (GH-23366)
This change partically reverts commit ad3252bad905d41635bcbb4b76db30d570cf0087 and the commit fe2978b3b940fe2478335e3a2ca5ad22338cdf9c. Many third party C extension modules rely on the ability of using Py_TYPE() to set an object type: "Py_TYPE(obj) = type;" or to set an object type using: "Py_SIZE(obj) = size;".
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/structures.rst8
-rw-r--r--Doc/whatsnew/3.10.rst11
2 files changed, 2 insertions, 17 deletions
diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst
index 37602ed..37072d3 100644
--- a/Doc/c-api/structures.rst
+++ b/Doc/c-api/structures.rst
@@ -68,9 +68,7 @@ the definition of all other Python objects.
Return a :term:`borrowed reference`.
- .. versionchanged:: 3.10
- :c:func:`Py_TYPE()` is changed to the inline static function.
- Use :c:func:`Py_SET_TYPE()` to set an object type.
+ The :c:func:`Py_SET_TYPE` function must be used to set an object type.
.. c:function:: int Py_IS_TYPE(PyObject *o, PyTypeObject *type)
@@ -108,9 +106,7 @@ the definition of all other Python objects.
Get the size of the Python object *o*.
- .. versionchanged:: 3.10
- :c:func:`Py_SIZE()` is changed to the inline static function.
- Use :c:func:`Py_SET_SIZE()` to set an object size.
+ The :c:func:`Py_SET_SIZE` function must be used to set an object size.
.. c:function:: void Py_SET_SIZE(PyVarObject *o, Py_ssize_t size)
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index 41252b8..cfb0383 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -489,17 +489,6 @@ Porting to Python 3.10
<arg-parsing>` and the :pep:`353`.
(Contributed by Victor Stinner in :issue:`40943`.)
-* Since :c:func:`Py_TYPE()` is changed to the inline static function,
- ``Py_TYPE(obj) = new_type`` must be replaced with ``Py_SET_TYPE(obj, new_type)``:
- see :c:func:`Py_SET_TYPE()` (available since Python 3.9). For backward
- compatibility, this macro can be used::
-
- #if PY_VERSION_HEX < 0x030900A4
- # define Py_SET_TYPE(obj, type) ((Py_TYPE(obj) = (type)), (void)0)
- #endif
-
- (Contributed by Dong-hee Na in :issue:`39573`.)
-
* Since :c:func:`Py_REFCNT()` is changed to the inline static function,
``Py_REFCNT(obj) = new_refcnt`` must be replaced with ``Py_SET_REFCNT(obj, new_refcnt)``:
see :c:func:`Py_SET_REFCNT()` (available since Python 3.9). For backward