diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-27 02:54:20 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-27 02:54:20 +0000 |
commit | 9abf98bbe47b65dbc058b8ab752aa81ba8c7754b (patch) | |
tree | 33ceb171e04fc12775f7b4a944a7693fe7abebe0 | |
parent | c898839035b6fe74f8281fb918c13f856690bfde (diff) |
merges r25001 from trunk into ruby_1_9_1.
--
* marshal.c (r_object0): entry regexp object before its encoding
name. [ruby-core:25625]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@25942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | marshal.c | 10 | ||||
-rw-r--r-- | test/ruby/test_marshal.rb | 8 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 20 insertions, 5 deletions
@@ -1,3 +1,8 @@ +Fri Sep 18 23:51:17 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * marshal.c (r_object0): entry regexp object before its encoding + name. [ruby-core:25625] + Sun Aug 16 00:30:33 2009 NARUSE, Yui <naruse@ruby-lang.org> * include/ruby/oniguruma.h @@ -1429,7 +1429,10 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod) { volatile VALUE str = r_bytes(arg); int options = r_byte(arg); - v = rb_reg_new("", 0, options); + VALUE args[2]; + args[0] = str; + args[1] = INT2FIX(options); + v = r_entry(rb_obj_alloc(rb_cRegexp), arg); if (ivp) { r_ivar(v, arg); *ivp = Qfalse; @@ -1440,9 +1443,8 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod) #define f_gsub_bang(x,y,z) rb_funcall(x, rb_intern("gsub!"), 2, y, z) f_gsub_bang(str, rb_reg_new("\\\\u", 3, 0), rb_usascii_str_new_cstr("u")); } - str = r_entry(rb_reg_new_str(str, options), arg); - rb_copy_generic_ivar(str, v); - v = r_leave(str, arg); + rb_obj_call_init(v, 2, args); + v = r_leave(v, arg); } break; diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index 172bfbb3f7..a697706632 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -204,4 +204,12 @@ class TestMarshal < Test::Unit::TestCase a = ClassUTF8.new assert_instance_of(ClassUTF8, Marshal.load(Marshal.dump(a)), '[ruby-core:24790]') end + + def test_regexp + bug2109 = '[ruby-core:25625]' + a = "\x82\xa0".force_encoding(Encoding::Windows_31J) + b = "\x82\xa2".force_encoding(Encoding::Windows_31J) + c = [/#{a}/, /#{b}/] + assert_equal(c, Marshal.load(Marshal.dump(c))) + end end @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.1" -#define RUBY_PATCHLEVEL 343 +#define RUBY_PATCHLEVEL 344 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 |