File tree 1 file changed +5
-8
lines changed
1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -4976,14 +4976,11 @@ S_fold_constants(pTHX_ OP *const o)
4976
4976
is_stringify = type == OP_STRINGIFY && !o->op_folded;
4977
4977
op_free(o);
4978
4978
assert(sv);
4979
- if (is_stringify)
4980
- SvPADTMP_off(sv);
4981
- else if (!SvIMMORTAL(sv)) {
4982
- SvPADTMP_on(sv);
4983
- /* Do not set SvREADONLY(sv) here. newSVOP will call
4984
- * Perl_ck_svconst, which will do it. Setting it early
4985
- * here prevents Perl_ck_svconst from setting SvIsCOW(sv).*/
4986
- }
4979
+ /* sv may have swiped the TARG from a PADTMP OP, but that flag
4980
+ * should be off when sv is attached to the new CONST OP. */
4981
+ SvPADTMP_off(sv);
4982
+ /* Perl_ck_svconst will try to set READONLY and IsCOW flags on
4983
+ * sv as part of the new CONST OP creation. */
4987
4984
newop = newSVOP(OP_CONST, 0, MUTABLE_SV(sv));
4988
4985
if (!is_stringify) newop->op_folded = 1;
4989
4986
return newop;
You can’t perform that action at this time.
0 commit comments