bpo-36565: Fix libregrtest for Python without builtin _abc (GH-12733) · python/cpython@79b5d29

Original file line numberDiff line numberDiff line change

@@ -8,9 +8,13 @@

88

try:

99

from _abc import _get_dump

1010

except ImportError:

11+

import weakref

12+
1113

def _get_dump(cls):

12-

# For legacy Python version

13-

return (cls._abc_registry, cls._abc_cache,

14+

# Reimplement _get_dump() for pure-Python implementation of

15+

# the abc module (Lib/_py_abc.py)

16+

registry_weakrefs = set(weakref.ref(obj) for obj in cls._abc_registry)

17+

return (registry_weakrefs, cls._abc_cache,

1418

cls._abc_negative_cache, cls._abc_negative_cache_version)

1519
1620