]> git.vpit.fr Git - perl/modules/Scope-Upper.git/commitdiff
Actually restore old_cop in su_localize()
authorVincent Pit <perl@profvince.com>
Mon, 6 Jun 2016 08:52:26 +0000 (10:52 +0200)
committerVincent Pit <perl@profvince.com>
Mon, 6 Jun 2016 08:52:26 +0000 (10:52 +0200)
Upper.xs

index e810d69b77603810c207334ee09fcb24e3cf1e6c..386bf5abe245f267c9515c0ca39ca2c2f7f10f2f 100644 (file)
--- a/Upper.xs
+++ b/Upper.xs
@@ -900,13 +900,12 @@ static void su_localize(pTHX_ void *ud_) {
  if (SvTYPE(sv) >= SVt_PVGV) {
   gv = (GV *) sv;
  } else {
  if (SvTYPE(sv) >= SVt_PVGV) {
   gv = (GV *) sv;
  } else {
-
 /* new perl context implementation frees savestack *before* restoring
  * PL_curcop. Temporarily restore it prematurely to make gv_fetch*
  * looks up unqualified var names in the caller's package */
 #if SU_HAS_NEW_CXT
   COP *old_cop = PL_curcop;
 /* new perl context implementation frees savestack *before* restoring
  * PL_curcop. Temporarily restore it prematurely to make gv_fetch*
  * looks up unqualified var names in the caller's package */
 #if SU_HAS_NEW_CXT
   COP *old_cop = PL_curcop;
-  PL_curcop = CX_CUR()->blk_oldcop;
+  PL_curcop    = CX_CUR()->blk_oldcop;
 #endif
 
 #ifdef gv_fetchsv
 #endif
 
 #ifdef gv_fetchsv
@@ -917,7 +916,7 @@ static void su_localize(pTHX_ void *ud_) {
   gv = gv_fetchpvn_flags(name, len, GV_ADDMULTI, t);
 #endif
 #if SU_HAS_NEW_CXT
   gv = gv_fetchpvn_flags(name, len, GV_ADDMULTI, t);
 #endif
 #if SU_HAS_NEW_CXT
-  CX_CUR()->blk_oldcop = PL_curcop;
+  CX_CUR()->blk_oldcop = old_cop;
 #endif
  }
 
 #endif
  }