commit
043e41b8 (29765), which made tr// threadsafe by moving the
swash into the pad, didn't mark the pad SV as read-only, so it was getting
removed from anon sub prototypes
SvREFCNT_dec(PAD_SVl(cPADOPo->op_padix));
PAD_SETSV(cPADOPo->op_padix, swash);
SvPADTMP_on(swash);
+ SvREADONLY_on(swash);
#else
cSVOPo->op_sv = swash;
#endif
require './test.pl';
}
-plan tests => 118;
+plan tests => 119;
my $Is_EBCDIC = (ord('i') == 0x89 & ord('J') == 0xd1);
$s =~ tr/i//;
ok( Internals::SvREADONLY($s), "count-only tr doesn't deCOW COWs" );
}
+
+# [ RT #61520 ]
+#
+# under threads, unicode tr within a cloned closure would SEGV or assert
+# fail, since the pointer in the pad to the swash was getting zeroed out
+# in the proto-CV
+
+{
+ my $x = "\x{142}";
+ sub {
+ $x =~ tr[\x{142}][\x{143}];
+ }->();
+ is($x,"\x{143}", "utf8 + closure");
+}
+
+