File tree Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -1775,16 +1775,20 @@ JL_DLLEXPORT void jl_disable_binding(jl_globalref_t *gr)
17751775 jl_binding_t * b = gr -> binding ;
17761776 if (!b )
17771777 b = jl_get_module_binding (gr -> mod , gr -> name , 1 );
1778- jl_binding_partition_t * bpart = jl_get_binding_partition (b , jl_current_task -> world_age );
17791778
1780- if (jl_binding_kind (bpart ) == PARTITION_KIND_GUARD ) {
1781- // Already guard
1779+ for (;;) {
1780+ jl_binding_partition_t * bpart = jl_get_binding_partition (b , jl_atomic_load_acquire (& jl_world_counter ));
1781+
1782+ if (jl_binding_kind (bpart ) == PARTITION_KIND_GUARD ) {
1783+ // Already guard
1784+ return ;
1785+ }
1786+
1787+ if (!jl_replace_binding (b , bpart , NULL , PARTITION_KIND_GUARD ))
1788+ continue ;
1789+
17821790 return ;
17831791 }
1784-
1785- for (;;)
1786- if (jl_replace_binding (b , bpart , NULL , PARTITION_KIND_GUARD ))
1787- break ;
17881792}
17891793
17901794JL_DLLEXPORT int jl_is_const (jl_module_t * m , jl_sym_t * var )
Original file line number Diff line number Diff line change 383383
384384# M3 connects all, so we should have a single partition
385385@test access_and_count (:afterM3 ) == 1
386+
387+ # Test that delete_binding in an outdated world age works
388+ module BindingTestModule; end
389+ function create_and_delete_binding ()
390+ Core. eval (BindingTestModule, :(const x = 1 ))
391+ Base. delete_binding (BindingTestModule, :x )
392+ end
393+ create_and_delete_binding ()
394+ @test Base. binding_kind (BindingTestModule, :x ) == Base. PARTITION_KIND_GUARD
You can’t perform that action at this time.
0 commit comments