Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package perl-Syntax-Keyword-Try for 
openSUSE:Factory checked in at 2021-05-12 19:32:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Syntax-Keyword-Try (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Syntax-Keyword-Try.new.2988 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Syntax-Keyword-Try"

Wed May 12 19:32:49 2021 rev:11 rq:892523 version:0.24

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/perl-Syntax-Keyword-Try/perl-Syntax-Keyword-Try.changes
  2021-04-12 12:39:34.653523629 +0200
+++ 
/work/SRC/openSUSE:Factory/.perl-Syntax-Keyword-Try.new.2988/perl-Syntax-Keyword-Try.changes
        2021-05-12 19:33:30.222732858 +0200
@@ -1,0 +2,15 @@
+Tue May 11 03:07:18 UTC 2021 - Tina M??ller <[email protected]>
+
+- updated to 0.24
+   see /usr/share/doc/packages/perl-Syntax-Keyword-Try/Changes
+
+  0.24    2021-05-10
+          [CHANGES]
+           * Deprecate the `try do { ... }` (experimental) syntax now that
+             try-in-do works reliably. It will be removed soon because it gets
+             in the way of converting the parser logic to XS::Parse::Keyword
+           * Add documentation about the core `use feature 'try'` and
+             Feature::Compat::Try module
+           * Added an initial attempt at B::Deparse logic
+
+-------------------------------------------------------------------

Old:
----
  Syntax-Keyword-Try-0.23.tar.gz

New:
----
  Syntax-Keyword-Try-0.24.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Syntax-Keyword-Try.spec ++++++
--- /var/tmp/diff_new_pack.rmuvz9/_old  2021-05-12 19:33:30.686731004 +0200
+++ /var/tmp/diff_new_pack.rmuvz9/_new  2021-05-12 19:33:30.690730988 +0200
@@ -18,7 +18,7 @@
 
 %define cpan_name Syntax-Keyword-Try
 Name:           perl-Syntax-Keyword-Try
-Version:        0.23
+Version:        0.24
 Release:        0
 Summary:        C<try/catch/finally> syntax for perl
 License:        Artistic-1.0 OR GPL-1.0-or-later
@@ -43,6 +43,13 @@
 parser plugins and manipulate optrees to provide new syntax and behaviours
 for perl code.
 
+Syntax similar to this module has now been added to core perl, starting at
+development version 5.33.7, and is expected to become generally available
+when perl 5.34 is released. If you are writing new code, it is suggested
+that you instead use the Feature::Compat::Try module instead, as that will
+enable the core feature on those supported perl versions, falling back to
+'Syntax::Keyword::Try' on older perls.
+
 %prep
 %autosetup  -n %{cpan_name}-%{version}
 

++++++ Syntax-Keyword-Try-0.23.tar.gz -> Syntax-Keyword-Try-0.24.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Syntax-Keyword-Try-0.23/Changes 
new/Syntax-Keyword-Try-0.24/Changes
--- old/Syntax-Keyword-Try-0.23/Changes 2021-03-27 16:36:44.000000000 +0100
+++ new/Syntax-Keyword-Try-0.24/Changes 2021-05-10 15:39:16.000000000 +0200
@@ -1,5 +1,14 @@
 Revision history for Syntax-Keyword-Try
 
+0.24    2021-05-10
+        [CHANGES]
+         * Deprecate the `try do { ... }` (experimental) syntax now that
+           try-in-do works reliably. It will be removed soon because it gets
+           in the way of converting the parser logic to XS::Parse::Keyword
+         * Add documentation about the core `use feature 'try'` and
+           Feature::Compat::Try module
+         * Added an initial attempt at B::Deparse logic
+
 0.23    2021-03-27
         [CHANGES]
          * Unit tests and documentation of the handling of the final-value
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Syntax-Keyword-Try-0.23/MANIFEST 
new/Syntax-Keyword-Try-0.24/MANIFEST
--- old/Syntax-Keyword-Try-0.23/MANIFEST        2021-03-27 16:36:44.000000000 
+0100
+++ new/Syntax-Keyword-Try-0.24/MANIFEST        2021-05-10 15:39:16.000000000 
+0200
@@ -6,6 +6,7 @@
 hax/wrap_keyword_plugin.c.inc
 lib/Syntax/Keyword/Try.pm
 lib/Syntax/Keyword/Try.xs
+lib/Syntax/Keyword/Try/Deparse.pm
 LICENSE
 MANIFEST                       This list of files
 META.json
@@ -26,6 +27,7 @@
 t/20try-do.t
 t/21try-do-finally.t
 t/30compat.t
+t/70deparse.t
 t/80await+SKT.t
 t/80defer+SKT.t
 t/90rt123547.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Syntax-Keyword-Try-0.23/META.json 
new/Syntax-Keyword-Try-0.24/META.json
--- old/Syntax-Keyword-Try-0.23/META.json       2021-03-27 16:36:44.000000000 
+0100
+++ new/Syntax-Keyword-Try-0.24/META.json       2021-05-10 15:39:16.000000000 
+0200
@@ -38,7 +38,11 @@
    "provides" : {
       "Syntax::Keyword::Try" : {
          "file" : "lib/Syntax/Keyword/Try.pm",
-         "version" : "0.23"
+         "version" : "0.24"
+      },
+      "Syntax::Keyword::Try::Deparse" : {
+         "file" : "lib/Syntax/Keyword/Try/Deparse.pm",
+         "version" : "0.24"
       }
    },
    "release_status" : "stable",
@@ -48,6 +52,6 @@
       ],
       "x_IRC" : "irc://irc.perl.org/#io-async"
    },
