Skip to content

Commit

Permalink
Merge branch 'master' into kc/remove_delimited_files
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC authored Aug 11, 2022
2 parents 69f6370 + 33378dc commit f3c9577
Show file tree
Hide file tree
Showing 167 changed files with 7,532 additions and 4,659 deletions.
6 changes: 6 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ Standard library changes
definitions, including to other function calls, while recording all intermediate test results ([#42518]).
* `TestLogger` and `LogRecord` are now exported from the Test stdlib ([#44080]).

#### Distributed

* SSHManager now supports workers with csh/tcsh login shell, via `addprocs()` option `shell=:csh` ([#41485]).


Deprecated or removed
---------------------

Expand Down Expand Up @@ -232,6 +237,7 @@ Tooling Improvements
[#41312]: https://github.com/JuliaLang/julia/issues/41312
[#41328]: https://github.com/JuliaLang/julia/issues/41328
[#41449]: https://github.com/JuliaLang/julia/issues/41449
[#41485]: https://github.com/JuliaLang/julia/issues/41485
[#41551]: https://github.com/JuliaLang/julia/issues/41551
[#41576]: https://github.com/JuliaLang/julia/issues/41576
[#41612]: https://github.com/JuliaLang/julia/issues/41612
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ configure-y: | $(BUILDDIRMAKE)
configure:
ifeq ("$(origin O)", "command line")
@if [ "$$(ls '$(BUILDROOT)' 2> /dev/null)" ]; then \
echo 'WARNING: configure called on non-empty directory $(BUILDROOT)'; \
printf $(WARNCOLOR)'WARNING: configure called on non-empty directory'$(ENDCOLOR)' %s\n' '$(BUILDROOT)'; \
read -p "Proceed [y/n]? " answer; \
else \
answer=y;\
fi; \
[ $$answer = 'y' ] && $(MAKE) configure-$$answer
[ "y$$answer" = yy ] && $(MAKE) configure-$$answer
else
$(error "cannot rerun configure from within a build directory")
endif
Expand Down Expand Up @@ -108,7 +108,7 @@ check-whitespace:
ifneq ($(NO_GIT), 1)
@# Append the directory containing the julia we just built to the end of `PATH`,
@# to give us the best chance of being able to run this check.
@PATH=$(PATH):$(dirname $(JULIA_EXECUTABLE)) $(JULIAHOME)/contrib/check-whitespace.jl
@PATH="$(PATH):$(dir $(JULIA_EXECUTABLE))" $(JULIAHOME)/contrib/check-whitespace.jl
else
$(warn "Skipping whitespace check because git is unavailable")
endif
Expand Down
6 changes: 1 addition & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@ Language changes
* New builtins `getglobal(::Module, ::Symbol[, order])` and `setglobal!(::Module, ::Symbol, x[, order])`
for reading from and writing to globals. `getglobal` should now be preferred for accessing globals over
`getfield`. ([#44137])
* A few basic operators have been generalized to more naturally support vector space structures:
unary minus falls back to scalar multiplication with -1, `-(x) = Int8(-1)*x`,
binary minus falls back to addition `-(x, y) = x + (-y)`, and, at the most generic level,
left- and right-division fall back to multiplication with the inverse from left and right,
respectively, as stated in the docstring. ([#44564])
* The `@invoke` macro introduced in 1.7 is now exported. Additionally, it now uses `Core.Typeof(x)`
rather than `Any` when a type annotation is omitted for an argument `x` so that types passed
as arguments are handled correctly. ([#45807])
* The `invokelatest` function and `@invokelatest` macro introduced in 1.7 are now exported. ([#45831])

Compiler/Runtime improvements
-----------------------------
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,25 @@ Then, acquire the source code by cloning the git repository:

git clone https://github.com/JuliaLang/julia.git

By default you will be building the latest unstable version of
and then use the command prompt to change into the resulting julia directory. By default you will be building the latest unstable version of
Julia. However, most users should use the [most recent stable version](https://github.com/JuliaLang/julia/releases)
of Julia. You can get this version by changing to the Julia directory
and running:
of Julia. You can get this version by running:

git checkout v1.7.3

Now run `make` to build the `julia` executable.
To build the `julia` executable, run `make` from within the julia directory.

Building Julia requires 2GiB of disk space and approximately 4GiB of virtual memory.

**Note:** The build process will fail badly if any of the build directory's parent directories have spaces or other shell meta-characters such as `$` or `:` in their names (this is due to a limitation in GNU make).

Once it is built, you can run the `julia` executable after you enter your julia directory and run
Once it is built, you can run the `julia` executable. From within the julia directory, run

./julia

Your first test of Julia determines whether your build is working
properly. From the UNIX/Windows command prompt inside the `julia`
source directory, type `make testall`. You should see output that
properly. From the julia
directory, type `make testall`. You should see output that
lists a series of running tests; if they complete without error, you
should be in good shape to start using Julia.

Expand Down
30 changes: 16 additions & 14 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ If multiple arguments are passed, equivalent to `has_offset_axes(A) | has_offset
See also [`require_one_based_indexing`](@ref).
"""
has_offset_axes(A) = _tuple_any(x->Int(first(x))::Int != 1, axes(A))
has_offset_axes(A) = _any_tuple(x->Int(first(x))::Int != 1, false, axes(A)...)
has_offset_axes(A::AbstractVector) = Int(firstindex(A))::Int != 1 # improve performance of a common case (ranges)
has_offset_axes(A...) = _tuple_any(has_offset_axes, A)
# Use `_any_tuple` to avoid unneeded invoke.
# note: this could call `any` directly if the compiler can infer it
has_offset_axes(As...) = _any_tuple(has_offset_axes, false, As...)
has_offset_axes(::Colon) = false

"""
Expand Down Expand Up @@ -891,13 +893,12 @@ See also [`copyto!`](@ref).
is available from the `Future` standard library as `Future.copy!`.
"""
function copy!(dst::AbstractVector, src::AbstractVector)
firstindex(dst) == firstindex(src) || throw(ArgumentError(
"vectors must have the same offset for copy! (consider using `copyto!`)"))
if length(dst) != length(src)
resize!(dst, length(src))
end
for i in eachindex(dst, src)
@inbounds dst[i] = src[i]
end
dst
copyto!(dst, src)
end

function copy!(dst::AbstractArray, src::AbstractArray)
Expand Down Expand Up @@ -1108,8 +1109,9 @@ function copyto!(dest::AbstractArray, dstart::Integer,
destinds, srcinds = LinearIndices(dest), LinearIndices(src)
(checkbounds(Bool, destinds, dstart) && checkbounds(Bool, destinds, dstart+n-1)) || throw(BoundsError(dest, dstart:dstart+n-1))
(checkbounds(Bool, srcinds, sstart) && checkbounds(Bool, srcinds, sstart+n-1)) || throw(BoundsError(src, sstart:sstart+n-1))
@inbounds for i = 0:(n-1)
dest[dstart+i] = src[sstart+i]
src′ = unalias(dest, src)
@inbounds for i = 0:n-1
dest[dstart+i] = src′[sstart+i]
end
return dest
end
Expand All @@ -1131,11 +1133,12 @@ function copyto!(B::AbstractVecOrMat{R}, ir_dest::AbstractRange{Int}, jr_dest::A
end
@boundscheck checkbounds(B, ir_dest, jr_dest)
@boundscheck checkbounds(A, ir_src, jr_src)
A′ = unalias(B, A)
jdest = first(jr_dest)
for jsrc in jr_src
idest = first(ir_dest)
for isrc in ir_src
@inbounds B[idest,jdest] = A[isrc,jsrc]
@inbounds B[idest,jdest] = A[isrc,jsrc]
idest += step(ir_dest)
end
jdest += step(jr_dest)
Expand Down Expand Up @@ -2187,14 +2190,13 @@ julia> hvncat(((3, 3), (3, 3), (6,)), true, a, b, c, d, e, f)
4 5 6
```
# Examples for construction of the arguments:
```julia
# Examples for construction of the arguments
```
[a b c ; d e f ;;;
g h i ; j k l ;;;
m n o ; p q r ;;;
s t u ; v w x]
=> dims = (2, 3, 4)
dims = (2, 3, 4)
[a b ; c ;;; d ;;;;]
___ _ _
Expand All @@ -2205,7 +2207,7 @@ julia> hvncat(((3, 3), (3, 3), (6,)), true, a, b, c, d, e, f)
4 = elements in each 3d slice (4,)
_____________
4 = elements in each 4d slice (4,)
=> shape = ((2, 1, 1), (3, 1), (4,), (4,)) with `rowfirst` = true
shape = ((2, 1, 1), (3, 1), (4,), (4,)) with `row_first` = true
```
"""
hvncat(dimsshape::Tuple, row_first::Bool, xs...) = _hvncat(dimsshape, row_first, xs...)
Expand Down
9 changes: 4 additions & 5 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,8 @@ end
function _copyto_impl!(dest::Array, doffs::Integer, src::Array, soffs::Integer, n::Integer)
n == 0 && return dest
n > 0 || _throw_argerror()
if soffs < 1 || doffs < 1 || soffs+n-1 > length(src) || doffs+n-1 > length(dest)
throw(BoundsError())
end
@boundscheck checkbounds(dest, doffs:doffs+n-1)
@boundscheck checkbounds(src, soffs:soffs+n-1)
unsafe_copyto!(dest, doffs, src, soffs, n)
return dest
end
Expand Down Expand Up @@ -359,7 +358,7 @@ Create a shallow copy of `x`: the outer structure is copied, but not all interna
For example, copying an array produces a new array with identically-same elements as the
original.
See also [`copy!`](@ref Base.copy!), [`copyto!`](@ref).
See also [`copy!`](@ref Base.copy!), [`copyto!`](@ref), [`deepcopy`](@ref).
"""
copy

Expand Down Expand Up @@ -1487,7 +1486,7 @@ end
Remove the item at the given `i` and return the modified `a`. Subsequent items
are shifted to fill the resulting gap.
See also: [`delete!`](@ref), [`popat!`](@ref), [`splice!`](@ref).
See also: [`keepat!`](@ref), [`delete!`](@ref), [`popat!`](@ref), [`splice!`](@ref).
# Examples
```jldoctest
Expand Down
5 changes: 3 additions & 2 deletions base/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,11 @@ function unsafe_copyto!(dest::BitArray, doffs::Integer, src::Union{BitArray,Arra
return dest
end

copyto!(dest::BitArray, doffs::Integer, src::Array, soffs::Integer, n::Integer) =
copyto!(dest::BitArray, doffs::Integer, src::Union{BitArray,Array}, soffs::Integer, n::Integer) =
_copyto_int!(dest, Int(doffs), src, Int(soffs), Int(n))
function _copyto_int!(dest::BitArray, doffs::Int, src::Array, soffs::Int, n::Int)
function _copyto_int!(dest::BitArray, doffs::Int, src::Union{BitArray,Array}, soffs::Int, n::Int)
n == 0 && return dest
n < 0 && throw(ArgumentError("Number of elements to copy must be nonnegative."))
soffs < 1 && throw(BoundsError(src, soffs))
doffs < 1 && throw(BoundsError(dest, doffs))
soffs+n-1 > length(src) && throw(BoundsError(src, length(src)+1))
Expand Down
3 changes: 2 additions & 1 deletion base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ macro _foldable_meta()
#=:nothrow=#false,
#=:terminates_globally=#true,
#=:terminates_locally=#false,
#=:notaskstate=#false))
#=:notaskstate=#false,
#=:inaccessiblememonly=#false))
end

const NTuple{N,T} = Tuple{Vararg{T,N}}
Expand Down
112 changes: 103 additions & 9 deletions base/channels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,26 @@ end
"""
fetch(c::Channel)
Wait for and get the first available item from the channel. Does not
remove the item. `fetch` is unsupported on an unbuffered (0-size) channel.
Waits for and returns (with removing) the first available item from the `Channel`.
Note: `fetch` is unsupported on an unbuffered (0-size) `Channel`.
# Examples
Buffered channel:
```jldoctest
julia> c = Channel(3) do ch
foreach(i -> put!(ch, i), 1:3)
end;
julia> fetch(c)
1
julia> collect(c) # item is not removed
3-element Vector{Any}:
1
2
3
```
"""
fetch(c::Channel) = isbuffered(c) ? fetch_buffered(c) : fetch_unbuffered(c)
function fetch_buffered(c::Channel)
Expand All @@ -402,10 +420,32 @@ fetch_unbuffered(c::Channel) = throw(ErrorException("`fetch` is not supported on
"""
take!(c::Channel)
Remove and return a value from a [`Channel`](@ref). Blocks until data is available.
Removes and returns a value from a [`Channel`](@ref) in order. Blocks until data is available.
For unbuffered channels, blocks until a [`put!`](@ref) is performed by a different task.
For unbuffered channels, blocks until a [`put!`](@ref) is performed by a different
task.
# Examples
Buffered channel:
```jldoctest
julia> c = Channel(1);
julia> put!(c, 1);
julia> take!(c)
1
```
Unbuffered channel:
```jldoctest
julia> c = Channel(0);
julia> task = Task(() -> put!(c, 1));
julia> schedule(task);
julia> take!(c)
1
```
"""
take!(c::Channel) = isbuffered(c) ? take_buffered(c) : take_unbuffered(c)
function take_buffered(c::Channel)
Expand Down Expand Up @@ -439,11 +479,41 @@ end
"""
isready(c::Channel)
Determine whether a [`Channel`](@ref) has a value stored to it. Returns
immediately, does not block.
Determines whether a [`Channel`](@ref) has a value stored in it.
Returns immediately, does not block.
For unbuffered channels returns `true` if there are tasks waiting on a [`put!`](@ref).
# Examples
Buffered channel:
```jldoctest
julia> c = Channel(1);
julia> isready(c)
false
julia> put!(c, 1);
julia> isready(c)
true
```
Unbuffered channel:
```jldoctest
julia> c = Channel();
julia> isready(c) # no tasks waiting to put!
false
julia> task = Task(() -> put!(c, 1));
julia> schedule(task); # schedule a put! task
julia> isready(c)
true
```
For unbuffered channels returns `true` if there are tasks waiting
on a [`put!`](@ref).
"""
isready(c::Channel) = n_avail(c) > 0
isempty(c::Channel) = n_avail(c) == 0
Expand All @@ -457,6 +527,30 @@ lock(f, c::Channel) = lock(f, c.cond_take)
unlock(c::Channel) = unlock(c.cond_take)
trylock(c::Channel) = trylock(c.cond_take)

"""
wait(c::Channel)
Blocks until the `Channel` [`isready`](@ref).
```jldoctest
julia> c = Channel(1);
julia> isready(c)
false
julia> task = Task(() -> wait(c));
julia> schedule(task);
julia> istaskdone(task) # task is blocked because channel is not ready
false
julia> put!(c, 1);
julia> istaskdone(task) # task is now unblocked
true
```
"""
function wait(c::Channel)
isready(c) && return
lock(c)
Expand Down
Loading

0 comments on commit f3c9577

Please sign in to comment.