Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r1082:a67eedfa67cb
Date: 2012-11-30 11:52 -0800
http://bitbucket.org/cffi/cffi/changeset/a67eedfa67cb/

Log:    Future-proof fix: the key did not include the funcname. By chance,
        the different funcnames have really different arguments.

diff --git a/cffi/model.py b/cffi/model.py
--- a/cffi/model.py
+++ b/cffi/model.py
@@ -383,8 +383,9 @@
 file_type = unknown_type('FILE', '_IO_FILE')
 
 def global_cache(srctype, ffi, funcname, *args):
+    key = (funcname, args)
     try:
-        return ffi._backend.__typecache[args]
+        return ffi._backend.__typecache[key]
     except KeyError:
         pass
     except AttributeError:
@@ -400,7 +401,7 @@
         res = getattr(ffi._backend, funcname)(*args)
     except NotImplementedError as e:
         raise NotImplementedError("%r: %s" % (srctype, e))
-    ffi._backend.__typecache[args] = res
+    ffi._backend.__typecache[key] = res
     return res
 
 def pointer_cache(ffi, BType):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to