[pypy-commit] cffi default: Merged in alex_gaynor/cffi-2/alex_gaynor/handle-the-case-where-someone-has-made-i-1391634819444 (pull request #26)
arigo
noreply at buildbot.pypy.org
Thu Feb 6 17:42:08 CET 2014
Author: Armin Rigo <armin.rigo at gmail.com>
Branch:
Changeset: r1462:9f3caeed71db
Date: 2014-02-06 17:41 +0100
http://bitbucket.org/cffi/cffi/changeset/9f3caeed71db/
Log: Merged in alex_gaynor/cffi-2/alex_gaynor/handle-the-case-where-
someone-has-made-i-1391634819444 (pull request #26)
Handle the case where someone has made `import weakref` return a
weird proxy.
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()
More information about the pypy-commit
mailing list