Correctly cleanup the internal top-level module registry when no
inner modules or classes are registered into it.
Fixes: #11788
Change-Id: I489dd6394dd3f14458379368b8c8f18d5a0bb109
--- /dev/null
+.. change::
+ :tags: bug, orm
+ :tickets: 11788
+
+ Correctly cleanup the internal top-level module registry when no
+ inner modules or classes are registered into it.
def _remove_item(self, name: str) -> None:
self.contents.pop(name, None)
- if not self.contents and self.parent is not None:
- self.parent._remove_item(self.name)
+ if not self.contents:
+ if self.parent is not None:
+ self.parent._remove_item(self.name)
_registries.discard(self)
def resolve_attr(self, key: str) -> Union[_ModNS, Type[Any]]:
del f2
gc_collect()
- eq_(len(clsregistry._registries), 1)
+ eq_(len(clsregistry._registries), 0)
def test_dupe_classes_name_race(self):
"""test the race condition that the class was garbage "