diff -Nru libwant-perl-0.26/Changes libwant-perl-0.29/Changes --- libwant-perl-0.26/Changes 2015-04-28 11:33:22.000000000 +0000 +++ libwant-perl-0.29/Changes 2016-02-26 04:42:33.000000000 +0000 @@ -142,3 +142,35 @@ C directly. ” Thanks to Reini Urban for the patch. + +0.27 Thu 25 Feb 2016 21:26:04 GMT + - perl 5.23.8 breaks the hack we were using to implement double_return. + + This patch from David Mitchell fixes it. See https://rt.cpan.org/Ticket/Display.html?id=112226 + + David wrote: + + > Running with a debugging perl-5.23.8 will show assertion failures in the Want test suite. It's because PL_comppad/PL_curpad save/restore is now done by the context stack / cx_popsub() rather than as previously on the savestack / LEAVE. + + > This stops the double_return() 'convert CXt_SUB to CXt_NULL' hack from working properly, as PL_comppad is no longer restored when transitioning from the inner to outer sub. The attached patch substitutes one evil hack for another: it keeps the CXt_SUB context stack entry, but sets its retop field to point to the return op again (rather than its caller) so that the return op gets called twice (with a bit of markstack hackery to ensure there are two marks for the two returns to pop). + + > rreturn and lnoreturn are also a bit under-tested. In particular, there are no tests for rreturn in list context. I added such a test, but more need adding. + + > I can see this hack breaking again in the future. Perhaps in the long term + > rreturn() and lnoreturn() should be implemented using custom ops??? + + > Dave M. + +0.28 Thu 25 Feb 2016 22:02:42 GMT + - Fix test failure in 5.14 + - Fix test failure in 5.23.9 (using a patch from Slaven Rezic) + http://cpan.cpantesters.org/authors/id/S/SR/SREZIC/patches/Want-0.26-RT112226.patch + +0.29 Fri 26 Feb 2016 04:42:19 GMT + - Restore compatibility with certain older perl versions (5.10 and 5.12) + + It seems that “ATTRS: lvalue” doesn’t work with older perls, but that you can + forward-declare the method in Perl code with the :lvalue attribute with the same + effect. + + This version of Want is still broken with perl 5.8, for reasons I haven’t investigated. diff -Nru libwant-perl-0.26/debian/changelog libwant-perl-0.29/debian/changelog --- libwant-perl-0.26/debian/changelog 2015-12-17 16:25:03.000000000 +0000 +++ libwant-perl-0.29/debian/changelog 2016-02-28 21:20:14.000000000 +0000 @@ -1,8 +1,16 @@ -libwant-perl (0.26-1build1) xenial; urgency=medium +libwant-perl (0.29-1) unstable; urgency=medium - * Rebuild for Perl 5.22.1. + * Team upload. - -- Colin Watson Thu, 17 Dec 2015 16:25:03 +0000 + [ Salvatore Bonaccorso ] + * debian/control: Use HTTPS transport protocol for Vcs-Git URI + + [ Lucas Kanashiro ] + * Add debian/upstream/metadata + * Import upstream version 0.29 + * Declare compliance with Debian policy 3.9.7 + + -- Lucas Kanashiro Sun, 28 Feb 2016 18:04:14 -0300 libwant-perl (0.26-1) unstable; urgency=medium diff -Nru libwant-perl-0.26/debian/control libwant-perl-0.29/debian/control --- libwant-perl-0.26/debian/control 2015-06-02 19:21:23.000000000 +0000 +++ libwant-perl-0.29/debian/control 2016-02-28 21:20:14.000000000 +0000 @@ -7,9 +7,9 @@ Uploaders: gregor herrmann , Ansgar Burchardt , Florian Schlichting -Standards-Version: 3.9.6 +Standards-Version: 3.9.7 Homepage: https://metacpan.org/release/Want -Vcs-Git: git://anonscm.debian.org/pkg-perl/packages/libwant-perl.git +Vcs-Git: https://anonscm.debian.org/git/pkg-perl/packages/libwant-perl.git Vcs-Browser: https://anonscm.debian.org/cgit/pkg-perl/packages/libwant-perl.git Testsuite: autopkgtest-pkg-perl diff -Nru libwant-perl-0.26/debian/upstream/metadata libwant-perl-0.29/debian/upstream/metadata --- libwant-perl-0.26/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 +++ libwant-perl-0.29/debian/upstream/metadata 2016-02-28 21:20:14.000000000 +0000 @@ -0,0 +1,4 @@ +--- +Archive: CPAN +Contact: Robin Houston +Name: Want diff -Nru libwant-perl-0.26/MANIFEST libwant-perl-0.29/MANIFEST --- libwant-perl-0.26/MANIFEST 2015-04-28 11:34:14.000000000 +0000 +++ libwant-perl-0.29/MANIFEST 2007-05-01 20:40:23.000000000 +0000 @@ -15,4 +15,3 @@ t/threads.p t/threads.t META.yml Module meta-data (added by MakeMaker) -META.json Module JSON meta-data (added by MakeMaker) diff -Nru libwant-perl-0.26/META.json libwant-perl-0.29/META.json --- libwant-perl-0.26/META.json 2015-04-28 11:34:14.000000000 +0000 +++ libwant-perl-0.29/META.json 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -{ - "abstract" : "unknown", - "author" : [ - "unknown" - ], - "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921", - "license" : [ - "unknown" - ], - "meta-spec" : { - "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", - "version" : "2" - }, - "name" : "Want", - "no_index" : { - "directory" : [ - "t", - "inc" - ] - }, - "prereqs" : { - "build" : { - "requires" : { - "ExtUtils::MakeMaker" : "0" - } - }, - "configure" : { - "requires" : { - "ExtUtils::MakeMaker" : "0" - } - }, - "runtime" : { - "requires" : {} - } - }, - "release_status" : "stable", - "version" : "0.26" -} diff -Nru libwant-perl-0.26/META.yml libwant-perl-0.29/META.yml --- libwant-perl-0.26/META.yml 2015-04-28 11:34:14.000000000 +0000 +++ libwant-perl-0.29/META.yml 2016-02-26 04:42:48.000000000 +0000 @@ -1,21 +1,20 @@ ---- -abstract: unknown -author: - - unknown -build_requires: - ExtUtils::MakeMaker: 0 +--- #YAML:1.0 +name: Want +version: 0.29 +abstract: ~ +author: [] +license: unknown +distribution_type: module configure_requires: - ExtUtils::MakeMaker: 0 -dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921' -license: unknown -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 -name: Want + ExtUtils::MakeMaker: 0 +build_requires: + ExtUtils::MakeMaker: 0 +requires: {} no_index: - directory: - - t - - inc -requires: {} -version: 0.26 + directory: + - t + - inc +generated_by: ExtUtils::MakeMaker version 6.56 +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 diff -Nru libwant-perl-0.26/README libwant-perl-0.29/README --- libwant-perl-0.26/README 2015-04-28 11:29:56.000000000 +0000 +++ libwant-perl-0.29/README 2016-02-26 04:30:25.000000000 +0000 @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- -| Want v0.26 - Robin Houston, 2015-04-28 +| Want v0.29 - Robin Houston, 2016-02-26 ----------------------------------------------------------------------------- For full documentation, see the POD included with the module. diff -Nru libwant-perl-0.26/t/all.t libwant-perl-0.29/t/all.t --- libwant-perl-0.26/t/all.t 2014-12-02 10:22:35.000000000 +0000 +++ libwant-perl-0.29/t/all.t 2016-02-25 21:24:00.000000000 +0000 @@ -1,4 +1,4 @@ -BEGIN { $| = 1; print "1..70\n"; } +BEGIN { $| = 1; print "1..72\n"; } # Test that we can load the module END {print "not ok 1\n" unless $loaded;} @@ -223,3 +223,20 @@ %x = (a => 1, tCOUNT(69, undef)); %::x = (a => 2, tCOUNT(70, undef)); + +sub try_rreturn : lvalue { + rreturn @_; + return; +} + +{ + my $res; + + $res = try_rreturn(qw(a b c)); + print "not " unless $res eq "c"; + print "ok 71 # rreturn in scalar context ($res)\n"; + + $res = join(':', try_rreturn(qw(a b c))); + print "not " unless $res eq "a:b:c"; + print "ok 72 # rreturn in list context ($res)\n"; +} diff -Nru libwant-perl-0.26/Want.pm libwant-perl-0.29/Want.pm --- libwant-perl-0.26/Want.pm 2015-04-28 11:29:59.000000000 +0000 +++ libwant-perl-0.29/Want.pm 2016-02-26 04:30:17.000000000 +0000 @@ -12,7 +12,7 @@ our @EXPORT = qw(want rreturn lnoreturn); our @EXPORT_OK = qw(howmany wantref); -our $VERSION = '0.26'; +our $VERSION = '0.29'; bootstrap Want $VERSION; @@ -168,34 +168,40 @@ } } +sub double_return :lvalue; + sub rreturn (@) { if (want_lvalue(1)) { croak "Can't rreturn in lvalue context"; } - double_return(); # Extra scope needed to work with perl-5.19.7 or greater. # Prevents the return being optimised out, which is needed # since it's actually going to be used a stack level above # this sub. { - return wantarray ? @_ : $_[$#_]; + return double_return(@_); } } -sub lnoreturn () { +sub lnoreturn () : lvalue { if (!want_lvalue(1) || !want_assign(1)) { croak "Can't lnoreturn except in ASSIGN context"; } - double_return(); # Extra scope needed to work with perl-5.19.7 or greater. # Prevents the return being optimised out, which is needed # since it's actually going to be used a stack level above # this sub. - { - return disarm_temp(my $undef); + # + # But in older versions of perl, adding the extra scope + # causes the error: + # Can't modify loop exit in lvalue subroutine return + # so we have to check the version. + if ($] >= 5.019) { + return double_return(disarm_temp(my $undef)); } + return double_return(disarm_temp(my $undef)); } # Some naughty people were relying on these internal methods. diff -Nru libwant-perl-0.26/Want.xs libwant-perl-0.29/Want.xs --- libwant-perl-0.26/Want.xs 2015-04-28 11:25:45.000000000 +0000 +++ libwant-perl-0.29/Want.xs 2016-02-26 04:29:09.000000000 +0000 @@ -172,8 +172,17 @@ continue; #ifdef CXt_LOOP_PLAIN case CXt_LOOP_PLAIN: +#endif +#ifdef CXt_LOOP_FOR case CXt_LOOP_FOR: -#else +#endif +#ifdef CXt_LOOP_LIST + case CXt_LOOP_LIST: +#endif +#ifdef CXt_LOOP_ARY + case CXt_LOOP_ARY: +#endif +#ifdef CXt_LOOP case CXt_LOOP: #endif return tcx; @@ -714,7 +723,7 @@ PUSHs(r ? sv_2mortal(newRV_noinc((SV*) r)) : &PL_sv_undef); void -double_return() +double_return(...) PREINIT: PERL_CONTEXT *ourcx, *cx; PPCODE: @@ -722,12 +731,28 @@ cx = upcontext(aTHX_ 1); if (!cx) Perl_croak(aTHX_ "Can't return outside a subroutine"); - +#ifdef POPBLOCK ourcx->cx_type = CXt_NULL; CvDEPTH(ourcx->blk_sub.cv)--; -#if HAS_RETSTACK +# if HAS_RETSTACK if (PL_retstack_ix > 0) --PL_retstack_ix; +# endif +#else + /* In 5.23.8 or later, PL_curpad is saved in the context stack and + * restored by cx_popsub(), rather than being saved on the savestack + * and restored by LEAVE; so just CXt_NULLing the parent sub + * skips the PL_curpad restore and so everything done during the + * second part of the return will have the wrong PL_curpad. + * So instead, fix up the first return so that it thinks the + * op to continue at is iteself, forcing it to do a double return. + */ + assert(PL_op->op_next->op_type == OP_RETURN); + /* force the op following the 'return' to be 'return' again */ + ourcx->blk_sub.retop = PL_op->op_next; + assert(PL_markstack + ourcx->blk_oldmarksp + 1 == PL_markstack_ptr); + ourcx->blk_oldmarksp++; + ourcx->blk_gimme = cx->blk_gimme; #endif return;