This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade Scalar-List-Utils from version 1.45 to 1.46
authorSteve Hay <steve.m.hay@googlemail.com>
Thu, 13 Oct 2016 12:31:51 +0000 (13:31 +0100)
committerSteve Hay <steve.m.hay@googlemail.com>
Thu, 13 Oct 2016 12:31:51 +0000 (13:31 +0100)
Porting/Maintainers.pl
cpan/Scalar-List-Utils/ListUtil.xs
cpan/Scalar-List-Utils/lib/List/Util.pm
cpan/Scalar-List-Utils/lib/List/Util/XS.pm
cpan/Scalar-List-Utils/lib/Scalar/Util.pm
cpan/Scalar-List-Utils/lib/Sub/Util.pm
cpan/Scalar-List-Utils/t/00version.t
cpan/Scalar-List-Utils/t/min.t
t/porting/customized.dat

index ddf7a54..e062d88 100755 (executable)
@@ -997,18 +997,8 @@ use File::Glob qw(:case);
     },
 
     'Scalar-List-Utils' => {
-        'DISTRIBUTION' => 'PEVANS/Scalar-List-Utils-1.45.tar.gz',
+        'DISTRIBUTION' => 'PEVANS/Scalar-List-Utils-1.46.tar.gz',
         'FILES'        => q[cpan/Scalar-List-Utils],
-        # Waiting to be merged upstream
-        # https://github.com/Scalar-List-Utils/Scalar-List-Utils/pull/42
-        'CUSTOMIZED'   => [
-            qw( ListUtil.xs
-                lib/List/Util.pm
-                lib/List/Util/XS.pm
-                lib/Scalar/Util.pm
-                lib/Sub/Util.pm
-                )
-        ],
     },
 
     'Search::Dict' => {
index cd84770..79e74d9 100644 (file)
@@ -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;
index d537053..1f7d4c0 100644 (file)
@@ -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
index 67093bd..0c397ea 100644 (file)
@@ -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;
index eb430cd..1aec9f8 100644 (file)
@@ -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
index 79e80fc..1f90c50 100644 (file)
@@ -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
index b04bd33..2aa25cf 100644 (file)
@@ -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");
 
index a7dfb10..2b85b41 100644 (file)
@@ -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");
+    }
+}
index fb9be03..e07f019 100644 (file)
@@ -40,11 +40,6 @@ Pod::Checker cpan/Pod-Checker/t/pod/contains_bad_pod.xr 73538fd80dfe6e19ad561fe0
 Pod::Checker cpan/Pod-Checker/t/pod/selfcheck.t 8ce3cfd38e4b9bcf5bc7fe7f2a14195e49aed7d8
 Pod::Checker cpan/Pod-Checker/t/pod/testcmp.pl a0cd5c8eca775c7753f4464eee96fa916e3d8a16
 Pod::Checker cpan/Pod-Checker/t/pod/testpchk.pl b2072c7f4379fd050e15424175d7cac5facf5b3b
-Scalar-List-Utils cpan/Scalar-List-Utils/lib/List/Util.pm e479a29c6b66ac5cbbde4ef2296afaab6c4635a6
-Scalar-List-Utils cpan/Scalar-List-Utils/lib/List/Util/XS.pm cbc38838d32fd213ae7b37ac38e30195355be3b9
-Scalar-List-Utils cpan/Scalar-List-Utils/lib/Scalar/Util.pm 14a20075dfb9a4ef33b99115ed6f43e6d1a15f9b
-Scalar-List-Utils cpan/Scalar-List-Utils/lib/Sub/Util.pm b984c0a2935bd5f5cf1733df846c8a8c0661ef32
-Scalar-List-Utils cpan/Scalar-List-Utils/ListUtil.xs 362a247c65878265fd8acae607b207400628ef3b
 Socket cpan/Socket/Socket.pm 98e38176d745c38282907f391c077298f5a3d0ba
 Socket cpan/Socket/Socket.xs edd4fed212785f11c5c2095a75941dad27d586d9
 Test::Harness cpan/Test-Harness/bin/prove 9b2866928cb1125de2c68f9773b25723e02c54c0