Array#rassoc should try to convert to array implicitly. Fixes #20003

This commit is contained in:
Tema Bolshakov 2023-11-12 21:12:16 +01:00 committed by Yusuke Endoh
parent 10f44dfeff
commit e4a11a1283
2 changed files with 12 additions and 3 deletions

View file

@ -5049,7 +5049,7 @@ rb_ary_rassoc(VALUE ary, VALUE value)
VALUE v;
for (i = 0; i < RARRAY_LEN(ary); ++i) {
v = RARRAY_AREF(ary, i);
v = rb_check_array_type(RARRAY_AREF(ary, i));
if (RB_TYPE_P(v, T_ARRAY) &&
RARRAY_LEN(v) > 1 &&
rb_equal(RARRAY_AREF(v, 1), value))