From: nobu.nokada@... Date: 2001-12-26T16:58:02+09:00 Subject: [ruby-talk:29433] Re: Is this a bug? At Wed, 26 Dec 2001 06:28:18 +0900, matz@ruby-lang.org (Yukihiro Matsumoto) wrote: > |irb(main):008:0> Integer("0\n") > |ArgumentError: invalid value for Integer: "0 > |" > | from (irb):8:in `Integer' > | from (irb):8 > | > |Is that a bug? > > No. Integer() checks more strictly. It's the spec. But Integer("3\n") passes. Isn't it strange? At Wed, 26 Dec 2001 05:57:53 +0900, Ryo Saeba wrote: > irb(main):005:0> Integer("3\n") > 3 If Integer("0\n") should succeed as Integer("3\n"), Index: bignum.c =================================================================== RCS file: /cvs/ruby/src/ruby/bignum.c,v retrieving revision 1.47 diff -u -2 -p -r1.47 bignum.c --- bignum.c 2001/11/19 05:03:02 1.47 +++ bignum.c 2001/12/26 07:52:11 @@ -245,5 +245,4 @@ rb_cstr2inum(str, base) while (*str && *str == '0') str++; if (ISSPACE(*str)) { - if (badcheck) goto bad; return INT2FIX(0); } or if Integer("3\n") should fail as Integer("0\n"), Index: bignum.c =================================================================== RCS file: /cvs/ruby/src/ruby/bignum.c,v retrieving revision 1.47 diff -u -2 -p -r1.47 bignum.c --- bignum.c 2001/11/19 05:03:02 1.47 +++ bignum.c 2001/12/26 07:52:44 @@ -258,5 +258,4 @@ rb_cstr2inum(str, base) if (badcheck) { if (end == str) goto bad; /* no number */ - while (*end && ISSPACE(*end)) end++; if (*end) { /* trailing garbage */ bad: Nobu Nakada