Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gv.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ S_maybe_add_coresub(pTHX_ HV * const stash, GV *gv,
get hairy. */
cv = MUTABLE_CV(newSV_type(SVt_PVCV));
GvCV_set(gv,cv);
assert(GvCVGEN(gv) == 0);
GvCVGEN(gv) = 0;
CvISXSUB_on(cv);
CvXSUB(cv) = core_xsub;
PoisonPADLIST(cv);
Expand Down
2 changes: 1 addition & 1 deletion op.c
Original file line number Diff line number Diff line change
Expand Up @@ -12320,7 +12320,7 @@ Perl_newSTUB(pTHX_ GV *gv, bool fake)
PERL_ARGS_ASSERT_NEWSTUB;
assert(!GvCVu(gv));
GvCV_set(gv, cv);
assert(GvCVGEN(gv) == 0);
GvCVGEN(gv) = 0;
if (!fake && GvSTASH(gv) && HvENAME_HEK(GvSTASH(gv)))
gv_method_changed(gv);
if (SvFAKE(gv)) {
Expand Down
21 changes: 20 additions & 1 deletion t/op/stash.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ BEGIN {
set_up_inc( qw(../lib) );
}

plan( tests => 55 );
plan( tests => 56 );

# Used to segfault (bug #15479)
fresh_perl_like(
Expand Down Expand Up @@ -356,3 +356,22 @@ is runperl(
),
"*main::main::\n",
"[perl #129869] lookup %:: by name after clearing %::";

is runperl(
prog => 'no strict q|refs|;
Stash->can(q|Trash|);
my $full_method = q|Stash::Trash|;
# Save method
my $mocked = \&{$full_method};
# Replace method
*{$full_method} = sub {};
# Restore original method
*{$full_method} = $mocked;
# Stash::Trash should now be undefined
my $coderef = sub { Stash::Trash() };
$coderef->();
',
stderr => 1,
),
"Undefined subroutine &Stash::Trash called at -e line 11.\n",
"[GH#23855], [GH#23856] Don't assume GvCVGEN(gv) value";
Loading