diff options
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r-- | Modules/_localemodule.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index 37b7ec1..8441f1e 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -530,7 +530,7 @@ static PyObject* PyIntl_gettext(PyObject* self, PyObject *args) { char *in; - if (!PyArg_ParseTuple(args, "z", &in)) + if (!PyArg_ParseTuple(args, "s", &in)) return 0; return str2uni(gettext(in)); } @@ -543,7 +543,7 @@ static PyObject* PyIntl_dgettext(PyObject* self, PyObject *args) { char *domain, *in; - if (!PyArg_ParseTuple(args, "zz", &domain, &in)) + if (!PyArg_ParseTuple(args, "zs", &domain, &in)) return 0; return str2uni(dgettext(domain, in)); } @@ -557,7 +557,7 @@ PyIntl_dcgettext(PyObject *self, PyObject *args) { char *domain, *msgid; int category; - if (!PyArg_ParseTuple(args, "zzi", &domain, &msgid, &category)) + if (!PyArg_ParseTuple(args, "zsi", &domain, &msgid, &category)) return 0; return str2uni(dcgettext(domain,msgid,category)); } @@ -587,9 +587,13 @@ PyDoc_STRVAR(bindtextdomain__doc__, static PyObject* PyIntl_bindtextdomain(PyObject* self,PyObject*args) { - char *domain,*dirname; - if (!PyArg_ParseTuple(args, "zz", &domain, &dirname)) + char *domain, *dirname; + if (!PyArg_ParseTuple(args, "sz", &domain, &dirname)) return 0; + if (!strlen(domain)) { + PyErr_SetString(Error, "domain must be a non-empty string"); + return 0; + } dirname = bindtextdomain(domain, dirname); if (!dirname) { PyErr_SetFromErrno(PyExc_OSError); |