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

Fix to work with perls since 5.37.7 #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

khwilliamson
Copy link

This fixes Perl/perl5#20571

The commit blamed in that tickect caused POSIX::localeconv() to return
all the defined fields in the lconv structure. Number::Format had been
relying on it to suppress empty fields.

The solution is simply for Number::Format to instead ignore empty fields
itself. This is entirely backwards compatible, as previously those
fields were never delivered to Number::Format.

There is a slight complication in that the POSIX standard allows for
the monetary decimal point and the monetary thousands separator to both
be empty. There is a check in Number::Format against both being empty
that must be relaxed to allow this legal combination. The check
previously was effectively useless as Number::Format would never see
those fields if they were empty, as POSIX::localeconv() would suppress
them.

This fixes Perl/perl5#20571

The commit blamed in that tickect caused POSIX::localeconv() to return
all the defined fields in the lconv structure.  Number::Format had been
relying on it to suppress empty fields.

The solution is simply for Number::Format to instead ignore empty fields
itself.  This is entirely backwards compatible, as previously those
fields were never delivered to Number::Format.

There is a slight complication in that the POSIX standard allows for
the monetary decimal point and the monetary thousands separator to both
be empty.  There is a check in Number::Format against both being empty
that must be relaxed to allow this legal combination.  The check
previously was effectively useless as Number::Format would never see
those fields if they were empty, as POSIX::localeconv() would suppress
them.
The comments wrongly claimed that certain platform behaviors were
broken, whereas they are legal, and the module just needed to handle
them.

This commit updates the text to better describe the situation.
khwilliamson referenced this pull request in Perl/perl5 Jan 31, 2023
The blamed commit, 04de022, exposed a bug in the module itself.  I will
submit a PR to fix it.

But this ticket did tell me that there was a problem with that commit.
It returned a C language value, CHAR_MAX, which doesn't really have a
corresponding concept in Perl.  Instead we use -1 to indicate that a
positive-valued variable is in some abnormal state.  This commit changes
to do that, and documents the changes, which should have been done in
04de022.
@rjbs
Copy link

rjbs commented May 6, 2023

(Bump.) I have sent Bill a direct email as well, offering to make a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BBC: Blead Breaks Number::Format
2 participants