Skip to content

Commit a6fb35c

Browse files
authored
Added handling of missing/nothing inputs for parse and tryparse. Returns nothings to stay consistent with parse returns during invalid parses.
1 parent d587f9d commit a6fb35c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

base/parse.jl

+2
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,8 @@ parse(::Type{T}, s::AbstractString; kwargs...) where T<:Real =
380380
convert(T, tryparse_internal(T, s, true; kwargs...))
381381
parse(::Type{T}, s::AbstractString) where T<:Complex =
382382
convert(T, tryparse_internal(T, s, firstindex(s), lastindex(s), true))
383+
parse(::Type{T}, s::Union{Missing, Nothing}) where T<:Number = nothing
383384

384385
tryparse(T::Type{Complex{S}}, s::AbstractString) where S<:Real =
385386
tryparse_internal(T, s, firstindex(s), lastindex(s), false)
387+
tryparse(::Type{T}, s::Union{Missing, Nothing}) where T<:Number = nothing

0 commit comments

Comments
 (0)