Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ir.CallStatement constructor fails if the arguments are not passed as keyword arguments #420

Open
wertysas opened this issue Oct 30, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@wertysas
Copy link
Contributor

What happened?

After the addition of a pre_init method to the CallStatment node class it is not possible to construct a CallStatement without passing a keyword argument.

What are the steps to reproduce the bug?

import loki.ir as ir
import loki.expression.symbols as sym

myfun = sym.ProcedureSymbol(name='myfun')
call = ir.CallStatement(myfun, (sym.IntLiteral(1),))   # this fails
# call = ir.CallStatement(name=myfun, arguments=(sym.IntLiteral(1),))   # this doesnt fail

Version

main branch

Platform (OS and architecture)

Mac OS

Relevant log output

File "callstmt_ctor_minimal_reproducible.py", line 5, in <module>
    call = ir.CallStatement(myfun, (sym.IntLiteral(1),))   # this fails
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/loki-venv/lib/python3.11/site-packages/pydantic/_internal/_dataclasses.py", line 141, in __init__
    s.__pydantic_validator__.validate_python(ArgsKwargs(args, kwargs), self_instance=s)
  File "loki/loki/ir/nodes.py", line 1005, in pre_init
    if 'arguments' in values.kwargs:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

Accompanying data

No response

Organisation

No response

@wertysas wertysas added the bug Something isn't working label Oct 30, 2024
@mlange05 mlange05 self-assigned this Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants