Skip to content

Commit 7612062

Browse files
authored
Merge pull request #34517 from JuliaLang/backports-release-1.4
Backports for Julia 1.4 RC2
2 parents b0c33b0 + b4edc25 commit 7612062

File tree

278 files changed

+898
-435
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

278 files changed

+898
-435
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions

Make.inc

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,13 +1010,17 @@ else
10101010
UTF8PROC_INC := $(build_includedir)
10111011
endif
10121012

1013+
# We need python for things like BB triplet recognition. We don't really care
1014+
# about version, generally, so just find something that works:
1015+
PYTHON := $(shell which python 2>/dev/null || which python3 2>/dev/null || which python2 2>/dev/null || echo not found)
1016+
10131017
# BinaryBuilder options. We default to "on" for all the projects listed in BB_PROJECTS,
10141018
# but only if contrib/normalize_triplet.py works for our requested triplet.
1015-
ifeq ($(shell python $(JULIAHOME)/contrib/normalize_triplet.py $(or $(XC_HOST),$(XC_HOST),$(BUILD_MACHINE)) >/dev/null 2>/dev/null; echo $$?),0)
1019+
ifeq ($(shell $(PYTHON) $(JULIAHOME)/contrib/normalize_triplet.py $(or $(XC_HOST),$(XC_HOST),$(BUILD_MACHINE)) >/dev/null 2>/dev/null; echo $$?),0)
10161020
USE_BINARYBUILDER ?= 1
10171021
else
1018-
ifneq ($(shell python $(JULIAHOME)/contrib/normalize_triplet.py x86_64-linux-gnu),x86_64-linux-gnu)
1019-
$(warning python normalize_triplet.py appears to be non-functional, so BinaryBuilder disabled)
1022+
ifneq ($(shell $(PYTHON) $(JULIAHOME)/contrib/normalize_triplet.py x86_64-linux-gnu),x86_64-linux-gnu)
1023+
$(warning normalize_triplet.py appears to be non-functional (used python interpreter "$(PYTHON)"), so BinaryBuilder disabled)
10201024
endif
10211025
USE_BINARYBUILDER ?= 0
10221026
endif
@@ -1340,18 +1344,20 @@ endif
13401344
exec = $(shell $(call spawn,$(1)))
13411345

13421346
JULIA_BUILD_MODE := release
1343-
JULIA_LIBSUFFIX:=
13441347
ifeq (,$(findstring release,$(MAKECMDGOALS)))
13451348
ifneq (,$(findstring debug,$(MAKECMDGOALS)))
13461349
JULIA_BUILD_MODE := debug
1347-
JULIA_LIBSUFFIX:=-debug
13481350
endif
13491351
endif
13501352

13511353
JULIA_EXECUTABLE_debug := $(build_bindir)/julia-debug$(EXE)
13521354
JULIA_EXECUTABLE_release := $(build_bindir)/julia$(EXE)
13531355
JULIA_EXECUTABLE := $(JULIA_EXECUTABLE_$(JULIA_BUILD_MODE))
13541356

1357+
JULIA_SYSIMG_debug := $(build_private_libdir)/sys-debug.$(SHLIB_EXT)
1358+
JULIA_SYSIMG_release := $(build_private_libdir)/sys.$(SHLIB_EXT)
1359+
JULIA_SYSIMG := $(JULIA_SYSIMG_$(JULIA_BUILD_MODE))
1360+
13551361
# Colors for make
13561362
ifndef VERBOSE
13571363
VERBOSE := 0

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,6 @@ distcleanall: cleanall
571571
test: check-whitespace $(JULIA_BUILD_MODE)
572572
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/test default JULIA_BUILD_MODE=$(JULIA_BUILD_MODE)
573573

574-
JULIA_SYSIMG=$(build_private_libdir)/sys$(JULIA_LIBSUFFIX).$(SHLIB_EXT)
575-
576574
testall: check-whitespace $(JULIA_BUILD_MODE)
577575
cp $(JULIA_SYSIMG) $(BUILDROOT)/local.$(SHLIB_EXT)
578576
$(call spawn,$(JULIA_EXECUTABLE) -J $(call cygpath_w,$(BUILDROOT)/local.$(SHLIB_EXT)) -e 'true')

README.md

Lines changed: 1 addition & 1 deletion

base/client.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ using ..Base
427427
# include(fname::AbstractString) = Main.Base.include(Main, fname)
428428
function include(fname::AbstractString)
429429
mod = Main
430-
isa(fname, String) || (fname = Base.convert(String, fname))
430+
isa(fname, String) || (fname = Base.convert(String, fname)::String)
431431
path, prev = Base._include_dependency(mod, fname)
432432
for callback in Base.include_callbacks # to preserve order, must come before Core.include
433433
Base.invokelatest(callback, mod, path)

