diff --git a/src/module.c b/src/module.c index e8ea5c73751b2..1292ed7cf9e75 100644 --- a/src/module.c +++ b/src/module.c @@ -992,7 +992,7 @@ JL_DLLEXPORT jl_value_t *jl_module_usings(jl_module_t *m) } uint8_t _binding_is_from_explicit_using(jl_binding_t *b) { - return (b->owner != b && !b->imported && + return (jl_atomic_load_relaxed(&b->owner) != NULL && b->owner != b && !b->imported && // Modules implicitly get all exported names from Base and Core as if they had // written `using Base`, but we don't show those via `names()`. // b->owner->value != (jl_value_t*)jl_base_module && b->owner->value != (jl_value_t*)jl_core_module); diff --git a/test/reflection.jl b/test/reflection.jl index 0ecf817ddd661..e9e35b1ff4d88 100644 --- a/test/reflection.jl +++ b/test/reflection.jl @@ -188,14 +188,16 @@ let Symbol("@test_deprecated"), Symbol("@test_logs"), Symbol("@test_nowarn"), Symbol("@test_skip"), Symbol("@test_throws"), Symbol("@test_warn"), Symbol("@testset"), :GenericArray, :GenericDict, :GenericOrder, :GenericSet, :GenericString, :Test, :TestSetException, :detect_ambiguities, :detect_unbound_args, - :TestMod7648, :TestModSub9475, :TestMod7648, :a9475, :foo9475, :c7648, :foo7648, :foo7648_nomethods, :Foo7648]) + :TestMod7648, :TestModSub9475, :TestMod7648, :a9475, :foo9475, :c7648, :foo7648, :foo7648_nomethods, + :Foo7648, Symbol("@__MODULE__"), :Base, :LogRecord, :(==), :(===), :TestLogger]) @test Set(names(TestMod7648, all = true, usings = true)) == Set([:x36529, :Test, Symbol("@inferred"), Symbol("@test"), Symbol("@test_broken"), Symbol("@test_deprecated"), Symbol("@test_logs"), Symbol("@test_nowarn"), Symbol("@test_skip"), Symbol("@test_throws"), Symbol("@test_warn"), Symbol("@testset"), :GenericArray, :GenericDict, :GenericOrder, :GenericSet, :GenericString, :Test, :TestSetException, :detect_ambiguities, :detect_unbound_args, :TestMod7648, :TestModSub9475, :a9475, :foo9475, :c7648, :d7648, :f7648, :foo7648, Symbol("#foo7648"), :foo7648_nomethods, Symbol("#foo7648_nomethods"), - :Foo7648, :eval, Symbol("#eval"), :include, Symbol("#include")]) + :Foo7648, :eval, Symbol("#eval"), :include, Symbol("#include"), Symbol("@__MODULE__"), :Base, + :LogRecord, :(==), :(===), :TestLogger]) @test isconst(TestMod7648, :c7648) @test !isconst(TestMod7648, :d7648) end