mirror of
https://github.com/python/cpython.git
synced 2025-09-30 12:21:51 +00:00
This commit is contained in:
parent
3405792b02
commit
b414e349eb
1 changed files with 8 additions and 3 deletions
|
@ -143,9 +143,14 @@ def dash_R_cleanup(fs, ps, pic, zdc, abcs):
|
||||||
sys._clear_type_cache()
|
sys._clear_type_cache()
|
||||||
|
|
||||||
# Clear ABC registries, restoring previously saved ABC registries.
|
# Clear ABC registries, restoring previously saved ABC registries.
|
||||||
for abc in [getattr(collections.abc, a) for a in collections.abc.__all__]:
|
abs_classes = [getattr(collections.abc, a) for a in collections.abc.__all__]
|
||||||
if not isabstract(abc):
|
abs_classes = filter(isabstract, abs_classes)
|
||||||
continue
|
if 'typing' in sys.modules:
|
||||||
|
t = sys.modules['typing']
|
||||||
|
# These classes require special treatment because they do not appear
|
||||||
|
# in direct subclasses of collections.abc classes
|
||||||
|
abs_classes = list(abs_classes) + [t.ChainMap, t.Counter, t.DefaultDict]
|
||||||
|
for abc in abs_classes:
|
||||||
for obj in abc.__subclasses__() + [abc]:
|
for obj in abc.__subclasses__() + [abc]:
|
||||||
obj._abc_registry = abcs.get(obj, WeakSet()).copy()
|
obj._abc_registry = abcs.get(obj, WeakSet()).copy()
|
||||||
obj._abc_cache.clear()
|
obj._abc_cache.clear()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue