1. Pypy
  2. Untitled project
  3. pypy

Commits

Brian Kearns  committed c5deffb

simplify -- why pop and then insert again?

  • Participants
  • Parent commits 0e3a286
  • Branches default

Comments (0)

Files changed (1)

File lib_pypy/_ctypes/function.py

View file
             #              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)