From b0d2d92787494ced7eefc228297f13d8deabb8fd Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Mon, 28 Sep 2020 11:16:21 +0100 Subject: [PATCH] Clarify __subclasses__ behavior in slotted classes Ref #691,#407 --- docs/glossary.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/glossary.rst b/docs/glossary.rst index 0d6b75ca..5d348219 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -87,6 +87,9 @@ Glossary - Since it's currently impossible to make a class slotted after it's been created, ``attrs`` has to replace your class with a new one. While it tries to do that as graciously as possible, certain metaclass features like ``__init_subclass__`` do not work with slotted classes. + - The `class.__subclasses__` attribute needs a garbage collection run (which can be manually triggered using `gc.collect`), for the original class to be removed. + See issue `#407 `_ for more details. + .. [#pypy] On PyPy, there is no memory advantage in using slotted classes. .. [#pypyweakref] On PyPy, slotted classes are naturally weak-referenceable so ``weakref_slot=False`` has no effect.