Skip to content

Commit

Permalink
Merge pull request #46984 from JuliaLang/backports-release-1.8
Browse files Browse the repository at this point in the history
Backports for Julia 1.8.3
  • Loading branch information
KristofferC authored Nov 8, 2022
2 parents 97ccb97 + 0a121d1 commit 8b67441
Show file tree
Hide file tree
Showing 74 changed files with 749 additions and 395 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/statuses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ jobs:
- run: |
declare -a CONTEXT_LIST=(
"buildbot/tester_freebsd64"
"buildbot/tester_win32"
"buildbot/tester_win64"
)
for CONTEXT in "${CONTEXT_LIST[@]}"
do
Expand Down
6 changes: 3 additions & 3 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1391,13 +1391,13 @@ define symlink_target # (from, to-dir, to-name)
CLEAN_TARGETS += clean-$$(abspath $(2)/$(3))
clean-$$(abspath $(2)/$(3)):
ifeq ($(BUILD_OS), WINNT)
-cmd //C rmdir $$(call mingw_to_dos,$(2)/$(3),cd $(2) &&)
-cmd //C rmdir $$(call cygpath_w,$(2)/$(3))
else
-rm -r $$(abspath $(2)/$(3))
endif
$$(abspath $(2)/$(3)): | $$(abspath $(2))
ifeq ($$(BUILD_OS), WINNT)
@cmd //C mklink //J $$(call mingw_to_dos,$(2)/$(3),cd $(2) &&) $$(call mingw_to_dos,$(1),)
@cmd //C mklink //J $$(call cygpath_w,$(2)/$(3)) $$(call cygpath_w,$(1))
else ifneq (,$$(findstring CYGWIN,$$(BUILD_OS)))
@cmd /C mklink /J $$(call cygpath_w,$(2)/$(3)) $$(call cygpath_w,$(1))
else ifdef JULIA_VAGRANT_BUILD
Expand All @@ -1415,7 +1415,7 @@ WINE ?= wine
# many of the following targets must be = not := because the expansion of the makefile functions (and $1) shouldn't happen until later
ifeq ($(BUILD_OS), WINNT) # MSYS
spawn = $(1)
cygpath_w = $(1)
cygpath_w = `cygpath -w $(1)`
else ifneq (,$(findstring CYGWIN,$(BUILD_OS))) # Cygwin
spawn = $(1)
cygpath_w = `cygpath -w $(1)`
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,10 @@ endif
endif
endif

# Note that we disable MSYS2's path munging here, as otherwise
# it replaces our `:`-separated list as a `;`-separated one.
define stringreplace
$(build_depsbindir)/stringreplace $$(strings -t x - $1 | grep $2 | awk '{print $$1;}') $3 255 "$(call cygpath_w,$1)"
MSYS2_ARG_CONV_EXCL='*' $(build_depsbindir)/stringreplace $$(strings -t x - $1 | grep $2 | awk '{print $$1;}') $3 255 "$(call cygpath_w,$1)"
endef


Expand Down Expand Up @@ -446,8 +448,9 @@ endif


exe:
# run Inno Setup to compile installer
$(call spawn,$(JULIAHOME)/dist-extras/inno/iscc.exe /DAppVersion=$(JULIA_VERSION) /DSourceDir="$(call cygpath_w,$(BUILDROOT)/julia-$(JULIA_COMMIT))" /DRepoDir="$(call cygpath_w,$(JULIAHOME))" /F"$(JULIA_BINARYDIST_FILENAME)" /O"$(call cygpath_w,$(BUILDROOT))" $(INNO_ARGS) $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.iss))
# run Inno Setup to compile installer.
# Note that we disable MSYS2 path munging, as it interferes with the `/` options:
MSYS2_ARG_CONV_EXCL='*' $(call spawn,$(JULIAHOME)/dist-extras/inno/iscc.exe /DAppVersion=$(JULIA_VERSION) /DSourceDir="$(call cygpath_w,$(BUILDROOT)/julia-$(JULIA_COMMIT))" /DRepoDir="$(call cygpath_w,$(JULIAHOME))" /F"$(JULIA_BINARYDIST_FILENAME)" /O"$(call cygpath_w,$(BUILDROOT))" $(INNO_ARGS) $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.iss))
chmod a+x "$(BUILDROOT)/$(JULIA_BINARYDIST_FILENAME).exe"

