From: Marcus Holland-Moritz Date: Mon, 15 Mar 2004 22:16:26 +0000 (+0100) Subject: C doesn't look like a number. See also: X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e0ab1c0e1c533d7f19b4ffe230a3d921bf733a02;p=p5sagit%2Fp5-mst-13.2.git C doesn't look like a number. See also: Subject: Re: [perl #27606] undef "looks like" a number Message-Id: <20040315221626.48061c67@r2d2> p4raw-id: //depot/perl@22662 --- diff --git a/ext/List/Util/lib/List/Util.pm b/ext/List/Util/lib/List/Util.pm index 77a52f6..ff38fb4 100644 --- a/ext/List/Util/lib/List/Util.pm +++ b/ext/List/Util/lib/List/Util.pm @@ -10,7 +10,7 @@ require Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw(first min max minstr maxstr reduce sum shuffle); -$VERSION = "1.13"; +$VERSION = "1.13_01"; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; diff --git a/ext/List/Util/lib/Scalar/Util.pm b/ext/List/Util/lib/Scalar/Util.pm index c2aabca..ad192a8 100644 --- a/ext/List/Util/lib/Scalar/Util.pm +++ b/ext/List/Util/lib/Scalar/Util.pm @@ -11,7 +11,7 @@ require List::Util; # List::Util loads the XS @ISA = qw(Exporter); @EXPORT_OK = qw(blessed dualvar reftype weaken isweak tainted readonly openhandle refaddr isvstring looks_like_number set_prototype); -$VERSION = "1.13"; +$VERSION = "1.13_01"; $VERSION = eval $VERSION; sub export_fail { diff --git a/ext/List/Util/t/lln.t b/ext/List/Util/t/lln.t index fe3ba4c..80b0996 100644 --- a/ext/List/Util/t/lln.t +++ b/ext/List/Util/t/lln.t @@ -41,7 +41,7 @@ ok(!!looks_like_number("Inf"), $] >= 5.006001); ok(!!looks_like_number("Infinity"), $] >= 5.008); ok(!!looks_like_number("NaN"), $] >= 5.008); ok(!!looks_like_number("foo"), ''); -ok(!!looks_like_number(undef), 1); +ok(!!looks_like_number(undef), $] < 5.009002); # That's enough - we trust the perl core tests like t/base/num.t __END__ diff --git a/pp_ctl.c b/pp_ctl.c index f0ac9fc..ec21e69 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -1058,8 +1058,9 @@ PP(pp_flip) #define RANGE_IS_NUMERIC(left,right) ( \ SvNIOKp(left) || (SvOK(left) && !SvPOKp(left)) || \ SvNIOKp(right) || (SvOK(right) && !SvPOKp(right)) || \ - (((!SvOK(left) && SvOK(right)) || (looks_like_number(left) && \ - SvPOKp(left) && *SvPVX(left) != '0')) && looks_like_number(right))) + (((!SvOK(left) && SvOK(right)) || ((!SvOK(left) || \ + looks_like_number(left)) && SvPOKp(left) && *SvPVX(left) != '0')) \ + && (!SvOK(right) || looks_like_number(right)))) PP(pp_flop) { diff --git a/sv.c b/sv.c index c3a5a38..77ad8d0 100644 --- a/sv.c +++ b/sv.c @@ -1910,7 +1910,7 @@ Perl_looks_like_number(pTHX_ SV *sv) else if (SvPOKp(sv)) sbegin = SvPV(sv, len); else - return 1; /* Historic. Wrong? */ + return SvFLAGS(sv) & (SVf_NOK|SVp_NOK|SVf_IOK|SVp_IOK); return grok_number(sbegin, len, NULL); }