Author: Brian Kearns <[email protected]>
Branch: 
Changeset: r69809:c5deffb57e50
Date: 2014-03-08 17:05 -0500
http://bitbucket.org/pypy/pypy/changeset/c5deffb57e50/

Log:    simplify -- why pop and then insert again?

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
@@ -322,24 +322,22 @@
             #              RuntimeWarning, stacklevel=2)
             argtypes = []
 
-        argsl = list(args)
         if self._com_index:
             from ctypes import cast, c_void_p, POINTER
-            if not argsl:
+            if not args:
                 raise ValueError(
                     "native COM method call without 'this' parameter"
                     )
-            thisvalue = argsl.pop(0)
+            thisvalue = args[0]
             thisarg = cast(thisvalue, POINTER(POINTER(c_void_p)))
             keepalives, newargs, argtypes, outargs, errcheckargs = (
-                        self._convert_args(argtypes, argsl, kwargs))
-            argsl.insert(0, thisvalue)
+                self._convert_args(argtypes, args[1:], kwargs))
             newargs.insert(0, thisvalue.value)
             argtypes.insert(0, c_void_p)
         else:
             thisarg = None
             keepalives, newargs, argtypes, outargs, errcheckargs = (
-                        self._convert_args(argtypes, argsl, kwargs))
+                self._convert_args(argtypes, args, kwargs))
 
         funcptr = self._getfuncptr(argtypes, self._restype_, thisarg)
         result = self._call_funcptr(funcptr, *newargs)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to