Skip to content

Commit 61f3bae

Browse files
committed
merge revision(s) 50982,50983: [Backport ruby#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 ruby#11291] * test/objspace/test_objspace.rb(test_dump_special_consts): Test for above fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@51059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 9af0f53 commit 61f3bae

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
Mon Jun 29 13:22:14 2015 Shota Fukumori <[email protected]>
2+
3+
* ext/objspace/objspace_dump.c(dump_object): Return empty JSON object when
4+
passed object is a special const, instead of SEGV.
5+
Based patch by Kohei Suzuki (eagletmt). [ruby-core:69692] [Bug #11291]
6+
7+
* test/objspace/test_objspace.rb(test_dump_special_consts): Test for above fix.
8+
9+
110
Wed Jun 17 11:39:15 2015 Koichi Sasada <[email protected]>
211

312
* vm_insnhelper.c (lep_svar_set): add WBs.

ext/objspace/objspace_dump.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ dump_object(VALUE obj, struct dump_config *dc)
152152
ID flags[RB_OBJ_GC_FLAGS_MAX];
153153
size_t n, i;
154154

155+
if (SPECIAL_CONST_P(obj)) {
156+
dump_append(dc, "{}");
157+
return;
158+
}
159+
155160
dc->cur_obj = obj;
156161
dc->cur_obj_references = 0;
157162
dc->cur_obj_klass = BUILTIN_TYPE(obj) == T_NODE ? 0 : RBASIC_CLASS(obj);

test/objspace/test_objspace.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,15 @@ def assert_dump_object(info, line)
234234
assert_match /"method":"#{loc.base_label}"/, info
235235
end
236236

237+
def test_dump_special_consts
238+
# [ruby-core:69692] [Bug #11291]
239+
assert_equal('{}', ObjectSpace.dump(nil))
240+
assert_equal('{}', ObjectSpace.dump(true))
241+
assert_equal('{}', ObjectSpace.dump(false))
242+
assert_equal('{}', ObjectSpace.dump(0))
243+
assert_equal('{}', ObjectSpace.dump(:foo))
244+
end
245+
237246
def test_dump_all
238247
entry = /"bytesize":11, "value":"TEST STRING", "encoding":"UTF-8", "file":"-", "line":4, "method":"dump_my_heap_please", "generation":/
239248

version.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#define RUBY_VERSION "2.1.7"
2-
#define RUBY_RELEASE_DATE "2015-06-17"
3-
#define RUBY_PATCHLEVEL 367
2+
#define RUBY_RELEASE_DATE "2015-06-29"
3+
#define RUBY_PATCHLEVEL 368
44

55
#define RUBY_RELEASE_YEAR 2015
66
#define RUBY_RELEASE_MONTH 6
7-
#define RUBY_RELEASE_DAY 17
7+
#define RUBY_RELEASE_DAY 29
88

99
#include "ruby/version.h"
1010

0 commit comments

Comments
 (0)