Skip to content

Commit

Permalink
Merge pull request #35229 from JuliaLang/backports-release-1.4.1
Browse files Browse the repository at this point in the history
Backports for Julia 1.4.1
  • Loading branch information
KristofferC authored Apr 14, 2020
2 parents b8e9a9e + 7bd73b6 commit ec31c9a
Show file tree
Hide file tree
Showing 347 changed files with 1,022 additions and 341 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ New library functions
* Added `Base.hasproperty` and `Base.hasfield` ([#28850]).
* One argument `!=(x)`, `>(x)`, `>=(x)`, `<(x)`, `<=(x)` have been added, returning partially-applied
versions of the functions, similar to the existing `==(x)` and `isequal(x)` methods ([#30915]).
* The new `map!(f, values(::AbstractDict))` method allows to modify in-place values of a dictionary ([#31223]).

Standard library changes
------------------------
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ else
JL_PRIVATE_LIBS-$(USE_SYSTEM_ZLIB) += libz
endif
ifeq ($(USE_LLVM_SHLIB),1)
JL_PRIVATE_LIBS-$(USE_SYSTEM_LLVM) += libLLVM libLLVM-8
JL_PRIVATE_LIBS-$(USE_SYSTEM_LLVM) += libLLVM libLLVM-8jl
endif

ifeq ($(USE_SYSTEM_LIBM),0)
Expand Down
3 changes: 3 additions & 0 deletions base/abstractdict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,9 @@ Modifies `dict` by transforming each value from `val` to `f(val)`.
Note that the type of `dict` cannot be changed: if `f(val)` is not an instance of the value type
of `dict` then it will be converted to the value type if possible and otherwise raise an error.
!!! compat "Julia 1.2"
`map!(f, values(dict::AbstractDict))` requires Julia 1.2 or later.
# Examples
```jldoctest
julia> d = Dict(:a => 1, :b => 2)
Expand Down
3 changes: 2 additions & 1 deletion base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,8 @@ end
function setindex_widen_up_to(dest::AbstractArray{T}, el, i) where T
@_inline_meta
new = similar(dest, promote_typejoin(T, typeof(el)))
copyto!(new, firstindex(new), dest, firstindex(dest), i-1)
f = first(LinearIndices(dest))
copyto!(new, first(LinearIndices(new)), dest, f, i-f)
@inbounds new[i] = el
return new
end
Expand Down
2 changes: 1 addition & 1 deletion base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ function abstract_call_known(@nospecialize(f), fargs::Union{Nothing,Vector{Any}}
elseif la == 3 && istopfunction(f, :(>:))
# mark issupertype as a exact alias for issubtype
# swap T1 and T2 arguments and call <:
if length(fargs) == 3
if fargs !== nothing && length(fargs) == 3
fargs = Any[<:, fargs[3], fargs[2]]
else
fargs = nothing
Expand Down
2 changes: 1 addition & 1 deletion base/compiler/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ intrinsic_effect_free_if_nothrow(f) = f === Intrinsics.pointerref || is_pure_int
plus_saturate(x::Int, y::Int) = max(x, y, x+y)

# known return type
isknowntype(@nospecialize T) = (T === Union{}) || isconcretetype(T)
isknowntype(@nospecialize T) = (T === Union{}) || isa(T, Const) || isconcretetype(widenconst(T))

function statement_cost(ex::Expr, line::Int, src::CodeInfo, sptypes::Vector{Any}, slottypes::Vector{Any}, params::Params)
head = ex.head
Expand Down
2 changes: 1 addition & 1 deletion base/compiler/ssair/inlining.jl
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ function analyze_method!(idx::Int, sig::Signature, @nospecialize(metharg), meths
# Check if we intersect any of this method's ambiguities
# TODO: We could split out the ambiguous case as another "union split" case.
# For now, we just reject the method
if method.ambig !== nothing
if method.ambig !== nothing && invoke_data === nothing
for entry::Core.TypeMapEntry in method.ambig
if typeintersect(sig.atype, entry.sig) !== Bottom
return nothing
Expand Down
4 changes: 0 additions & 4 deletions base/deepcopy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ independent object. For example, deep-copying an array produces a new array whos
are deep copies of the original elements. Calling `deepcopy` on an object should generally
have the same effect as serializing and then deserializing it.
As a special case, functions can only be actually deep-copied if they are anonymous,
otherwise they are just copied. The difference is only relevant in the case of closures,
i.e. functions which may contain hidden internal references.
While it isn't normally necessary, user-defined types can override the default `deepcopy`
behavior by defining a specialized version of the function
`deepcopy_internal(x::T, dict::IdDict)` (which shouldn't otherwise be used),
Expand Down
3 changes: 1 addition & 2 deletions base/errorshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function showerror(io::IO, ex::MethodError)
kwargs = pairs(ex.args[1])
ex = MethodError(f, ex.args[3:end])
end
if f == Base.convert && length(arg_types_param) == 2 && !is_arg_types
if f === Base.convert && length(arg_types_param) == 2 && !is_arg_types
f_is_function = true
show_convert_error(io, ex, arg_types_param)
elseif isempty(methods(f)) && isa(f, DataType) && f.abstract
Expand Down Expand Up @@ -716,4 +716,3 @@ function show(io::IO, ip::InterpreterIP)
print(io, " in $(ip.code) at statement $(Int(ip.stmt))")
end
end

11 changes: 7 additions & 4 deletions base/file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ function rm(path::AbstractString; force::Bool=false, recursive::Bool=false)
try
@static if Sys.iswindows()
# is writable on windows actually means "is deletable"
if (filemode(path) & 0o222) == 0
if (filemode(lstat(path)) & 0o222) == 0
chmod(path, 0o777)
end
end
Expand Down Expand Up @@ -853,10 +853,13 @@ function walkdir(root; topdown=true, follow_symlinks=false, onerror=throw)
dirs = Vector{eltype(content)}()
files = Vector{eltype(content)}()
for name in content
if isdir(joinpath(root, name))
push!(dirs, name)
else
path = joinpath(root, name)

# If we're not following symlinks, then treat all symlinks as files
if (!follow_symlinks && islink(path)) || !isdir(path)
push!(files, name)
else
push!(dirs, name)
end
end

Expand Down
2 changes: 1 addition & 1 deletion base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ end
issubset(r::OneTo, s::OneTo) = r.stop <= s.stop

issubset(r::AbstractUnitRange{<:Integer}, s::AbstractUnitRange{<:Integer}) =
first(r) >= first(s) && last(r) <= last(s)
isempty(r) || first(r) >= first(s) && last(r) <= last(s)

## linear operations on ranges ##

Expand Down
8 changes: 8 additions & 0 deletions base/refpointer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,11 @@ getindex(b::RefArray) = b.x[b.i]
setindex!(b::RefArray, x) = (b.x[b.i] = x; b)

###

"""
AddrSpacePtr{T, AS}
When passed as a `ccall` argument with the `llvmcall` calling convention, an `AddrSpacePtr` will be converted to an LLVM pointer type with the correct address space.
This type is mainly used to ensure Julia's codegen uses the correct address space when calling LLVM intrinsics.
"""
Core.AddrSpacePtr
6 changes: 4 additions & 2 deletions base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1503,11 +1503,13 @@ function show_unquoted(io::IO, ex::Expr, indent::Int, prec::Int, quote_level::In
is_core_macro(args[1], "@big_str")
print(io, args[3])
# x"y" and x"y"z
elseif isa(args[1], Symbol) &&
elseif isa(args[1], Symbol) && nargs >= 3 && isa(args[3], String) &&
startswith(string(args[1]::Symbol), "@") &&
endswith(string(args[1]::Symbol), "_str")
s = string(args[1]::Symbol)
print(io, s[2:prevind(s,end,4)], "\"", args[3], "\"")
print(io, s[2:prevind(s,end,4)], "\"")
escape_raw_string(io, args[3])
print(io, "\"")
if nargs == 4
print(io, args[4])
end
Expand Down
12 changes: 10 additions & 2 deletions base/sort.jl
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,11 @@ function searchsortedlast(a::AbstractRange{<:Integer}, x::Real, o::DirectOrderin
if step(a) == 0
lt(o, x, first(a)) ? 0 : length(a)
else
clamp( fld(floor(Integer, x) - first(a), step(a)) + 1, 0, length(a))
if o isa ForwardOrdering
clamp( fld(floor(Integer, x) - first(a), step(a)) + 1, 0, length(a))
else
clamp( fld(ceil(Integer, x) - first(a), step(a)) + 1, 0, length(a))
end
end
end

Expand All @@ -262,7 +266,11 @@ function searchsortedfirst(a::AbstractRange{<:Integer}, x::Real, o::DirectOrderi
if step(a) == 0
lt(o, first(a), x) ? length(a)+1 : 1
else
clamp(-fld(floor(Integer, -x) + first(a), step(a)) + 1, 1, length(a) + 1)
if o isa ForwardOrdering
clamp(-fld(floor(Integer, -x) + first(a), step(a)) + 1, 1, length(a) + 1)
else
clamp(-fld(ceil(Integer, -x) + first(a), step(a)) + 1, 1, length(a) + 1)
end
end
end

Expand Down
49 changes: 49 additions & 0 deletions base/strings/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,55 @@ julia> println(raw"\\\\x \\\\\\"")
"""
macro raw_str(s); s; end

"""
escape_raw_string(s::AbstractString)
escape_raw_string(io, s::AbstractString)
Escape a string in the manner used for parsing raw string literals.
For each double-quote (`"`) character in input string `s`, this
function counts the number _n_ of preceeding backslash (`\\`) characters,
and then increases there the number of backslashes from _n_ to 2_n_+1
(even for _n_ = 0). It also doubles a sequence of backslashes at the end
of the string.
This escaping convention is used in raw strings and other non-standard
string literals. (It also happens to be the escaping convention
expected by the Microsoft C/C++ compiler runtime when it parses a
command-line string into the argv[] array.)
See also: [`escape_string`](@ref)
"""
function escape_raw_string(io, str::AbstractString)
escapes = 0
for c in str
if c == '\\'
escapes += 1
else
if c == '"'
# if one or more backslashes are followed by
# a double quote then escape all backslashes
# and the double quote
escapes = escapes * 2 + 1
end
while escapes > 0
write(io, '\\')
escapes -= 1
end
escapes = 0
write(io, c)
end
end
# also escape any trailing backslashes,
# so they do not affect the closing quote
while escapes > 0
write(io, '\\')
write(io, '\\')
escapes -= 1
end
end
escape_raw_string(str::AbstractString) = sprint(escape_raw_string, str;
sizehint = lastindex(str) + 2)

## multiline strings ##

"""
Expand Down
4 changes: 2 additions & 2 deletions contrib/refresh_bb_tarballs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ for triplet in ${TRIPLETS}; do
for proj in ${BB_CXX_EXPANDED_PROJECTS}; do
PROJ="$(echo ${proj} | tr [a-z] [A-Z])"
for cxx in cxx03 cxx11; do
make -C "${CONTRIB_DIR}/../deps" BINARYBUILDER_LLVM_ASSERTS=1 USE_BINARYBUILDER_${PROJ}=1 ${PROJ}_BB_TRIPLET=${triplet}-${cxx} BB_TRIPLET_CXXABI=${triplet} distclean-${proj}
make -C "${CONTRIB_DIR}/../deps" BINARYBUILDER_LLVM_ASSERTS=1 USE_BINARYBUILDER_${PROJ}=1 ${PROJ}_BB_TRIPLET=${triplet}-${cxx} BB_TRIPLET_CXXABI=${triplet} install-${proj}
make -C "${CONTRIB_DIR}/../deps" USE_BINARYBUILDER_${PROJ}=1 ${PROJ}_BB_TRIPLET=${triplet}-${cxx} BB_TRIPLET_CXXABI=${triplet} distclean-${proj}
make -C "${CONTRIB_DIR}/../deps" USE_BINARYBUILDER_${PROJ}=1 ${PROJ}_BB_TRIPLET=${triplet}-${cxx} BB_TRIPLET_CXXABI=${triplet} install-${proj}
done
done
done
4 changes: 2 additions & 2 deletions deps/Versions.make
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
LLVM_VER = 8.0.1
LLVM_BB_REL = 0
LLVM_BB_REL = 3
PCRE_VER = 10.31
PCRE_BB_REL = 0
DSFMT_VER = 2.2.3
DSFMT_BB_REL = 0
OPENBLAS_VER = 0.3.5
OPENBLAS_BB_REL = 1
OPENBLAS_BB_REL = 2
LAPACK_VER = 3.5.0
SUITESPARSE_VER = 5.4.0
SUITESPARSE_BB_REL = 2
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
be7eaf27902b55ac389d8c214b8c36dd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a8e9f21c52d42cb70203a82b6c366f23b89dcd3c485a22810d7659ca03c2b31a5faf66c90852af7bd6b7f94ffdc9288e67fa650b6db82d2b9786493902fb8d40
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
04547981883b5bb2065ccec35e5c1462
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d9c01ea98ddae686e4de09d86c92b6074284d0e2a0d04d1fdc2e62fe1fccf0dc9fa8a47098e0ce500256c4a8564f40f1a27639988cc92c2fb6f13a4cfb34b4f7
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5db1aeee001f43e687f3b8dc0328f255
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fa67118fa79911af94839e0fc57dc74dc3db12d5901a9bf650d22192b56653062608da2d290386dd7c42d2d03e2729aa8e975beccf871000f5e69fc78ef605e0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
74578fbe266f4497b31c6522186dec64
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dde472b256fa99a2234fbf1aa606911cabe24b085102e5cf3395b1dd24953016d1f624cf5cc6fe1b6ddece5d71c2e80318e7c254ef0736fe8223f8496db76c14
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f2ffba937431b173e83b0dc5a38b4783
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2e4c6a9a8cf8af3f058f9d82a86cd93a4c290bc71464102ca2a8b97b2bbee91b164ca3c34a69ee8e6fd553238841b79e8ae86ab26eeabf17deef8205dc35da4d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0c30890b7450a808782eb4d39aa77e4c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a5e729ea32d570a963accb7d770a142d40c511436fc84b218b601fb68ba722bd2b297b4aacef42e997f5a2d3f159e75efcb3bcbec172f3d026c2ccca81ea986a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f0f0da23760e595a40ddf666a31d4736
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6b287e7d339d333b508565b97b6e9404e758d01db7bcf3baac49f6621eec27d37d502b821a9c6046b7835dd5db42f325f51f007530d450f980c57f158b0a0b87
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
84bda1fe195ec873bc9757293ff83acb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
624e6f1753a7d6d1b6b5fc6113fbe0d6aba3931cb6815e536fb0746ae2d483e1048ceeaed677321768f15816fdce397943e8a9173c8379e7184f27334aac3b6e
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
38088b9fba2c392733a0f6e9cbe2fe31
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
54cadee2c76c9b73f87cb5897976bd22d577546dadded982d3b27ce289df4ff23a73e5360930d0ace58215952ee7cfbeffcaaabc16efa1a2bcf744428fa6518a
Loading

0 comments on commit ec31c9a

Please sign in to comment.