[pypy-commit] pypy default: Skip this import if it fails because of _weakref

arigo noreply at buildbot.pypy.org
Sun Feb 12 18:03:03 CET 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r52389:21f1095789ea
Date: 2012-01-20 10:12 +0100
http://bitbucket.org/pypy/pypy/changeset/21f1095789ea/

Log:	Skip this import if it fails because of _weakref (transplanted from
	ffedd17ff570417c0201182e14a61bafe7b7697a)

diff --git a/lib-python/modified-2.7/UserDict.py b/lib-python/modified-2.7/UserDict.py
--- a/lib-python/modified-2.7/UserDict.py
+++ b/lib-python/modified-2.7/UserDict.py
@@ -85,8 +85,12 @@
     def __iter__(self):
         return iter(self.data)
 
-import _abcoll
-_abcoll.MutableMapping.register(IterableUserDict)
+try:
+    import _abcoll
+except ImportError:
+    pass    # e.g. no '_weakref' module on this pypy
+else:
+    _abcoll.MutableMapping.register(IterableUserDict)
 
 
 class DictMixin:


More information about the pypy-commit mailing list