base/compiler/inferenceresult.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ function matching_cache_argtypes(linfo::MethodInstance, given_argtypes::Vector)
3535
if linfo.def.isva
3636
isva_given_argtypes = Vector{Any}(undef, nargs)
3737
for i = 1:(nargs - 1)
38-
isva_given_argtypes[i] = given_argtypes[i]
38+
isva_given_argtypes[i] = argtype_by_index(given_argtypes, i)
39+
end
40+
if length(given_argtypes) >= nargs || !isvarargtype(given_argtypes[end])
41+
isva_given_argtypes[nargs] = tuple_tfunc(given_argtypes[nargs:end])
42+
else
43+
isva_given_argtypes[nargs] = tuple_tfunc(given_argtypes[end:end])
3944
end
40-
isva_given_argtypes[nargs] = tuple_tfunc(given_argtypes[nargs:end])
4145
given_argtypes = isva_given_argtypes
4246
end
4347
cache_argtypes, overridden_by_const = matching_cache_argtypes(linfo, nothing)

base/iterators.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ reverse(G::Generator) = Generator(G.f, reverse(G.iter))
9898
reverse(r::Reverse) = r.itr
9999
reverse(x::Union{Number,AbstractChar}) = x
100100
reverse(p::Pair) = Base.reverse(p) # copying pairs is cheap
101-
reverse(xs::Tuple) = Base.reverse(xs) # allows inference in mapfoldr and similar
102101

103102
iterate(r::Reverse{<:Tuple}, i::Int = length(r.itr)) = i < 1 ? nothing : (r.itr[i], i-1)
104103

base/loading.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,8 +1086,8 @@ include_string(m::Module, txt::AbstractString, fname::AbstractString="string") =
10861086

10871087
function source_path(default::Union{AbstractString,Nothing}="")
10881088
s = current_task().storage
1089-
if s !== nothing && haskey(s, :SOURCE_PATH)
1090-
return s[:SOURCE_PATH]
1089+
if s !== nothing && haskey(s::IdDict{Any,Any}, :SOURCE_PATH)
1090+
return s[:SOURCE_PATH]::Union{Nothing,String}
10911091
end
10921092
return default
10931093
end
@@ -1264,6 +1264,8 @@ function compilecache(pkg::PkgId, path::String)
12641264
open(cachefile, "a+") do f
12651265
write(f, _crc32c(seekstart(f)))
12661266
end
1267+
# inherit permission from the source file
1268+
chmod(cachefile, filemode(path) & 0o777)
12671269
elseif p.exitcode == 125
12681270
return PrecompilableError()
12691271
else
@@ -1485,7 +1487,7 @@ Alternatively see [`PROGRAM_FILE`](@ref).
14851487
"""
14861488
macro __FILE__()
14871489
__source__.file === nothing && return nothing
1488-
return String(__source__.file)
1490+
return String(__source__.file::Symbol)
14891491
end
14901492

14911493
"""
@@ -1497,6 +1499,6 @@ Return the current working directory if run from a REPL or if evaluated by `juli
14971499
"""
14981500
macro __DIR__()
14991501
__source__.file === nothing && return nothing
1500-
_dirname = dirname(String(__source__.file))
1502+
_dirname = dirname(String(__source__.file::Symbol))
15011503
return isempty(_dirname) ? pwd() : abspath(_dirname)
15021504
end

base/logging.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ end
204204
macro _sourceinfo()
205205
esc(quote
206206
(__module__,
207-
__source__.file === nothing ? "?" : String(__source__.file),
207+
__source__.file === nothing ? "?" : String(__source__.file::Symbol),
208208
__source__.line)
209209
end)
210210
end
@@ -248,6 +248,8 @@ function log_record_id(_module, level, message, log_kws)
248248
end
249249
end
250250

251+
default_group(file) = Symbol(splitext(basename(file))[1])
252+
251253
# Generate code for logging macros
252254
function logmsg_code(_module, file, line, level, message, exs...)
253255
id = Expr(:quote, log_record_id(_module, level, message, exs))
@@ -293,12 +295,12 @@ function logmsg_code(_module, file, line, level, message, exs...)
293295
if group === nothing
294296
group = if isdefined(Base, :basename) && isa(file, String)
295297
# precompute if we can
296-
QuoteNode(splitext(basename(file))[1])
298+
QuoteNode(default_group(file))
297299
else
298300
# memoized run-time execution
299301
ref = Ref{Symbol}()
300302
:(isassigned($ref) ? $ref[]
301-
: $ref[] = Symbol(splitext(basename(something($file, "")))[1]))
303+
: $ref[] = default_group(something($file, "")))
302304
end
303305
end
304306

base/math.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,19 @@ julia> hypot(3, 4im)
613613
hypot(x::Number, y::Number) = hypot(promote(x, y)...)
614614
hypot(x::Complex, y::Complex) = hypot(abs(x), abs(y))
615615
hypot(x::T, y::T) where {T<:Real} = hypot(float(x), float(y))
616-
hypot(x::T, y::T) where {T<:Number} = (z = y/x; abs(x) * sqrt(one(z) + z*z))
616+
function hypot(x::T, y::T) where {T<:Number}
617+
if !iszero(x)
618+
z = y/x
619+
z2 = z*z
620+
621+
abs(x) * sqrt(oneunit(z2) + z2)
622+
else
623+
abs(y)
624+
end
625+
end
626+
617627
function hypot(x::T, y::T) where T<:AbstractFloat
618-
#Return Inf if either or both imputs is Inf (Compliance with IEEE754)
628+
# Return Inf if either or both inputs is Inf (Compliance with IEEE754)
619629
if isinf(x) || isinf(y)
620630
return T(Inf)
621631
end

0 commit comments

Comments
 (0)