← 输入框|github.com|刷新
Skip to content

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

Closed

Description

@ronnuriel

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'

Activity

  1. added
    c
    asr
    tests
    cpython
    on Jun 15, 2023
  2. changed the title [-]Bug Union init - C backend + Cpython[/-] [+]Bug Union init - C backend + Cpython + Lpython tests[/+] on Jun 15, 2023
  3. Smit-create commented on Jun 15, 2023

    @Smit-create
    Collaborator

    Yes, cpython tests are not enabled for union_02.py

  4. certik commented on Jun 15, 2023

    @certik
    Contributor

    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!

  5. self-assigned this
    on Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

asrccpythontests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions