[pypy-svn] pypy jitypes2: move the import outside the method, to save a couple of guards

antocuni commits-noreply at bitbucket.org
Mon Jan 17 13:31:48 CET 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: jitypes2
Changeset: r40760:44417d6d9102
Date: 2011-01-16 19:08 +0100
http://bitbucket.org/pypy/pypy/changeset/44417d6d9102/

Log:	move the import outside the method, to save a couple of guards

diff --git a/lib_pypy/_ctypes/function.py b/lib_pypy/_ctypes/function.py
--- a/lib_pypy/_ctypes/function.py
+++ b/lib_pypy/_ctypes/function.py
@@ -2,6 +2,7 @@
 from _ctypes.basics import _CData, _CDataMeta, cdata_from_address
 from _ctypes.basics import ArgumentError, keepalive_key
 from _ctypes.basics import shape_to_ffi_type, is_struct_shape
+from _ctypes.primitive import _SimpleCData
 import _rawffi
 import _ffi
 import sys
@@ -386,7 +387,6 @@
         """
         # hack for performance: if restype is a "simple" primitive type, don't
         # allocate the buffer because it's going to be thrown away immediately
-        from _ctypes.primitive import _SimpleCData
         if restype.__bases__[0] is _SimpleCData and not restype._is_pointer_like():
             return result
         #


More information about the Pypy-commit mailing list