summaryrefslogtreecommitdiffstats
path: root/Modules/_localemodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r--Modules/_localemodule.c8
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);