[Python-checkins] cpython (2.7): Close #3067: locale.setlocale() accepts a Unicode locale.
Terry Reedy
tjreedy at udel.edu
Mon Jun 20 18:52:41 CEST 2011
On 6/20/2011 10:14 AM, victor.stinner wrote:
> http://hg.python.org/cpython/rev/d370d609d09b
> changeset: 70902:d370d609d09b
> branch: 2.7
> parent: 70891:6c16a31e0442
> user: Victor Stinner<victor.stinner at haypocalc.com>
> date: Mon Jun 20 16:14:48 2011 +0200
> summary:
> Close #3067: locale.setlocale() accepts a Unicode locale.
For the reasons I gave on the tracker, after careful consideration, I
consider this to be a feature addition and recommended rejection of the
change. I think this should be reverted.
> files:
> Lib/locale.py | 2 +-
> Misc/NEWS | 2 ++
> 2 files changed, 3 insertions(+), 1 deletions(-)
>
>
> diff --git a/Lib/locale.py b/Lib/locale.py
> --- a/Lib/locale.py
> +++ b/Lib/locale.py
> @@ -525,7 +525,7 @@
> category may be given as one of the LC_* values.
>
> """
> - if locale and type(locale) is not type(""):
> + if locale and not isinstance(locale, basestring):
> # convert to string
> locale = normalize(_build_localename(locale))
> return _setlocale(category, locale)
> diff --git a/Misc/NEWS b/Misc/NEWS
> --- a/Misc/NEWS
> +++ b/Misc/NEWS
> @@ -16,6 +16,8 @@
> Library
> -------
>
> +- Issue #3067: locale.setlocale() accepts a Unicode locale.
You yourself said this is useless because it cannot be used in previous
versions of 2.7.
--
Terry Jan Reedy
More information about the Python-checkins
mailing list