diff --git a/pp_ctl.c b/pp_ctl.c index 6a1112038d5b..283670006739 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -4077,11 +4077,18 @@ S_doeval_compile(pTHX_ U8 gimme, CV* outside, U32 seq, HV *hh) SvREFCNT_dec(GvHV(PL_hintgv)); GvHV(PL_hintgv) = hh; FETCHFEATUREBITSHH(hh); - SV *versv, **svp; - if((svp = hv_fetchs(hh, "CORE/prevailing_version", 0)) && (versv = *svp) && SvOK(versv)) { + /* temporarily turn magical flags off so we can delete without it getting in the way */ + U32 wasflags = SvFLAGS(hh); + SvMAGICAL_off(hh); + + SV *versv; + /* hh is a new copy for us to use; we are permitted to delete keys */ + if((versv = hv_deletes(hh, "CORE/prevailing_version", 0)) && SvOK(versv)) { SAVEI16(PL_prevailing_version); PL_prevailing_version = SvUV(versv); } + + SvFLAGS(hh) = wasflags; } } SAVECOMPILEWARNINGS();