Actions
Feature #20390
closedIssue with StringIO and chilled strings
Description
StringIO doesn't appear to handle chilled strings in a backwards-compatible way after 12be40ae
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>'
Updated by byroot (Jean Boussier) 9 months ago
This is being discussed at https://github.com/ruby/stringio/pull/93
Updated by byroot (Jean Boussier) 9 months ago
- Assignee set to byroot (Jean Boussier)
- Backport changed from 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN to 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED
Updated by nobu (Nobuyoshi Nakada) 9 months ago
- Tracker changed from Bug to Feature
- ruby -v deleted (
ruby 3.4.0dev (2024-03-23T16:40:17Z master 8265a7531f) [x86_64-linux]) - Backport deleted (
3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED)
Updated by etienne (Étienne Barrié) 9 months ago
- Status changed from Open to Closed
Applied in changeset git|0f5ab4ad5289d6385b74e800a73de005a48737b6.
[ruby/stringio] Eagerly defrost chilled strings
[Feature #20390]
https://github.com/ruby/stringio/commit/17ee957f34
Co-authored-by: Jean Boussier byroot@ruby-lang.org
Updated by byroot (Jean Boussier) 7 months ago
- Related to Feature #20205: Enable `frozen_string_literal` by default added
Actions
Like0
Like1Like0Like0Like0Like0