[Python-3000-checkins] r55880 - python/branches/p3yk/Lib/test/regrtest.py

neal.norwitz python-3000-checkins at python.org
Mon Jun 11 07:07:41 CEST 2007


Author: neal.norwitz
Date: Mon Jun 11 07:07:36 2007
New Revision: 55880

Modified:
   python/branches/p3yk/Lib/test/regrtest.py
Log:
Fix the refleak counter on test_collections.  The ABC metaclass creates
a registry which must be cleared on each run.  Otherwise, there *seem*
to be refleaks when there really aren't any.  (The class is held within
the registry even though it's no longer needed.)


Modified: python/branches/p3yk/Lib/test/regrtest.py
==============================================================================
--- python/branches/p3yk/Lib/test/regrtest.py	(original)
+++ python/branches/p3yk/Lib/test/regrtest.py	Mon Jun 11 07:07:36 2007
@@ -697,7 +697,7 @@
     import gc, copy_reg
     import _strptime, linecache, dircache
     import urlparse, urllib, urllib2, mimetypes, doctest
-    import struct, filecmp
+    import struct, filecmp, collections
     from distutils.dir_util import _path_created
 
     # Restore some original values.
@@ -707,6 +707,10 @@
     sys.path_importer_cache.clear()
     sys.path_importer_cache.update(pic)
 
+    # Clear ABC registries.
+    for obj in [collections.Hashable, collections.Iterable]:
+        obj._ABCMeta__registry.clear()
+
     # Clear assorted module caches.
     _path_created.clear()
     re.purge()


More information about the Python-3000-checkins mailing list