Skip to content

Commit fb3fbf3

Browse files
committed
Make __ctl_wr work for an arbitrary number of parameters
1 parent 260e551 commit fb3fbf3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

bindings/python/unicorn/unicorn_py3/unicorn.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,16 +1253,15 @@ def __ctl_w(self, ctl: int, *args: Arg):
12531253

12541254
self.ctl(ctl, uc.UC_CTL_IO_WRITE, *cargs)
12551255

1256-
def __ctl_wr(self, ctl: int, arg0: Arg, arg1: Arg):
1257-
atype, avalue = arg0
1258-
carg0 = atype(avalue)
1256+
def __ctl_wr(self, ctl: int, *args: Arg):
1257+
cargs = (atype(avalue) for atype, avalue in args[:-1])
12591258

1260-
atype, _ = arg1
1261-
carg1 = atype()
1259+
atype, _ = args[-1]
1260+
cretv = atype()
12621261

1263-
self.ctl(ctl, uc.UC_CTL_IO_READ_WRITE, carg0, ctypes.byref(carg1))
1262+
self.ctl(ctl, uc.UC_CTL_IO_READ_WRITE, *cargs, ctypes.byref(cretv))
12641263

1265-
return carg1.value
1264+
return cretv.value
12661265

12671266
def ctl_get_mode(self) -> int:
12681267
"""Retrieve current processor mode.

0 commit comments

Comments
 (0)