-   "version" : "0.23",
+   "version" : "0.24",
    "x_serialization_backend" : "JSON::PP version 4.05"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Syntax-Keyword-Try-0.23/META.yml 
new/Syntax-Keyword-Try-0.24/META.yml
--- old/Syntax-Keyword-Try-0.23/META.yml        2021-03-27 16:36:44.000000000 
+0100
+++ new/Syntax-Keyword-Try-0.24/META.yml        2021-05-10 15:39:16.000000000 
+0200
@@ -17,11 +17,14 @@
 provides:
   Syntax::Keyword::Try:
     file: lib/Syntax/Keyword/Try.pm
-    version: '0.23'
+    version: '0.24'
+  Syntax::Keyword::Try::Deparse:
+    file: lib/Syntax/Keyword/Try/Deparse.pm
+    version: '0.24'
 requires:
   perl: '5.014'
 resources:
   IRC: irc://irc.perl.org/#io-async
   license: http://dev.perl.org/licenses/
-version: '0.23'
+version: '0.24'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Syntax-Keyword-Try-0.23/README 
new/Syntax-Keyword-Try-0.24/README
--- old/Syntax-Keyword-Try-0.23/README  2021-03-27 16:36:44.000000000 +0100
+++ new/Syntax-Keyword-Try-0.24/README  2021-05-10 15:39:16.000000000 +0200
@@ -29,6 +29,13 @@
     implement parser plugins and manipulate optrees to provide new syntax
     and behaviours for perl code.
 
+    Syntax similar to this module has now been added to core perl, starting
+    at development version 5.33.7, and is expected to become generally
+    available when perl 5.34 is released. If you are writing new code, it
+    is suggested that you instead use the Feature::Compat::Try module
+    instead, as that will enable the core feature on those supported perl
+    versions, falling back to Syntax::Keyword::Try on older perls.
+
 Experimental Features
 
     Some of the features of this module are currently marked as
@@ -43,7 +50,7 @@
 
        use Syntax::Keyword::Try qw( try :experimental(typed) );
     
-       use Syntax::Keyword::Try qw( try :experimental(try_value) );
+       use Syntax::Keyword::Try qw( try :experimental(try_value) ); # 
deprecated
     
        use Syntax::Keyword::Try qw( try :experimental );  # all of the above
 
