r26055 - in /branches/upstream/libset-object-perl/current: Changes.pod META.yml Makefile.PL Object.xs SIGNATURE lib/Set/Object.pm lib/Set/Object/Weak.pm t/object/union.t t/object/weakref.t

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Wed Oct 15 16:37:17 UTC 2008


Author: ansgar-guest
Date: Wed Oct 15 16:37:14 2008
New Revision: 26055

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=26055
Log:
[svn-upgrade] Integrating new upstream version, libset-object-perl (1.26)

Modified:
    branches/upstream/libset-object-perl/current/Changes.pod
    branches/upstream/libset-object-perl/current/META.yml
    branches/upstream/libset-object-perl/current/Makefile.PL
    branches/upstream/libset-object-perl/current/Object.xs
    branches/upstream/libset-object-perl/current/SIGNATURE
    branches/upstream/libset-object-perl/current/lib/Set/Object.pm
    branches/upstream/libset-object-perl/current/lib/Set/Object/Weak.pm
    branches/upstream/libset-object-perl/current/t/object/union.t
    branches/upstream/libset-object-perl/current/t/object/weakref.t

Modified: branches/upstream/libset-object-perl/current/Changes.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libset-object-perl/current/Changes.pod?rev=26055&op=diff
==============================================================================
--- branches/upstream/libset-object-perl/current/Changes.pod (original)
+++ branches/upstream/libset-object-perl/current/Changes.pod Wed Oct 15 16:37:14 2008
@@ -2,6 +2,28 @@
 =encoding utf8
 
 =head1 REVISION HISTORY FOR Set::Object
+
+=head1 1.26, 13 Oct 2008
+
+=over
+
+=item *
+
+Methods which destroyed C<$@> due to internal use of C<eval> now
+properly call C<local($@)> (Yuval)
+
+=item *
+
+Fix a leak and a corner case with weak set magic, and squash some
+warnings (Yuval)
+
+=item *
+
+Define behaviour when dealing with return values from operations on
+weak sets.  No longer hard-coded "Set::Object" - may affect
+Set::Object sub-classes (Sam)
+
+=back
 
 =head1 1.25, 22 Jul 2008
 

Modified: branches/upstream/libset-object-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libset-object-perl/current/META.yml?rev=26055&op=diff
==============================================================================
--- branches/upstream/libset-object-perl/current/META.yml (original)
+++ branches/upstream/libset-object-perl/current/META.yml Wed Oct 15 16:37:14 2008
@@ -1,9 +1,10 @@
 --- #YAML:1.0
 name:                Set-Object
-version:             1.25
+version:             1.26
 abstract:            Unordered collections (sets) of Perl Objects
-license:             ~
-author:              ~
+license:             Artistic
+author:              
+    - Jean-Louis Leroy and Sam Vilain
 generated_by:        ExtUtils::MakeMaker version 6.42
 distribution_type:   module
 requires:     

