diff --git a/base/REPL.jl b/base/REPL.jl index 323a0d6d7cca8..67d61fbdbeae9 100644 --- a/base/REPL.jl +++ b/base/REPL.jl @@ -82,7 +82,7 @@ end function start_repl_backend(repl_channel::RemoteRef, response_channel::RemoteRef) backend = REPLBackend(repl_channel, response_channel, nothing) - @async begin + global interactive_task = @schedule begin # include looks at this to determine the relative include path # nothing means cwd while true diff --git a/base/task.jl b/base/task.jl index f732343d1a2ec..272b731af01f4 100644 --- a/base/task.jl +++ b/base/task.jl @@ -80,6 +80,10 @@ function task_done_hook(t::Task) end yieldto(nexttask, result) else + if err && isa(result,InterruptException) && isdefined(REPL,:interactive_task) && + REPL.interactive_task.state == :waiting && isempty(Workqueue) + throwto(REPL.interactive_task, result) + end wait() end end diff --git a/src/julia.h b/src/julia.h index c3879f7c1a696..ae8bd3fa9931a 100644 --- a/src/julia.h +++ b/src/julia.h @@ -1344,7 +1344,7 @@ typedef struct { extern DLLEXPORT jl_compileropts_t jl_compileropts; -// Settings for code_coverage and mallog_log +// Settings for code_coverage and malloc_log #define JL_LOG_NONE 0 #define JL_LOG_USER 1 #define JL_LOG_ALL 2 diff --git a/test/intfuncs.jl b/test/intfuncs.jl index 8d1fce1084df6..239031d399e41 100644 --- a/test/intfuncs.jl +++ b/test/intfuncs.jl @@ -86,3 +86,19 @@ @test isqrt(4) == 2 @test isqrt(5) == 2 +# issue #4884 +@test isqrt(9223372030926249000) == 3037000498 +@test isqrt(typemax(Int128)) == int128("13043817825332782212") +@test isqrt(int128(typemax(Int64))^2-1) == 9223372036854775806 +@test isqrt(0) == 0 +for i = 1:1000 + n = rand(UInt128) + s = isqrt(n) + @test s*s <= n + @test (s+1)*(s+1) > n + n = rand(UInt64) + s = isqrt(n) + @test s*s <= n + @test (s+1)*(s+1) > n +end + diff --git a/test/math.jl b/test/math.jl index 0f28b4c1b09d4..3514baac9e263 100644 --- a/test/math.jl +++ b/test/math.jl @@ -277,22 +277,6 @@ end @test any(ccall("jl_zero_subnormals", UInt8, (UInt8,), 1) .== [0x00 0x01]) @test any(ccall("jl_zero_subnormals", UInt8, (UInt8,), 0) .== [0x00 0x01]) -# isqrt (issue #4884) -@test isqrt(9223372030926249000) == 3037000498 -@test isqrt(typemax(Int128)) == int128("13043817825332782212") -@test isqrt(int128(typemax(Int64))^2-1) == 9223372036854775806 -@test isqrt(0) == 0 -for i = 1:1000 - n = rand(UInt128) - s = isqrt(n) - @test s*s <= n - @test (s+1)*(s+1) > n - n = rand(UInt64) - s = isqrt(n) - @test s*s <= n - @test (s+1)*(s+1) > n -end - # useful test functions for relative error err(z, x) = abs(z - x) / abs(x) errc(z, x) = max(err(real(z),real(x)), err(imag(z),imag(x)))