@@ -205,14 +212,23 @@
     warning and discarded, leaving $@ containing the original exception, if
     one existed.
 
+    Note that the finally syntax is not available when using this module
+    via Feature::Compat::Try, as it is not expected that syntax will be
+    added to the core perl 'try' feature. This is because a more
+    general-purpose ability may be added instead, under the name 'defer'.
+    If you wish to write code that may more easily be forward-compatible
+    with that feature instead, you should consider using
+    Syntax::Keyword::Defer rather than using finally statements.
+
 VALUE SEMANTICS
 
-      Warning: the feature described in this section is experimental. This
-      experiment has existed for a while, though given that since version
-      0.22 the regular try syntax already behaves fine inside a do block,
-      there is no longer any reason for this experimental feature to exist.
-      It will start printing deprecation warnings in a later version, and
-      eventually will be removed.
+      Warning: the feature described in this section was experimental and
+      is now deprecated. This experiment has existed for a while, though
+      given that since version 0.22 the regular try syntax already behaves
+      fine inside a do block, there is no longer any reason for this
+      experimental feature to exist. It will print a deprecation warning,
+      and eventually will be removed in a later version. You should use do
+      { try ... } instead.
 
       Additionally, on perl versions 5.18 and later, it will produce a
       warning in the experimental category.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Syntax-Keyword-Try-0.23/hax/perl-additions.c.inc 
new/Syntax-Keyword-Try-0.24/hax/perl-additions.c.inc
--- old/Syntax-Keyword-Try-0.23/hax/perl-additions.c.inc        2021-03-27 
16:36:44.000000000 +0100
+++ new/Syntax-Keyword-Try-0.24/hax/perl-additions.c.inc        2021-05-10 
15:39:16.000000000 +0200
@@ -40,7 +40,8 @@
   SvROK_on(sv);
 }
 
-static OP *newPADxVOP(I32 type, PADOFFSET padix, I32 flags, U32 private)
+#define newPADxVOP(type, padix, flags, private)  S_newPADxVOP(aTHX_ type, 
padix, flags, private)
+static OP *S_newPADxVOP(pTHX_ I32 type, PADOFFSET padix, I32 flags, U32 
private)
 {
   OP *op = newOP(type, flags);
   op->op_targ = padix;
@@ -155,3 +156,78 @@
 
   return o;
 }
+
+static char *PL_savetype_name[] = {
+  /* These have been present since 5.16 */
+  [SAVEt_ADELETE]             = "ADELETE",
+  [SAVEt_AELEM]               = "AELEM",
+  [SAVEt_ALLOC]               = "ALLOC",
+  [SAVEt_APTR]                = "APTR",
+  [SAVEt_AV]                  = "AV",
+  [SAVEt_BOOL]                = "BOOL",
+  [SAVEt_CLEARSV]             = "CLEARSV",
+  [SAVEt_COMPILE_WARNINGS]    = "COMPILE_WARNINGS",
+  [SAVEt_COMPPAD]             = "COMPPAD",
+  [SAVEt_DELETE]              = "DELETE",
+  [SAVEt_DESTRUCTOR]          = "DESTRUCTOR",
+  [SAVEt_DESTRUCTOR_X]        = "DESTRUCTOR_X",
+  [SAVEt_FREECOPHH]           = "FREECOPHH",
+  [SAVEt_FREEOP]              = "FREEOP",
+  [SAVEt_FREEPV]              = "FREEPV",
+  [SAVEt_FREESV]              = "FREESV",
+  [SAVEt_GENERIC_PVREF]       = "GENERIC_PVREF",
+  [SAVEt_GENERIC_SVREF]       = "GENERIC_SVREF",
+  [SAVEt_GP]                  = "GP",
+  [SAVEt_GVSV]                = "GVSV",
+  [SAVEt_HELEM]               = "HELEM",
+  [SAVEt_HINTS]               = "HINTS",
+  [SAVEt_HPTR]                = "HPTR",
+  [SAVEt_HV]                  = "HV",
+  [SAVEt_I16]                 = "I16",
+  [SAVEt_I32]                 = "I32",
+  [SAVEt_I32_SMALL]           = "I32_SMALL",
+  [SAVEt_I8]                  = "I8",
+  [SAVEt_INT]                 = "INT",
+  [SAVEt_INT_SMALL]           = "INT_SMALL",
+  [SAVEt_ITEM]                = "ITEM",
+  [SAVEt_IV]                  = "IV",
+  [SAVEt_LONG]                = "LONG",
+  [SAVEt_MORTALIZESV]         = "MORTALIZESV",
+  [SAVEt_NSTAB]               = "NSTAB",
+  [SAVEt_OP]                  = "OP",
+  [SAVEt_PADSV_AND_MORTALIZE] = "PADSV_AND_MORTALIZE",
+  [SAVEt_PARSER]              = "PARSER",
+  [SAVEt_PPTR]                = "PPTR",
+  [SAVEt_REGCONTEXT]          = "REGCONTEXT",
+  [SAVEt_SAVESWITCHSTACK]     = "SAVESWITCHSTACK",
+  [SAVEt_SET_SVFLAGS]         = "SET_SVFLAGS",
+  [SAVEt_SHARED_PVREF]        = "SHARED_PVREF",
+  [SAVEt_SPTR]                = "SPTR",
+  [SAVEt_STACK_POS]           = "STACK_POS",
+  [SAVEt_SVREF]               = "SVREF",
+  [SAVEt_SV]                  = "SV",
+  [SAVEt_VPTR]                = "VPTR",
+
+#if HAVE_PERL_VERSION(5,18,0)
+  [SAVEt_CLEARPADRANGE]       = "CLEARPADRANGE",
+  [SAVEt_GVSLOT]              = "GVSLOT",
+#endif
+
+#if HAVE_PERL_VERSION(5,20,0)
+  [SAVEt_READONLY_OFF]        = "READONLY_OFF",
+  [SAVEt_STRLEN]              = "STRLEN",
+#endif
+
+#if HAVE_PERL_VERSION(5,22,0)
+  [SAVEt_FREEPADNAME]         = "FREEPADNAME",
+#endif
+
+#if HAVE_PERL_VERSION(5,24,0)
+  [SAVEt_TMPSFLOOR]           = "TMPSFLOOR",
+#endif
+
+#if HAVE_PERL_VERSION(5,34,0)
+  [SAVEt_STRLEN_SMALL]        = "STRLEN_SMALL",
+  [SAVEt_HINTS_HH]            = "HINTS_HH",
+#endif
+};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Syntax-Keyword-Try-0.23/hax/perl-backcompat.c.inc 
new/Syntax-Keyword-Try-0.24/hax/perl-backcompat.c.inc
--- old/Syntax-Keyword-Try-0.23/hax/perl-backcompat.c.inc       2021-03-27 
16:36:44.000000000 +0100
+++ new/Syntax-Keyword-Try-0.24/hax/perl-backcompat.c.inc       2021-05-10 
15:39:16.000000000 +0200
@@ -1,4 +1,11 @@
-/* vi: set ft=c inde=: */
+/* vi: set ft=c */
+
+#define HAVE_PERL_VERSION(R, V, S) \
+    (PERL_REVISION > (R) || (PERL_REVISION == (R) && (PERL_VERSION > (V) || 
(PERL_VERSION == (V) && (PERL_SUBVERSION >= (S))))))
+
+#ifndef SvTRUE_NN
+#  define SvTRUE_NN(sv)  SvTRUE(sv)
+#endif
 
 #if !HAVE_PERL_VERSION(5, 18, 0)
 typedef AV PADNAMELIST;
@@ -54,6 +61,11 @@
 #  define OpMORESIB_set(op,sib)  ((op)->op_sibling = (sib))
 #endif
 
