The documentation for Perl_form() says that it returns in the same buffer each time, so you have to copy it if you need to save its value.
But the code reads:
if (PL_phase != PERL_PHASE_DESTRUCT) return newSVpvs_flags("", SVs_TEMP);
This is from mess_alloc in util.c that is what is eventually called to get the space to return the value.
Only in global destruction is the the buffer reused. This seems wrong.
Description
The documentation for
Perl_form()
says that it returns in the same buffer each time, so you have to copy it if you need to save its value. But the code reads:if (PL_phase != PERL_PHASE_DESTRUCT) return newSVpvs_flags("", SVs_TEMP);
This is from
mess_alloc
inutil.c
that is what is eventually called to get the space to return the value.Only in global destruction is the the buffer reused. This seems wrong.
This is the state of affairs in v5.39.9