From ab4d4879e4d79963b30f7d3cc0237d79ad490310 Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Thu, 25 Aug 2022 17:25:13 +0200 Subject: [PATCH] dist/threads/shared.pm - use attributes.pm explicitly It seems it is possible that we load the attributes XS code without loading the .pm code first. This causes threads/t/kill.t to die with an error about XS version mismatch. Explicitly loading the attributes module from threads::shared seems to fix the problem. This resolves #20155. --- MANIFEST | 1 + dist/threads-shared/lib/threads/shared.pm | 6 ++--- dist/threads-shared/t/version.t | 28 +++++++++++++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 dist/threads-shared/t/version.t diff --git a/MANIFEST b/MANIFEST index c5aae3059971..25fbdba95276 100644 --- a/MANIFEST +++ b/MANIFEST @@ -4079,6 +4079,7 @@ dist/threads-shared/t/stress.t Stress test dist/threads-shared/t/sv_refs.t thread shared variables dist/threads-shared/t/sv_simple.t thread shared variables dist/threads-shared/t/utf8.t Test UTF-8 keys in shared hashes +dist/threads-shared/t/version.t Test that pod version matches code version. dist/threads-shared/t/wait.t Test cond_wait and cond_timedwait dist/threads-shared/t/waithires.t Test sub-second cond_timedwait dist/Tie-File/ChangeLog Tie::File diff --git a/dist/threads-shared/lib/threads/shared.pm b/dist/threads-shared/lib/threads/shared.pm index bd89c30b3fa6..3e39c5691191 100644 --- a/dist/threads-shared/lib/threads/shared.pm +++ b/dist/threads-shared/lib/threads/shared.pm @@ -4,11 +4,11 @@ use 5.008; use strict; use warnings; +use attributes; use Config; - use Scalar::Util qw(reftype refaddr blessed); -our $VERSION = '1.65'; # Please update the pod, too. +our $VERSION = '1.66'; # Please update the pod, too. my $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -196,7 +196,7 @@ threads::shared - Perl extension for sharing data structures between threads =head1 VERSION -This document describes threads::shared version 1.64 +This document describes threads::shared version 1.66 =head1 SYNOPSIS diff --git a/dist/threads-shared/t/version.t b/dist/threads-shared/t/version.t new file mode 100644 index 000000000000..eef8b593e571 --- /dev/null +++ b/dist/threads-shared/t/version.t @@ -0,0 +1,28 @@ +use strict; +use warnings; +use Test::More; + +BEGIN { + use Config; + if (! $Config{'useithreads'}) { + print("1..0 # SKIP Perl not compiled with 'useithreads'\n"); + exit(0); + } +} + +use threads::shared; + +# test that the version documented in threads.pm pod matches +# that of the code. + +open my $fh, "<", $INC{"threads/shared.pm"} + or die qq(Failed to open '$INC{"threads/shared.pm"}': $!); +my $file= do { local $/; <$fh> }; +close $fh; +my $pod_version = 0; +if ($file=~/This document describes threads::shared version (\d.\d+)/) { + $pod_version = $1; +} +is($pod_version, $threads::shared::VERSION, + "Check that pod and \$threads::shared::VERSION match"); +done_testing();