Skip to content

Bug Union init - C backend + Cpython + Lpython tests #1915

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

Closed
Tracked by #1802
ronnuriel opened this issue Jun 15, 2023 · 2 comments · Fixed by #1917
Closed
Tracked by #1802

Bug Union init - C backend + Cpython + Lpython tests #1915

ronnuriel opened this issue Jun 15, 2023 · 2 comments · Fixed by #1917
Assignees
Labels
asr ASR related changes c Label for C language related changes cpython Changes related to CPython tests Testing related changes

Comments

@ronnuriel
Copy link
Collaborator

ronnuriel commented Jun 15, 2023

Cpython runtime error:

Traceback (most recent call last):
    from common import cht_test_st

    class cht_test_st(Union):

    cpy_imm_16_st: cht_cpy_imm_16_st = cht_cpy_imm_16_st()
TypeError: cht_cpy_imm_16_st.__init__() missing 6 required positional arguments: 'test_case', 'num_iters', 'cycles_count', 'seu_insts_count', 'imm_val', and 'vdst_hndl'

My Unions:

from lpython import packed, dataclass, i8, u8, u16, i64, i32, u32, u64, u16, ccall, union, Union


@packed
@dataclass
class cht_cpy_imm_16_st:
    test_case: u16
    num_iters: i64
    cycles_count: u64
    seu_insts_count: u64
    imm_val:  u16
    vdst_hndl: u64

@ccall
@union
class cht_test_st(Union):
    test_indx: u32
    cpy_imm_16_st: cht_cpy_imm_16_st = cht_cpy_imm_16_st()

Please test again union_02.py using Cpython run

Cpython error when running union_02.py

Traceback (most recent call last):
  File "/Users/ronnuriel/Desktop/testlpython.py", line 21, in <module>
    class D(Union):
  File "/Users/ronnuriel/Desktop/testlpython.py", line 22, in D
    a: A = A()
TypeError: A.__init__() missing 2 required positional arguments: 'ax' and 'ay'
@ronnuriel ronnuriel added c Label for C language related changes asr ASR related changes tests Testing related changes cpython Changes related to CPython labels Jun 15, 2023
@ronnuriel ronnuriel changed the title Bug Union init - C backend + Cpython Bug Union init - C backend + Cpython + Lpython tests Jun 15, 2023
@Smit-create
Copy link
Collaborator

Yes, cpython tests are not enabled for union_02.py

@certik
Copy link
Contributor

certik commented Jun 15, 2023

Ah, we need to fix this. It looks like LPython works for the file, but not CPython, which is a bug that we need to fix. Thanks for the report @ronnuriel!

@certik certik mentioned this issue Jun 15, 2023
25 tasks
@Smit-create Smit-create self-assigned this Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
asr ASR related changes c Label for C language related changes cpython Changes related to CPython tests Testing related changes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants