diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2009-12-01 21:59:18 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2009-12-01 21:59:18 (GMT) |
commit | 64f3ca4206ebcb4b3166e0cd8fe0658628b04b4e (patch) | |
tree | 12004dc09fe16057d8b3845a273566b379112365 /Modules/_localemodule.c | |
parent | c2e1cb7d36ad387a06c6b7dadf30c6535f086280 (diff) | |
download | cpython-64f3ca4206ebcb4b3166e0cd8fe0658628b04b4e.zip cpython-64f3ca4206ebcb4b3166e0cd8fe0658628b04b4e.tar.gz cpython-64f3ca4206ebcb4b3166e0cd8fe0658628b04b4e.tar.bz2 |
Merged revisions 76625 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76625 | amaury.forgeotdarc | 2009-12-01 22:51:04 +0100 (mar., 01 déc. 2009) | 3 lines
#7419: Fix a crash on Windows in locale.setlocale() when the category
is outside the allowed range.
........
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r-- | Modules/_localemodule.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index fa6ab8f..aabc3ac 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -133,6 +133,14 @@ PyLocale_setlocale(PyObject* self, PyObject* args) if (!PyArg_ParseTuple(args, "i|z:setlocale", &category, &locale)) return NULL; +#if defined(MS_WINDOWS) + if (category < LC_MIN || category > LC_MAX) + { + PyErr_SetString(Error, "invalid locale category"); + return NULL; + } +#endif + if (locale) { /* set locale */ result = setlocale(category, locale); |