summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2021-10-03 16:10:01 +0900
committernagachika <nagachika@ruby-lang.org>2021-10-03 16:10:01 +0900
commit5341eca588e738cd5031ab7d8bb5c300471c00e9 (patch)
tree9cc4d4d2a072df1db2c918105eb95954fcc21d7c /load.c
parentefa1ba15fd5007210f819e6d11002ca829c989bf (diff)
merge revision(s) ddb32e66160ab50849419ef7c7ac584913b79c34: [Backport #18173]
[Bug #18173] Update loaded_features_index If $LOADED_FEATURES is changed in the just required file, also the index table needs to be updated before loaded_features_snapshot is reset. If the snapshot is reset without updating the table, the name of the added feature will not be found. --- load.c | 1 + test/ruby/test_require.rb | 17 +++++++++++++++++ 2 files changed, 18 insertions(+)
Diffstat (limited to 'load.c')
-rw-r--r--load.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/load.c b/load.c
index 2d931b91f0..e5b0ff435d 100644
--- a/load.c
+++ b/load.c
@@ -606,6 +606,7 @@ rb_provide_feature(VALUE feature)
}
rb_str_freeze(feature);
+ get_loaded_features_index();
rb_ary_push(features, rb_fstring(feature));
features_index_add(feature, INT2FIX(RARRAY_LEN(features)-1));
reset_loaded_features_snapshot();