Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r977:33292fa6fbea
Date: 2012-09-27 19:01 +0200
http://bitbucket.org/cffi/cffi/changeset/33292fa6fbea/

Log:    Fix (thanks Hakan Ardo)

diff --git a/cffi/model.py b/cffi/model.py
--- a/cffi/model.py
+++ b/cffi/model.py
@@ -313,6 +313,7 @@
 class EnumType(StructOrUnionOrEnum):
     kind = 'enum'
     partial = False
+    partial_resolved = False
 
     def __init__(self, name, enumerators, enumvalues):
         self.name = name
@@ -320,7 +321,7 @@
         self.enumvalues = enumvalues
 
     def check_not_partial(self):
-        if self.partial:
+        if self.partial and not self.partial_resolved:
             from . import ffiplatform
             raise ffiplatform.VerificationMissing(self._get_c_name(''))
 
diff --git a/cffi/vengine_cpy.py b/cffi/vengine_cpy.py
--- a/cffi/vengine_cpy.py
+++ b/cffi/vengine_cpy.py
@@ -582,7 +582,7 @@
             enumvalues = [getattr(module, enumerator)
                           for enumerator in tp.enumerators]
             tp.enumvalues = tuple(enumvalues)
-            tp.partial = False
+            tp.partial_resolved = True
 
     def _loaded_cpy_enum(self, tp, name, module, library):
         for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues):
diff --git a/cffi/vengine_gen.py b/cffi/vengine_gen.py
--- a/cffi/vengine_gen.py
+++ b/cffi/vengine_gen.py
@@ -394,7 +394,7 @@
             enumvalues = [self._load_constant(True, tp, enumerator, module)
                           for enumerator in tp.enumerators]
             tp.enumvalues = tuple(enumvalues)
-            tp.partial = False
+            tp.partial_resolved = True
         else:
             BFunc = self.ffi.typeof("int(*)(char*)")
             funcname = '_cffi_e_%s_%s' % (prefix, name)
diff --git a/cffi/verifier.py b/cffi/verifier.py
--- a/cffi/verifier.py
+++ b/cffi/verifier.py
@@ -121,7 +121,7 @@
             del self._vengine._f
             if must_close:
                 file.close()
-        if file is None:
+        if must_close:
             self._has_source = True
 
     def _compile_module(self):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to