[前][次][番号順一覧][スレッド一覧]

ruby-changes:64972

From: Jean <ko1@a...>
Date: Thu, 21 Jan 2021 03:48:38 +0900 (JST)
Subject: [ruby-changes:64972] 6ca3d1af33 (master): objspace_dump.c: Handle allocation path and line missing

https://git.ruby-lang.org/ruby.git/commit/?id=6ca3d1af33

From 6ca3d1af3302f722aed530764d07c1cc83e95ecf Mon Sep 17 00:00:00 2001
From: Jean Boussier <jean.boussier@g...>
Date: Fri, 15 Jan 2021 18:18:58 +0100
Subject: objspace_dump.c: Handle allocation path and line missing


diff --git a/ext/objspace/objspace_dump.c b/ext/objspace/objspace_dump.c
index 7a5f44a..544d11e 100644
--- a/ext/objspace/objspace_dump.c
+++ b/ext/objspace/objspace_dump.c
@@ -471,10 +471,15 @@ dump_object(VALUE obj, struct dump_config *dc) https://github.com/ruby/ruby/blob/trunk/ext/objspace/objspace_dump.c#L471
         dump_append(dc, "]");
 
     if (ainfo) {
-        dump_append(dc, ", \"file\":\"");
-        dump_append(dc, ainfo->path);
-        dump_append(dc, "\", \"line\":");
-        dump_append_lu(dc, ainfo->line);
+        if (ainfo->path) {
+            dump_append(dc, ", \"file\":\"");
+            dump_append(dc, ainfo->path);
+            dump_append(dc, "\"");
+        }
+        if (ainfo->line) {
+            dump_append(dc, ", \"line\":");
+            dump_append_lu(dc, ainfo->line);
+        }
         if (RTEST(ainfo->mid)) {
             VALUE m = rb_sym2str(ainfo->mid);
             dump_append(dc, ", \"method\":");
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]