From 4fde31c017efef029928963d8eb88c9b20dc8fb5 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Fri, 6 Sep 2024 09:35:49 +1000 Subject: [PATCH] builtin::stringify: duplicate the implementation for XS I'm not entirely happy with this, but pp_stringify is in pp_hot.c for a reason, so: a) I don't want to move it b) I don't want to complicate it so just duplicate the trivial implementation. Fixes #22542 --- builtin.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/builtin.c b/builtin.c index 328df38cc22a..34865ec9a4bb 100644 --- a/builtin.c +++ b/builtin.c @@ -192,7 +192,16 @@ XS(XS_builtin_func1_scalar) break; case OP_STRINGIFY: - Perl_pp_stringify(aTHX); + { + /* we could only call pp_stringify if we're sure there is a TARG + and if the XSUB is called from call_sv() or goto it may not + have one. + */ + dXSTARG; + sv_copypv(TARG, *PL_stack_sp); + SvSETMAGIC(TARG); + rpp_replace_1_1_NN(TARG); + } break; default: