Skip Menu |
 

This queue is for tickets about the Scalar-List-Utils CPAN distribution.

Report information
The Basics
Id: 107970
Status: open
Priority: 0/
Queue: Scalar-List-Utils

People
Owner: Nobody in particular
Requestors: TONYC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.46



Subject: min/max do not handle magic correctly on their arguments
Download (untitled) / with headers
text/plain 988b
See https://rt.perl.org/Ticket/Display.html?id=126440 for the original report. min/max do handle AMAGIC (overload magic) correctly on their arguments, but do not handle GMAGIC. The macro definition: # define slu_sv_value(sv) (SvIOK(sv)) ? (SvIOK_UV(sv)) ? (NV)(SvUVX(sv)) : (NV)(SvIVX(sv)) : (SvNV(sv)) checks the flags on sv without having called any get magic on the SV, so the flags are meaningless. This wasn't an issue before perl commit 4bac9ae47b5ad7845a24e26b0e95609805de688a since before that the IOK flag wouldn't be set before or after get magic was called and the macro would call SvNV() which does the get magic. Changing the above macro to: # define slu_sv_value(sv) (SvGETMAGIC(sv), SvIOK(sv)) ? (SvIOK_UV(sv)) ? (NV)(SvUVX(sv)) : (NV)(SvIVX(sv)) : (SvNV(sv)) allows the case in the rt.perl.org ticket to behave as expected, but will result in some extra magic calls, probably fixable by using SvNV_nomg, but I haven't performed any extensive testing of it. Tony
Download (untitled) / with headers
text/plain 120b
This appears to have been fixed in commit 498375774fa485ca0f2f189c56c3db581ab7ecc5. Which looks like it should be 1.46.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.