[pypy-commit] cffi cmacros: Fixes

arigo noreply at buildbot.pypy.org
Thu Jul 30 22:41:31 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cmacros
Changeset: r2240:5cae421affd9
Date: 2015-07-30 22:17 +0200
http://bitbucket.org/cffi/cffi/changeset/5cae421affd9/

Log:	Fixes

diff --git a/cffi/api.py b/cffi/api.py
--- a/cffi/api.py
+++ b/cffi/api.py
@@ -607,7 +607,7 @@
     copied_enums = []
     #
     def make_accessor_locked(name):
-        key = 'function ' + name
+        key = ('function', name, '')
         if key in ffi._parser._declarations:
             tp = ffi._parser._declarations[key]
             BType = ffi._get_cached_btype(tp)
@@ -618,7 +618,7 @@
             library.__dict__[name] = value
             return
         #
-        key = 'variable ' + name
+        key = ('variable', name, '')
         if key in ffi._parser._declarations:
             tp = ffi._parser._declarations[key]
             BType = ffi._get_cached_btype(tp)
@@ -645,7 +645,7 @@
             if name in library.__dict__:
                 return
         #
-        key = 'constant ' + name
+        key = ('constant', name, '')
         if key in ffi._parser._declarations:
             raise NotImplementedError("fetching a non-integer constant "
                                       "after dlopen()")
diff --git a/cffi/cparser.py b/cffi/cparser.py
--- a/cffi/cparser.py
+++ b/cffi/cparser.py
@@ -392,6 +392,7 @@
 
     def _declare(self, key, obj, included=False):
         assert isinstance(key, tuple)
+        assert isinstance(key[2], str)
 
         if key in self._declarations:
             if self._declarations[key] is obj:


More information about the pypy-commit mailing list