From 61a02168f7ba353a2838f2783f291a816d7e0c90 Mon Sep 17 00:00:00 2001 From: NAKAMURA Usaku Date: Wed, 24 Nov 2021 19:34:59 +0900 Subject: 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(+) --- load.c | 1 + 1 file changed, 1 insertion(+) (limited to 'load.c') diff --git a/load.c b/load.c index 419ceae84d..2441acfded 100644 --- a/load.c +++ b/load.c @@ -597,6 +597,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(); -- cgit v1.2.3