When newCONSTSUB was added in commit
5476c433, it did not set
curcop temporarily to &compiling, and so gv_fetchpv would look at
curcop->cop_stash. So cop_stash needed to be localised.
(Time passes.... curcop is now PL_curcop. &compiling is
now &PL_compiling. gv_fetchpv is now gv_fetchpvn_flags.
curcop->cop_stash is now CopSTASH(PL_curcop).)
Since commit
401667e9, newCONSTSUB has set PL_curcop to &PL_compiling
temporarily. When that is the case, gv_fetchpvn_flags uses
PL_curstash and ignores CopSTASH(PL_curcop).
So this localisation is no longer necessary, as newCONSTSUB has always
set (PL_)curstash.
if (stash) {
SAVEGENERICSV(PL_curstash);
- SAVECOPSTASH(PL_curcop);
PL_curstash = (HV *)SvREFCNT_inc_simple_NN(stash);
- CopSTASH_set(PL_curcop,stash);
}
/* file becomes the CvFILE. For an XS, it's usually static storage,
CvXSUBANY(cv).any_ptr = sv;
CvCONST_on(cv);
-#ifdef USE_ITHREADS
- if (stash)
- CopSTASH_free(PL_curcop);
-#endif
LEAVE;
return cv;