We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4a35291 commit eb4ee49Copy full SHA for eb4ee49
ext/stringio/stringio.c
@@ -180,7 +180,9 @@ check_modifiable(struct StringIO *ptr)
180
else if (OBJ_FROZEN_RAW(ptr->string)) {
181
rb_raise(rb_eIOError, "not modifiable string");
182
}
183
- rb_str_modify(ptr->string);
+ else {
184
+ rb_str_modify(ptr->string);
185
+ }
186
187
188
static VALUE
test/stringio/test_stringio.rb
@@ -64,6 +64,10 @@ def test_null
64
assert_nil io.gets
65
io.puts "abc"
66
assert_nil io.string
67
+
68
+ # Null device StringIO just drop ungot string
69
+ io.ungetc '#'
70
+ assert_nil io.getc
71
end
72
73
def test_truncate
0 commit comments