[pypy-svn] r76855 - pypy/trunk/lib_pypy/_ctypes
arigo at codespeak.net
arigo at codespeak.net
Fri Sep 3 14:42:52 CEST 2010
Author: arigo
Date: Fri Sep 3 14:42:50 2010
New Revision: 76855
Modified:
pypy/trunk/lib_pypy/_ctypes/array.py
pypy/trunk/lib_pypy/_ctypes/function.py
pypy/trunk/lib_pypy/_ctypes/primitive.py
Log:
Kill a few unneeded local imports.
Modified: pypy/trunk/lib_pypy/_ctypes/array.py
==============================================================================
--- pypy/trunk/lib_pypy/_ctypes/array.py (original)
+++ pypy/trunk/lib_pypy/_ctypes/array.py Fri Sep 3 14:42:50 2010
@@ -75,7 +75,7 @@
def _CData_output(self, resarray, base=None, index=-1):
# this seems to be a string if we're array of char, surprise!
- from ctypes import c_char, c_wchar, c_char_p, c_wchar_p
+ from ctypes import c_char, c_wchar
if self._type_ is c_char:
return _rawffi.charp2string(resarray.buffer, self._length_)
if self._type_ is c_wchar:
Modified: pypy/trunk/lib_pypy/_ctypes/function.py
==============================================================================
--- pypy/trunk/lib_pypy/_ctypes/function.py (original)
+++ pypy/trunk/lib_pypy/_ctypes/function.py Fri Sep 3 14:42:50 2010
@@ -60,7 +60,6 @@
return self._restype_
def _setrestype(self, restype):
self._ptr = None
- from ctypes import c_char_p
if restype is int:
from ctypes import c_int
restype = c_int
@@ -214,9 +213,7 @@
@staticmethod
def _guess_argtypes(args):
- from _ctypes import _CData
from ctypes import c_char_p, c_wchar_p, c_void_p, c_int
- from ctypes import Array, Structure
res = []
for arg in args:
if hasattr(arg, '_as_parameter_'):
Modified: pypy/trunk/lib_pypy/_ctypes/primitive.py
==============================================================================
--- pypy/trunk/lib_pypy/_ctypes/primitive.py (original)
+++ pypy/trunk/lib_pypy/_ctypes/primitive.py Fri Sep 3 14:42:50 2010
@@ -57,7 +57,6 @@
pyobj_container = GlobalPyobjContainer()
def generic_xxx_p_from_param(cls, value):
- from _ctypes import Array, _Pointer
if value is None:
return cls(None)
if isinstance(value, basestring):
@@ -119,8 +118,6 @@
result._ffiarray = ffiarray
if tp == 'z':
# c_char_p
- from _ctypes import Array, _Pointer
-
def _getvalue(self):
addr = self._buffer[0]
if addr == 0:
@@ -143,7 +140,7 @@
result.value = property(_getvalue, _setvalue)
elif tp == 'Z':
# c_wchar_p
- from _ctypes import Array, _Pointer, _wstring_at
+ from _ctypes import _wstring_at
def _getvalue(self):
addr = self._buffer[0]
if addr == 0:
More information about the Pypy-commit
mailing list