@@ -514,24 +514,16 @@ function _show_default(io::IO, @nospecialize(x))
514
514
end
515
515
516
516
function active_module ()
517
- REPL = REPL_MODULE_REF[]
518
- REPL === Base && return Main
519
- return invokelatest (REPL. active_module):: Module
517
+ if ccall (:jl_is_in_pure_context , Bool, ())
518
+ error (" active_module() should not be called from a pure context" )
519
+ end
520
+ if ! @isdefined (active_repl) || active_repl === nothing
521
+ return Main
522
+ end
523
+ return invokelatest (active_module, active_repl):: Module
520
524
end
521
525
522
- # Check if a particular symbol is exported from a standard library module
523
- function is_exported_from_stdlib (name:: Symbol , mod:: Module )
524
- ! isdefined (mod, name) && return false
525
- orig = getfield (mod, name)
526
- while ! (mod === Base || mod === Core)
527
- activemod = active_module ()
528
- parent = parentmodule (mod)
529
- if mod === activemod || mod === parent || parent === activemod
530
- return false
531
- end
532
- mod = parent
533
- end
534
- return isexported (mod, name) && isdefined (mod, name) && ! isdeprecated (mod, name) && getfield (mod, name) === orig
526
+ module UsesCoreAndBaseOnly
535
527
end
536
528
537
529
function show_function (io:: IO , f:: Function , compact:: Bool , fallback:: Function )
@@ -544,13 +536,13 @@ function show_function(io::IO, f::Function, compact::Bool, fallback::Function)
544
536
print (io, mt. name)
545
537
elseif isdefined (mt, :module ) && isdefined (mt. module, mt. name) &&
546
538
getfield (mt. module, mt. name) === f
547
- mod = active_module ()
548
- if is_exported_from_stdlib (mt . name, mt . module) || mt . module === mod
549
- show_sym (io, mt . name )
550
- else
539
+ # this used to call the removed internal function `is_exported_from_stdlib`, which effectively
540
+ # just checked for exports from Core and Base.
541
+ mod = get (io, :module , UsesCoreAndBaseOnly )
542
+ if ! ( isvisible (mt . name, mt . module, mod) || mt . module === mod)
551
543
print (io, mt. module, " ." )
552
- show_sym (io, mt. name)
553
544
end
545
+ show_sym (io, mt. name)
554
546
else
555
547
fallback (io, f)
556
548
end
737
729
function show_typealias (io:: IO , name:: GlobalRef , x:: Type , env:: SimpleVector , wheres:: Vector )
738
730
if ! (get (io, :compact , false ):: Bool )
739
731
# Print module prefix unless alias is visible from module passed to
740
- # IOContext. If :module is not set, default to Main (or current active module) .
732
+ # IOContext. If :module is not set, default to Main.
741
733
# nothing can be used to force printing prefix.
742
- from = get (io, :module , active_module () )
734
+ from = get (io, :module , Main )
743
735
if (from === nothing || ! isvisible (name. name, name. mod, from))
744
736
show (io, name. mod)
745
737
print (io, " ." )
@@ -1053,9 +1045,9 @@ function show_type_name(io::IO, tn::Core.TypeName)
1053
1045
quo = false
1054
1046
if ! (get (io, :compact , false ):: Bool )
1055
1047
# Print module prefix unless type is visible from module passed to
1056
- # IOContext If :module is not set, default to Main (or current active module) .
1048
+ # IOContext If :module is not set, default to Main.
1057
1049
# nothing can be used to force printing prefix
1058
- from = get (io, :module , active_module () )
1050
+ from = get (io, :module , Main )
1059
1051
if isdefined (tn, :module ) && (from === nothing || ! isvisible (sym, tn. module, from:: Module ))
1060
1052
show (io, tn. module)
1061
1053
print (io, " ." )
@@ -2535,7 +2527,7 @@ function show_signature_function(io::IO, @nospecialize(ft), demangle=false, farg
2535
2527
uw = unwrap_unionall (ft)
2536
2528
if ft <: Function && isa (uw, DataType) && isempty (uw. parameters) && _isself (uw)
2537
2529
uwmod = parentmodule (uw)
2538
- if qualified && ! is_exported_from_stdlib ( uw. name. mt. name, uwmod ) && uwmod != = Main
2530
+ if qualified && ! isexported (uwmod, uw. name. mt. name) && uwmod != = Main
2539
2531
print_within_stacktrace (io, uwmod, ' .' , bold= true )
2540
2532
end
2541
2533
s = sprint (show_sym, (demangle ? demangle_function_name : identity)(uw. name. mt. name), context= io)
0 commit comments