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

bpo-28604: Fix localeconv() for different LC_MONETARY #10606

Merged
merged 3 commits into from Nov 20, 2018
Merged

bpo-28604: Fix localeconv() for different LC_MONETARY #10606

merged 3 commits into from Nov 20, 2018

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Nov 20, 2018

locale.localeconv() now sets temporarily the LC_CTYPE locale to the
LC_MONETARY locale if the two locales are different and monetary
strings are non-ASCII. This temporary change affects other threads.

Changes:

  • locale.localeconv() can now set LC_CTYPE to LC_MONETARY to decode
    monetary fields.
  • Add LocaleInfo.grouping_buffer: copy localeconv() grouping string
    since it can be replaced anytimes if a different thread calls
    localeconv().
  • _Py_GetLocaleconvNumeric() now requires a "struct lconv *"
    structure, so locale.localeconv() now longer calls localeconv()
    twice. Moreover, the function now requires all arguments to be
    non-NULL.
  • Rename STATIC_LOCALE_INFO_INIT to LOCALE_INFO_STATIC_INIT.
  • Move _Py_GetLocaleconvNumeric() definition from fileutils.h
    to pycore_fileutils.h. pycore_fileutils.h now includes locale.h.
  • The _locale module is now built with Py_BUILD_CORE defined.

https://bugs.python.org/issue28604

locale.localeconv() now sets temporarily the LC_CTYPE locale to the
LC_MONETARY locale if the two locales are different and monetary
strings are non-ASCII. This temporary change affects other threads.

Changes:

* locale.localeconv() can now set LC_CTYPE to LC_MONETARY to decode
  monetary fields.
* Add LocaleInfo.grouping_buffer: copy localeconv() grouping string
  since it can be replaced anytimes if a different thread calls
  localeconv().
* _Py_GetLocaleconvNumeric() now requires a "struct lconv *"
  structure, so locale.localeconv() now longer calls localeconv()
  twice. Moreover, the function now requires all arguments to be
  non-NULL.
* Rename STATIC_LOCALE_INFO_INIT to LOCALE_INFO_STATIC_INIT.
* Move _Py_GetLocaleconvNumeric() definition from fileutils.h
  to pycore_fileutils.h. pycore_fileutils.h now includes locale.h.
* The _locale module is now built with Py_BUILD_CORE defined.
@vstinner
Copy link
Member Author

Once this change will be merged into master, I will write a smaller change for 3.7 and older Python versions since this change is a little bit too big to be backported.

@vstinner vstinner merged commit 02e6bf7 into python:master Nov 20, 2018
@vstinner vstinner deleted the lc_monetary branch November 20, 2018 15:20
vstinner added a commit that referenced this pull request Nov 20, 2018
…10619)

locale.localeconv() now sets temporarily the LC_CTYPE locale to the
LC_MONETARY locale if the two locales are different and monetary
strings are non-ASCII. This temporary change affects other threads.

Changes:

* locale.localeconv() can now set LC_CTYPE to LC_MONETARY to decode
  monetary fields.
* Add LocaleInfo.grouping_buffer: copy localeconv() grouping string
  since it can be replaced anytime if a different thread calls
  localeconv().

(cherry picked from commit 02e6bf7)
vstinner added a commit that referenced this pull request Nov 20, 2018
…10619) (GH-10621)

locale.localeconv() now sets temporarily the LC_CTYPE locale to the
LC_MONETARY locale if the two locales are different and monetary
strings are non-ASCII. This temporary change affects other threads.

Changes:

* locale.localeconv() can now set LC_CTYPE to LC_MONETARY to decode
  monetary fields.
* Add LocaleInfo.grouping_buffer: copy localeconv() grouping string
  since it can be replaced anytime if a different thread calls
  localeconv().

(cherry picked from commit 02e6bf7)
(cherry picked from commit 6eff6b8)
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.

None yet

3 participants