This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
ex-PVBM and mro interact badly
authorBen Morrow <ben@morrow.me.uk>
Mon, 15 Oct 2007 22:56:16 +0000 (23:56 +0100)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Wed, 17 Oct 2007 08:08:04 +0000 (08:08 +0000)
Message-ID: <20071015215616.GA43800@osiris.mauzo.dyndns.org>

p4raw-id: //depot/perl@32119

hv.c
t/op/hash.t

diff --git a/hv.c b/hv.c
index 95df7c8..c8279d8 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -1450,7 +1450,7 @@ Perl_hv_free_ent(pTHX_ HV *hv, register HE *entry)
     if (!entry)
        return;
     val = HeVAL(entry);
-    if (val && isGV(val) && GvCVu(val) && HvNAME_get(hv))
+    if (val && isGV(val) && isGV_with_GP(val) && GvCVu(val) && HvNAME_get(hv))
         mro_method_changed_in(hv);     /* deletion of method from stash */
     SvREFCNT_dec(val);
     if (HeKLEN(entry) == HEf_SVKEY) {
index 6e1b4da..9bde518 100644 (file)
@@ -8,7 +8,7 @@ BEGIN {
 
 use strict;
 
-plan tests => 5;
+plan tests => 6;
 
 my %h;
 
@@ -109,3 +109,12 @@ sub hash {
     $u += $u << 15; $u %= MASK_U32;
     $u;
 }
+
+# This will crash perl if it fails
+
+use constant PVBM => 'foo';
+
+my $dummy = index 'foo', PVBM;
+eval { my %h = (a => PVBM); 1 };
+
+ok (!$@, 'fbm scalar can be inserted into a hash');