]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-124520: What's New entry for ctypes metaclass __new__/__init__ change ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 27 Sep 2024 21:23:16 +0000 (23:23 +0200)
committerGitHub <noreply@github.com>
Fri, 27 Sep 2024 21:23:16 +0000 (14:23 -0700)
gh-124520: What's New entry for ctypes metaclass __new__/__init__ change (GH-124546)
(cherry picked from commit 3387f76b8f0b9f5ef89f9526c583bcc3dc36f486)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Doc/whatsnew/3.13.rst

index 45817799b542bc6682041ae37060e8c65deb555b..52fe749697cfa45d0ffa406de51da23c63319e4e 100644 (file)
@@ -824,6 +824,24 @@ copy
   (Contributed by Serhiy Storchaka in :gh:`108751`.)
 
 
+ctypes
+------
+
+* As a consequence of necessary internal refactoring, initialization of
+  internal metaclasses now happens in ``__init__`` rather
+  than in ``__new__``. This affects projects that subclass these internal
+  metaclasses to provide custom initialization.
+  Generally:
+
+  - Custom logic that was done in ``__new__`` after calling ``super().__new__``
+    should be moved to ``__init__``.
+  - To create a class, call the metaclass, not only the metaclass's
+    ``__new__`` method.
+
+  See :gh:`124520` for discussion and links to changes in some affected
+  projects.
+
+
 dbm
 ---