diff options
| author | Luke Gruber <luke.gruber@shopify.com> | 2025-08-15 11:15:58 -0400 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2025-08-15 13:25:17 -0400 |
| commit | 7c67060dad5ae1582e91a88841cc0cf5c6edeea3 (patch) | |
| tree | dc21a6e4a69f5a5f0bd79c84008e7933cd7b30f4 | |
| parent | 8f7e7bfca23ff5e402ed9c22a8f684fe59de72e4 (diff) | |
Fix enc_list across ractors
Calling rb_ary_replace(copy, orig) can modify orig, which is not safe
across ractors because orig is shared (it's the global encoding list).
Hoping to address CI failures such as https://ci.rvm.jp/results/trunk-gc-asserts@ruby-sp2-noble-docker/5890058
| -rw-r--r-- | encoding.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/encoding.c b/encoding.c index 78964476c0..0a5d61ee4a 100644 --- a/encoding.c +++ b/encoding.c @@ -1394,10 +1394,8 @@ enc_names(VALUE self) static VALUE enc_list(VALUE klass) { - VALUE ary = rb_ary_new2(ENCODING_LIST_CAPA); VALUE list = RUBY_ATOMIC_VALUE_LOAD(rb_encoding_list); - rb_ary_replace(ary, list); - return ary; + return rb_ary_dup(list); } /* |
