Armin Rigo avatar 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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.