From 32c7a56555b7099431cc98ff2bed3ca8330d5f82 Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 21 Aug 2008 17:25:43 +0000 Subject: [PATCH] * iseq.c (iseq_inspect): don't raise on uninitialized object. show real class name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ iseq.c | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3942b9c970..413b60e34d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Aug 22 02:25:04 2008 Tanaka Akira + + * iseq.c (iseq_inspect): don't raise on uninitialized object. + show real class name. + Fri Aug 22 02:08:58 2008 Tanaka Akira * io.c (rb_io_initialize): accept hash argument. diff --git a/iseq.c b/iseq.c index 84c3b741e5..b9641763da 100644 --- a/iseq.c +++ b/iseq.c @@ -548,9 +548,14 @@ iseq_eval(VALUE self) static VALUE iseq_inspect(VALUE self) { - rb_iseq_t *iseq = iseq_check(self); + rb_iseq_t *iseq; + GetISeqPtr(self, iseq); + if (!iseq->name) { + return rb_sprintf("#<%s: uninitialized>", rb_obj_classname(self)); + } - return rb_sprintf("", + return rb_sprintf("<%s:%s@%s>", + rb_obj_classname(self), RSTRING_PTR(iseq->name), RSTRING_PTR(iseq->filename)); }