[ruby-core:118585] [Ruby master Bug#20619] Backport bd583ca645ea348a2894f4227fcb1af650ee8dec to ruby 3.3