Alex Gaynor committed 64a35d3

Make the library be a ModuleType subclass so that on PyPy it is optimized for the fact that the attribtues are generally never re-assigned.

Comments (0)

Files changed (1)


-import sys, os, binascii, imp, shutil
+import sys
+import types
 from . import model, ffiplatform
         # call loading_gen_struct() to get the struct layout inferred by
         # the C compiler
         self._load(module, 'loading')
-        #
         # build the FFILibrary class and instance
-        class FFILibrary(object):
+        class FFILibrary(types.ModuleType):
             _cffi_generic_module = module
             _cffi_ffi = self.ffi
-        library = FFILibrary()
+        library = FFILibrary("")
         # finally, call the loaded_gen_xxx() functions.  This will set
         # up the 'library' object.