Skip to content

crash after StackOverflowError #46870

@mzaffalon

Description

@mzaffalon
using Dictionaries: dictionary

struct Bcode
    code::Int
end

Base.convert(::Type{String}, b::Bcode) = dictionary([Bcode(1) => "Z"])[b]
Base.show(io::IO, c::Bcode) = print(io, "$(convert(String, c))")

julia> Bcode(1)
Z

julia> Bcode(2)
Error showing value of type Bcode:
ERROR: StackOverflowError:
<snip>

julia> Bcode(2)
PS C:\Users\michele.zaffalon>

I do expect the StackOverflowError but when I try a second time, Julia quits. This seems to be a Windows only problem.

(test2) pkg> st
Status `C:\Users\michele.zaffalon\test2\Project.toml`
  [85a47980] Dictionaries v0.3.24

julia> versioninfo()
Julia Version 1.8.1
Commit afb6c60d69 (2022-09-06 15:09 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 6 × Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
  Threads: 1 on 6 virtual cores
Environment:
  JULIA_DEPOT_PATH = C:\Users\michele.zaffalon\.julia
  JULIA_PKG_USE_CLI_GIT = true

Ref: https://discourse.julialang.org/t/repl-crashes-with-custom-pretty-printing-and-dictionaries/87622

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