Skip to content

Commit

Permalink
Add "mea culpa" to foreign module assignment error.
Browse files Browse the repository at this point in the history
As requested in #56933, acknowledge that this error was missing in Julia 1.9 and 1.10
and provide a reference to the issue so that people have an easier starting point.
  • Loading branch information
Keno committed Jan 5, 2025
1 parent d848e2e commit 7ad0f21
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ JL_DLLEXPORT jl_binding_t *jl_get_binding_wr(jl_module_t *m JL_PROPAGATES_ROOT,
if (decode_restriction_kind(pku) != BINDING_KIND_DECLARED) {
check_safe_newbinding(m, var);
if (!alloc)
jl_errorf("Global %s.%s does not exist and cannot be assigned. Declare it using `global` before attempting assignment.", jl_symbol_name(m->name), jl_symbol_name(var));
jl_errorf("Global %s.%s does not exist and cannot be assigned.\n"
"Note: Julia 1.9 and 1.10 inadvertently omitted this error check (#56933).\n"
"Hint: Declare it using `global` before attempting assignment.", jl_symbol_name(m->name), jl_symbol_name(var));
}
jl_ptr_kind_union_t new_pku = encode_restriction((jl_value_t*)jl_any_type, BINDING_KIND_GLOBAL);
if (!jl_atomic_cmpswap(&bpart->restriction, &pku, new_pku))
Expand Down

0 comments on commit 7ad0f21

Please sign in to comment.