[ruby-core:117306] [Ruby master Bug#20390] Issue with StringIO and chilled strings
From:
"byroot (Jean Boussier) via ruby-core" <ruby-core@...>
Date:
2024-03-24 16:05:13 UTC
List:
ruby-core #117306
Issue #20390 has been updated by byroot (Jean Boussier).
This is being discussed at https://github.com/ruby/stringio/pull/93
----------------------------------------
Bug #20390: Issue with StringIO and chilled strings
https://bugs.ruby-lang.org/issues/20390#change-107446
* Author: mdalessio (Mike Dalessio)
* Status: Open
* ruby -v: ruby 3.4.0dev (2024-03-23T16:40:17Z master 8265a7531f) [x86_64-linux]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
StringIO doesn't appear to handle chilled strings in a backwards-compatible way after 12be40ae
```ruby
require "stringio"
sio = StringIO.new("")
sio.write("hello")
```
When not specifying a value for `frozen-string-literal`, the empty string is chilled so I would expect to get a warning but also expect the write to complete.
Instead, the write fails as if the string is frozen:
```
ruby 3.4.0dev (2024-03-23T16:40:17Z master 8265a7531f) [x86_64-linux]
./issue-stringio-frozen.rb:8:in 'StringIO#write': not opened for writing (IOError)
from ./issue-stringio-frozen.rb:8:in '<main>'
```
cc @byroot @etienne
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- [email protected]
To unsubscribe send an email to [email protected]
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/