diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2016-10-13 13:31:51 +0100 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2016-10-13 13:31:51 +0100 |
commit | a0b61ef95c1627542742a80907516f7ab89aaed6 (patch) | |
tree | 1c840b8d4a083bce80f2c222e1010bd352bf0ecf /cpan/Scalar-List-Utils | |
parent | 061828b3b8df6f38383ada8703fd195cd2f6ef74 (diff) | |
download | perl-a0b61ef95c1627542742a80907516f7ab89aaed6.tar.gz |
Upgrade Scalar-List-Utils from version 1.45 to 1.46
Diffstat (limited to 'cpan/Scalar-List-Utils')
-rw-r--r-- | cpan/Scalar-List-Utils/ListUtil.xs | 10 | ||||
-rw-r--r-- | cpan/Scalar-List-Utils/lib/List/Util.pm | 10 | ||||
-rw-r--r-- | cpan/Scalar-List-Utils/lib/List/Util/XS.pm | 2 | ||||
-rw-r--r-- | cpan/Scalar-List-Utils/lib/Scalar/Util.pm | 2 | ||||
-rw-r--r-- | cpan/Scalar-List-Utils/lib/Sub/Util.pm | 2 | ||||
-rw-r--r-- | cpan/Scalar-List-Utils/t/00version.t | 9 | ||||
-rw-r--r-- | cpan/Scalar-List-Utils/t/min.t | 20 |
7 files changed, 45 insertions, 10 deletions
diff --git a/cpan/Scalar-List-Utils/ListUtil.xs b/cpan/Scalar-List-Utils/ListUtil.xs index cd84770910..79e74d9302 100644 --- a/cpan/Scalar-List-Utils/ListUtil.xs +++ b/cpan/Scalar-List-Utils/ListUtil.xs @@ -114,6 +114,7 @@ CODE: XSRETURN_UNDEF; retsv = ST(0); + SvGETMAGIC(retsv); magic = SvAMAGIC(retsv); if(!magic) retval = slu_sv_value(retsv); @@ -121,6 +122,7 @@ CODE: for(index = 1 ; index < items ; index++) { SV *stacksv = ST(index); SV *tmpsv; + SvGETMAGIC(stacksv); if((magic || SvAMAGIC(stacksv)) && (tmpsv = amagic_call(retsv, stacksv, gt_amg, 0))) { if(SvTRUE(tmpsv) ? !ix : ix) { retsv = stacksv; @@ -174,6 +176,7 @@ CODE: } sv = ST(0); + SvGETMAGIC(sv); switch((accum = accum_type(sv))) { case ACC_SV: retsv = TARG; @@ -189,6 +192,7 @@ CODE: for(index = 1 ; index < items ; index++) { sv = ST(index); + SvGETMAGIC(sv); if(accum < ACC_SV && SvAMAGIC(sv)){ if(!retsv) retsv = TARG; @@ -389,6 +393,7 @@ CODE: GvSV(agv) = ret; SvSetMagicSV(ret, args[1]); #ifdef dMULTICALL + assert(cv); if(!CvISXSUB(cv)) { dMULTICALL; I32 gimme = G_SCALAR; @@ -444,6 +449,7 @@ CODE: SAVESPTR(GvSV(PL_defgv)); #ifdef dMULTICALL + assert(cv); if(!CvISXSUB(cv)) { dMULTICALL; I32 gimme = G_SCALAR; @@ -515,6 +521,7 @@ PPCODE: SAVESPTR(GvSV(PL_defgv)); #ifdef dMULTICALL + assert(cv); if(!CvISXSUB(cv)) { dMULTICALL; I32 gimme = G_SCALAR; @@ -697,6 +704,7 @@ PPCODE: SAVESPTR(GvSV(agv)); SAVESPTR(GvSV(bgv)); #ifdef dMULTICALL + assert(cv); if(!CvISXSUB(cv)) { /* Since MULTICALL is about to move it */ SV **stack = PL_stack_base + ax; @@ -781,6 +789,7 @@ PPCODE: SAVESPTR(GvSV(agv)); SAVESPTR(GvSV(bgv)); #ifdef dMULTICALL + assert(cv); if(!CvISXSUB(cv)) { /* Since MULTICALL is about to move it */ SV **stack = PL_stack_base + ax; @@ -871,6 +880,7 @@ PPCODE: * Skip it on those versions (RT#87857) */ #if defined(dMULTICALL) && (PERL_BCDVERSION > 0x5010000 || PERL_BCDVERSION < 0x5008009) + assert(cv); if(!CvISXSUB(cv)) { /* Since MULTICALL is about to move it */ SV **stack = PL_stack_base + ax; diff --git a/cpan/Scalar-List-Utils/lib/List/Util.pm b/cpan/Scalar-List-Utils/lib/List/Util.pm index d53705310e..1f7d4c025f 100644 --- a/cpan/Scalar-List-Utils/lib/List/Util.pm +++ b/cpan/Scalar-List-Utils/lib/List/Util.pm @@ -15,7 +15,7 @@ our @EXPORT_OK = qw( all any first min max minstr maxstr none notall product reduce sum sum0 shuffle uniq uniqnum uniqstr pairs unpairs pairkeys pairvalues pairmap pairgrep pairfirst ); -our $VERSION = "1.45_01"; +our $VERSION = "1.46"; our $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -50,9 +50,9 @@ List::Util - A selection of general-utility list subroutines max maxstr min minstr product sum sum0 - pairs pairkeys pairvalues pairfirst pairgrep pairmap + pairs unpairs pairkeys pairvalues pairfirst pairgrep pairmap - shuffle uniqnum uniqstr + shuffle uniq uniqnum uniqstr ); =head1 DESCRIPTION @@ -517,6 +517,10 @@ are enabled (C<use warnings 'uninitialized';>). In addition, an C<undef> in the returned list is coerced into a numerical zero, so that the entire list of values returned by C<uniqnum> are well-behaved as numbers. +Note also that multiple IEEE C<NaN> values are treated as duplicates of +each other, regardless of any differences in their payloads, and despite +the fact that C<< 0+'NaN' == 0+'NaN' >> yields false. + =head2 uniqstr my @subset = uniqstr @values diff --git a/cpan/Scalar-List-Utils/lib/List/Util/XS.pm b/cpan/Scalar-List-Utils/lib/List/Util/XS.pm index 67093bde79..0c397eafdc 100644 --- a/cpan/Scalar-List-Utils/lib/List/Util/XS.pm +++ b/cpan/Scalar-List-Utils/lib/List/Util/XS.pm @@ -3,7 +3,7 @@ use strict; use warnings; use List::Util; -our $VERSION = "1.45_01"; # FIXUP +our $VERSION = "1.46"; # FIXUP $VERSION = eval $VERSION; # FIXUP 1; diff --git a/cpan/Scalar-List-Utils/lib/Scalar/Util.pm b/cpan/Scalar-List-Utils/lib/Scalar/Util.pm index eb430cdcd5..1aec9f897b 100644 --- a/cpan/Scalar-List-Utils/lib/Scalar/Util.pm +++ b/cpan/Scalar-List-Utils/lib/Scalar/Util.pm @@ -17,7 +17,7 @@ our @EXPORT_OK = qw( dualvar isdual isvstring looks_like_number openhandle readonly set_prototype tainted ); -our $VERSION = "1.45_01"; +our $VERSION = "1.46"; $VERSION = eval $VERSION; require List::Util; # List::Util loads the XS diff --git a/cpan/Scalar-List-Utils/lib/Sub/Util.pm b/cpan/Scalar-List-Utils/lib/Sub/Util.pm index 79e80fc43c..1f90c50f45 100644 --- a/cpan/Scalar-List-Utils/lib/Sub/Util.pm +++ b/cpan/Scalar-List-Utils/lib/Sub/Util.pm @@ -15,7 +15,7 @@ our @EXPORT_OK = qw( subname set_subname ); -our $VERSION = "1.45_01"; +our $VERSION = "1.46"; $VERSION = eval $VERSION; require List::Util; # as it has the XS diff --git a/cpan/Scalar-List-Utils/t/00version.t b/cpan/Scalar-List-Utils/t/00version.t index b04bd33e0d..2aa25cfdfc 100644 --- a/cpan/Scalar-List-Utils/t/00version.t +++ b/cpan/Scalar-List-Utils/t/00version.t @@ -6,10 +6,13 @@ use warnings; use Scalar::Util (); use List::Util (); use List::Util::XS (); -use Test::More tests => 2; +use Sub::Util (); +use Test::More tests => 4; -is( $Scalar::Util::VERSION, $List::Util::VERSION, "VERSION mismatch"); +is( $Scalar::Util::VERSION, $List::Util::VERSION, "VERSION mismatch between Scalar/List"); my $has_xs = eval { Scalar::Util->import('dualvar'); 1 }; my $xs_version = $has_xs ? $List::Util::VERSION : undef; -is( $List::Util::XS::VERSION, $xs_version, "XS VERSION"); +is( $List::Util::XS::VERSION, $xs_version, "VERSION mismatch between LU::XS and LU"); +is( $Sub::Util::VERSION, $Scalar::Util::VERSION, "VERSION mistmatch between Sub/Scalar"); +is( $Sub::Util::VERSION, $List::Util::VERSION, "VERSION mistmatch between Sub/List"); diff --git a/cpan/Scalar-List-Utils/t/min.t b/cpan/Scalar-List-Utils/t/min.t index a7dfb10683..2b85b414cf 100644 --- a/cpan/Scalar-List-Utils/t/min.t +++ b/cpan/Scalar-List-Utils/t/min.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 10; +use Test::More tests => 22; use List::Util qw(min); my $v; @@ -62,3 +62,21 @@ is($v, 1, 'bigint and normal int'); $v = min(1, 2, $v1, 3); is($v, 1, 'bigint and normal int'); +{ + # test that min/max and sum call GETMAGIC properly + # note, in my tests how this fails depends on exactly + # which List::Util subs are called and in what order. + my @list; + for my $size (10, 20, 10, 30) { + @list = ( 1 ) x $size; + + my $sum= List::Util::sum( 0, $#list ); + ok( $sum == $size-1, "sum(\$#list, 0) == $size-1"); + + my $min= List::Util::min( 15, $#list ); + ok( $min <= 15, "min(15,$size)" ); + + my $max= List::Util::max( 0, $#list ); + ok( $max == $size-1, "max(\$#list, 0) == $size-1"); + } +} |