Skip to content

Cannot marshal unions directly #651

@williamcroberts

Description

@williamcroberts

One cannot marshal unions directly since they need a type selector. Perhaps make the marshal routine smart enough to know if it's in a union and need an extra argument for the selector value or seperate the union marshal out to it's own thing that union types can inherit from.

b = TPMU_PUBLIC_ID(rsa=b"\x00" * 256).marshal()
Traceback (most recent call last):
  File "<python-input-3>", line 1, in <module>
    b = TPMU_PUBLIC_ID(rsa=b"\x00" * 256).marshal()
  File "/usr/local/lib64/python3.13/site-packages/tpm2_pytss/types.py", line 222, in marshal
    _chkrc(mfunc(_cdata, buf, 4096, offset))
           ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Tss2_MU_TPMU_PUBLIC_ID_Marshal expected 5 arguments, got 4
>>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions