You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Arguments to AutoQASM subroutines can't be passed by keyword. For example, if I have an @aq.subroutine defined as def test(a: int, b: int), I can successfully call it with positional args like test(0, 1), but I cannot call it with keyword args like test(a=0, b=1).
This should succeed and print the serialized program.
Actual Result
It fails with the following error:
TypeError: in user code:
File "\Temp\ipykernel_2828\4024543667.py", line 8, in main *
test(a=0, b=1)
File "C:\Repos\autoqasm\src\autoqasm\transpiler\transpiler.py", line 226, in converted_call
return _call_unconverted(f, args, kwargs, options)
File "C:\Repos\autoqasm\src\autoqasm\transpiler\transpiler.py", line 315, in _call_unconverted
return f(*args, **kwargs)
File "C:\Repos\autoqasm\src\autoqasm\api.py", line 205, in _wrapper
return converter_callback(func, options=options, args=args, kwargs=kwargs, **converter_args)
File "C:\Repos\autoqasm\src\autoqasm\api.py", line 355, in _convert_subroutine
subroutine_function_call = oqpy_sub(oqpy_program, *args, **kwargs)
TypeError: wrapper() got an unexpected keyword argument 'a'
The text was updated successfully, but these errors were encountered:
I would like to work on this issue as part of unitary hack. Not sure about this, but this would require changes in oqpy module not in autoqasm right?
I expect that it could be addressed in autoqasm, for example, if any kwargs correspond to subroutine parameters, convert them to positional args before calling into the oqpy subroutine.
Summary
Arguments to AutoQASM subroutines can't be passed by keyword. For example, if I have an
@aq.subroutine
defined asdef test(a: int, b: int)
, I can successfully call it with positional args liketest(0, 1)
, but I cannot call it with keyword args liketest(a=0, b=1)
.Repro Steps
Expected Result
This should succeed and print the serialized program.
Actual Result
It fails with the following error:
The text was updated successfully, but these errors were encountered: