-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
TOMLbugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorstdlibJulia's standard libraryJulia's standard library
Description
julia> TOML.print(Dict("a" => """x\nx"""))
a = "x\nx"
julia> TOML.parse("""a = "x\nx" """)
ERROR: TOML Parser error:
none:2:-1 error: newline character in single quoted string
a = "x
^
Stacktrace:
[1] parse
@ ./toml_parser.jl:445 [inlined]
[2] parse(str::String)
@ TOML ~/.julia/juliaup/julia-1.10.4+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/TOML/src/TOML.jl:71
[3] top-level scope
@ REPL[99]:1Interestingly, this seems to only be an issue with stdout and is handled correctly with other IO streams
julia> io = IOBuffer(); TOML.print(io, Dict("a" => """x\nx""")); TOML.parse(seekstart(io))
Dict{String, Any} with 1 entry:
"a" => "x\nx"I'm guessing this intersection of two different expectations -- we generally don't include triple quotes for show-type methods going to stdout, but in this particular case, it prevents a simple copy-paste of the generated TOML into other use cases.
julia> versioninfo()
Julia Version 1.10.4
Commit 48d4fd48430 (2024-06-04 10:41 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: macOS (arm64-apple-darwin22.4.0)
CPU: 8 × Apple M1
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 4 default, 0 interactive, 2 GC (on 4 virtual cores)Metadata
Metadata
Assignees
Labels
TOMLbugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorstdlibJulia's standard libraryJulia's standard library