Skip to content

Commit 2dc6453

Browse files
committed
gh-92810: Add What's New entry
1 parent 16f39bd commit 2dc6453

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Doc/whatsnew/3.15.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,18 @@ zlib
375375
Optimizations
376376
=============
377377

378-
module_name
379-
-----------
378+
abc
379+
---
380+
381+
* Reduce memory usage of `issubclass` checks for classes inheriting abstract classes.
382+
383+
:class:`abc.ABCMeta` hook ``__subclasscheck__`` now includes
384+
a guard which is triggered then the hook is called from a parent class
385+
(``issubclass(cls, RootClass)`` -> ``issubclass(cls, NestedClass)`` -> ...).
386+
This guard prevents adding ``cls`` to ``NestedClass`` positive and negative caches,
387+
preventing memory bloat in some cases (thousands of classes inherited from ABC).
380388

381-
* TODO
389+
(Contributed by Maxim Martynov in :gh:`92810`.)
382390

383391

384392

0 commit comments

Comments
 (0)