Skip to content

Encoding exceptions - segfault #727

@regnarg

Description

@regnarg

Question

I tried to make serializable exceptions using:

import msgspec
class TaggedException(msgspec.Struct, Exception, tag=True): pass

However, this reliably segfaults Python (CPython 3.12.5, msgspec 0.18.6).

I presume there is some kind of incompatibility between the C-level layout of Struct objects and Exception objects? Are there any good alternatives for encoding exception objects? (which seems super usefil when implementing APIs) Maybe this cannot be fixed. But maybe it should at least throw an error instead of crashing the interpreter?

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