bpo-39573: Convert Py_TYPE() to a static inline function (GH-20290)
diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst
index 634e971..5535f42 100644
--- a/Doc/c-api/structures.rst
+++ b/Doc/c-api/structures.rst
@@ -62,12 +62,15 @@
See documentation of :c:type:`PyVarObject` above.
-.. c:macro:: Py_TYPE(o)
+.. c:function:: PyTypeObject* Py_TYPE(const PyObject *o)
- This macro is used to access the :attr:`ob_type` member of a Python object.
- It expands to::
+ Get the type of the Python object *o*.
- (((PyObject*)(o))->ob_type)
+ Return a 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.
.. c:function:: int Py_IS_TYPE(PyObject *o, PyTypeObject *type)
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index e650f94..98a231f 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -97,21 +97,14 @@
=============
-Build and C API Changes
-=======================
-
-
-
Deprecated
==========
-
Removed
=======
-
Porting to Python 3.10
======================
@@ -119,3 +112,26 @@
that may require changes to your code.
+
+Build Changes
+=============
+
+
+C API Changes
+=============
+
+New Features
+------------
+
+
+Porting to Python 3.10
+----------------------
+
+* 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).
+ (Contributed by Dong-hee Na in :issue:`39573`.)
+
+
+Removed
+-------