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

neal.norwitz python-3000-checkins at python.org
Sat Jun 16 05:54:29 CEST 2007


Author: neal.norwitz
Date: Sat Jun 16 05:54:18 2007
New Revision: 56004

Modified:
   python/branches/p3yk/Lib/test/regrtest.py
Log:
Fix it so test_os no longer reports ref leaks by clearing all the caches
the ABCMeta stores on the class.  Apply this to all the ABC collections
as well as the class of os.environ which inherits from an ABC collection.


Modified: python/branches/p3yk/Lib/test/regrtest.py
==============================================================================
--- python/branches/p3yk/Lib/test/regrtest.py	(original)
+++ python/branches/p3yk/Lib/test/regrtest.py	Sat Jun 16 05:54:18 2007
@@ -697,7 +697,7 @@
     import gc, copy_reg
     import _strptime, linecache, dircache
     import urlparse, urllib, urllib2, mimetypes, doctest
-    import struct, filecmp, collections
+    import struct, filecmp, _abcoll
     from distutils.dir_util import _path_created
 
     # Restore some original values.
@@ -708,8 +708,10 @@
     sys.path_importer_cache.update(pic)
 
     # Clear ABC registries.
-    for obj in [collections.Hashable, collections.Iterable]:
+    for obj in [getattr(_abcoll, a) for a in _abcoll.__all__] + [os.environ]:
         obj._ABCMeta__registry.clear()
+        obj._ABCMeta__cache.clear()
+        obj._ABCMeta__negative_cache.clear()
 
     # Clear assorted module caches.
     _path_created.clear()


More information about the Python-3000-checkins mailing list