New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mro::method_changed_in(..) ignores AUTOLOAD #9546
Comments
From laurent.dami@free.frThis is a bug report for perl from dami@cpan.org, When creating a subclass dynamically, and when adding It only appears in the method cache after a call The attached test file demonstrates the problem. This was detected while trying to solve bug 40159 in DBIx::DataModel. Flags: Site configuration information for perl 5.10.0: Configured by SYSTEM at Tue May 13 16:52:25 2008. Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Locally applied patches: @INC for perl 5.10.0: Environment for perl 5.10.0: |
From @tonycozThe following patch fixed the problem with the sample mro.pl. The extra test in t/mro/basic.t fails without the change to sv.c Tony (also attached) Inline Patchdiff -ru ../current/perl-master/sv.c work3/sv.c
--- ../current/perl-master/sv.c 2008-10-31 09:32:11.000000000 +1100
+++ work3/sv.c 2008-10-31 23:53:47.000000000 +1100
@@ -3463,6 +3463,7 @@
SV **location;
U8 import_flag = 0;
const U32 stype = SvTYPE(sref);
+ I32 mro_changes = 0;
PERL_ARGS_ASSERT_GLOB_ASSIGN_REF;
@@ -3489,6 +3490,8 @@
goto common;
case SVt_PVAV:
location = (SV **) &GvAV(dstr);
+ if (strEQ(GvNAME((GV*)dstr), "ISA"))
+ mro_changes = 2;
import_flag = GVf_IMPORTED_AV;
goto common;
case SVt_PVIO:
@@ -3566,6 +3569,7 @@
SvREFCNT_dec(dref);
if (SvTAINTED(sstr))
SvTAINT(dstr);
+ if(mro_changes == 2) mro_isa_changed_in(GvSTASH(dstr));
return;
}
diff -ru ../current/perl-master/t/mro/basic.t work3/t/mro/basic.t
--- ../current/perl-master/t/mro/basic.t 2008-09-20 07:04:20.000000000 +1000
+++ work3/t/mro/basic.t 2008-10-31 23:53:08.000000000 +1100
@@ -3,7 +3,7 @@
use strict;
use warnings;
-require q(./test.pl); plan(tests => 40);
+require q(./test.pl); plan(tests => 42);
{
package MRO_A;
@@ -231,3 +231,17 @@
is($stk_obj->foo(3), 6);
}
+{
+ {
+ # assigning @ISA via arrayref to globref RT 60220
+ package P1;
+ sub new { bless {}, shift }
+
+ package P2;
+ }
+ *{P2::ISA} = [ 'P1' ];
+ my $foo = P2->new;
+ ok(!eval { $foo->bark }, "no bark method");
+ *{P1::bark} = sub { "[bark]" };
+ is(scalar eval { $foo->bark }, "[bark]", "can bark now");
+}
|
From @tonycozavtogv_isa.diffdiff -ru ../current/perl-master/sv.c work3/sv.c
--- ../current/perl-master/sv.c 2008-10-31 09:32:11.000000000 +1100
+++ work3/sv.c 2008-10-31 23:53:47.000000000 +1100
@@ -3463,6 +3463,7 @@
SV **location;
U8 import_flag = 0;
const U32 stype = SvTYPE(sref);
+ I32 mro_changes = 0;
PERL_ARGS_ASSERT_GLOB_ASSIGN_REF;
@@ -3489,6 +3490,8 @@
goto common;
case SVt_PVAV:
location = (SV **) &GvAV(dstr);
+ if (strEQ(GvNAME((GV*)dstr), "ISA"))
+ mro_changes = 2;
import_flag = GVf_IMPORTED_AV;
goto common;
case SVt_PVIO:
@@ -3566,6 +3569,7 @@
SvREFCNT_dec(dref);
if (SvTAINTED(sstr))
SvTAINT(dstr);
+ if(mro_changes == 2) mro_isa_changed_in(GvSTASH(dstr));
return;
}
diff -ru ../current/perl-master/t/mro/basic.t work3/t/mro/basic.t
--- ../current/perl-master/t/mro/basic.t 2008-09-20 07:04:20.000000000 +1000
+++ work3/t/mro/basic.t 2008-10-31 23:53:08.000000000 +1100
@@ -3,7 +3,7 @@
use strict;
use warnings;
-require q(./test.pl); plan(tests => 40);
+require q(./test.pl); plan(tests => 42);
{
package MRO_A;
@@ -231,3 +231,17 @@
is($stk_obj->foo(3), 6);
}
+{
+ {
+ # assigning @ISA via arrayref to globref RT 60220
+ package P1;
+ sub new { bless {}, shift }
+
+ package P2;
+ }
+ *{P2::ISA} = [ 'P1' ];
+ my $foo = P2->new;
+ ok(!eval { $foo->bark }, "no bark method");
+ *{P1::bark} = sub { "[bark]" };
+ is(scalar eval { $foo->bark }, "[bark]", "can bark now");
+}
|
The RT System itself - Status changed from 'new' to 'open' |
From @nwc10On Sat, Nov 01, 2008 at 12:20:21AM +1100, Tony Cook wrote:
Thanks for this. Without looking fully at it yet (something I don't currently have time for,
Why the value 2, for a new variable that is effectively only used for Nicholas Clark |
From @tonycozOn Fri, Oct 31, 2008 at 01:25:23PM +0000, Nicholas Clark wrote:
I was following the similar logic in S_glob_assign_glob and I'm not all that attached to the value 2, using it as a boolean would I just tried the test script from 60232 and that runs successfully Tony |
From laurent.dami@free.fr
After a more careful read of perldelta, I just found out @{$my_subclass."::ISA"} = @$parents_aref; instead of *{$my_subclass."::ISA} = $parents_aref; In other words, updating @ISA magically refreshes the method |
From [Unknown Contact. See original ticket]
After a more careful read of perldelta, I just found out @{$my_subclass."::ISA"} = @$parents_aref; instead of *{$my_subclass."::ISA} = $parents_aref; In other words, updating @ISA magically refreshes the method |
From @tonycozOn Sat, Nov 01, 2008 at 01:17:26AM -0700, laurent dami via RT wrote:
That matches the patch I produced - I added a check to Tony |
From @nwc10Dave notes: not clear whether this is a regression or not. There's also an offered |
From @craigberryOn Fri, Oct 31, 2008 at 8:37 AM, Tony Cook<tony@develop-help.com> wrote:
This is now (at long last) in blead at: http://perl5.git.perl.org/perl.git/commitdiff/26d68d8 I see no new test failures in the core test suite with default builds http://www.nntp.perl.org/group/perl.daily-build.reports/ |
p5p@spam.wizbit.be - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#60220 (status was 'resolved')
Searchable as RT60220$
The text was updated successfully, but these errors were encountered: