In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/aa2bc4d385298947b20667efc390d3182feaebe1?hp=02d43d4fe5a9bc7f7f8b3759421a04c19d95ebf2>
- Log ----------------------------------------------------------------- commit aa2bc4d385298947b20667efc390d3182feaebe1 Author: Karl Williamson <k...@cpan.org> Date: Tue Nov 14 21:33:43 2017 -0700 POSIX.pod: Add cautions about locale use commit 5579633cf51e50d6cd8e79c7c2593fbd06d39b67 Author: Karl Williamson <k...@cpan.org> Date: Sun Nov 12 22:29:58 2017 -0700 locale.c: Use mnemonic Replace this number by an already existing mnemonic ----------------------------------------------------------------------- Summary of changes: ext/POSIX/lib/POSIX.pod | 8 +++++++- locale.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ext/POSIX/lib/POSIX.pod b/ext/POSIX/lib/POSIX.pod index 0d7a1a0809..712132bd57 100644 --- a/ext/POSIX/lib/POSIX.pod +++ b/ext/POSIX/lib/POSIX.pod @@ -939,6 +939,9 @@ containing the current underlying locale's formatting values. Users of this fun should also read L<perllocale>, which provides a comprehensive discussion of Perl locale handling, including L<a section devoted to this function|perllocale/The localeconv function>. +It should not be used in a threaded application unless it's certain that +the underlying locale is C or POSIX. This is because it otherwise +changes the locale, which globally affects all threads simultaneously. Here is how to query the database for the B<de> (Deutsch or German) locale. @@ -1804,7 +1807,10 @@ may not check for overflow, and therefore will never set C<$!>. C<strtod> respects any POSIX C<setlocale()> C<LC_TIME> settings, regardless of whether or not it is called from Perl code that is within -the scope of S<C<use locale>>. +the scope of S<C<use locale>>. This means it should not be used in a +threaded application unless it's certain that the underlying locale is C +or POSIX. This is because it otherwise changes the locale, which +globally affects all threads simultaneously. To parse a string C<$str> as a floating point number use diff --git a/locale.c b/locale.c index 5bc5fc500b..bc507d9031 100644 --- a/locale.c +++ b/locale.c @@ -2963,7 +2963,7 @@ Perl__is_cur_LC_category_utf8(pTHX_ int category) if ( len != STRLENs(REPLACEMENT_CHARACTER_UTF8) - || wc != (wchar_t) 0xFFFD) + || wc != (wchar_t) UNICODE_REPLACEMENT) { is_utf8 = FALSE; DEBUG_L(PerlIO_printf(Perl_debug_log, "\replacement=U+%x\n", -- Perl5 Master Repository