ruby-changes:15426
From: akr <ko1@a...>
Date: Mon, 12 Apr 2010 22:49:58 +0900 (JST)
Subject: [ruby-changes:15426] Ruby:r27322 (trunk): * enumerator.c (inspect_enumerator): don't raise for uninitialized
akr 2010-04-12 22:49:44 +0900 (Mon, 12 Apr 2010) New Revision: 27322 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27322 Log: * enumerator.c (inspect_enumerator): don't raise for uninitialized enumerator. Modified files: trunk/ChangeLog trunk/enumerator.c Index: ChangeLog =================================================================== --- ChangeLog (revision 27321) +++ ChangeLog (revision 27322) @@ -1,3 +1,8 @@ +Mon Apr 12 22:48:47 2010 Tanaka Akira <akr@f...> + + * enumerator.c (inspect_enumerator): don't raise for uninitialized + enumerator. + Mon Apr 12 21:47:41 2010 Nobuyoshi Nakada <nobu@r...> * LEGAL: separated the section for parse.c. contributed by Paul Index: enumerator.c =================================================================== --- enumerator.c (revision 27321) +++ enumerator.c (revision 27322) @@ -725,11 +725,19 @@ static VALUE inspect_enumerator(VALUE obj, VALUE dummy, int recur) { - struct enumerator *e = enumerator_ptr(obj); - const char *cname = rb_obj_classname(obj); + struct enumerator *e; + const char *cname; VALUE eobj, str; int tainted, untrusted; + TypedData_Get_Struct(obj, struct enumerator, &enumerator_data_type, e); + + cname = rb_obj_classname(obj); + + if (!e || e->obj == Qundef) { + return rb_sprintf("#<%s: uninitialized>", cname); + } + if (recur) { str = rb_sprintf("#<%s: ...>", cname); OBJ_TAINT(str); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/