Change 20168 by [EMAIL PROTECTED] on 2003/07/18 06:21:15
Subject: [ PATCH] Re: isa(UNIVERSAL)?
From: Dave Mitchell <[EMAIL PROTECTED]>
Date: Thu, 17 Jul 2003 21:51:12 +0100
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/t/op/universal.t#22 edit
... //depot/perl/universal.c#75 edit
Differences ...
==== //depot/perl/t/op/universal.t#22 (xtext) ====
Index: perl/t/op/universal.t
--- perl/t/op/universal.t#21~18486~ Wed Jan 15 12:34:52 2003
+++ perl/t/op/universal.t Thu Jul 17 23:21:15 2003
@@ -9,7 +9,7 @@
$| = 1;
}
-print "1..98\n";
+print "1..100\n";
$a = {};
bless $a, "Bob";
@@ -187,3 +187,11 @@
::test $x->isa("Human");
::test $x->can("eat");
}
+
+# bugid 3284
+# a second call to isa('UNIVERSAL') when @ISA is null failed due to caching
+
[EMAIL PROTECTED]::ISA=();
+my $x = {}; bless $x, 'X';
+test $x->isa('UNIVERSAL');
+test $x->isa('UNIVERSAL');
==== //depot/perl/universal.c#75 (text) ====
Index: perl/universal.c
--- perl/universal.c#74~19847~ Mon Jun 23 21:52:42 2003
+++ perl/universal.c Thu Jul 17 23:21:15 2003
@@ -45,6 +45,9 @@
if (strEQ(HvNAME(stash), name))
return &PL_sv_yes;
+ if (strEQ(name, "UNIVERSAL"))
+ return &PL_sv_yes;
+
if (level > 100)
Perl_croak(aTHX_ "Recursive inheritance detected in package '%s'",
HvNAME(stash));
@@ -112,8 +115,7 @@
(void)hv_store(hv,name,len,&PL_sv_no,0);
}
}
-
- return boolSV(strEQ(name, "UNIVERSAL"));
+ return &PL_sv_no;
}
/*
End of Patch.