Skip to content

Commit ebfa1d5

Browse files
JeffBezansonKeno
authored andcommitted
remove more deprecations (#28457)
1 parent 3c2c811 commit ebfa1d5

File tree

29 files changed

+34
-1227
lines changed

29 files changed

+34
-1227
lines changed

base/abstractdict.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ function IdDict(kv)
554554
try
555555
dict_with_eltype((K, V) -> IdDict{K, V}, kv, eltype(kv))
556556
catch e
557-
if !applicable(start, kv) || !all(x->isa(x,Union{Tuple,Pair}),kv)
557+
if !applicable(iterate, kv) || !all(x->isa(x,Union{Tuple,Pair}),kv)
558558
throw(ArgumentError(
559559
"IdDict(kv): kv needs to be an iterator of tuples or pairs"))
560560
else

base/deprecated.jl

Lines changed: 1 addition & 897 deletions
Large diffs are not rendered by default.

base/essentials.jl

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -837,72 +837,6 @@ next element and the new iteration state should be returned.
837837
"""
838838
function iterate end
839839

840-
# Compatibility with old iteration protocol
841-
function iterate(x, state)
842-
@_inline_meta
843-
done(x, state) && return nothing
844-
return next(x, state)
845-
end
846-
const old_iterate_line_prev = (@__LINE__)
847-
function iterate(x)
848-
r = iterate(x, start(x))
849-
depwarn("The start/next/done iteration protocol is deprecated. Implement `iterate(::$(typeof(x)))`.", :start)
850-
r
851-
end
852-
853-
struct LegacyIterationCompat{I,T,S}
854-
done::Bool
855-
nextval::T
856-
state::S
857-
LegacyIterationCompat{I,T,S}() where {I,T,S} = new{I,T,S}(true)
858-
LegacyIterationCompat{I,T,S}(nextval::T, state::S) where {I,T,S} = new{I,T,S}(false, nextval, state)
859-
end
860-
861-
function has_non_default_iterate(T)
862-
world = ccall(:jl_get_world_counter, UInt, ())
863-
mt = Base._methods(iterate, Tuple{T}, -1, world)
864-
# Check if this is the above method
865-
if (mt[1][3].file == @__FILE_SYMBOL__) && (mt[1][3].line == old_iterate_line_prev + 2)
866-
return false
867-
end
868-
return true
869-
end
870-
871-
const compat_start_line_prev = (@__LINE__)
872-
function start(itr::T) where {T}
873-
has_non_default_iterate(T) || throw(MethodError(iterate, (itr,)))
874-
depwarn("The start/next/done iteration protocol is deprecated. Use `iterate` instead.", :start)
875-
y = iterate(itr)
876-
y === nothing && return LegacyIterationCompat{T, Union{}, Union{}}()
877-
val, state = y
878-
LegacyIterationCompat{T, typeof(val), typeof(state)}(val, state)
879-
end
880-
881-
function next(itr::I, state::LegacyIterationCompat{I,T,S}) where {I,T,S}
882-
val, state = state.nextval, state.state
883-
y = iterate(itr, state)
884-
if y === nothing
885-
return (val, LegacyIterationCompat{I,T,S}())
886-
end
887-
nextval, state = y
888-
val, LegacyIterationCompat{I, typeof(nextval), typeof(state)}(nextval, state)
889-
end
890-
891-
done(itr::I, state::LegacyIterationCompat{I,T,S}) where {I,T,S} = (@_inline_meta; state.done)
892-
# This is necessary to support the above compatibility layer,
893-
# eventually, this should just check for applicability of `iterate`
894840
function isiterable(T)::Bool
895-
if !has_non_default_iterate(T)
896-
world = ccall(:jl_get_world_counter, UInt, ())
897-
mt = Base._methods(start, Tuple{T}, -1, world)
898-
# Check if this is the fallback start method
899-
if (mt[1][3].file == @__FILE_SYMBOL__) && (mt[1][3].line == compat_start_line_prev + 2)
900-
return false
901-
end
902-
end
903-
return true
841+
return hasmethod(iterate, Tuple{T})
904842
end
905-
906-
# This is required to avoid massive performance problems
907-
# due to the start(s::AbstractString) deprecation.
908-
iterate(s::AbstractString) = iterate(s, firstindex(s))

base/iterators.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,6 @@ end
496496

497497
@propagate_inbounds iterate(i::Rest, st=i.st) = iterate(i.itr, st)
498498
isdone(i::Rest, st...) = isdone(i.itr, st...)
499-
@propagate_inbounds iterate(i::Rest{I,S}, st::S=i.st) where {I,S<:Base.LegacyIterationCompat{I}} =
500-
done(i.itr, st) ? nothing : next(i.itr, st)
501499

502500
eltype(::Type{<:Rest{I}}) where {I} = eltype(I)
503501
IteratorEltype(::Type{<:Rest{I}}) where {I} = IteratorEltype(I)

base/show.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ function show(io::IO, tn::Core.TypeName)
564564
end
565565

566566
show(io::IO, ::Nothing) = print(io, "nothing")
567+
print(io::IO, ::Nothing) = throw(ArgumentError("`nothing` should not be printed; use `show`, `repr`, or custom output instead."))
567568
show(io::IO, b::Bool) = print(io, b ? "true" : "false")
568569
show(io::IO, n::Signed) = (write(io, string(n)); nothing)
569570
show(io::IO, n::Unsigned) = print(io, "0x", string(n, pad = sizeof(n)<<1, base = 16))

base/sort.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import ..@__MODULE__, ..parentmodule
66
const Base = parentmodule(@__MODULE__)
77
using .Base.Order
88
using .Base: copymutable, LinearIndices, length, (:),
9-
eachindex, axes, first, last, similar, start, next, done, zip, OrdinalRange,
9+
eachindex, axes, first, last, similar, zip, OrdinalRange,
1010
AbstractVector, @inbounds, AbstractRange, @eval, @inline, Vector, @noinline,
1111
AbstractMatrix, AbstractUnitRange, isless, identity, eltype, >, <, <=, >=, |, +, -, *, !,
1212
extrema, sub_with_overflow, add_with_overflow, oneunit, div, getindex, setindex!,

base/sysimg.jl

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,6 @@ function __init__()
462462
ENV["OPENBLAS_NUM_THREADS"] = "8"
463463
elseif haskey(ENV, "JULIA_CPU_THREADS") # or exactly as specified
464464
ENV["OPENBLAS_NUM_THREADS"] = cpu_threads
465-
elseif haskey(ENV, "JULIA_CPU_CORES") # TODO: delete in 1.0 (deprecation)
466-
Core.print("JULIA_CPU_CORES is deprecated, use JULIA_CPU_THREADS instead.\n")
467-
ENV["OPENBLAS_NUM_THREADS"] = cpu_threads
468465
end # otherwise, trust that openblas will pick CPU_THREADS anyways, without any intervention
469466
end
470467
# for the few uses of Libc.rand in Base:
@@ -545,85 +542,6 @@ let
545542

546543
print_time("Stdlibs total", Base.tot_time_stdlib[])
547544
end
548-
549-
@eval Base begin
550-
@deprecate_binding Test root_module(Base, :Test) true ", run `using Test` instead"
551-
@deprecate_binding Distributed root_module(Base, :Distributed) true ", run `using Distributed` instead"
552-
@deprecate_binding Random root_module(Base, :Random) true ", run `using Random` instead"
553-
@deprecate_binding Serializer root_module(Base, :Serialization) true ", run `using Serialization` instead"
554-
555-
# PR #25571
556-
@deprecate_binding LinAlg root_module(Base, :LinearAlgebra) true ", run `using LinearAlgebra` instead"
557-
@deprecate_binding(I, root_module(Base, :LinearAlgebra).I, true,
558-
", run `using LinearAlgebra` to load linear algebra functionality.")
559-
560-
@deprecate_binding Pkg root_module(Base, :Pkg) true ", run `using Pkg` instead"
561-
@deprecate_binding LibGit2 root_module(Base, :LibGit2) true ", run `import LibGit2` instead"
562-
563-
@eval @deprecate_stdlib $(Symbol("@spawn")) Distributed true
564-
@eval @deprecate_stdlib $(Symbol("@spawnat")) Distributed true
565-
@eval @deprecate_stdlib $(Symbol("@fetch")) Distributed true
566-
@eval @deprecate_stdlib $(Symbol("@fetchfrom")) Distributed true
567-
@eval @deprecate_stdlib $(Symbol("@everywhere")) Distributed true
568-
@eval @deprecate_stdlib $(Symbol("@parallel")) Distributed true
569-
570-
@deprecate_stdlib addprocs Distributed true
571-
@deprecate_stdlib CachingPool Distributed true
572-
@deprecate_stdlib clear! Distributed true
573-
@deprecate_stdlib ClusterManager Distributed true
574-
@deprecate_stdlib default_worker_pool Distributed true
575-
@deprecate_stdlib init_worker Distributed true
576-
@deprecate_stdlib interrupt Distributed true
577-
@deprecate_stdlib launch Distributed true
578-
@deprecate_stdlib manage Distributed true
579-
@deprecate_stdlib myid Distributed true
580-
@deprecate_stdlib nprocs Distributed true
581-
@deprecate_stdlib nworkers Distributed true
582-
@deprecate_stdlib pmap Distributed true
583-
@deprecate_stdlib procs Distributed true
584-
@deprecate_stdlib remote Distributed true
585-
@deprecate_stdlib remotecall Distributed true
586-
@deprecate_stdlib remotecall_fetch Distributed true
587-
@deprecate_stdlib remotecall_wait Distributed true
588-
@deprecate_stdlib remote_do Distributed true
589-
@deprecate_stdlib rmprocs Distributed true
590-
@deprecate_stdlib workers Distributed true
591-
@deprecate_stdlib WorkerPool Distributed true
592-
@deprecate_stdlib RemoteChannel Distributed true
593-
@deprecate_stdlib Future Distributed true
594-
@deprecate_stdlib WorkerConfig Distributed true
595-
@deprecate_stdlib RemoteException Distributed true
596-
@deprecate_stdlib ProcessExitedException Distributed true
597-
598-
# PR #24874
599-
@deprecate_stdlib rand! Random true
600-
@deprecate_stdlib srand Random true
601-
@deprecate_stdlib AbstractRNG Random true
602-
@deprecate_stdlib randcycle Random true
603-
@deprecate_stdlib randcycle! Random true
604-
@deprecate_stdlib randperm Random true
605-
@deprecate_stdlib randperm! Random true
606-
@deprecate_stdlib shuffle Random true
607-
@deprecate_stdlib shuffle! Random true
608-
@deprecate_stdlib randsubseq Random true
609-
@deprecate_stdlib randsubseq! Random true
610-
@deprecate_stdlib randstring Random true
611-
@deprecate_stdlib MersenneTwister Random true
612-
@deprecate_stdlib RandomDevice Random true
613-
@deprecate_stdlib randn! Random true
614-
@deprecate_stdlib randexp Random true
615-
@deprecate_stdlib randexp! Random true
616-
@deprecate_stdlib bitrand Random true
617-
@deprecate_stdlib randjump Random true
618-
@deprecate_stdlib GLOBAL_RNG Random false
619-
620-
# PR #25571: LinearAlgebra to stdlib
621-
622-
# PR #25021
623-
@deprecate_stdlib normalize_string Unicode true
624-
@deprecate_stdlib graphemes Unicode true
625-
@deprecate_stdlib is_assigned_char Unicode true
626-
end
627545
end
628546

629547
# Clear global state

base/sysinfo.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ function __init__()
9292
env_threads = nothing
9393
if haskey(ENV, "JULIA_CPU_THREADS")
9494
env_threads = ENV["JULIA_CPU_THREADS"]
95-
elseif haskey(ENV, "JULIA_CPU_CORES") # TODO: delete in 1.0 (deprecation)
96-
Core.print("JULIA_CPU_CORES is deprecated, use JULIA_CPU_THREADS instead.\n")
97-
env_threads = ENV["JULIA_CPU_CORES"]
9895
end
9996
global CPU_THREADS = if env_threads !== nothing
10097
env_threads = tryparse(Int, env_threads)
@@ -106,7 +103,6 @@ function __init__()
106103
else
107104
Int(ccall(:jl_cpu_threads, Int32, ()))
108105
end
109-
global CPU_CORES = CPU_THREADS # TODO: delete in 1.0 (deprecation)
110106
global SC_CLK_TCK = ccall(:jl_SC_CLK_TCK, Clong, ())
111107
global CPU_NAME = ccall(:jl_get_cpu_name, Ref{String}, ())
112108
global JIT = ccall(:jl_get_JIT, Ref{String}, ())

doc/src/base/base.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ Base.process_exited
244244
Base.kill(::Base.Process, ::Integer)
245245
Base.Sys.set_process_title
246246
Base.Sys.get_process_title
247-
Base.readandwrite
248247
Base.ignorestatus
249248
Base.detach
250249
Base.Cmd

stdlib/Distributed/src/Distributed.jl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,6 @@ include("pmap.jl")
9292
include("managers.jl") # LocalManager and SSHManager
9393
include("precompile.jl")
9494

95-
# Deprecations
96-
97-
@eval @deprecate $(Symbol("@parallel")) $(Symbol("@distributed"))
98-
99-
# PR 26783
100-
@deprecate pmap(p::AbstractWorkerPool, f, c; kwargs...) pmap(f, p, c; kwargs...)
101-
@deprecate pmap(p::AbstractWorkerPool, f, c1, c...; kwargs...) pmap(f, p, c1, c...; kwargs...)
102-
10395
function __init__()
10496
init_parallel()
10597
end

0 commit comments

Comments
 (0)