So that they're cloned later, which seems to fix some strange issues that arose with
a5339a6ced4d5e3ad1541320476c3d6bf8ff9408 when the default callbacks were no longer capturing an external pad (which used to make them eligible for cloning).
This fixes RT #47902.
t/99-kwalitee.t
t/lib/indirect/Test0/Fffff/Vvvvvvv.pm
t/lib/indirect/Test0/Oooooo/Pppppppp.pm
+t/lib/indirect/Test1/il1.pm
+t/lib/indirect/Test1/il2.pm
t/lib/indirect/TestRequired1.pm
t/lib/indirect/TestRequired2.pm
# define SvPVX_const SvPVX
#endif
+#ifndef SvREFCNT_inc_simple_NN
+# define SvREFCNT_inc_simple_NN SvREFCNT_inc
+#endif
+
#ifndef sv_catpvn_nomg
# define sv_catpvn_nomg sv_catpvn
#endif
STATIC SV *indirect_tag(pTHX_ SV *value) {
#define indirect_tag(V) indirect_tag(aTHX_ (V))
indirect_hint_t *h;
+ SV *code = NULL;
dMY_CXT;
- value = SvOK(value) && SvROK(value) ? SvRV(value) : NULL;
+ if (SvOK(value) && SvROK(value)) {
+ value = SvRV(value);
+ if (SvTYPE(value) >= SVt_PVCV) {
+ code = value;
+ if (CvANON(code) && !CvCLONED(code))
+ CvCLONE_on(code);
+ SvREFCNT_inc_simple_NN(code);
+ }
+ }
h = PerlMemShared_malloc(sizeof *h);
- h->code = SvREFCNT_inc(value);
+ h->code = code;
#if I_WORKAROUND_REQUIRE_PROPAGATION
{
my $tests;
BEGIN { $tests = 18 }
-use Test::More tests => 1 + $tests + 1 + 2 + 3 + 5;
+use Test::More tests => 1 + $tests + 1 + 2 + 3 + 5 + 1;
use lib 't/lib';
is_deeply \@w, [ ], 'second require test doesn\'t have more errors';
}
+{
+ eval <<' SNIP';
+ return;
+ no indirect ':fatal';
+ use indirect::Test1::il1 ();
+ use indirect::Test1::il2 ();
+ SNIP
+ is $@, '', 'RT #47902';
+}
+
__DATA__
my $a = new P1;
--- /dev/null
+no indirect ":fatal";
+
+1;
--- /dev/null
+package indirect::Test1::il2;
+import indirect::Test1::il2;
+1;