diff --git a/base/interactiveutil.jl b/base/interactiveutil.jl index 68fceb78b513d..3db65c1f32892 100644 --- a/base/interactiveutil.jl +++ b/base/interactiveutil.jl @@ -667,7 +667,7 @@ Print information about exported global variables in a module, optionally restri The memory consumption estimate is an approximate lower bound on the size of the internal structure of the object. """ -function whos(io::IO=STDOUT, m::Module=current_module(), pattern::Regex=r"^(?!.*(Base|Main|Core)).*$") +function whos(io::IO=STDOUT, m::Module=current_module(), pattern::Regex=r"") maxline = displaysize(io)[2] line = zeros(UInt8, maxline) head = PipeBuffer(maxline + 1) @@ -677,17 +677,20 @@ function whos(io::IO=STDOUT, m::Module=current_module(), pattern::Regex=r"^(?!.* value = getfield(m, v) @printf head "%30s " s try - bytes = summarysize(value) - if bytes < 10_000 - @printf(head, "%6d bytes ", bytes) + if s ∈ ("Base", "Main", "Core") + print(head, " ") else - @printf(head, "%6d KB ", bytes ÷ (1024)) + bytes = summarysize(value) + if bytes < 10_000 + @printf(head, "%6d bytes ", bytes) + else + @printf(head, "%6d KB ", bytes ÷ (1024)) + end end print(head, summary(value)) catch e print(head, "#=ERROR: unable to show value=#") end - newline = search(head, UInt8('\n')) - 1 if newline < 0 newline = nb_available(head)