ruby-changes:38966
From: nagachika <ko1@a...>
Date: Sat, 27 Jun 2015 23:13:18 +0900 (JST)
Subject: [ruby-changes:38966] nagachika:r51047 (ruby_2_2): merge revision(s) 50982, 50983: [Backport #11291]
nagachika 2015-06-27 23:12:49 +0900 (Sat, 27 Jun 2015) New Revision: 51047 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51047 Log: merge revision(s) 50982,50983: [Backport #11291] * ext/objspace/objspace_dump.c(dump_object): Return empty JSON object when passed object is a special const, instead of SEGV. Based patch by Kohei Suzuki (eagletmt). [ruby-core:69692] [Bug #11291] * test/objspace/test_objspace.rb(test_dump_special_consts): Test for above fix. Modified directories: branches/ruby_2_2/ Modified files: branches/ruby_2_2/ChangeLog branches/ruby_2_2/ext/objspace/objspace_dump.c branches/ruby_2_2/test/objspace/test_objspace.rb branches/ruby_2_2/version.h Index: ruby_2_2/ChangeLog =================================================================== --- ruby_2_2/ChangeLog (revision 51046) +++ ruby_2_2/ChangeLog (revision 51047) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1 +Sat Jun 27 22:51:59 2015 Shota Fukumori <her@s...> + + * ext/objspace/objspace_dump.c(dump_object): Return empty JSON object when + passed object is a special const, instead of SEGV. + Based patch by Kohei Suzuki (eagletmt). [ruby-core:69692] [Bug #11291] + + * test/objspace/test_objspace.rb(test_dump_special_consts): Test for above fix. + + Wed Jun 17 02:53:59 2015 Koichi Sasada <ko1@a...> * test/objspace/test_objspace.rb (test_dump_flags): relax pattern Index: ruby_2_2/ext/objspace/objspace_dump.c =================================================================== --- ruby_2_2/ext/objspace/objspace_dump.c (revision 51046) +++ ruby_2_2/ext/objspace/objspace_dump.c (revision 51047) @@ -149,6 +149,11 @@ dump_object(VALUE obj, struct dump_confi https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/objspace/objspace_dump.c#L149 ID flags[RB_OBJ_GC_FLAGS_MAX]; size_t n, i; + if (SPECIAL_CONST_P(obj)) { + dump_append(dc, "{}"); + return; + } + dc->cur_obj = obj; dc->cur_obj_references = 0; dc->cur_obj_klass = BUILTIN_TYPE(obj) == T_NODE ? 0 : RBASIC_CLASS(obj); Index: ruby_2_2/version.h =================================================================== --- ruby_2_2/version.h (revision 51046) +++ ruby_2_2/version.h (revision 51047) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.3" -#define RUBY_RELEASE_DATE "2015-06-17" -#define RUBY_PATCHLEVEL 136 +#define RUBY_RELEASE_DATE "2015-06-27" +#define RUBY_PATCHLEVEL 137 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 6 -#define RUBY_RELEASE_DAY 17 +#define RUBY_RELEASE_DAY 27 #include "ruby/version.h" Index: ruby_2_2/test/objspace/test_objspace.rb =================================================================== --- ruby_2_2/test/objspace/test_objspace.rb (revision 51046) +++ ruby_2_2/test/objspace/test_objspace.rb (revision 51047) @@ -234,6 +234,15 @@ class TestObjSpace < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/objspace/test_objspace.rb#L234 assert_match /"method":"#{loc.base_label}"/, info end + def test_dump_special_consts + # [ruby-core:69692] [Bug #11291] + assert_equal('{}', ObjectSpace.dump(nil)) + assert_equal('{}', ObjectSpace.dump(true)) + assert_equal('{}', ObjectSpace.dump(false)) + assert_equal('{}', ObjectSpace.dump(0)) + assert_equal('{}', ObjectSpace.dump(:foo)) + end + def test_dump_all entry = /"bytesize":11, "value":"TEST STRING", "encoding":"UTF-8", "file":"-", "line":4, "method":"dump_my_heap_please", "generation":/ Property changes on: ruby_2_2 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r50982-50983 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/