summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew/3.11.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/whatsnew/3.11.rst')
-rw-r--r--Doc/whatsnew/3.11.rst28
1 files changed, 28 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index 1b3b824..1ea8cba 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -149,6 +149,34 @@ Porting to Python 3.11
(:c:member:`PyTypeObject.tp_traverse`).
(Contributed by Victor Stinner in :issue:`44263`.)
+* Since :c:func:`Py_TYPE()` is changed to a inline static function,
+ ``Py_TYPE(obj) = new_type`` must be replaced with
+ ``Py_SET_TYPE(obj, new_type)``: see the :c:func:`Py_SET_TYPE()` function
+ (available since Python 3.9). For backward compatibility, this macro can be
+ used::
+
+ #if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_TYPE)
+ static inline void _Py_SET_TYPE(PyObject *ob, PyTypeObject *type)
+ { ob->ob_type = type; }
+ #define Py_SET_TYPE(ob, type) _Py_SET_TYPE(_PyObject_CAST(ob), type)
+ #endif
+
+ (Contributed by Victor Stinner in :issue:`39573`.)
+
+* Since :c:func:`Py_SIZE()` is changed to a inline static function,
+ ``Py_SIZE(obj) = new_size`` must be replaced with
+ ``Py_SET_SIZE(obj, new_size)``: see the :c:func:`Py_SET_SIZE()` function
+ (available since Python 3.9). For backward compatibility, this macro can be
+ used::
+
+ #if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_SIZE)
+ static inline void _Py_SET_SIZE(PyVarObject *ob, Py_ssize_t size)
+ { ob->ob_size = size; }
+ #define Py_SET_SIZE(ob, size) _Py_SET_SIZE((PyVarObject*)(ob), size)
+ #endif
+
+ (Contributed by Victor Stinner in :issue:`39573`.)
+
Deprecated
----------