Skip to content

Cannot set gc=False on Generic structs? #631

Closed
@HansBrende

Description

@HansBrende

Question

If I do

class MsgspecEntity(msgspec.Struct, Generic[P], gc=False):

I get the following error:

ValueError: Cannot set gc=False when inheriting from non-struct types

I suppose I can work around this by dynamically redefining the struct for each possible P type, to avoid using Generic, but is this expected? It would be easier if Generic were excluded from the above restriction.

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