From ef4ac48db70f6d8dcaa21e6b67e7fbec7a50cf7b Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Sat, 4 Mar 2023 08:54:04 +0100 Subject: t/ - Given is deprecated in 5.37.10, do not test it This silences vast numbers of warnings, and will prevent the module from breaking in 5.42. --- t/05-words.t | 7 +++++-- t/13-reap-ctl.t | 2 ++ t/23-localize-ctl.t | 2 ++ t/55-yield-target.t | 2 ++ t/lib/Scope/Upper/TestGenerator.pm | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/t/05-words.t b/t/05-words.t index 9fe39ff..a5acb6b 100644 --- a/t/05-words.t +++ b/t/05-words.t @@ -339,8 +339,11 @@ $var =~ s{.}{do { my $x; UP }}e; is $var, 1, 'subst : do block preserved' unless $^P; SKIP: { - skip 'Perl 5.10 required to test given/when' => 4 * ($^P ? 4 : 5) + 4 - if "$]" < 5.010; + my $skip_count = 4 * ($^P ? 4 : 5) + 4; + skip 'Perl 5.10 required to test given/when' + => $skip_count if "$]" < 5.010; + skip 'Not testing deprecated given/when on Perl 5.37.10 or later' + => $skip_count if "$]" >= 5.037010; eval <<'TEST_GIVEN'; BEGIN { diff --git a/t/13-reap-ctl.t b/t/13-reap-ctl.t index 085cc05..d7a7f14 100644 --- a/t/13-reap-ctl.t +++ b/t/13-reap-ctl.t @@ -138,6 +138,8 @@ $y = undef; SKIP: { skip 'Perl 5.10 required to test given/when' => 30 if "$]" < 5.010; + skip 'Not testing deprecated given/when on Perl 5.37.10 or later' + => 30 if "$]" >= 5.037010; eval <<' GIVEN_TEST_1'; BEGIN { diff --git a/t/23-localize-ctl.t b/t/23-localize-ctl.t index b72be22..aaefdb6 100644 --- a/t/23-localize-ctl.t +++ b/t/23-localize-ctl.t @@ -191,6 +191,8 @@ $y = undef; SKIP: { skip 'Perl 5.10 required to test given/when' => 30 if "$]" < 5.010; + skip 'Not testing deprecated given/when on Perl 5.37.10 or later' + => 30 if "$]" >= 5.037010; eval <<' GIVEN_TEST_1'; BEGIN { diff --git a/t/55-yield-target.t b/t/55-yield-target.t index ced05c8..682d4cc 100644 --- a/t/55-yield-target.t +++ b/t/55-yield-target.t @@ -81,6 +81,8 @@ SKIP: { SKIP: { skip 'perl 5.10 is required to test interaction with given/when' => 6 if "$]" < 5.010; + skip 'Not testing deprecated given/when on Perl 5.37.10 or later' + => 6 if "$]" >= 5.037010; @res = eval <<'TESTCASE'; BEGIN { diff --git a/t/lib/Scope/Upper/TestGenerator.pm b/t/lib/Scope/Upper/TestGenerator.pm index b4f6e1b..df175ac 100644 --- a/t/lib/Scope/Upper/TestGenerator.pm +++ b/t/lib/Scope/Upper/TestGenerator.pm @@ -32,7 +32,7 @@ my @blocks = ( [ 'eval q[', '];' ], ); -push @blocks, [ 'given (1) {', '}' ] if "$]" >= 5.010_001; +push @blocks, [ 'given (1) {', '}' ] if "$]" >= 5.010_001 and "$]" < 5.037_010; my %exports = ( verbose_is => \&verbose_is, -- cgit v1.2.3 From c8fb3ada01d8c1a6ac1a37778edb0fc9164d7bf1 Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Sat, 4 Mar 2023 09:00:37 +0100 Subject: Upper.xs - in 5.37.6 cop_warnings became a char * (RCVP) It is actually a RCPV (RefCounted PV), so we can use RCPV_LEN() to find its length. Unfortunately there is not currently a way to "mortalize" a RCPV, an oversight that I will correct in a future release of Perl. But for now this should do. --- Upper.xs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Upper.xs b/Upper.xs index 0c762de..7d994fc 100644 --- a/Upper.xs +++ b/Upper.xs @@ -3136,7 +3136,9 @@ PPCODE: /* warnings (9) */ { SV *mask = NULL; -#if XSH_HAS_PERL(5, 9, 4) +#if XSH_HAS_PERL(5, 37, 6) + char *old_warnings = cop->cop_warnings; +#elif XSH_HAS_PERL(5, 9, 4) STRLEN *old_warnings = cop->cop_warnings; #else SV *old_warnings = cop->cop_warnings; @@ -3169,7 +3171,9 @@ context_info_warnings_on: if (!mask) mask = su_newmortal_pvn(WARN_ALLstring, WARNsize); } else { -#if XSH_HAS_PERL(5, 9, 4) +#if XSH_HAS_PERL(5, 37, 6) + mask = su_newmortal_pvn((char *) old_warnings, RCPV_LEN(old_warnings)); +#elif XSH_HAS_PERL(5, 9, 4) mask = su_newmortal_pvn((char *) (old_warnings + 1), old_warnings[0]); #else mask = sv_mortalcopy(old_warnings); -- cgit v1.2.3 From 20d82307d02d72e3b5e73cfa40588b3af52d81d4 Mon Sep 17 00:00:00 2001 From: Vincent Pit Date: Sun, 26 Mar 2023 14:51:59 +0200 Subject: Add a CONTRIBUTING guidelines file --- CONTRIBUTING | 39 +++++++++++++++++++++++++++++++++++++++ MANIFEST | 1 + 2 files changed, 40 insertions(+) create mode 100644 CONTRIBUTING diff --git a/CONTRIBUTING b/CONTRIBUTING new file mode 100644 index 0000000..ddc995a --- /dev/null +++ b/CONTRIBUTING @@ -0,0 +1,39 @@ +Contributing guildelines for the Scope-Upper distribution + +Patch submissions guidelines : +- Patches VERY MUCH SHOULD be generated with "git format-patch". + If that's really not possible, make sure your patches apply cleanly in the + distribution directory. +- Single patches MUST be submitted to the bugtracker. + Open a ticket and add your patch as an attachment. +- Series of patches CAN be submitted as a public feature branch. + You can clone the directory wherever you want and point me to your remote + branch as long as I don't need to log in. + +C/XS-related guidelines : +- C code MUST be kept ANSI-compliant. + Older perl versions may have been built with a C compiler that does not + support C99 features (plus they are mostly useless except for restrict). + In particular, this means no C99 comments, no mixed declaration and code, + and no C++ void* casts. +- XS code MUST be buildable with any perl matching the META requirements. + If needed, wrap your code around with the XSH_HAS_PERL(x, y, z) macro. + +Tests-related guidelines : +- Patches MUST be tested before being sent. + Make sure the distribution builds and tests correctly. +- Patches that add version-specific code MUST be tested with at least + one perl release matching each version interval. + That is, if you add new code specific to perl 5.34 and above, then you + have to test it with a pre-5.34 perl (e.g. 5.32) and a post-5.34 perl + (e.g. 5.34). +- C/XS patches MUST be tested with a threaded perl regardless of how much you + dislike perl threads. + Testing with a threaded perl makes sure your code can build in many more + situations. Memory issues are also more easily spotted. +- Bugfixes SHOULD come with a regression test. + Add it to an existing .t file or create your own. + +What you don't need to do : +- DON'T update the Changes file. +- DON'T run author tests. diff --git a/MANIFEST b/MANIFEST index 8885f4b..f3c0edf 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,3 +1,4 @@ +CONTRIBUTING Changes MANIFEST META.json -- cgit v1.2.3 From b8097cede97532068ee636c926a09939965720c0 Mon Sep 17 00:00:00 2001 From: Vincent Pit Date: Sun, 26 Mar 2023 14:54:19 +0200 Subject: Bump copyright year --- lib/Scope/Upper.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Scope/Upper.pm b/lib/Scope/Upper.pm index d35eefd..4fdb39b 100644 --- a/lib/Scope/Upper.pm +++ b/lib/Scope/Upper.pm @@ -865,7 +865,7 @@ Thanks to Shawn M. Moore for motivation. =head1 COPYRIGHT & LICENSE -Copyright 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2021 Vincent Pit, all rights reserved. +Copyright 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2021,2023 Vincent Pit, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. -- cgit v1.2.3 From 2a6c48705317d18cf843a0a538e89f7a9e5d6ba2 Mon Sep 17 00:00:00 2001 From: Vincent Pit Date: Sun, 26 Mar 2023 17:24:28 +0200 Subject: Fix assertion failure on 5.37.10 Seems like PL_curpad[0] doesn't have an excessive refcount anymore. --- Upper.xs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Upper.xs b/Upper.xs index 7d994fc..7be4f69 100644 --- a/Upper.xs +++ b/Upper.xs @@ -2034,9 +2034,11 @@ static int su_uplevel_runops_hook_entersub(pTHX) { AvFILLp(av) = fill; } +#if !XSH_HAS_PERL(5, 37, 10) /* should be referenced by PL_curpad[0] and *_ */ assert(SvREFCNT(PL_curpad[0]) > 1); SvREFCNT_dec(PL_curpad[0]); +#endif PL_curpad[0] = (SV *) av; } -- cgit v1.2.3 From 06d56a7d75a0691e8cdc82f75841b4fcd5d8f7c9 Mon Sep 17 00:00:00 2001 From: Vincent Pit Date: Sun, 26 Mar 2023 17:29:54 +0200 Subject: Work around test failures in t/64-uplevel-caller.t This is probably related to the caller behaviour change re-re-introduced with core commit f6387cf. --- t/64-uplevel-caller.t | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/t/64-uplevel-caller.t b/t/64-uplevel-caller.t index 50a44d7..575ed3d 100644 --- a/t/64-uplevel-caller.t +++ b/t/64-uplevel-caller.t @@ -12,14 +12,18 @@ sub callstack { my $i = 1; my @stack; while (1) { - my @c = $check_args ? do { package DB; caller($i++) } - : caller($i++); + my @c = $check_args ? do { + my $frame = ("$]" >= 5.037_010) ? ($i + 1) : $i; + package DB; + caller($frame) + } : caller($i); last unless @c; if ($check_args) { my $args = $c[4] ? [ @DB::args ] : undef; push @c, $args; } push @stack, \@c; + ++$i; } return \@stack; } -- cgit v1.2.3 From 2d6e98ca9b8fd44cc4a4575fda08d045da8d43e5 Mon Sep 17 00:00:00 2001 From: Vincent Pit Date: Sun, 26 Mar 2023 18:00:16 +0200 Subject: This is 0.34 --- Changes | 13 +++++++++++++ META.json | 6 +++--- META.yml | 4 ++-- README | 6 +++--- lib/Scope/Upper.pm | 4 ++-- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Changes b/Changes index cd12fdd..3ebf9d5 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,18 @@ Revision history for Scope-Upper +0.34 2023-03-26 16:00 UTC + + Add : Contributing guidelines are now listed in the new + CONTRIBUTING file. + + Fix : [RT #146897] Scope::Upper does not know about RCPV + cop_warnings, and does not know that given is deprecated. + "given" related warnings were silenced, and the new RCPV + interface is now used. + Thanks Yves Orton for reporting and contributing a fix. + + Fix : Assertion failures triggering on perl version 5.37.10 and + higher with DEBUGGING enabled. + + Fix : t/64-uplevel-caller.t has been taught about the new call frame + numbering convention. + 0.33 2021-12-20 20:30 UTC + Fix : [RT #114816] resources/remote/url points to web interface META files now follow version 2.0 of the CPAN META spec. diff --git a/META.json b/META.json index f3ea0a8..f842869 100644 --- a/META.json +++ b/META.json @@ -4,7 +4,7 @@ "Vincent Pit " ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.62, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.66, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], @@ -61,6 +61,6 @@ "web" : "http://git.vpit.fr/?p=perl%2Fmodules%2FScope-Upper.git" } }, - "version" : "0.33", - "x_serialization_backend" : "JSON::PP version 4.06" + "version" : "0.34", + "x_serialization_backend" : "JSON::PP version 4.16" } diff --git a/META.yml b/META.yml index ac67f34..e67cc70 100644 --- a/META.yml +++ b/META.yml @@ -13,7 +13,7 @@ build_requires: configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.62, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.66, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -33,5 +33,5 @@ resources: homepage: http://search.cpan.org/dist/Scope-Upper/ license: http://dev.perl.org/licenses/ repository: http://git.vpit.fr/perl/modules/Scope-Upper.git/ -version: '0.33' +version: '0.34' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff --git a/README b/README index bb108eb..1f7b09e 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ NAME Scope::Upper - Act on upper scopes. VERSION - Version 0.33 + Version 0.34 SYNOPSIS "reap", "localize", "localize_elem", "localize_delete" and "WORDS" : @@ -824,8 +824,8 @@ ACKNOWLEDGEMENTS COPYRIGHT & LICENSE Copyright - 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2021 Vincent - Pit, all rights reserved. + 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2021,2023 + Vincent Pit, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Scope/Upper.pm b/lib/Scope/Upper.pm index 4fdb39b..49d2aa4 100644 --- a/lib/Scope/Upper.pm +++ b/lib/Scope/Upper.pm @@ -11,13 +11,13 @@ Scope::Upper - Act on upper scopes. =head1 VERSION -Version 0.33 +Version 0.34 =cut our $VERSION; BEGIN { - $VERSION = '0.33'; + $VERSION = '0.34'; } =head1 SYNOPSIS -- cgit v1.2.3