Modified: branches/upstream/libset-object-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libset-object-perl/current/Makefile.PL?rev=26055&op=diff
==============================================================================
--- branches/upstream/libset-object-perl/current/Makefile.PL (original)
+++ branches/upstream/libset-object-perl/current/Makefile.PL Wed Oct 15 16:37:14 2008
@@ -11,6 +11,8 @@
 # the contents of the Makefile that is written.
 WriteMakefile(
     'NAME'	=> 'Set::Object',
+    'AUTHOR'    => 'Jean-Louis Leroy and Sam Vilain',
+    'LICENSE'   => 'Artistic',
     'VERSION_FROM' => 'lib/Set/Object.pm', # finds $VERSION
     'ABSTRACT'  => "Unordered collections (sets) of Perl Objects",
     'LIBS'	=> [''],   # e.g., '-lm' 

Modified: branches/upstream/libset-object-perl/current/Object.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libset-object-perl/current/Object.xs?rev=26055&op=diff
==============================================================================
--- branches/upstream/libset-object-perl/current/Object.xs (original)
+++ branches/upstream/libset-object-perl/current/Object.xs Wed Oct 15 16:37:14 2008
@@ -337,10 +337,12 @@
     IF_SPELL_DEBUG(_warn("dispelling magic from 0x%.8x (self = 0x%.8x, mg = 0x%.8x)",
 			 sv, self_svrv, mg));
     if (mg) {
-       AV* wand = mg->mg_obj;
+       AV* wand = (AV *)mg->mg_obj;
        SV ** const svp = AvARRAY(wand);
        I32 i = AvFILLp(wand);
        int c = 0;
+
+       assert( SvTYPE(want) == SVt_PVAV );
 
        while (i >= 0) {
 	 if (svp[i] && SvIV(svp[i])) {
@@ -381,7 +383,7 @@
 }
 
 void
-_fiddle_strength(ISET* s, int strong) {
+_fiddle_strength(ISET* s, const int strong) {
 
       BUCKET* bucket_iter = s->bucket;
       BUCKET* bucket_last = bucket_iter + s->buckets;
@@ -405,7 +407,8 @@
 			       SvREFCNT(*el_iter)));
 	      }
 	      else {
-		_cast_magic(s, *el_iter);
+		if ( SvREFCNT(*el_iter) > 1 )
+		  _cast_magic(s, *el_iter);
 		SvREFCNT_dec(*el_iter);
 		IF_DEBUG(_warn("reduced RC of 0x%.8x to %d", *el_iter,
 			       SvREFCNT(*el_iter)));
@@ -463,18 +466,20 @@
     mg = _detect_magic(sv);
     if (mg) {
       IF_SPELL_DEBUG(_warn("sv_magicext reusing wand 0x%.8x for 0x%.8x", wand, sv));
-      wand = mg->mg_obj;
+      wand = (AV *)mg->mg_obj;
+      assert( SvTYPE(wand) == SVt_PVAV );
     }
     else {
       wand=newAV();
       IF_SPELL_DEBUG(_warn("sv_magicext(0x%.8x, 0x%.8x, %ld, 0x%.8x, NULL, 0)", sv, wand, how, vtable));
 #if (PERL_VERSION > 7) || ( (PERL_VERSION == 7)&&( PERL_SUBVERSION > 2) )
-      sv_magicext(sv, wand, how, vtable, NULL, 0);
+      mg = sv_magicext(sv, (SV *)wand, how, vtable, NULL, 0);
 #else
       sv_magic(sv, wand, how, NULL, 0);
       mg = mg_find(sv, SET_OBJECT_MAGIC_backref);
       mg->mg_virtual = &SET_OBJECT_vtbl_backref;
 #endif
+      mg->mg_flags |= MGf_REFCOUNTED;
       SvRMAGICAL_on(sv);
     }
 
@@ -488,6 +493,8 @@
 	if (s == o)
 	  return;
       } else {
+	if ( svp[i] ) SvREFCNT_dec(svp[i]);
+	svp[i] = NULL;
 	free = i;
       }
       i = i - 1;
@@ -500,6 +507,7 @@
       IF_SPELL_DEBUG(_warn("casting self 0x%.8x to slot %d", self_svrv, free));
       svp[free] = self_svrv;
     }
+
     /*
     SvREFCNT_inc(self_svrv);
     */
@@ -838,13 +846,16 @@
 
    CODE:
       ISET* s = INT2PTR(ISET*, SvIV(SvRV(self)));
-      IF_DEBUG(_warn("aargh!"));
-      iset_clear(s);
-      if (s->flat) {
-	hv_undef(s->flat);
-	SvREFCNT_dec(s->flat);
-      }
-      Safefree(s);
+      if ( s ) {
+	sv_setiv(SvRV(self), 0);
+	IF_DEBUG(_warn("aargh!"));
+	iset_clear(s);
+	if (s->flat) {
+	  hv_undef(s->flat);
+	  SvREFCNT_dec(s->flat);
+	}
+	Safefree(s);
+      }
       
 int
 is_weak(self)
@@ -867,7 +878,7 @@
       if (s->is_weak)
         XSRETURN_UNDEF;
 
-	IF_DEBUG(_warn("weakening set (0x%.8x)", SvRV(self)));
+      IF_DEBUG(_warn("weakening set (0x%.8x)", SvRV(self)));
 
       s->is_weak = SvRV(self);
 
@@ -964,14 +975,14 @@
 CODE:
   ISET* s = INT2PTR(ISET*, SvIV(SvRV(sv)));
   if (s->flat) {
-    RETVAL = newRV_inc(s->flat);
+    RETVAL = newRV_inc((SV *)s->flat);
   } else {
     XSRETURN_UNDEF;
   }
 OUTPUT:
   RETVAL
 
-char *
+const char *
 blessed(sv)
     SV * sv
 PROTOTYPE: $
@@ -987,7 +998,7 @@
 OUTPUT:
     RETVAL
 
-char *
+const char *
 reftype(sv)
     SV * sv
 PROTOTYPE: $

Modified: branches/upstream/libset-object-perl/current/SIGNATURE
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libset-object-perl/current/SIGNATURE?rev=26055&op=diff
==============================================================================
--- branches/upstream/libset-object-perl/current/SIGNATURE (original)
+++ branches/upstream/libset-object-perl/current/SIGNATURE Wed Oct 15 16:37:14 2008
@@ -14,24 +14,18 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-SHA1 3048464c1581d609a070aa8301c75b3d811bf606 Changes.pod
-SHA1 a183196335c39361a7030b1bf55b2a137ea883c8 MANIFEST
-SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709 META.yml
-SHA1 a88f349740616e083df4553bd1c592fb6ec68dcd Makefile.PL
-SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709 Object.bs
-SHA1 1bff9af534230f8114e9b4b9eaa508b79b46f9f0 Object.c
-SHA1 4eb8ea0bf64e09e30ed7aaf47a4335849c00457b Object.o
-SHA1 9a3435e38c125fe0ddae8fddf77ff07b73580770 Object.xs
+SHA1 6f6095fe820326aaad9446165514fc76906e5d03 Changes.pod
+SHA1 816639c05c69373b63a93333c3e7e60a87866e56 MANIFEST
+SHA1 c826cfdec5efc768c4a6eaec8d690b4f309c03d0 Makefile.PL
+SHA1 c7e94daaee60472be79ff69104d2b18d1b7fe2a3 Object.xs
 SHA1 c2c4506b0563e59dd930ccb513e5a5fc5b2a1f70 README
-SHA1 f7d5300f8ec1d6b0e1bab4bee7a0c8e32680e6bb Set-Object-1.22.tar
-SHA1 9a7aadf8498a58001b3ba1b1747bdaa265a21530 lib/Set/Object.pm
-SHA1 ed61f9e9e845796a72d1338544eec8e05157fe1f lib/Set/Object/Weak.pm
-SHA1 b005f8fc4c2610e45f9ae19d6b8141e07c665cfb ppport.h
+SHA1 e04c3d0688bca4ddbc3d445328170de3bf7c97b3 lib/Set/Object.pm
+SHA1 3ee3d2b72d4130ed27f8d24a2625fa22895e52ca lib/Set/Object/Weak.pm
+SHA1 f04d25338c1e35bda69ac5eda0bc672e10ca5b6f ppport.h
 SHA1 213b597a69c1f909d585a14a6a094a25c3e684af t/ingy/arrayref.t
 SHA1 db433f58da0fbecc971da5815ef5a530cd7f59f4 t/misc/leaks.t
 SHA1 4a159d3dccb6918ec790905d0e2bec3e58db15e9 t/misc/pod.t
 SHA1 dfb47bc536bc8bface7f95144e4985dd79447977 t/misc/pod_coverage.t
-SHA1 70f9b68b285bab7a8415392e9fab2a25b30267c3 t/misc/threads.t
 SHA1 494c2f3a77ce211ffcbedc5e44dd8a6454764fe2 t/misc/undef.t
 SHA1 018c38db837777290619ec16a5f1c0dd5783263a t/object/Person.pm
 SHA1 40b4a7db1302cbd1d9b57e23508209818c8542dc t/object/Saint.pm
@@ -52,8 +46,8 @@
 SHA1 35a2ea64d0f939557f15c4e55f22715ebe5dafaf t/object/storable.t
 SHA1 479a9f5cd91b03a7ef37a833886c54e8e19c18cd t/object/subsuper.t
 SHA1 d18eaba2928ec2aa58a09feb70e49aad7d05e3f6 t/object/symmetric_difference.t
-SHA1 5d0eb7c8022f69119b05c26f0fed06c83e088a7f t/object/union.t
-SHA1 db1cfa2c673150e51adc99f9e6c34cea158bb373 t/object/weakref.t
+SHA1 f96b691a78eb18bc85739b6b0c4b45d2208b2669 t/object/union.t
+SHA1 eebb5dae0215a01ec427abafac502d534c20d524 t/object/weakref.t
 SHA1 85b0418c45937ccfc37694fc0463617d9d926261 t/scalar/basic.t
 SHA1 547133fca61d8af7abfd6774be681f65b48ca43e t/scalar/basic_overload.t
 SHA1 b3b8d494ae6e7b875a424110425d6c55d6676fdc t/scalar/boolean.t
@@ -74,7 +68,7 @@
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (GNU/Linux)
 
-iEYEARECAAYFAkh/+90ACgkQ/AZAiGayWEOR2wCeJLrfk+lFLMelEwF3v2pE3CA8
-TO4An0/Ir5VGkSA+qrJEWhReUn25fZBJ
-=ZGbA
+iEYEARECAAYFAkjyaoUACgkQ/AZAiGayWEMzZACgzA0Y4+tZWxjK9xaO4q+Uur3C
+hBEAnRloSudJLKVGlfrWvEu5McFpRYMX
+=Ro6e
 -----END PGP SIGNATURE-----

Modified: branches/upstream/libset-object-perl/current/lib/Set/Object.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libset-object-perl/current/lib/Set/Object.pm?rev=26055&op=diff
==============================================================================
--- branches/upstream/libset-object-perl/current/lib/Set/Object.pm (original)
+++ branches/upstream/libset-object-perl/current/lib/Set/Object.pm Wed Oct 15 16:37:14 2008
@@ -509,7 +509,7 @@
 
 @EXPORT_OK = qw( ish_int is_int is_string is_double blessed reftype
 		 refaddr is_overloaded is_object is_key set weak_set );
-$VERSION = '1.25';
+$VERSION = '1.26';
 
 bootstrap Set::Object $VERSION;
 
@@ -898,6 +898,7 @@
 # to be an array index, and if so returns the index
 sub ish_int {
     my $i;
+    local $@;
     eval { $i = _ish_int($_[0]) };
 
     if ($@) {
@@ -1074,6 +1075,7 @@
 }
 
 sub set {
+    local $@;
     if (eval { $_[0]->isa(__PACKAGE__) }) {
     	shift;
     }

Modified: branches/upstream/libset-object-perl/current/lib/Set/Object/Weak.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libset-object-perl/current/lib/Set/Object/Weak.pm?rev=26055&op=diff
==============================================================================
--- branches/upstream/libset-object-perl/current/lib/Set/Object/Weak.pm (original)
+++ branches/upstream/libset-object-perl/current/lib/Set/Object/Weak.pm Wed Oct 15 16:37:14 2008
@@ -82,7 +82,7 @@
 sub set {
     my $class = __PACKAGE__;
     if (blessed $_[0] and $_[0]->isa("Set::Object")) {
-    	$class = "Set::Object";
+    	$class = (shift)->strong_pkg;
     }
     $class->new(@_);
 }

Modified: branches/upstream/libset-object-perl/current/t/object/union.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libset-object-perl/current/t/object/union.t?rev=26055&op=diff
==============================================================================
--- branches/upstream/libset-object-perl/current/t/object/union.t (original)
+++ branches/upstream/libset-object-perl/current/t/object/union.t Wed Oct 15 16:37:14 2008
@@ -1,28 +1,25 @@
 use Set::Object;
+
+use Test::More tests => 10;
 
 require 't/object/Person.pm';
 package Person;
 
 populate();
 
-$simpsons = Set::Object->new($homer, $marge);
-$bouviers = Set::Object->new($marge, $patty, $selma);
-$both = Set::Object->new($homer, $marge, $patty, $selma);
-$empty = Set::Object->new;
+foreach my $class ( qw(Set::Object Set::Object::Weak) ) {
+	$simpsons = $class->new($homer, $marge);
+	$bouviers = $class->new($marge, $patty, $selma);
+	$both = $class->new($homer, $marge, $patty, $selma);
+	$empty = $class->new;
 
-print "1..5\n";
+	::ok( $simpsons->union($bouviers) == $both, "union method" );
 
-print 'not ' unless $simpsons->union($bouviers) == $both;
-print "ok 1\n";
+	::ok( $simpsons + $bouviers == $both, "op_union" );
 
-print 'not ' unless $simpsons + $bouviers == $both;
-print "ok 2\n";
+	::ok( $bouviers + $simpsons == $both, "op union with ops reversed" );
 
-print 'not ' unless $bouviers + $simpsons == $both;
-print "ok 3\n";
+	::ok( $simpsons + $simpsons == $simpsons, "union with self" );
 
-print 'not ' unless $simpsons + $simpsons == $simpsons;
-print "ok 4\n";
-
-print 'not ' unless $simpsons + $empty == $simpsons;
-print "ok 5\n";
+	::ok( $simpsons + $empty == $simpsons, "union with empty set" );
+}

Modified: branches/upstream/libset-object-perl/current/t/object/weakref.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libset-object-perl/current/t/object/weakref.t?rev=26055&op=diff
==============================================================================
--- branches/upstream/libset-object-perl/current/t/object/weakref.t (original)
+++ branches/upstream/libset-object-perl/current/t/object/weakref.t Wed Oct 15 16:37:14 2008
@@ -1,6 +1,6 @@
 # -*- perl -*-
 
-use Test::More tests => 37;
+use Test::More qw(no_plan);
 use Set::Object qw(set refaddr);
 use strict;
 
@@ -197,3 +197,6 @@
      each %{$_[0]};
  }
 }
+
+$set = Set::Object::weak_set(["ø"]) + Set::Object::weak_set(["þ"]);
+is($set->size(), 2, "computations on sets don't care that they're weak");




More information about the Pkg-perl-cvs-commits mailing list