From f4743a351fd4c30b899bffbc9025414037ed28dc Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Thu, 1 Sep 2022 00:38:38 -0700 Subject: [PATCH] remove support for unnamed arguments for @_custom_insns functions unnamed arguments support was broken anyway, it would call with `fields` last rather than first, due to how partial() works. --- src/openpower/sv/trans/svp64.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/openpower/sv/trans/svp64.py b/src/openpower/sv/trans/svp64.py index 0c3e3f87..95d2903b 100644 --- a/src/openpower/sv/trans/svp64.py +++ b/src/openpower/sv/trans/svp64.py @@ -51,8 +51,8 @@ def instruction(*fields): CUSTOM_INSNS = {} -def _insn(name, *args, **kwargs): - return name, args, kwargs +def _insn(name, **kwargs): + return name, kwargs def _custom_insns(*insns): @@ -61,17 +61,17 @@ def _custom_insns(*insns): def decorator(fn): FIELDS_ARG = object() if len(insns) == 0: - insns_ = (fn.__name__, (), {}), + insns_ = (fn.__name__, {}), else: insns_ = insns - for name, args, kwargs in insns_: + for name, kwargs in insns_: if not isinstance(name, str): raise TypeError("instruction name must be a str: {name!r}") if name in CUSTOM_INSNS: raise ValueError(f"duplicate instruction mnemonic: {name!r}") # use getcallargs to check that arguments work: - inspect.getcallargs(fn, FIELDS_ARG, *args, **kwargs) - CUSTOM_INSNS[name] = functools.partial(fn, *args, **kwargs) + inspect.getcallargs(fn, FIELDS_ARG, **kwargs) + CUSTOM_INSNS[name] = functools.partial(fn, **kwargs) return fn return decorator -- 2.30.2