Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 25f90d5

Browse files
committed
Use de_DE in example, change message for unknown locale. Fixes #797447.
Will backport to 2.3.
1 parent 2e31ce2 commit 25f90d5

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

Doc/lib/liblocale.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ \section{\module{locale} ---
398398
\begin{verbatim}
399399
>>> import locale
400400
>>> loc = locale.setlocale(locale.LC_ALL) # get current locale
401-
>>> locale.setlocale(locale.LC_ALL, 'de') # use German locale
401+
>>> locale.setlocale(locale.LC_ALL, 'de_DE') # use German locale; name might vary with platform
402402
>>> locale.strcoll('f\xe4n', 'foo') # compare a string containing an umlaut
403403
>>> locale.setlocale(locale.LC_ALL, '') # use user's preferred locale
404404
>>> locale.setlocale(locale.LC_ALL, 'C') # use default (C) locale

Modules/_localemodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/***********************************************************
2-
Copyright (C) 1997, 2002 Martin von Loewis
2+
Copyright (C) 1997, 2002, 2003 Martin von Loewis
33
44
Permission to use, copy, modify, and distribute this software and its
55
documentation for any purpose and without fee is hereby granted,
@@ -177,7 +177,7 @@ PyLocale_setlocale(PyObject* self, PyObject* args)
177177
result = setlocale(category, locale);
178178
if (!result) {
179179
/* operation failed, no setting was changed */
180-
PyErr_SetString(Error, "locale setting not supported");
180+
PyErr_SetString(Error, "unsupported locale setting");
181181
return NULL;
182182
}
183183
result_object = PyString_FromString(result);

0 commit comments

Comments
 (0)