Skip to content

Dump function fails for dicts of enums #40042

Closed
@jakobnissen

Description

@jakobnissen

MWE:

julia> @enum Foo a b

julia> dump(Dict{Foo, Int}())
Dict{Foo, Int64}
  slots: Array{UInt8}((16,)) UInt8[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
  keys: Array{Foo}((16,))
    1: Foo ERROR: KeyError: key 1742231696 not found

I can't tell if this can realistically be fixed or not. The issue is that the .keys field of the Dict is uninitialized, and thus contain invalid (and un-printable values).

One possible solution could be to wrap the show in dump in try-catch, but will that cause too undefined behaviour? What if the show method throws some other, unrelated error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviordisplay and printingAesthetics and correctness of printed representations of objects.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions