summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-04-08 23:36:34 (GMT)
committerGitHub <noreply@github.com>2019-04-08 23:36:34 (GMT)
commit79b5d29041bd85ea3baa050b3fa2481344ea35c9 (patch)
tree31c54c1e2fd3d7256d45bcde9258ef5e96115aa5 /Lib
parenteb7e29f2a9d075accc1ab3faf3612ac44f5e2183 (diff)
downloadcpython-79b5d29041bd85ea3baa050b3fa2481344ea35c9.zip
cpython-79b5d29041bd85ea3baa050b3fa2481344ea35c9.tar.gz
cpython-79b5d29041bd85ea3baa050b3fa2481344ea35c9.tar.bz2
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.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/libregrtest/refleak.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/libregrtest/refleak.py b/Lib/test/libregrtest/refleak.py
index 6724488..d68ea63 100644
--- a/Lib/test/libregrtest/refleak.py
+++ b/Lib/test/libregrtest/refleak.py
@@ -8,9 +8,13 @@ from test import support
try:
from _abc import _get_dump
except ImportError:
+ import weakref
+
def _get_dump(cls):
- # For legacy Python version
- return (cls._abc_registry, cls._abc_cache,
+ # Reimplement _get_dump() for pure-Python implementation of
+ # 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)