+#ifndef OpLASTSIB_set
+   /* older perls don't need to store this at all */
+#  define OpLASTSIB_set(op,parent)
+#endif
+
 #ifndef op_convert_list
 #  define op_convert_list(type, flags, o)  S_op_convert_list(aTHX_ type, 
flags, o)
 static OP *S_op_convert_list(pTHX_ I32 type, I32 flags, OP *o)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/Syntax-Keyword-Try-0.23/lib/Syntax/Keyword/Try/Deparse.pm 
new/Syntax-Keyword-Try-0.24/lib/Syntax/Keyword/Try/Deparse.pm
--- old/Syntax-Keyword-Try-0.23/lib/Syntax/Keyword/Try/Deparse.pm       
1970-01-01 01:00:00.000000000 +0100
+++ new/Syntax-Keyword-Try-0.24/lib/Syntax/Keyword/Try/Deparse.pm       
2021-05-10 15:39:16.000000000 +0200
@@ -0,0 +1,116 @@
+#  You may distribute under the terms of either the GNU General Public License
+#  or the Artistic License (the same terms as Perl itself)
+#
+#  (C) Paul Evans, 2021 -- [email protected]
+
+package Syntax::Keyword::Try::Deparse 0.24;
+
+use v5.14;
+use warnings;
+
+use B qw( opnumber );
+
+require B::Deparse;
+
+use constant {
+   OP_CUSTOM  => opnumber('custom'),
+   OP_ENTER   => opnumber('enter'),
+   OP_LINESEQ => opnumber('lineseq'),
+};
+
+=head1 NAME
+
+C<Syntax::Keyword::Try::Deparse> - L<B::Deparse> support for 
L<Syntax::Keyword::Try>
+
+=head1 DESCRIPTION
+
+Loading this module will apply some hacks onto L<B::Deparse> that attempts to
+provide deparse support for code which uses the syntax provided by
+L<Syntax::Keyword::Try>.
+
+=cut
+
+my $orig_pp_leave;
+{
+   no warnings 'redefine';
+   no strict 'refs';
+   $orig_pp_leave = *{"B::Deparse::pp_leave"}{CODE};
+   *{"B::Deparse::pp_leave"} = \&pp_leave;
+}
+
+sub pp_leave
+{
+   my $self = shift;
+   my ( $op ) = @_;
+
+   my $enter = $op->first;
+   $enter->type == OP_ENTER or
+      return $self->$orig_pp_leave( @_ );
+
+   my $body = $enter->sibling;
+   my $first = $body->first;
+
+   my $finally = "";
+
+   if( $body->type == OP_LINESEQ and $first->name eq "pushfinally" ) {
+      my $finally_cv = $first->sv;
+      $finally = "\nfinally " . $self->deparse_sub( $finally_cv ) . "\cK";
+
+      $first = $first->sibling;
+      $first = $first->sibling while $first and $first->name eq "lineseq";
+
+      # Jump over a scope op
+      if( $first->type == 0 ) {
+         $body  = $first;
+         $first = $first->first;
+      }
+   }
+
+   if( $first->type == OP_CUSTOM and $first->name eq "catch" ) {
+      # This is a try/catch block
+      shift;
+      return $self->deparse( $body, @_ ) . $finally;
+   }
+   elsif( length $finally ) {
+      # Body is the remaining siblings. We'll have to do them all together
+      my $try = B::Deparse::scopeop( 1, $self, $body, 0 );
+
+      return "try {\n\t$try\n\b}" . $finally;
+   }
+
+   return $orig_pp_leave->($self, @_);
+}
+
+sub B::Deparse::pp_catch
+{
+   my $self = shift;
+   my ( $op ) = @_;
+
+   my $tryop   = $op->first;
+   my $catchop = $op->first->sibling;
+
+   my $try = $self->pp_leave($tryop, 0);
+
+   # skip the OP_SCOPE and dive into the OP_LINESEQ inside
+   #
+   # TODO: Try to detect the `catch my $e` variable, though that will be hard
+   # to dishtinguish from actual code that really does that
+   my $catch = $self->deparse($catchop->first, 0);
+
+   return "try {\n\t$try\n\b}\ncatch {\n\t$catch\n\b}\cK";
+}
+
+=head1 TODO
+
+Correctly handle typed dispatch cases
+(C<catch($var isa CLASS)>, C<catch($var =~ m/pattern/)>)
+
+=cut
+
+=head1 AUTHOR
+
+Paul Evans <[email protected]>
+
+=cut
+
+0x55AA;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Syntax-Keyword-Try-0.23/lib/Syntax/Keyword/Try.pm 
new/Syntax-Keyword-Try-0.24/lib/Syntax/Keyword/Try.pm
--- old/Syntax-Keyword-Try-0.23/lib/Syntax/Keyword/Try.pm       2021-03-27 
16:36:44.000000000 +0100
+++ new/Syntax-Keyword-Try-0.24/lib/Syntax/Keyword/Try.pm       2021-05-10 
15:39:16.000000000 +0200
@@ -3,7 +3,7 @@
 #
 #  (C) Paul Evans, 2016-2021 -- [email protected]
 
