summaryrefslogtreecommitdiff
path: root/ext/objspace/objspace_dump.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-27 14:12:49 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-27 14:12:49 +0000
commit1343c89ecb7b0527d514951be24b655247e5ed77 (patch)
tree0f0e256916df3b5c2fa377fd9ce346ee9da16786 /ext/objspace/objspace_dump.c
parentcaa4dfa2bb2d819e6835ca135c9ec205e6cf6833 (diff)
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/objspace/objspace_dump.c')
-rw-r--r--ext/objspace/objspace_dump.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/objspace/objspace_dump.c b/ext/objspace/objspace_dump.c
index 7e082f96bb..b6973df10e 100644
--- a/ext/objspace/objspace_dump.c
+++ b/ext/objspace/objspace_dump.c
@@ -149,6 +149,11 @@ dump_object(VALUE obj, struct dump_config *dc)
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);