Author: Alex Gaynor <[email protected]>
Branch: library-module
Changeset: r1168:64a35d32512c
Date: 2013-02-24 20:11 -0800
http://bitbucket.org/cffi/cffi/changeset/64a35d32512c/

Log:    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.

diff --git a/cffi/vengine_gen.py b/cffi/vengine_gen.py
--- a/cffi/vengine_gen.py
+++ b/cffi/vengine_gen.py
@@ -1,4 +1,6 @@
-import sys, os, binascii, imp, shutil
+import sys
+import types
+
 from . import model, ffiplatform
 
 
@@ -54,12 +56,12 @@
         # 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.
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to