diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | io.c | 8 | ||||
-rw-r--r-- | lib/delegate.rb | 3 | ||||
-rw-r--r-- | test/ruby/test_fnmatch.rb | 6 |
4 files changed, 22 insertions, 8 deletions
@@ -1,3 +1,16 @@ +Mon Aug 27 00:41:13 2007 Yukihiro Matsumoto <matz@ruby-lang.org> + + * io.c (rb_io_each_byte): caused infinite loop. [ruby-dev:31652] + + * io.c (rb_io_getc): should return nil at EOF, not EOFError. + + * lib/delegate.rb (SimpleDelegator::__setobj__): use raise + argument to specify backtrace. + + * test/ruby/test_fnmatch.rb (TestFnmatch::bracket_test): + String#include? no longer works for Fixnum. use #chr. + [ruby-dev:31652] + Sun Aug 26 12:27:14 2007 Koichi Sasada <ko1@atdot.net> * cont.c: fix to remove Fiber.new until fiber.so is not loaded. @@ -2022,12 +2022,14 @@ rb_io_each_byte(VALUE io) rb_yield(INT2FIX(*p & 0xff)); p++; } + fptr->rbuf_off += fptr->rbuf_len; + fptr->rbuf_len = 0; rb_io_check_readable(fptr); READ_CHECK(fptr); if (io_fillbuf(fptr) < 0) { break; } - } + } return io; } @@ -2090,7 +2092,7 @@ rb_io_getc(VALUE io) READ_CHECK(fptr); if (io_fillbuf(fptr) < 0) { - rb_eof_error(); + return Qnil; } n = rb_enc_mbclen(fptr->rbuf+fptr->rbuf_off, enc); if (n < fptr->rbuf_len) { @@ -2103,7 +2105,7 @@ rb_io_getc(VALUE io) left = fptr->rbuf_len; MEMCPY(RSTRING_PTR(str), fptr->rbuf+fptr->rbuf_off, char, left); if (io_fillbuf(fptr) < 0) { - rb_eof_error(); + return Qnil; } MEMCPY(RSTRING_PTR(str)+left, fptr->rbuf, char, n-left); fptr->rbuf_off += left; diff --git a/lib/delegate.rb b/lib/delegate.rb index 01ed0871c6..9084a7f191 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -283,8 +283,7 @@ def DelegateClass(superclass) begin @delegate_dc_obj.__send(:#{method}, *args, &block) rescue - $@[0,2] = nil - raise + raise $!, $@[2..-1] end end EOS diff --git a/test/ruby/test_fnmatch.rb b/test/ruby/test_fnmatch.rb index 7e378b911d..aad848d09f 100644 --- a/test/ruby/test_fnmatch.rb +++ b/test/ruby/test_fnmatch.rb @@ -4,9 +4,9 @@ class TestFnmatch < Test::Unit::TestCase def bracket_test(s, t) # `s' should start with neither '!' nor '^' 0x21.upto(0x7E) do |i| - assert_equal(t.include?(i), File.fnmatch("[#{s}]", i.chr, File::FNM_DOTMATCH)) - assert_equal(t.include?(i), !File.fnmatch("[^#{s}]", i.chr, File::FNM_DOTMATCH)) - assert_equal(t.include?(i), !File.fnmatch("[!#{s}]", i.chr, File::FNM_DOTMATCH)) + assert_equal(t.include?(i.chr), File.fnmatch("[#{s}]", i.chr, File::FNM_DOTMATCH)) + assert_equal(t.include?(i.chr), !File.fnmatch("[^#{s}]", i.chr, File::FNM_DOTMATCH)) + assert_equal(t.include?(i.chr), !File.fnmatch("[!#{s}]", i.chr, File::FNM_DOTMATCH)) end end def test_fnmatch |