mirror of https://github.com/python/cpython.git
Backport of -r59242:59246 from py3k
Fixed problem with regrtest caused by the additional of objects to _abcoll.
This commit is contained in:
parent
81ddc1a69b
commit
6b29dd05c8
|
@ -649,6 +649,7 @@ def cleanup_test_droppings(testname, verbose):
|
||||||
def dash_R(the_module, test, indirect_test, huntrleaks):
|
def dash_R(the_module, test, indirect_test, huntrleaks):
|
||||||
# This code is hackish and inelegant, but it seems to do the job.
|
# This code is hackish and inelegant, but it seems to do the job.
|
||||||
import copy_reg, _abcoll
|
import copy_reg, _abcoll
|
||||||
|
from abc import _Abstract
|
||||||
|
|
||||||
if not hasattr(sys, 'gettotalrefcount'):
|
if not hasattr(sys, 'gettotalrefcount'):
|
||||||
raise Exception("Tracking reference leaks requires a debug build "
|
raise Exception("Tracking reference leaks requires a debug build "
|
||||||
|
@ -660,11 +661,11 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
|
||||||
pic = sys.path_importer_cache.copy()
|
pic = sys.path_importer_cache.copy()
|
||||||
abcs = {}
|
abcs = {}
|
||||||
for abc in [getattr(_abcoll, a) for a in _abcoll.__all__]:
|
for abc in [getattr(_abcoll, a) for a in _abcoll.__all__]:
|
||||||
|
if not isinstance(abc, _Abstract):
|
||||||
|
continue
|
||||||
for obj in abc.__subclasses__() + [abc]:
|
for obj in abc.__subclasses__() + [abc]:
|
||||||
abcs[obj] = obj._abc_registry.copy()
|
abcs[obj] = obj._abc_registry.copy()
|
||||||
|
|
||||||
print >> sys.stderr, abcs
|
|
||||||
|
|
||||||
if indirect_test:
|
if indirect_test:
|
||||||
def run_the_test():
|
def run_the_test():
|
||||||
indirect_test()
|
indirect_test()
|
||||||
|
@ -698,6 +699,7 @@ def dash_R_cleanup(fs, ps, pic, abcs):
|
||||||
import _strptime, linecache, dircache
|
import _strptime, linecache, dircache
|
||||||
import urlparse, urllib, urllib2, mimetypes, doctest
|
import urlparse, urllib, urllib2, mimetypes, doctest
|
||||||
import struct, filecmp, _abcoll
|
import struct, filecmp, _abcoll
|
||||||
|
from abc import _Abstract
|
||||||
from distutils.dir_util import _path_created
|
from distutils.dir_util import _path_created
|
||||||
|
|
||||||
# Restore some original values.
|
# Restore some original values.
|
||||||
|
@ -709,6 +711,8 @@ def dash_R_cleanup(fs, ps, pic, abcs):
|
||||||
|
|
||||||
# Clear ABC registries, restoring previously saved ABC registries.
|
# Clear ABC registries, restoring previously saved ABC registries.
|
||||||
for abc in [getattr(_abcoll, a) for a in _abcoll.__all__]:
|
for abc in [getattr(_abcoll, a) for a in _abcoll.__all__]:
|
||||||
|
if not issubclass(abc, _Abstract):
|
||||||
|
continue
|
||||||
for obj in abc.__subclasses__() + [abc]:
|
for obj in abc.__subclasses__() + [abc]:
|
||||||
obj._abc_registry = abcs.get(obj, {}).copy()
|
obj._abc_registry = abcs.get(obj, {}).copy()
|
||||||
obj._abc_cache.clear()
|
obj._abc_cache.clear()
|
||||||
|
|
Loading…
Reference in New Issue