[pypy-commit] pypy default: avoid 'import ctypes' inside the byref function, we import 'pointer' directly from _ctypes

antocuni noreply at buildbot.pypy.org
Thu Sep 1 18:05:18 CEST 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: 
Changeset: r46987:862677259356
Date: 2011-09-01 15:07 +0200
http://bitbucket.org/pypy/pypy/changeset/862677259356/

Log:	avoid 'import ctypes' inside the byref function, we import 'pointer'
	directly from _ctypes

diff --git a/lib_pypy/_ctypes/basics.py b/lib_pypy/_ctypes/basics.py
--- a/lib_pypy/_ctypes/basics.py
+++ b/lib_pypy/_ctypes/basics.py
@@ -166,7 +166,8 @@
     return tp._alignmentofinstances()
 
 def byref(cdata):
-    from ctypes import pointer
+    # "pointer" is imported at the end of this module to avoid circular
+    # imports
     return pointer(cdata)
 
 def cdata_from_address(self, address):
@@ -226,3 +227,6 @@
     'v' : _ffi.types.sshort,
     }
 
+
+# used by "byref"
+from _ctypes.pointer import pointer


More information about the pypy-commit mailing list