Bug #15952
closed
Issue with Array#unshift, sometimes doesn't respect frozenness of array
Added by luke-gru (Luke Gruber) almost 5 years ago.
Updated over 4 years ago.
Description
This should raise a FrozenError
, but doesn't:
a = [1] * 100
b = a[4..-1]
a.replace([1])
b.freeze
b.unshift("a") # no error
There is a code path in ary_ensure_room_for_unshift
where the frozen check is skipped. I'll hoist this check to the top of the function in a PR.
Thanks,
- Status changed from Open to Closed
- Backport changed from 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN to 2.4: UNKNOWN, 2.5: REQUIRED, 2.6: REQUIRED
- Backport changed from 2.4: UNKNOWN, 2.5: REQUIRED, 2.6: REQUIRED to 2.4: UNKNOWN, 2.5: REQUIRED, 2.6: DONE
ruby_2_6 r67740 merged revision(s) ec8e5f5aa64e2a54cf1e303f2b012c98e8d521ba,5a187e26adc8aa32367f294c1496935c7356d386.
- Backport changed from 2.4: UNKNOWN, 2.5: REQUIRED, 2.6: DONE to 2.4: UNKNOWN, 2.5: DONE, 2.6: DONE
ruby_2_5 r67771 merged revision(s) ec8e5f5aa64e2a54cf1e303f2b012c98e8d521ba,5a187e26adc8aa32367f294c1496935c7356d386.
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0