From bee84b3c9cf9ce28fb64984db12efbcf0cf4e59e Mon Sep 17 00:00:00 2001 From: Cody Tapscott Date: Tue, 2 Jul 2024 16:48:27 -0400 Subject: [PATCH] Use `TOML.Parser` for TOML parsing w/ Dates support This behavior had actually subtly changed with https://github.com/JuliaLang/julia/pull/54755 so that this no longer returned Dates objects, but sticking to the public `TOML.Parser` interface should prevent that from being an issue after https://github.com/JuliaLang/julia/pull/55020 lands. --- src/Registry/registry_instance.jl | 8 +++----- src/Types.jl | 3 +-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Registry/registry_instance.jl b/src/Registry/registry_instance.jl index 36b8ce13d2..4795cbf694 100644 --- a/src/Registry/registry_instance.jl +++ b/src/Registry/registry_instance.jl @@ -15,8 +15,7 @@ function to_tar_path_format(file::AbstractString) end # See loading.jl -const TOML_CACHE = let parser = Base.TOML.Parser() - parser.Dates = Dates +const TOML_CACHE = let parser = TOML.Parser() Base.TOMLCache(parser, Dict{String, Dict{String, Any}}()) end const TOML_LOCK = ReentrantLock() @@ -26,9 +25,8 @@ function parsefile(in_memory_registry::Union{Dict, Nothing}, folder::AbstractStr return _parsefile(joinpath(folder, file)) else content = in_memory_registry[to_tar_path_format(file)] - parser = Base.TOML.Parser(content; filepath=file) - parser.Dates = Dates - return Base.TOML.parse(parser) + parser = TOML.Parser(content; filepath=file) + return TOML.parse(parser) end end diff --git a/src/Types.jl b/src/Types.jl index e0e1a37e03..27d70e7117 100644 --- a/src/Types.jl +++ b/src/Types.jl @@ -53,8 +53,7 @@ function deepcopy_toml(x::Dict{String, Any}) end # See loading.jl -const TOML_CACHE = let parser = Base.TOML.Parser() - parser.Dates = Dates +const TOML_CACHE = let parser = TOML.Parser() Base.TOMLCache(parser, Dict{String, Dict{String, Any}}()) end const TOML_LOCK = ReentrantLock()