Skip to content

Commit

Permalink
Use TOML.Parser for TOML parsing w/ Dates support
Browse files Browse the repository at this point in the history
This behavior had actually subtly changed with JuliaLang/julia#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 JuliaLang/julia#55020 lands.
  • Loading branch information
topolarity committed Jul 3, 2024
1 parent 8c99679 commit bee84b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/Registry/registry_instance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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

Expand Down
3 changes: 1 addition & 2 deletions src/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit bee84b3

Please sign in to comment.