From 82e84fdcc4e4cb50bd1945877a25197ec5bec456 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Sun, 2 May 2021 14:45:20 +0200 Subject: [PATCH 1/2] Add What's New entry --- Doc/whatsnew/3.10.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst index 1a390663c8a404..1b1404425e6348 100644 --- a/Doc/whatsnew/3.10.rst +++ b/Doc/whatsnew/3.10.rst @@ -1712,6 +1712,10 @@ New Features creating type instances. (Contributed by Victor Stinner in :issue:`43916`.) +* Add a new :c:data:`Py_TPFLAGS_IMMUTABLETYPE` type flag for creating immutable + type objects: type attributes cannot be set nor deleted. + (Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.) + Porting to Python 3.10 ---------------------- @@ -1769,6 +1773,12 @@ Porting to Python 3.10 been included directly, consider including ``Python.h`` instead. (Contributed by Nicholas Sim in :issue:`35134`) +* Use the :c:data:`Py_TPFLAGS_IMMUTABLETYPE` type flag to create immutable type + objects. Do not rely on :c:data:`Py_TPFLAGS_HEAPTYPE` to decide if a type + object is mutable or not; check for :c:data:`Py_TPFLAGS_IMMUTABLETYPE` + instead. + (Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.) + Deprecated ---------- From 9e24131f7f255a6e15527098f42e1b49b0836a4f Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Sun, 2 May 2021 21:52:51 +0200 Subject: [PATCH 2/2] Improve wording --- Doc/whatsnew/3.10.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst index 1b1404425e6348..528219a2e12a84 100644 --- a/Doc/whatsnew/3.10.rst +++ b/Doc/whatsnew/3.10.rst @@ -1775,7 +1775,7 @@ Porting to Python 3.10 * Use the :c:data:`Py_TPFLAGS_IMMUTABLETYPE` type flag to create immutable type objects. Do not rely on :c:data:`Py_TPFLAGS_HEAPTYPE` to decide if a type - object is mutable or not; check for :c:data:`Py_TPFLAGS_IMMUTABLETYPE` + object is mutable or not; check if :c:data:`Py_TPFLAGS_IMMUTABLETYPE` is set instead. (Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.)