Hi Father Chrysostomos, Todd R. and I checked your branch sprout/cv-in-stash and had a look at the issue from the extract from t/op/local.t, which is failing. Hope this patch could help, but looks like the OP multideref is not calling the Perl_mro_method_changed_in via a regular save_gp call. We came with this lazy solution (view attached patch) which force to upgrade the RV/CV to a GV. As these cases are probably uncommon, I think it's a solution we could consider when using local on a CV. Also, notice that some other OPs might require the same kind of action. I’ve also attached to this case a simple test (with some comments) to show the problem. sincerely nicolas On Thu, 21 Sep 2017 09:34:42 -0700, sprout wrote: > On Mon, 18 Sep 2017 09:00:58 -0700, atoomic wrote: > > On Mon, 28 Aug 2017 20:33:55 -0700, sprout wrote: > > > On Wed, 19 Oct 2016 07:20:42 -0700, mauke- wrote: > > > > > > > > This is a bug report for perl from l.mai@web.de, > > > > generated with the help of perlbug 1.40 running under perl > > > > 5.24.0. > > > > > > > > > > > > ----------------------------------------------------------------- > > > > [Please describe your issue here] > > > > > > > > Here's the merge I'm talking about: > > > > http://perl5.git.perl.org/perl.git/commitdiff/f9d9e965 > > > > > > > > Also listed in perl5220delta: > > > > > > > > Subroutines in packages no longer need to be stored in typeglobs: > > > > declaring a subroutine will now put a simple sub reference > > > > directly > > > > in > > > > the stash if possible, saving memory. > > > > > > > > This works fine for the main script: > > > > > > > > $ perl -wE 'sub foo { 42 } say $main::{foo}' > > > > CODE(0xa06f668) > > > > > > > > But not in other packages: > > > > > > > > $ perl -wE 'package Other; sub foo { 42 } say $Other::{foo}' > > > > *Other::foo > > > > > > > > I.e. this optimization doesn't apply to modules, which is where > > > > most > > > > subroutines come from. > > > > > > Fixing it causes this to fail: > > > > Could you precise the 'fixing it' part. Where/what is the patch with > > your fix candidate ? is there any commit id / topic branch where we > > could read your attempt to fix it ? > > Due to test failures, I had not actually committed it yet. But now I > have. It is the ‘unfinished’ commit on the sprout/cv-in-stash branch. > > > > > > > > > > use Test::More tests => 1; > > > > > > package Other; > > > > > > sub f1 { "f1" } > > > local $Other::{"f1"} = sub { "h1" }; > > > ::is(f1(), "h1", "localised sub via stash"); > > > > > > Does this matter? This is pretty obscure code (from t/op/local.t) > > > that should probably be doing local *Other::f1 = sub { "h1" } > > > instead > > > (if it were production code). --- via perlbug: queue: perl5 status: open https://rt.perl.org/Ticket/Display.html?id=129916Thread Previous | Thread Next