-package Syntax::Keyword::Try 0.23;
+package Syntax::Keyword::Try 0.24;
 
 use v5.14;
 use warnings;
@@ -44,6 +44,13 @@
 plugins and manipulate optrees to provide new syntax and behaviours for perl
 code.
 
+Syntax similar to this module has now been added to core perl, starting at
+development version 5.33.7, and is expected to become generally available when
+perl 5.34 is released. If you are writing new code, it is suggested that you
+instead use the L<Feature::Compat::Try> module instead, as that will enable
+the core feature on those supported perl versions, falling back to
+C<Syntax::Keyword::Try> on older perls.
+
 =head1 Experimental Features
 
 Some of the features of this module are currently marked as experimental. They
@@ -56,7 +63,7 @@
 
    use Syntax::Keyword::Try qw( try :experimental(typed) );
 
-   use Syntax::Keyword::Try qw( try :experimental(try_value) );
+   use Syntax::Keyword::Try qw( try :experimental(try_value) ); # deprecated
 
    use Syntax::Keyword::Try qw( try :experimental );  # all of the above
 
@@ -219,16 +226,24 @@
 exception, this will be printed as a warning and discarded, leaving C<$@>
 containing the original exception, if one existed.
 
+Note that the C<finally> syntax is not available when using this module via
+L<Feature::Compat::Try>, as it is not expected that syntax will be added to
+the core perl C<'try'> feature. This is because a more general-purpose ability
+may be added instead, under the name C<'defer'>. If you wish to write code
+that may more easily be forward-compatible with that feature instead, you
+should consider using L<Syntax::Keyword::Defer> rather than using C<finally>
+statements.
+
 =head1 VALUE SEMANTICS
 
 =over 4
 
-B<Warning:> the feature described in this section is experimental. This
-experiment has existed for a while, though given that since version 0.22
-the regular C<try> syntax already behaves fine inside a C<do> block, there is
-no longer any reason for this experimental feature to exist. It will start
-printing deprecation warnings in a later version, and eventually will be
-removed.
+B<Warning:> the feature described in this section was experimental and is now
+deprecated. This experiment has existed for a while, though given that since
+version 0.22 the regular C<try> syntax already behaves fine inside a C<do>
+block, there is no longer any reason for this experimental feature to exist.
+It will print a deprecation warning, and eventually will be removed in a later
+version. You should use C<do { try ... }> instead.
 
 Additionally, on I<perl> versions 5.18 and later, it will produce a warning
 in the C<experimental> category.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Syntax-Keyword-Try-0.23/lib/Syntax/Keyword/Try.xs 
