Actions
Bug #15952
closedIssue with Array#unshift, sometimes doesn't respect frozenness of array
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,
Updated by luke-gru (Luke Gruber) almost 5 years ago
Updated by luke-gru (Luke Gruber) almost 5 years ago
- Status changed from Open to Closed
Applied in changeset git|ec8e5f5aa64e2a54cf1e303f2b012c98e8d521ba.
array.c: always check frozenness in Array#unshift. Fixes [Bug #15952]
Updated by nagachika (Tomoyuki Chikanaga) almost 5 years ago
- Backport changed from 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN to 2.4: UNKNOWN, 2.5: REQUIRED, 2.6: REQUIRED
Updated by nagachika (Tomoyuki Chikanaga) over 4 years ago
- 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.
Updated by usa (Usaku NAKAMURA) over 4 years ago
- 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.
Actions
Like0
Like0Like0Like0Like0Like0