Skip to content

Commit 1950846

Browse files
committed
Revert "Deprecate DevNull, STDIN, STDOUT, and STDERR to lowercase (#25959)"
This reverts commit 446085a. Lowercasing these identifiers conflicts with the statistical meaning of `stderr`, i.e. the standard error. This is defined in StatsBase and widely used.
1 parent 029677a commit 1950846

File tree

106 files changed

+432
-444
lines changed

Some content is hidden

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

106 files changed

+432
-444
lines changed

DISTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ for result in eachrow(results)
375375
end
376376
```
377377

378-
This will write color-coded lines to `stdout`.
378+
This will write color-coded lines to STDOUT.
379379
All lines in red must be investigated as they signify potential breakages caused by the
380380
backport version.
381381
Lines in yellow should be looked into since it means a package ran on one version but

NEWS.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,9 +1116,6 @@ Deprecated or removed
11161116
* The fallback method `^(x, p::Integer)` is deprecated. If your type relied on this definition,
11171117
add a method such as `^(x::MyType, p::Integer) = Base.power_by_squaring(x, p)` ([#23332]).
11181118

1119-
* `DevNull`, `STDIN`, `STDOUT`, and `STDERR` have been renamed to `devnull`, `stdin`, `stdout`,
1120-
and `stderr`, respectively ([#25786]).
1121-
11221119
* `wait` and `fetch` on `Task` now resemble the interface of `Future`.
11231120

11241121
* `showcompact(io, x...)` has been deprecated in favor of
@@ -1128,6 +1125,8 @@ Deprecated or removed
11281125
* `isupper`, `islower`, `ucfirst` and `lcfirst` have been deprecated in favor of `isuppercase`,
11291126
`islowercase`, `uppercasefirst` and `lowercasefirst`, respectively ([#26442]).
11301127

1128+
* `wait` and `fetch` on `Task` now resemble the interface of `Future`
1129+
11311130
Command-line option changes
11321131
---------------------------
11331132

@@ -1436,4 +1435,4 @@ Command-line option changes
14361435
[#26286]: https://github.com/JuliaLang/julia/issues/26286
14371436
[#26436]: https://github.com/JuliaLang/julia/issues/26436
14381437
[#26442]: https://github.com/JuliaLang/julia/issues/26442
1439-
[#26600]: https://github.com/JuliaLang/julia/issues/26600
1438+
[#26600]: https://github.com/JuliaLang/julia/issues/26600

base/boot.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ atdoc!(λ) = global atdoc = λ
443443
abstract type IO end
444444
struct CoreSTDOUT <: IO end
445445
struct CoreSTDERR <: IO end
446-
const stdout = CoreSTDOUT()
447-
const stderr = CoreSTDERR()
446+
const STDOUT = CoreSTDOUT()
447+
const STDERR = CoreSTDERR()
448448
io_pointer(::CoreSTDOUT) = Intrinsics.pointerref(Intrinsics.cglobal(:jl_uv_stdout, Ptr{Cvoid}), 1, 1)
449449
io_pointer(::CoreSTDERR) = Intrinsics.pointerref(Intrinsics.cglobal(:jl_uv_stderr, Ptr{Cvoid}), 1, 1)
450450

@@ -468,9 +468,9 @@ print(io::IO, @nospecialize(x), @nospecialize a...) = (print(io, x); print(io, a
468468
println(io::IO) = (write(io, 0x0a); nothing) # 0x0a = '\n'
469469
println(io::IO, @nospecialize x...) = (print(io, x...); println(io))
470470

471-
show(@nospecialize a) = show(stdout, a)
472-
print(@nospecialize a...) = print(stdout, a...)
473-
println(@nospecialize a...) = println(stdout, a...)
471+
show(@nospecialize a) = show(STDOUT, a)
472+
print(@nospecialize a...) = print(STDOUT, a...)
473+
println(@nospecialize a...) = println(STDOUT, a...)
474474

475475
struct GeneratedFunctionStub
476476
gen

base/client.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function display_error(io::IO, er, bt)
165165
showerror(IOContext(io, :limit => true), er, bt)
166166
println(io)
167167
end
168-
display_error(er, bt) = display_error(stderr, er, bt)
168+
display_error(er, bt) = display_error(STDERR, er, bt)
169169
display_error(er) = display_error(er, [])
170170

171171
function eval_user_input(@nospecialize(ast), show_value::Bool)
@@ -189,7 +189,7 @@ function eval_user_input(@nospecialize(ast), show_value::Bool)
189189
try
190190
invokelatest(display, value)
191191
catch err
192-
println(stderr, "Evaluation succeeded, but an error occurred while showing value of type ", typeof(value), ":")
192+
println(STDERR, "Evaluation succeeded, but an error occurred while showing value of type ", typeof(value), ":")
193193
rethrow(err)
194194
end
195195
println()
@@ -198,17 +198,17 @@ function eval_user_input(@nospecialize(ast), show_value::Bool)
198198
break
199199
catch err
200200
if errcount > 0
201-
println(stderr, "SYSTEM: show(lasterr) caused an error")
201+
println(STDERR, "SYSTEM: show(lasterr) caused an error")
202202
end
203203
errcount, lasterr = errcount+1, err
204204
if errcount > 2
205-
println(stderr, "WARNING: it is likely that something important is broken, and Julia will not be able to continue normally")
205+
println(STDERR, "WARNING: it is likely that something important is broken, and Julia will not be able to continue normally")
206206
break
207207
end
208208
bt = catch_backtrace()
209209
end
210210
end
211-
isa(stdin, TTY) && println()
211+
isa(STDIN, TTY) && println()
212212
nothing
213213
end
214214

@@ -328,7 +328,7 @@ function exec_options(opts)
328328
end
329329
repl |= is_interactive
330330
if repl
331-
interactiveinput = isa(stdin, TTY)
331+
interactiveinput = isa(STDIN, TTY)
332332
if interactiveinput
333333
global is_interactive = true
334334
banner = (opts.banner != 0) # --banner!=no
@@ -369,8 +369,8 @@ function __atreplinit(repl)
369369
try
370370
f(repl)
371371
catch err
372-
showerror(stderr, err)
373-
println(stderr)
372+
showerror(STDERR, err)
373+
println(STDERR)
374374
end
375375
end
376376
end
@@ -397,7 +397,7 @@ function run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_fil
397397
if interactive && isassigned(REPL_MODULE_REF)
398398
invokelatest(REPL_MODULE_REF[]) do REPL
399399
term_env = get(ENV, "TERM", @static Sys.iswindows() ? "" : "dumb")
400-
term = REPL.Terminals.TTYTerminal(term_env, stdin, stdout, stderr)
400+
term = REPL.Terminals.TTYTerminal(term_env, STDIN, STDOUT, STDERR)
401401
color_set || (global have_color = REPL.Terminals.hascolor(term))
402402
banner && REPL.banner(term, term)
403403
if term.term_type == "dumb"
@@ -419,7 +419,7 @@ function run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_fil
419419
@warn "REPL provider not available: using basic fallback"
420420
end
421421
banner && Base.banner()
422-
let input = stdin
422+
let input = STDIN
423423
if isa(input, File) || isa(input, IOStream)
424424
# for files, we can slurp in the whole thing at once
425425
ex = parse_input_line(read(input, String))
@@ -437,7 +437,7 @@ function run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_fil
437437
while isopen(input) || !eof(input)
438438
if interactive
439439
print("julia> ")
440-
flush(stdout)
440+
flush(STDOUT)
441441
end
442442
eval_user_input(parse_input_line(input), true)
443443
end

base/clipboard.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
if Sys.isapple()
66
function clipboard(x)
7-
open(pipeline(`pbcopy`, stderr=stderr), "w") do io
7+
open(pipeline(`pbcopy`, stderr=STDERR), "w") do io
88
print(io, x)
99
end
1010
end
@@ -28,7 +28,7 @@ elseif Sys.islinux() || Sys.KERNEL === :FreeBSD
2828
global _clipboardcmd
2929
_clipboardcmd !== nothing && return _clipboardcmd
3030
for cmd in (:xclip, :xsel)
31-
success(pipeline(`which $cmd`, devnull)) && return _clipboardcmd = cmd
31+
success(pipeline(`which $cmd`, DevNull)) && return _clipboardcmd = cmd
3232
end
3333
pkgs = @static if Sys.islinux()
3434
"xsel or xclip"
@@ -43,7 +43,7 @@ elseif Sys.islinux() || Sys.KERNEL === :FreeBSD
4343
if cmd === nothing
4444
error("unexpected clipboard command: $c")
4545
end
46-
open(pipeline(cmd, stderr=stderr), "w") do io
46+
open(pipeline(cmd, stderr=STDERR), "w") do io
4747
print(io, x)
4848
end
4949
end
@@ -53,7 +53,7 @@ elseif Sys.islinux() || Sys.KERNEL === :FreeBSD
5353
if cmd === nothing
5454
error("unexpected clipboard command: $c")
5555
end
56-
read(pipeline(cmd, stderr=stderr), String)
56+
read(pipeline(cmd, stderr=STDERR), String)
5757
end
5858

5959
elseif Sys.iswindows()

base/compiler/bootstrap.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ let fs = Any[typeinf_ext, typeinf, typeinf_edge, pure_eval_call, optimize, run_p
1515
x = T_IFUNC[i]
1616
push!(fs, x[3])
1717
else
18-
println(stderr, "WARNING: tfunc missing for ", reinterpret(IntrinsicFunction, Int32(i)))
18+
println(STDERR, "WARNING: tfunc missing for ", reinterpret(IntrinsicFunction, Int32(i)))
1919
end
2020
end
2121
for f in fs

base/compiler/compiler.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ getfield(getfield(Main, :Core), :eval)(getfield(Main, :Core), :(baremodule Compi
44

55
using Core.Intrinsics, Core.IR
66

7-
import Core: print, println, show, write, unsafe_write, stdout, stderr,
7+
import Core: print, println, show, write, unsafe_write, STDOUT, STDERR,
88
_apply, svec, apply_type, Builtin, IntrinsicFunction, MethodInstance
99

1010
const getproperty = getfield

base/compiler/optimize.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3827,7 +3827,7 @@ macro check_ast(ctx, ex)
38273827
println("Code:")
38283828
println(ctx.sv.src)
38293829
println("Value Info Map:")
3830-
show_info(stdout, ctx.infomap, ctx)
3830+
show_info(STDOUT, ctx.infomap, ctx)
38313831
ccall(:abort, Union{}, ())
38323832
end
38333833
end

base/compiler/validation.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ function validate_code_in_debug_mode(linfo::MethodInstance, src::CodeInfo, kind:
6161
if !isempty(errors)
6262
for e in errors
6363
if linfo.def isa Method
64-
println(stderr, "WARNING: Encountered invalid ", kind, " code for method ",
64+
println(STDERR, "WARNING: Encountered invalid ", kind, " code for method ",
6565
linfo.def, ": ", e)
6666
else
67-
println(stderr, "WARNING: Encountered invalid ", kind, " code for top level expression in ",
67+
println(STDERR, "WARNING: Encountered invalid ", kind, " code for top level expression in ",
6868
linfo.def, ": ", e)
6969
end
7070
end

base/coreio.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

3-
print(xs...) = print(stdout::IO, xs...)
4-
println(xs...) = println(stdout::IO, xs...)
3+
print(xs...) = print(STDOUT::IO, xs...)
4+
println(xs...) = println(STDOUT::IO, xs...)
55
println(io::IO) = print(io, '\n')
66

77
struct DevNullStream <: IO end
8-
const devnull = DevNullStream()
8+
const DevNull = DevNullStream()
99
isreadable(::DevNullStream) = false
1010
iswritable(::DevNullStream) = true
1111
isopen(::DevNullStream) = true
@@ -26,6 +26,6 @@ let CoreIO = Union{Core.CoreSTDOUT, Core.CoreSTDERR}
2626
unsafe_write(io::CoreIO, x::Ptr{UInt8}, nb::UInt) = Core.unsafe_write(io, x, nb)
2727
end
2828

29-
stdin = devnull
30-
stdout = Core.stdout
31-
stderr = Core.stderr
29+
STDIN = DevNull
30+
STDOUT = Core.STDOUT
31+
STDERR = Core.STDERR

0 commit comments

Comments
 (0)