new/Syntax-Keyword-Try-0.24/lib/Syntax/Keyword/Try.xs
--- old/Syntax-Keyword-Try-0.23/lib/Syntax/Keyword/Try.xs       2021-03-27 
16:36:44.000000000 +0100
+++ new/Syntax-Keyword-Try-0.24/lib/Syntax/Keyword/Try.xs       2021-05-10 
15:39:16.000000000 +0200
@@ -7,8 +7,7 @@
 #include "perl.h"
 #include "XSUB.h"
 
-#define HAVE_PERL_VERSION(R, V, S) \
-    (PERL_REVISION > (R) || (PERL_REVISION == (R) && (PERL_VERSION > (V) || 
(PERL_VERSION == (V) && (PERL_SUBVERSION >= (S))))))
+#include "perl-backcompat.c.inc"
 
 #if HAVE_PERL_VERSION(5,32,0)
 #  define HAVE_OP_ISA
@@ -28,8 +27,6 @@
 #  include "wrap_keyword_plugin.c.inc"
 #endif
 
-#include "perl-backcompat.c.inc"
-
 #include "lexer-additions.c.inc"
 
 #include "perl-additions.c.inc"
@@ -440,6 +437,9 @@
         "'try do' syntax is experimental and may be changed or removed without 
notice");
     }
 #endif
+
+    Perl_ck_warner(aTHX_ packWARN(WARN_DEPRECATED),
+      "'try do' syntax is deprecated and will be removed. Use  do { try ... }  
instead");
   }
 
   if(lex_peek_unichar(0) != '{')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Syntax-Keyword-Try-0.23/t/20try-do.t 
new/Syntax-Keyword-Try-0.24/t/20try-do.t
--- old/Syntax-Keyword-Try-0.23/t/20try-do.t    2021-03-27 16:36:44.000000000 
+0100
+++ new/Syntax-Keyword-Try-0.24/t/20try-do.t    2021-05-10 15:39:16.000000000 
+0200
@@ -10,6 +10,8 @@
 no if HAVE_WARN_EXPERIMENTAL, warnings => 'experimental';
 use Syntax::Keyword::Try qw( try try_value );
 
+no warnings 'deprecated';
+
 # try do { } yields result
 {
    is( try do { "result" } catch ($e) {},
@@ -56,11 +58,13 @@
       'Plain do { ... } unaffected' );
 }
 
