Author: Alex Gaynor <[email protected]>
Branch: alex_gaynor/handle-the-case-where-someone-has-made-i-1391634819444
Changeset: r1461:b90a5f638975
Date: 2014-02-05 21:13 +0000
http://bitbucket.org/cffi/cffi/changeset/b90a5f638975/
Log: Handle the case where someone has made `import weakref` return a
weird proxy.
Fixes: https://bugs.pypy.org/issue1688
diff --git a/cffi/model.py b/cffi/model.py
--- a/cffi/model.py
+++ b/cffi/model.py
@@ -1,4 +1,6 @@
+import types
import weakref
+
from .lock import allocate_lock
@@ -469,8 +471,7 @@
# initialize the __typecache attribute, either at the module level
# if ffi._backend is a module, or at the class level if ffi._backend
# is some instance.
- ModuleType = type(weakref)
- if isinstance(ffi._backend, ModuleType):
+ if isinstance(ffi._backend, types.ModuleType):
ffi._backend.__typecache = weakref.WeakValueDictionary()
else:
type(ffi._backend).__typecache = weakref.WeakValueDictionary()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit