summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Holland-Moritz <mhx-perl@gmx.net>2004-03-15 23:16:26 +0100
committerMarcus Holland-Moritz <mhx-perl@gmx.net>2004-04-05 20:03:03 +0000
commite0ab1c0e1c533d7f19b4ffe230a3d921bf733a02 (patch)
tree1a9348874320960a458f9027f96d08293d67b49f
parentdc9da78b70f004446f5a9327eea553687ad8c180 (diff)
downloadperl-e0ab1c0e1c533d7f19b4ffe230a3d921bf733a02.tar.gz
C<undef> 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
-rw-r--r--ext/List/Util/lib/List/Util.pm2
-rw-r--r--ext/List/Util/lib/Scalar/Util.pm2
-rw-r--r--ext/List/Util/t/lln.t2
-rw-r--r--pp_ctl.c5
-rw-r--r--sv.c2
5 files changed, 7 insertions, 6 deletions
diff --git a/ext/List/Util/lib/List/Util.pm b/ext/List/Util/lib/List/Util.pm
index 77a52f6e1d..ff38fb4469 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 c2aabcaa09..ad192a8a74 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 fe3ba4cb3a..80b0996c56 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 f0ac9fcb95..ec21e69bb9 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 c3a5a38f75..77ad8d0c1d 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);
}