Skip to content

Commit d43a975

Browse files
gh-92810: Clear the ABC cache in _abc._reset_registry (#162665)
Registered classes are now also added to the positive cache, so `register()` after `_abc_registry_clear()` did nothing for them and the registration was lost once the caches were cleared. This broke the registry restoring of regrtest in refleak mode.
1 parent c0ee4bb commit d43a975

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎Modules/_abc.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,9 @@ _abc__reset_registry(PyObject *module, PyObject *self)
565565
if (impl != NULL) {
566566
Py_BEGIN_CRITICAL_SECTION(impl);
567567
abc_table_clear(&impl->registry);
568+
// Registered classes are also in the cache, and register()
569+
// does nothing for a class which is cached as a subclass.
570+
abc_table_clear(&impl->cache);
568571
Py_END_CRITICAL_SECTION();
569572
}
570573
_PyThreadState_PopCStackRef(tstate, &cref);

0 commit comments

Comments
 (0)