[ruby-core:117652] [Ruby master Bug#20445] Backport 2571d5376a38c333b8fe85f1f9b2f9c2422c0ad9 to ruby_3_3