app:
Expand Down Expand Up @@ -572,7 +575,7 @@ win-extras:
cd $(JULIAHOME)/dist-extras && \
$(JLDOWNLOAD) https://www.jrsoftware.org/download.php/is.exe && \
chmod a+x is.exe && \
$(call spawn, $(JULIAHOME)/dist-extras/is.exe /DIR="$(call cygpath_w,$(JULIAHOME)/dist-extras/inno)" /PORTABLE=1 /CURRENTUSER /VERYSILENT)
MSYS2_ARG_CONV_EXCL='*' $(call spawn, $(JULIAHOME)/dist-extras/is.exe /DIR="$(call cygpath_w,$(JULIAHOME)/dist-extras/inno)" /PORTABLE=1 /CURRENTUSER /VERYSILENT)

# various statistics about the build that may interest the user
ifeq ($(USE_SYSTEM_LLVM), 1)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ New library features
* `extrema` now accepts an `init` keyword argument ([#36265], [#43604]).
* `Iterators.countfrom` now accepts any type that defines `+` ([#37747]).
* `@time` now separates out % time spent recompiling invalidated methods ([#45015]).
* An issue with order of operations in `fld1` is now fixed ([#28973]).

Standard library changes
------------------------
Expand Down
6 changes: 3 additions & 3 deletions base/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ setproperty!(x::Tuple, f::Int, v, order::Symbol) = setfield!(x, f, v, order) # t
getproperty(x, f::Symbol, order::Symbol) = (@inline; getfield(x, f, order))
setproperty!(x, f::Symbol, v, order::Symbol) = (@inline; setfield!(x, f, convert(fieldtype(typeof(x), f), v), order))

swapproperty!(x, f::Symbol, v, order::Symbol=:notatomic) =
swapproperty!(x, f::Symbol, v, order::Symbol=:not_atomic) =
(@inline; Core.swapfield!(x, f, convert(fieldtype(typeof(x), f), v), order))
modifyproperty!(x, f::Symbol, op, v, order::Symbol=:notatomic) =
modifyproperty!(x, f::Symbol, op, v, order::Symbol=:not_atomic) =
(@inline; Core.modifyfield!(x, f, op, v, order))
replaceproperty!(x, f::Symbol, expected, desired, success_order::Symbol=:notatomic, fail_order::Symbol=success_order) =
replaceproperty!(x, f::Symbol, expected, desired, success_order::Symbol=:not_atomic, fail_order::Symbol=success_order) =
(@inline; Core.replacefield!(x, f, expected, convert(fieldtype(typeof(x), f), desired), success_order, fail_order))

convert(::Type{Any}, Core.@nospecialize x) = x
Expand Down
7 changes: 4 additions & 3 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ function unsafe_getindex(A::AbstractArray, I...)
r
end

struct CanonicalIndexError
struct CanonicalIndexError <: Exception
func::String
type::Any
CanonicalIndexError(func::String, @nospecialize(type)) = new(func, type)
Expand Down Expand Up @@ -3187,8 +3187,9 @@ function circshift!(a::AbstractVector, shift::Integer)
n == 0 && return
shift = mod(shift, n)
shift == 0 && return
reverse!(a, 1, shift)
reverse!(a, shift+1, length(a))
l = lastindex(a)
reverse!(a, firstindex(a), l-shift)
reverse!(a, l-shift+1, lastindex(a))
reverse!(a)
return a
end
2 changes: 1 addition & 1 deletion base/compiler/inferenceresult.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function matching_cache_argtypes(
# invalidate `Conditional` imposed on varargs
if condargs !== nothing
for (slotid, i) in condargs
if slotid last
if slotid last && (1 i length(isva_given_argtypes)) # `Conditional` is already widened to vararg-tuple otherwise
isva_given_argtypes[i] = widenconditional(isva_given_argtypes[i])
end
end
Expand Down
5 changes: 4 additions & 1 deletion base/compiler/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ function retrieve_code_info(linfo::MethodInstance)
end
if c === nothing && isdefined(m, :source)
src = m.source
if isa(src, Array{UInt8,1})
if src === nothing
# can happen in images built with --strip-ir
return nothing
elseif isa(src, Array{UInt8,1})
c = ccall(:jl_uncompress_ir, Any, (Any, Ptr{Cvoid}, Any), m, C_NULL, src)
else
c = copy(src::CodeInfo)
Expand Down
10 changes: 6 additions & 4 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2144,11 +2144,13 @@ end
end
for chi in includes
f, ftime_req = chi.filename, chi.mtime
# Issue #13606: compensate for Docker images rounding mtimes
# Issue #20837: compensate for GlusterFS truncating mtimes to microseconds
# The `ftime != 1.0` condition below provides compatibility with Nix mtime.
ftime = mtime(f)
if ftime != ftime_req && ftime != floor(ftime_req) && ftime != trunc(ftime_req, digits=6) && ftime != 1.0
is_stale = ( ftime != ftime_req ) &&
( ftime != floor(ftime_req) ) && # Issue #13606, PR #13613: compensate for Docker images rounding mtimes
( ftime != trunc(ftime_req, digits=6) ) && # Issue #20837, PR #20840: compensate for GlusterFS truncating mtimes to microseconds
( ftime != 1.0 ) && # PR #43090: provide compatibility with Nix mtime.
!( 0 < (ftime_req - ftime) < 1e-6 ) # PR #45552: Compensate for Windows tar giving mtimes that may be incorrect by up to one microsecond
if is_stale
@debug "Rejecting stale cache file $cachefile (mtime $ftime_req) because file $f (mtime $ftime) has changed"
return true
end
Expand Down
2 changes: 1 addition & 1 deletion base/logging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ function handle_message(logger::SimpleLogger, level::LogLevel, message, _module,
remaining > 0 || return
end
buf = IOBuffer()
stream = logger.stream
stream::IO = logger.stream
if !(isopen(stream)::Bool)
stream = stderr
end
Expand Down
2 changes: 1 addition & 1 deletion base/namedtuple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function NamedTuple{names}(nt::NamedTuple) where {names}
types = Tuple{(fieldtype(nt, idx[n]) for n in 1:length(idx))...}
Expr(:new, :(NamedTuple{names, $types}), Any[ :(getfield(nt, $(idx[n]))) for n in 1:length(idx) ]...)
else
length_names = length(names)::Integer
length_names = length(names::Tuple)
types = Tuple{(fieldtype(typeof(nt), names[n]) for n in 1:length_names)...}
NamedTuple{names, types}(map(Fix1(getfield, nt), names))
end
Expand Down
2 changes: 1 addition & 1 deletion base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ julia> x == (fld1(x, y) - 1) * y + mod1(x, y)
true
```
"""
fld1(x::T, y::T) where {T<:Real} = (m = mod1(x, y); fld(x + y - m, y))
fld1(x::T, y::T) where {T<:Real} = (m = mod1(x, y); fld((x - m) + y, y))
function fld1(x::T, y::T) where T<:Integer
d = div(x, y)
return d + (!signbit(x y) & (d * y != x))
Expand Down
15 changes: 7 additions & 8 deletions base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1392,14 +1392,13 @@ function sum(r::AbstractRange{<:Real})
end

function _in_range(x, r::AbstractRange)
if !isfinite(x)
return false
elseif iszero(step(r))
return !isempty(r) && first(r) == x
else
n = round(Integer, (x - first(r)) / step(r)) + 1
return n >= 1 && n <= length(r) && r[n] == x
end
isempty(r) && return false
f, l = first(r), last(r)
# check for NaN, Inf, and large x that may overflow in the next calculation
f <= x <= l || l <= x <= f || return false
iszero(step(r)) && return true
n = round(Integer, (x - f) / step(r)) + 1
n >= 1 && n <= length(r) && r[n] == x
end
in(x::Real, r::AbstractRange{<:Real}) = _in_range(x, r)
# This method needs to be defined separately since -(::T, ::T) can be implemented
Expand Down
38 changes: 22 additions & 16 deletions base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2715,6 +2715,9 @@ function dump(arg; maxdepth=DUMP_DEFAULT_MAXDEPTH)
dump(IOContext(stdout, :limit => true, :module => mod), arg; maxdepth=maxdepth)
end

nocolor(io::IO) = IOContext(io, :color => false)
alignment_from_show(io::IO, x::Any) =
textwidth(sprint(show, x, context=nocolor(io), sizehint=0))

"""
`alignment(io, X)` returns a tuple (left,right) showing how many characters are
Expand All @@ -2732,35 +2735,38 @@ julia> Base.alignment(stdout, 1 + 10im)
(3, 5)
```
"""
alignment(io::IO, x::Any) = (0, length(sprint(show, x, context=io, sizehint=0)))
alignment(io::IO, x::Number) = (length(sprint(show, x, context=io, sizehint=0)), 0)
alignment(io::IO, x::Integer) = (length(sprint(show, x, context=io, sizehint=0)), 0)
alignment(io::IO, x::Any) = (0, alignment_from_show(io, x))
alignment(io::IO, x::Number) = (alignment_from_show(io, x), 0)
alignment(io::IO, x::Integer) = (alignment_from_show(io, x), 0)
function alignment(io::IO, x::Real)
m = match(r"^(.*?)((?:[\.eEfF].*)?)$", sprint(show, x, context=io, sizehint=0))
m === nothing ? (length(sprint(show, x, context=io, sizehint=0)), 0) :
(length(m.captures[1]), length(m.captures[2]))
s = sprint(show, x, context=nocolor(io), sizehint=0)
m = match(r"^(.*?)((?:[\.eEfF].*)?)$", s)
m === nothing ? (textwidth(s), 0) :
(textwidth(m.captures[1]), textwidth(m.captures[2]))
end
function alignment(io::IO, x::Complex)
m = match(r"^(.*[^ef][\+\-])(.*)$", sprint(show, x, context=io, sizehint=0))
m === nothing ? (length(sprint(show, x, context=io, sizehint=0)), 0) :
(length(m.captures[1]), length(m.captures[2]))
s = sprint(show, x, context=nocolor(io), sizehint=0)
m = match(r"^(.*[^ef][\+\-])(.*)$", s)
m === nothing ? (textwidth(s), 0) :
(textwidth(m.captures[1]), textwidth(m.captures[2]))
end
function alignment(io::IO, x::Rational)
m = match(r"^(.*?/)(/.*)$", sprint(show, x, context=io, sizehint=0))
m === nothing ? (length(sprint(show, x, context=io, sizehint=0)), 0) :
(length(m.captures[1]), length(m.captures[2]))
s = sprint(show, x, context=nocolor(io), sizehint=0)
m = match(r"^(.*?/)(/.*)$", s)
m === nothing ? (textwidth(s), 0) :
(textwidth(m.captures[1]), textwidth(m.captures[2]))
end

function alignment(io::IO, x::Pair)
s = sprint(show, x, context=io, sizehint=0)
fullwidth = alignment_from_show(io, x)
if !isdelimited(io, x) # i.e. use "=>" for display
ctx = IOContext(io, :typeinfo => gettypeinfos(io, x)[1])
left = length(sprint(show, x.first, context=ctx, sizehint=0))
left = alignment_from_show(ctx, x.first)
left += 2 * !isdelimited(ctx, x.first) # for parens around p.first
left += !(get(io, :compact, false)::Bool) # spaces are added around "=>"
(left+1, length(s)-left-1) # +1 for the "=" part of "=>"
(left+1, fullwidth-left-1) # +1 for the "=" part of "=>"
else
(0, length(s)) # as for x::Any
(0, fullwidth) # as for x::Any
end
end

Expand Down
2 changes: 1 addition & 1 deletion base/sort.jl
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ function sortperm(v::AbstractVector;
min, max = extrema(v)
(diff, o1) = sub_with_overflow(max, min)
(rangelen, o2) = add_with_overflow(diff, oneunit(diff))
if !o1 && !o2 && rangelen < div(n,2)
if (!o1 && !o2)::Bool && rangelen < div(n,2)
return sortperm_int_range(v, rangelen, min)
end
end
Expand Down
8 changes: 8 additions & 0 deletions cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ endif
# Build list of dependent libraries that must be opened
SHIPFLAGS += -DDEP_LIBS="\"$(LOADER_BUILD_DEP_LIBS)\""
DEBUGFLAGS += -DDEP_LIBS="\"$(LOADER_DEBUG_BUILD_DEP_LIBS)\""
ifneq (,$(findstring MINGW,$(shell uname)))
# In MSYS2, do not perform path conversion for `DEP_LIBS`.
# https://www.msys2.org/wiki/Porting/#filesystem-namespaces
# We define this environment variable for only these two object files,
# as they're the only ones that require it at the time of writing.
$(BUILDDIR)/loader_lib.o: export MSYS2_ARG_CONV_EXCL = -DDEP_LIBS=
$(BUILDDIR)/loader_lib.dbg.obj: export MSYS2_ARG_CONV_EXCL = -DDEP_LIBS=
endif # MSYS2

EXE_OBJS := $(BUILDDIR)/loader_exe.o
EXE_DOBJS := $(BUILDDIR)/loader_exe.dbg.obj
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1f97646bd4a79fd623faaa029c730e3c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8eb01bd4690f87d69104284721ec48238f914e8dbcb91df495062794fa26e2c60505b68e990123b532b7c65bca134014a41da60d101ea7b9a711a52939a815f8
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e62b7c98591daeddeefc775c67a5a174
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10552c210f4152611e65aa7a6f92e382ab3aea51abfd712ca8eb1f42826b1f0c9358bb98a0e54a8b4167f9cb9f9a84a98020be4922084480a3faeae76c072eaf

This file was deleted.

This file was deleted.

18 changes: 12 additions & 6 deletions doc/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ cd(joinpath(@__DIR__, "src")) do
Base.rm("stdlib"; recursive=true, force=true)
mkdir("stdlib")
for dir in readdir(STDLIB_DIR)
if (dir == "SuiteSparse") && (!Base.USE_GPL_LIBS)
@info "Excluding SuiteSparse from the docs because Base.USE_GPL_LIBS is false"
continue
end
sourcefile = joinpath(STDLIB_DIR, dir, "docs", "src")
if dir in EXT_STDLIB_DOCS
sourcefile = joinpath(sourcefile, "basedocs.md")
Expand Down Expand Up @@ -236,12 +240,14 @@ DocMeta.setdocmeta!(
maybe_revise(:(using SparseArrays, LinearAlgebra));
recursive=true, warn=false,
)
DocMeta.setdocmeta!(
SuiteSparse,
:DocTestSetup,
maybe_revise(:(using SparseArrays, LinearAlgebra, SuiteSparse));
recursive=true, warn=false,
)
if Base.USE_GPL_LIBS
DocMeta.setdocmeta!(
SuiteSparse,
:DocTestSetup,
maybe_revise(:(using SparseArrays, LinearAlgebra, SuiteSparse));
recursive=true, warn=false,
)
end
DocMeta.setdocmeta!(
UUIDs,
:DocTestSetup,
Expand Down
Loading

0 comments on commit 8b67441

Please sign in to comment.