From 00169e2cdde29138824a7bf6b66d5875aaa8278d Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Fri, 29 Oct 2010 20:45:34 -0700 Subject: Switch the core MRO code over to HvENAME MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This has the side-effect of fixing these one-liners: $ perl5.13.5 -le' my $glob = \*foo::ISA; delete $::{"foo::"}; *$glob = *a' Bus error $ perl5.13.5 -le' my $glob = \*foo::ISA; delete $::{"foo::"}; *$glob = []' Bus error $ perl5.13.6 -le'sub baz; my $glob = \*foo::bar; delete $::{"foo::"}; *$glob = *baz;' Bus error $ perl5.13.6 -le'sub foo::bar; my $glob = \*foo::bar; delete $::{"foo::"}; *$glob = *baz;' Bus error In the first two cases the crash was inadvertently fixed (isn’t it nice when that happens?) in 5.13.6 (by 6f86b615fa7), but there was still a fatal error: Can't call mro_isa_changed_in() on anonymous symbol table at -e line 1. Because sv_clear calls ->DESTROY, if an object’s stash has been detached from the symbol table, mro_get_linear_isa can be called on a hash with no HvENAME. So HvNAME is used as a fallback for those cases. --- mg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mg.c') diff --git a/mg.c b/mg.c index 03ff000325..4a1a72b668 100644 --- a/mg.c +++ b/mg.c @@ -1630,7 +1630,9 @@ Perl_magic_clearisa(pTHX_ SV *sv, MAGIC *mg) : (const GV *)mg_find(mg->mg_obj, PERL_MAGIC_isa)->mg_obj ); - if (stash) + /* The stash may have been detached from the symbol table, so check its + name before doing anything. */ + if (stash && HvENAME_get(stash)) mro_isa_changed_in(stash); return 0; -- cgit v1.2.1