diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | iseq.c | 9 |
2 files changed, 12 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Fri Aug 22 02:25:04 2008 Tanaka Akira <akr@fsij.org> + + * iseq.c (iseq_inspect): don't raise on uninitialized object. + show real class name. + Fri Aug 22 02:08:58 2008 Tanaka Akira <akr@fsij.org> * io.c (rb_io_initialize): accept hash argument. @@ -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("<ISeq:%s@%s>", + return rb_sprintf("<%s:%s@%s>", + rb_obj_classname(self), RSTRING_PTR(iseq->name), RSTRING_PTR(iseq->filename)); } |