-# try do syntax produces experimental warnings
+# try do syntax produces experimental and deprecated warnings
 SKIP: {
    use if HAVE_WARN_EXPERIMENTAL, warnings => 'experimental';
    skip "No 'experimental' warnings category", 1 unless HAVE_WARN_EXPERIMENTAL;
 
+   use warnings 'deprecated';
+
    my $warnings = "";
    local $SIG{__WARN__} = sub { $warnings .= join "", @_ };
 
@@ -68,9 +72,13 @@
 
    like( $warnings, qr/^'try do' syntax is experimental/,
       'try do syntax produces experimental warnings' );
+   like( $warnings, qr/^'try do' syntax is deprecated /m,
+      'try do syntax produces deprecated warnings' );
 
    # warning can be disabled
    use Syntax::Keyword::Try qw( :experimental(try_value) );
+   no warnings 'deprecated';
+
    $warnings = "";
 
    eval "try do { 3 } catch (\$e) { 4 }" or die $@;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Syntax-Keyword-Try-0.23/t/21try-do-finally.t 
new/Syntax-Keyword-Try-0.24/t/21try-do-finally.t
--- old/Syntax-Keyword-Try-0.23/t/21try-do-finally.t    2021-03-27 
16:36:44.000000000 +0100
+++ new/Syntax-Keyword-Try-0.24/t/21try-do-finally.t    2021-05-10 
15:39:16.000000000 +0200
@@ -14,6 +14,8 @@
 no if HAVE_WARN_EXPERIMENTAL, warnings => 'experimental';
 use Syntax::Keyword::Try qw( try try_value );
 
+no warnings 'deprecated';
+
 # try do { } finally { }
 {
    my $x;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Syntax-Keyword-Try-0.23/t/70deparse.t 
new/Syntax-Keyword-Try-0.24/t/70deparse.t
--- old/Syntax-Keyword-Try-0.23/t/70deparse.t   1970-01-01 01:00:00.000000000 
+0100
+++ new/Syntax-Keyword-Try-0.24/t/70deparse.t   2021-05-10 15:39:16.000000000 
+0200
@@ -0,0 +1,54 @@
+#!/usr/bin/perl
+
+use v5.14;
+use warnings;
+
+use Test::More;
+
+use Syntax::Keyword::Try;
+use Syntax::Keyword::Try::Deparse;
+
+use B::Deparse;
+my $deparser = B::Deparse->new();
+
+sub is_deparsed
+{
+   my ( $sub, $exp, $name ) = @_;
+
+   my $got = $deparser->coderef2text( $sub );
+
+   # Deparsed output is '{ ... }'-wrapped
+   $got = ( $got =~ m/^{\n(.*)\n}$/s )[0];
+   $got =~ s/^    //mg;
+
+   # Deparsed output will have a lot of pragmata and so on
+   1 while $got =~ s/^\s*(?:use|no) \w+.*\n//;
+   $got =~ s/^BEGIN \{\n.*?\n\}\n//s;
+
+   # Trim a trailing linefeed
+   chomp $got;
+
+   is( $got, $exp, $name );
+}
+
+is_deparsed
+   sub { try { ABC() } catch { DEF() } },
+   "try {\n    ABC();\n}\ncatch {\n    DEF();\n}",
+   'try/catch';
+
+is_deparsed
+   sub { try { ABC() } catch($e) { DEF() } },
+   "try {\n    ABC();\n}\ncatch {\n    my \$e = \$@;\n    DEF();\n}",
+   'try/catch(VAR)';
+
+is_deparsed
+   sub { try { ABC() } finally { XYZ() } },
+   "try {\n    ABC();\n}\nfinally {\n    XYZ();\n}",
+   'try/finally';
+
+is_deparsed
+   sub { try { ABC() } catch { DEF() } finally { XYZ() } },
+   "try {\n    ABC();\n}\ncatch {\n    DEF();\n}\nfinally {\n    XYZ();\n}",
+   'try/catch/finally';
+
+done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Syntax-Keyword-Try-0.23/t/80await+SKT.t 
new/Syntax-Keyword-Try-0.24/t/80await+SKT.t
--- old/Syntax-Keyword-Try-0.23/t/80await+SKT.t 2021-03-27 16:36:44.000000000 
+0100
+++ new/Syntax-Keyword-Try-0.24/t/80await+SKT.t 2021-05-10 15:39:16.000000000 
+0200
@@ -8,9 +8,9 @@
 BEGIN {
    plan skip_all => "Future is not available"
       unless eval { require Future };
-   plan skip_all => "Future::AsyncAwait >= 0.10 is not available"
+   plan skip_all => "Future::AsyncAwait >= 0.50 is not available"
       unless eval { require Future::AsyncAwait;
-                    Future::AsyncAwait->VERSION( '0.10' ) };
+                    Future::AsyncAwait->VERSION( '0.50' ) };
    plan skip_all => "Syntax::Keyword::Try >= 0.22 is not available"
       unless eval { require Syntax::Keyword::Try;
                     Syntax::Keyword::Try->VERSION( '0.22' ) };
@@ -123,6 +123,26 @@
    is( scalar $fret->get, "TF", '$fret for await in try/finally' );
 }
 
+# finally still runs for cancel (RT135351)
+{
+   my $ok;
+   my $f1 = Future->new;
+   my $fret = (async sub {
+      try {
+         await $f1;
+      }
+      finally {
+         $ok++;
+      }
+   })->();
+
+   ok( !$ok, 'defer {} not run before ->cancel' );
+
+   $fret->cancel;
+
+   ok( $ok, 'defer {} was run after ->cancel' );
+}
+
 # await in toplevel try
 {
    try {

Reply via email to