Commits

Armin Rigo committed 33292fa

Fix (thanks Hakan Ardo)

Comments (0)

Files changed (4)

 class EnumType(StructOrUnionOrEnum):
     kind = 'enum'
     partial = False
+    partial_resolved = False
 
     def __init__(self, name, enumerators, enumvalues):
         self.name = name
         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(''))
 

cffi/vengine_cpy.py

             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):

cffi/vengine_gen.py

             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)
             del self._vengine._f
             if must_close:
                 file.close()
-        if file is None:
+        if must_close:
             self._has_source = True
 
     def _compile_module(self):