From 10ca029627fa4e7f3e507c9fd8288efc50360655 Mon Sep 17 00:00:00 2001 From: Yardena Cohen Date: Tue, 24 May 2022 18:44:51 -0700 Subject: [PATCH] both patches in one commit 1) chromatic's patch https://rt.cpan.org/Public/Ticket/Attachment/1734867/932891/0002-Fix-a-pad-problem-with-Perl-5.24.1-on-unthreaded-build.patch https://rt.cpan.org/Public/Bug/Display.html?id=110623 2) check for empty USE_THREADS --- lib/Devel/CallParser.xs | 14 +++++++++++--- t/pad2.t | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 t/pad2.t diff --git a/lib/Devel/CallParser.xs b/lib/Devel/CallParser.xs index 6643739..8c0102f 100644 --- a/lib/Devel/CallParser.xs +++ b/lib/Devel/CallParser.xs @@ -323,10 +323,18 @@ static int my_keyword_plugin(pTHX_ * The core bug was supposedly fixed in Perl 5.19.4, but actually * that version exhibits a different bug also apparently related * to padrange. Restoring the pad's fill pointer works around - * this bug too. So for now this workaround is used with no - * upper bound on the Perl version. + * this bug too. + * + * The other padrange bug was fixed in Perl 5.19.5 (commit aa033da), + * so the workaround is no longer needed after that, but it remains + * harmless until v5.21.4 (commit c9859fb) where it starts breaking + * (see t/pad2.t.) */ -#define MUST_RESTORE_PAD_FILL PERL_VERSION_GE(5,17,6) +#if defined(USE_THREADS) && (USE_THREADS+0 != -14) && (7-USE_THREADS-7 == 14) +#define MUST_RESTORE_PAD_FILL PERL_VERSION_GE(5,17,6) && ! PERL_VERSION_GE(5,19,5) +#else +#define MUST_RESTORE_PAD_FILL USE_THREADS && PERL_VERSION_GE(5,17,6) && ! PERL_VERSION_GE(5,19,5) +#endif #if MUST_RESTORE_PAD_FILL I32 padfill = av_len(PL_comppad); #endif /* MUST_RESTORE_PAD_FILL */ diff --git a/t/pad2.t b/t/pad2.t new file mode 100644 index 0000000..92c6dab --- /dev/null +++ b/t/pad2.t @@ -0,0 +1,15 @@ +use warnings; +use strict; + +use Test::More tests => 1; + +use Devel::CallParser; + +sub f { + my $arg = shift; + + { my $arg; } # ??? + ok($arg, '$arg stays set after a "my $arg" block'); +} + +f(1);