mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* marshal.c (r_object0): entry regexp object before its encoding
name. [ruby-core:25625] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d36c76dc71
commit
1aa21e630f
3 changed files with 19 additions and 4 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]
|
||||||
|
|
||||||
Fri Sep 18 16:29:16 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Sep 18 16:29:16 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* common.mk (eval.o): needs vm.h.
|
* common.mk (eval.o): needs vm.h.
|
||||||
|
|
10
marshal.c
10
marshal.c
|
@ -1444,7 +1444,10 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
|
||||||
{
|
{
|
||||||
volatile VALUE str = r_bytes(arg);
|
volatile VALUE str = r_bytes(arg);
|
||||||
int options = r_byte(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) {
|
if (ivp) {
|
||||||
r_ivar(v, arg);
|
r_ivar(v, arg);
|
||||||
*ivp = FALSE;
|
*ivp = FALSE;
|
||||||
|
@ -1455,9 +1458,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)
|
#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"));
|
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_obj_call_init(v, 2, args);
|
||||||
rb_copy_generic_ivar(str, v);
|
v = r_leave(v, arg);
|
||||||
v = r_leave(str, arg);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -204,4 +204,12 @@ class TestMarshal < Test::Unit::TestCase
|
||||||
a = ClassUTF8.new
|
a = ClassUTF8.new
|
||||||
assert_instance_of(ClassUTF8, Marshal.load(Marshal.dump(a)), '[ruby-core:24790]')
|
assert_instance_of(ClassUTF8, Marshal.load(Marshal.dump(a)), '[ruby-core:24790]')
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue