Skip to content

Commit

Permalink
don't clear IOK on @{"_<$file"} entries when a dbstate is freed
Browse files Browse the repository at this point in the history
These are meant to be IOK even when non-breakable, and I broke that
when fixing Perl#19198.

Fixes Perl#21564
  • Loading branch information
tonycoz committed Oct 17, 2023
1 parent 65038fe commit 99affa5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
24 changes: 24 additions & 0 deletions lib/perl5db.t
Original file line number Diff line number Diff line change
Expand Up @@ -3296,6 +3296,30 @@ EOS
"[github #19198] check we stopped correctly");
}

{
# https://github.com/Perl/perl5/issues/21564
# not a debugger bug, but with the way the fix for #19198 was broken
# this needs to be tested with a debugger of some sort (even a no-op
# debugger) so test it here.
my $wrapper = DebugWrap->new(
{
cmds =>
[
'c', # just run it, we check the output of the code
'q'
],
prog => \<<'EOS',
use v5.12;
no strict;
use B qw(svref_2object SVf_IOK);
my $sv = svref_2object(\(${"_<$0"}[3])); # the "use B;" line
say +($sv->FLAGS & SVf_IOK) ? "OK" : "FAIL";
EOS
}
);
$wrapper->output_like(qr/\bOK\b/, "check the line is IOK");
}

done_testing();

END {
Expand Down
1 change: 0 additions & 1 deletion op.c
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,6 @@ S_cop_free(pTHX_ COP* cop)
if (av) {
SV * const * const svp = av_fetch(av, CopLINE(cop), FALSE);
if (svp && *svp != &PL_sv_undef && SvIVX(*svp) == PTR2IV(cop) ) {
(void)SvIOK_off(*svp);
SvIV_set(*svp, 0);
}
}
Expand Down

0 comments on commit 99affa5

Please sign in to comment.