diff options
author | Jeremy Evans <[email protected]> | 2025-04-14 18:51:59 -0700 |
---|---|---|
committer | git <[email protected]> | 2025-05-13 03:20:09 +0000 |
commit | 18d395e0784401585b5c14300e689de55e208647 () | |
tree | 7a92a717eb9ea461610a4b3df4cb4e3c35315449 | |
parent | 9b8c846bdf4ae2f218e0b92d0898d7206d0002c9 (diff) |
[ruby/stringio] Do not issue warning when calling set_encoding if string is chilled
StringIO does not warn for unchilled unfrozen string or for frozen string, so it should not warn for chilled string. https://.com/ruby/stringio/commit/4ac33b8c70
-rw-r--r-- | ext/stringio/stringio.c | 8 | ||||
-rw-r--r-- | test/stringio/test_stringio.rb | 7 |
2 files changed, 14 insertions, 1 deletions
@@ -20,6 +20,7 @@ STRINGIO_VERSION = "3.1.8.dev"; #include "ruby.h" #include "ruby/io.h" #include "ruby/encoding.h" #if defined(HAVE_FCNTL_H) || defined(_WIN32) #include <fcntl.h> #elif defined(HAVE_SYS_FCNTL_H) @@ -1864,7 +1865,12 @@ strio_set_encoding(int argc, VALUE *argv, VALUE self) } } ptr->enc = enc; - if (!NIL_P(ptr->string) && WRITABLE(self)) { rb_enc_associate(ptr->string, enc); } @@ -1057,6 +1057,13 @@ class TestStringIO < Test::Unit::TestCase assert_equal("test", io.string) assert_same(chilled_string, io.string) end end private |