Commit graph

114 commits

Author SHA1 Message Date
Victor Stinner cc0d5e568e
gh-94226: Remove the locale.format() function (#94229)
Remove the locale.format() function, deprecated in Python
3.7: use locale.format_string() instead.

Remove TestFormatPatternArg test case: it is irrelevant for
locale.format_string() which accepts complex formats.
2022-06-26 12:41:19 +02:00
Victor Stinner bf58cd01b3
gh-90817: Deprecate explicitly locale.resetlocale() (#93196)
The function was already deprecated in Python 3.11 since it calls
locale.getdefaultlocale() which was deprecated in Python 3.11.
2022-05-25 22:04:06 +02:00
Inada Naoki 354ace8b07
gh-91954: Emit EncodingWarning from locale and subprocess (GH-91977)
locale.getpreferredencoding() and subprocess.Popen() emit EncodingWarning
2022-04-30 15:53:29 +09:00
Inada Naoki 13b17e2a0a
gh-91156: Fix encoding="locale" in UTF-8 mode (GH-70056) 2022-04-14 16:00:35 +09:00
Inada Naoki 6773203487
bpo-47000: Add locale.getencoding() (GH-32068) 2022-04-09 09:54:54 +09:00
Victor Stinner b899126094
bpo-46659: Deprecate locale.getdefaultlocale() (GH-31206)
The locale.getdefaultlocale() function is deprecated and will be
removed in Python 3.13. Use locale.setlocale(),
locale.getpreferredencoding(False) and locale.getlocale() functions
instead.
2022-02-22 22:06:43 +01:00
Nikita Sobolev 0cbdd21311
bpo-46565: del loop vars that are leaking into module namespaces (GH-30993) 2022-02-03 11:20:08 +02:00
Cédric Krier e126547c07
bpo-34311: Add locale.localize (GH-15275)
* Add method localize to the locale module
* Update the documentation of the locale module
2021-04-12 14:17:40 +02:00
Victor Stinner b62bdf71ea
bpo-42208: Add _locale._get_locale_encoding() (GH-23052)
* Add a new _locale._get_locale_encoding() function to get the
  current locale encoding.
* Modify locale.getpreferredencoding() to use it.
* Remove the _bootlocale module.
2020-10-31 01:32:11 +01:00
Inada Naoki e96d954527
bpo-38536: locale: Remove trailing space in formatted currency (GH-16864) 2020-01-20 12:45:50 +09:00
Ronald Oussoren b0caf32981 bpo-18378: Recognize "UTF-8" as a valid name in locale._parse_localename (GH-14736) 2019-08-29 00:33:52 -04:00
Serhiy Storchaka a3f19c3f52
Remove mojibake in the locale aliases mapping. (GH-6716) 2018-05-06 10:52:38 +03:00
Serhiy Storchaka cedc9b7420
bpo-20087: Update locale alias mapping with glibc 2.27 supported locales. (ПР-6708) 2018-05-06 08:46:15 +03:00
Victor Stinner 91106cd9ff
bpo-29240: PEP 540: Add a new UTF-8 Mode (#855)
* Add -X utf8 command line option, PYTHONUTF8 environment variable
  and a new sys.flags.utf8_mode flag.
* If the LC_CTYPE locale is "C" at startup: enable automatically the
  UTF-8 mode.
* Add _winapi.GetACP(). encodings._alias_mbcs() now calls
  _winapi.GetACP() to get the ANSI code page
* locale.getpreferredencoding() now returns 'UTF-8' in the UTF-8
  mode. As a side effect, open() now uses the UTF-8 encoding by
  default in this mode.
* Py_DecodeLocale() and Py_EncodeLocale() now use the UTF-8 encoding
  in the UTF-8 Mode.
* Update subprocess._args_from_interpreter_flags() to handle -X utf8
* Skip some tests relying on the current locale if the UTF-8 mode is
  enabled.
* Add test_utf8mode.py.
* _Py_DecodeUTF8_surrogateescape() gets a new optional parameter to
  return also the length (number of wide characters).
* pymain_get_global_config() and pymain_set_global_config() now
  always copy flag values, rather than only copying if the new value
  is greater than the old value.
2017-12-13 12:29:09 +01:00
Serhiy Storchaka 81108375d9 bpo-30152: Reduce the number of imports for argparse. (#1269) 2017-09-26 00:55:55 +03:00
Serhiy Storchaka 2e576f5aec bpo-30144: Import collections ABC from collections.abc rather than collections. (#1263) 2017-04-24 09:05:00 +03:00
Serhiy Storchaka 5affd23e6f bpo-29762: More use "raise from None". (#569)
This hides unwanted implementation details from tracebacks.
2017-04-05 09:37:24 +03:00
Victor Stinner 9acc6a03f1 test_locale now ignores the DeprecationWarning (#977)
Don't fail anymore if test run with python3 -Werror.

Fix also deprecation message: add a space.
2017-04-03 18:09:55 +02:00
Garvit Khatri 1cf93a76c2 bpo-10379: add 'monetary' to format_string, deprecate format
Add the 'monetary' parameter to format_string so that all
uses of format can be converted to format_string.  Adjust
the documentation accordingly, and add a deprecation
warning when format is used.
2017-03-28 11:43:38 -04:00
Benjamin Peterson df8280838f bpo-20087: Revert "make the glibc alias table take precedence over the X11 one (#422)" (#713)
This reverts commit 02371e0ed1.
2017-03-19 23:49:43 -07:00
Benjamin Peterson 02371e0ed1 make the glibc alias table take precedence over the X11 one (#422)
bpo-20087
2017-03-07 22:03:13 -08:00
Xavier de Gaye 6c9dcda6b4 Issue #28596: The preferred encoding is UTF-8 on Android. 2016-12-17 09:19:11 +01:00
Martin Panter 3e04d5b306 Issue #27076: Merge spelling from 3.5 2016-05-26 06:03:19 +00:00
Martin Panter 46f50726a0 Issue #27076: Doc, comment and tests spelling fixes
Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
2016-05-26 05:35:26 +00:00
Senthil Kumaran 6fce35354a merge 3.5.
[minor] - Correct the docstring of locale.str. Patch by poleto.
2016-04-12 23:15:44 -07:00
Senthil Kumaran a3c532b0ed [minor] - Correct the docstring of locale.str. Patch by poleto. 2016-04-12 23:14:14 -07:00
Victor Stinner 2753a096e0 locale.delocalize(): only call localeconv() once 2015-11-03 14:34:51 +01:00
Serhiy Storchaka f0eeedf0d8 Issue #22681: Added support for the koi8_t encoding. 2015-05-12 23:24:19 +03:00
Serhiy Storchaka ad8a1c3fb2 Issue #22682: Added support for the kz1048 encoding. 2015-05-12 23:16:55 +03:00
Antoine Pitrou b64bca9852 Issue #13918: Provide a locale.delocalize() function which can remove
locale-specific number formatting from a string representing a number,
without then converting it to a specific type.  Patch by Cédric Krier.
2014-10-23 22:52:31 +02:00
Serhiy Storchaka 9e04edaf64 Issue #20079: Updated alias mapping to glibc 2.19 SUPPORTED file. 2014-10-02 10:49:26 +03:00
Serhiy Storchaka b8cd8cf8f2 Issue #20076: Remove just added the sr_rs.utf8@latn alias because it is
derived from sr_rs@latin.
2014-10-02 10:19:29 +03:00
Serhiy Storchaka 1de0ba2cf5 Issue #20076: Added non derived UTF-8 aliases to locale aliases table. 2014-10-02 00:09:37 +03:00
Serhiy Storchaka 99cb41d423 Issue #20079: Added locales supported in glibc 2.18 to locale alias table. 2014-10-01 23:43:35 +03:00
Serhiy Storchaka 8c4f57d1d5 Issue #20046: Locale alias table no longer contains entities which can be
calculated.  Generalized support of the euro modifier.
2013-12-27 00:56:53 +02:00
Serhiy Storchaka e190fac5f9 Issue #20027: Fixed locale aliases for devanagari locales. 2013-12-26 21:21:52 +02:00
Serhiy Storchaka 5eb01530b2 Issue #20027: Fixed locale aliases for devanagari locales. 2013-12-26 21:20:59 +02:00
Serhiy Storchaka 6e6ec50f82 Issue #20034: Updated alias mapping to most recent locale.alias file
from X.org distribution using makelocalealias.py.
2013-12-20 18:50:32 +02:00
Serhiy Storchaka 715233c3cd Issue #20034: Updated alias mapping to most recent locale.alias file
from X.org distribution using makelocalealias.py.
2013-12-20 18:23:26 +02:00
Serhiy Storchaka 16f02d2b06 Issue #5815: Fixed support for locales with modifiers. Fixed support for
locale encodings with hyphens.
2013-12-19 21:21:40 +02:00
Serhiy Storchaka c8cc42edf4 Issue #5815: Fixed support for locales with modifiers. Fixed support for
locale encodings with hyphens.
2013-12-19 21:21:25 +02:00
Antoine Pitrou fd4722cacf Issue #9548: Add a minimal "_bootlocale" module that is imported by the _io module instead of the full locale module. 2013-10-12 00:13:50 +02:00
Brett Cannon cd171c8e92 Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a) 2013-07-04 17:43:24 -04:00
Brett Cannon 0a140668fa Issue #18200: Update the stdlib (except tests) to use
ModuleNotFoundError.
2013-06-13 20:57:26 -04:00
Éric Araujo a2b89e364f Fix last remaining references to ex-devguide 2011-11-29 16:36:17 +01:00
Petri Lehtinen 395ca72380 Issue #3067: Enhance the documentation and docstring of locale.setlocale() 2011-11-05 10:21:16 +02:00
Petri Lehtinen 3c85fe07f4 Issue #3067: Fix the error raised by locale.setlocale() 2011-11-04 22:21:07 +02:00
Jesus Cea 5032292f9e Closes #13283: removal of two unused variable in locale.py 2011-10-31 16:03:34 +01:00
Ronald Oussoren 6edd8c1faf (merge) Fix #10154 and #10090: locale normalizes the UTF-8 encoding to "UTF-8" instead of "UTF8"
On MacOSX and OpenBSD (and possibly other BSDs) "en_US.UTF-8" is a valid locale
while "en_US.UTF8" is not. As the former works on Linux as well it is better
to normalize to that value.
2011-05-17 13:03:54 +02:00
Ronald Oussoren 02a67ac72b Fix #10154 and #10090: locale normalizes the UTF-8 encoding to "UTF-8" instead of "UTF8"
On MacOSX and OpenBSD (and possibly other BSDs) "en_US.UTF-8" is a valid locale
while "en_US.UTF8" is not. As the former works on Linux as well it is better
to normalize to that value.
2011-05-17 12:44:54 +02:00