In perl.git, the branch blead has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/1e2cfe157cae98578de3c274bc64b8ea032b91e0?hp=2ea7b253ec46e8acd1ff2b09220c60eed34cd337>

- Log -----------------------------------------------------------------
commit 1e2cfe157cae98578de3c274bc64b8ea032b91e0
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Sun Feb 4 11:13:56 2018 -0800

    Disable CV-in-stash optimization
    
    outside of the main package.
    
    Instead of actually reverting to the previous logic that excluded
    packages other that main as a side effect of the logic being
    faulty, this time I am checking for the main package explicitly.

-----------------------------------------------------------------------

Summary of changes:
 op.c       | 3 +++
 t/op/sub.t | 1 +
 2 files changed, 4 insertions(+)

diff --git a/op.c b/op.c
index 373822a349..c6f228b2e0 100644
--- a/op.c
+++ b/op.c
@@ -9847,9 +9847,12 @@ Perl_newATTRSUB_x(pTHX_ I32 floor, OP *o, OP *proto, OP 
*attrs,
           Also, we may be called from load_module at run time, so
           PL_curstash (which sets CvSTASH) may not point to the stash the
           sub is stored in.  */
+       /* XXX This optimization is currently disabled for packages other
+              than main, since there was too much CPAN breakage.  */
        const I32 flags =
           ec ? GV_NOADD_NOINIT
              :   (IN_PERL_RUNTIME && PL_curstash != CopSTASH(PL_curcop))
+              || PL_curstash != PL_defstash
               || memchr(name, ':', namlen) || memchr(name, '\'', namlen)
                    ? gv_fetch_flags
                    : GV_ADDMULTI | GV_NOINIT | GV_NOTQUAL;
diff --git a/t/op/sub.t b/t/op/sub.t
index 5de358ebf3..c8bf72d680 100644
--- a/t/op/sub.t
+++ b/t/op/sub.t
@@ -399,6 +399,7 @@ is ref($main::{rt_129916}), 'CODE', 'simple sub stored as 
CV in stash (main::)';
     sub foo { 42 }
 }
 {
+    local $::TODO = "disabled for now";
     is ref($RT129916::{foo}), 'CODE', 'simple sub stored as CV in stash 
(non-main::)';
 }
 

-- 
Perl5 Master Repository

Reply via email to