Skip to content

Commit

Permalink
use the httable key instead of the binding name in jl_module_names
Browse files Browse the repository at this point in the history
  • Loading branch information
Pangoraw authored and KristofferC committed Oct 31, 2021
1 parent ca6b3ba commit dec1727
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -833,9 +833,10 @@ JL_DLLEXPORT jl_value_t *jl_module_names(jl_module_t *m, int all, int imported)
(imported && b->imported) ||
(b->owner == m && !b->imported && (all || m == jl_main_module))) &&
(all || (!b->deprecated && !hidden))) {
jl_sym_t *in_module_name = (jl_sym_t*)table[i-1]; // the name in the module may not be b->name, use the httable key instead
jl_array_grow_end(a, 1);
//XXX: change to jl_arrayset if array storage allocation for Array{Symbols,1} changes:
jl_array_ptr_set(a, jl_array_dim0(a)-1, (jl_value_t*)b->name);
jl_array_ptr_set(a, jl_array_dim0(a)-1, (jl_value_t*)in_module_name);
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2493,6 +2493,10 @@ import .Mod: x as x2
@test x2 == 1
@test !@isdefined(x)

module_names = names(@__MODULE__; all=true, imported=true)
@test :x2 module_names
@test :x module_names

import .Mod2.y as y2

@test y2 == 2
Expand Down

0 comments on commit dec1727

Please sign in to comment.