Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perl_form not accurately described in pod; maybe the implementation is wrong #22170

Open
khwilliamson opened this issue Apr 24, 2024 · 1 comment

Comments

@khwilliamson
Copy link
Contributor

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 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.

This is the state of affairs in v5.39.9

@tonycoz
Copy link
Contributor

tonycoz commented Apr 25, 2024

The temp allocation was added in e72dc28, I think it just needs documentation.

khwilliamson added a commit to khwilliamson/perl5 that referenced this issue Apr 25, 2024
This fixes GH Perl#22170, and includes several corrections.
khwilliamson added a commit to khwilliamson/perl5 that referenced this issue Apr 30, 2024
This fixes GH Perl#22170, and includes several corrections.
khwilliamson added a commit that referenced this issue Apr 30, 2024
This fixes GH #22170, and includes several corrections.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants