Avoid an assertion failure when overloading readpipe.
Nicholas Clark [Fri, 2 Mar 2007 15:02:43 +0000 (15:02 +0000)]
p4raw-id: //depot/perl@30444

t/op/gv.t
toke.c

index d736138..b5f63be 100755 (executable)
--- a/t/op/gv.t
+++ b/t/op/gv.t
@@ -12,7 +12,7 @@ BEGIN {
 use warnings;
 
 require './test.pl';
-plan( tests => 159 );
+plan( tests => 160 );
 
 # type coersion on assignment
 $foo = 'foo';
@@ -480,6 +480,10 @@ foreach my $value ([1,2,3], {1=>2}, *STDOUT{IO}, \&ok, *STDOUT{FORMAT}) {
     $CORE::GLOBAL::{"readline"}=[];
     eval "no warnings; <STDOUT>";
     is($@, '', "Can't trip up readline overloading");
+
+    $CORE::GLOBAL::{"readpipe"}=[];
+    eval "`` if 0";
+    is($@, '', "Can't trip up readpipe overloading");
 }
 __END__
 Perl
diff --git a/toke.c b/toke.c
index 2498de2..5c4e4e2 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -2922,7 +2922,7 @@ S_readpipe_override(pTHX)
                && GvCVu(gv_readpipe) && GvIMPORTED_CV(gv_readpipe))
            ||
            ((gvp = (GV**)hv_fetchs(PL_globalstash, "readpipe", FALSE))
-            && (gv_readpipe = *gvp) != (GV*)&PL_sv_undef
+            && (gv_readpipe = *gvp) && isGV_with_GP(gv_readpipe)
             && GvCVu(gv_readpipe) && GvIMPORTED_CV(gv_readpipe)))
     {
        PL_lex_op = (OP*)newUNOP(OP_ENTERSUB, OPf_STACKED,