Skip to content

Add __slots__ to structs #130

@corby

Description

@corby

This is an excellent tool and just what I was looking for. Thank you.

In order for the IDEs to recognize the fields as valid inputs we add __slots__ to all of our ctype.Structs.
Would it be possible to add a step to each struct def to add the slots?

e.g.:

class struct_c__SA_my_struct_t(Structure):
    pass

class struct_c__SA_my_struct_t._pack_ = 1  # source:True
class struct_c__SA_my_struct_t._fields_ = [
    ('my_var1', ctypes.c_ubyte),
    ('my_var2', ctypes.c_uint16),
]
class struct_c__SA_my_struct_t.__slots__ = ('my_var1','my_var2')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions