bpo-36565: Fix libregrtest for Python without builtin _abc (GH-12733)
Fix reference hunting (``python3 -m test -R 3:3``) when Python has no built-in abc module: fix _get_dump() reimplementation of libregrtest.
This commit is contained in:
parent
eb7e29f2a9
commit
79b5d29041
|
@ -8,9 +8,13 @@ from test import support
|
||||||
try:
|
try:
|
||||||
from _abc import _get_dump
|
from _abc import _get_dump
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
import weakref
|
||||||
|
|
||||||
def _get_dump(cls):
|
def _get_dump(cls):
|
||||||
# For legacy Python version
|
# Reimplement _get_dump() for pure-Python implementation of
|
||||||
return (cls._abc_registry, cls._abc_cache,
|
# the abc module (Lib/_py_abc.py)
|
||||||
|
registry_weakrefs = set(weakref.ref(obj) for obj in cls._abc_registry)
|
||||||
|
return (registry_weakrefs, cls._abc_cache,
|
||||||
cls._abc_negative_cache, cls._abc_negative_cache_version)
|
cls._abc_negative_cache, cls._abc_negative_cache_version)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Fix reference hunting (``python3 -m test -R 3:3``) when Python has no
|
||||||
|
built-in abc module.
|
Loading…
Reference in New Issue