summaryrefslogtreecommitdiffstats
path: root/Modules/_localemodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r--Modules/_localemodule.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index 02e9e53..ce84b27 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -119,7 +119,7 @@ fixup_ulcase(void)
if (isupper(c))
ul[n++] = c;
}
- ulo = PyString_FromStringAndSize((const char *)ul, n);
+ ulo = PyBytes_FromStringAndSize((const char *)ul, n);
if (!ulo)
return;
if (string)
@@ -134,7 +134,7 @@ fixup_ulcase(void)
if (islower(c))
ul[n++] = c;
}
- ulo = PyString_FromStringAndSize((const char *)ul, n);
+ ulo = PyBytes_FromStringAndSize((const char *)ul, n);
if (!ulo)
return;
if (string)
@@ -149,7 +149,7 @@ fixup_ulcase(void)
if (isalpha(c))
ul[n++] = c;
}
- ulo = PyString_FromStringAndSize((const char *)ul, n);
+ ulo = PyBytes_FromStringAndSize((const char *)ul, n);
if (!ulo)
return;
if (string)
@@ -175,7 +175,7 @@ PyLocale_setlocale(PyObject* self, PyObject* args)
PyErr_SetString(Error, "unsupported locale setting");
return NULL;
}
- result_object = PyString_FromString(result);
+ result_object = PyBytes_FromString(result);
if (!result_object)
return NULL;
/* record changes to LC_CTYPE */
@@ -190,7 +190,7 @@ PyLocale_setlocale(PyObject* self, PyObject* args)
PyErr_SetString(Error, "locale query failed");
return NULL;
}
- result_object = PyString_FromString(result);
+ result_object = PyBytes_FromString(result);
}
return result_object;
}
@@ -216,7 +216,7 @@ PyLocale_localeconv(PyObject* self)
involved herein */
#define RESULT_STRING(s)\
- x = PyString_FromString(l->s);\
+ x = PyBytes_FromString(l->s);\
if (!x) goto failed;\
PyDict_SetItemString(result, #s, x);\
Py_XDECREF(x)
@@ -284,9 +284,9 @@ PyLocale_strcoll(PyObject* self, PyObject* args)
if (!PyArg_UnpackTuple(args, "strcoll", 2, 2, &os1, &os2))
return NULL;
/* If both arguments are byte strings, use strcoll. */
- if (PyString_Check(os1) && PyString_Check(os2))
- return PyInt_FromLong(strcoll(PyString_AS_STRING(os1),
- PyString_AS_STRING(os2)));
+ if (PyBytes_Check(os1) && PyBytes_Check(os2))
+ return PyInt_FromLong(strcoll(PyBytes_AS_STRING(os1),
+ PyBytes_AS_STRING(os2)));
/* If neither argument is unicode, it's an error. */
if (!PyUnicode_Check(os1) && !PyUnicode_Check(os2)) {
PyErr_SetString(PyExc_ValueError, "strcoll arguments must be strings");
@@ -368,7 +368,7 @@ PyLocale_strxfrm(PyObject* self, PyObject* args)
return PyErr_NoMemory();
strxfrm(buf, s, n2);
}
- result = PyString_FromString(buf);
+ result = PyBytes_FromString(buf);
PyMem_Free(buf);
return result;
}
@@ -563,13 +563,13 @@ PyLocale_nl_langinfo(PyObject* self, PyObject* args)
return NULL;
/* Check whether this is a supported constant. GNU libc sometimes
returns numeric values in the char* return value, which would
- crash PyString_FromString. */
+ crash PyBytes_FromString. */
for (i = 0; langinfo_constants[i].name; i++)
if (langinfo_constants[i].value == item) {
/* Check NULL as a workaround for GNU libc's returning NULL
instead of an empty string for nl_langinfo(ERA). */
const char *result = nl_langinfo(item);
- return PyString_FromString(result != NULL ? result : "");
+ return PyBytes_FromString(result != NULL ? result : "");
}
PyErr_SetString(PyExc_ValueError, "unsupported langinfo constant");
return NULL;
@@ -588,7 +588,7 @@ PyIntl_gettext(PyObject* self, PyObject *args)
char *in;
if (!PyArg_ParseTuple(args, "z", &in))
return 0;
- return PyString_FromString(gettext(in));
+ return PyBytes_FromString(gettext(in));
}
PyDoc_STRVAR(dgettext__doc__,
@@ -601,7 +601,7 @@ PyIntl_dgettext(PyObject* self, PyObject *args)
char *domain, *in;
if (!PyArg_ParseTuple(args, "zz", &domain, &in))
return 0;
- return PyString_FromString(dgettext(domain, in));
+ return PyBytes_FromString(dgettext(domain, in));
}
PyDoc_STRVAR(dcgettext__doc__,
@@ -615,7 +615,7 @@ PyIntl_dcgettext(PyObject *self, PyObject *args)
int category;
if (!PyArg_ParseTuple(args, "zzi", &domain, &msgid, &category))
return 0;
- return PyString_FromString(dcgettext(domain,msgid,category));
+ return PyBytes_FromString(dcgettext(domain,msgid,category));
}
PyDoc_STRVAR(textdomain__doc__,
@@ -633,7 +633,7 @@ PyIntl_textdomain(PyObject* self, PyObject* args)
PyErr_SetFromErrno(PyExc_OSError);
return NULL;
}
- return PyString_FromString(domain);
+ return PyBytes_FromString(domain);
}
PyDoc_STRVAR(bindtextdomain__doc__,
@@ -651,7 +651,7 @@ PyIntl_bindtextdomain(PyObject* self,PyObject*args)
PyErr_SetFromErrno(PyExc_OSError);
return NULL;
}
- return PyString_FromString(dirname);
+ return PyBytes_FromString(dirname);
}
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
@@ -667,7 +667,7 @@ PyIntl_bind_textdomain_codeset(PyObject* self,PyObject*args)
return NULL;
codeset = bind_textdomain_codeset(domain, codeset);
if (codeset)
- return PyString_FromString(codeset);
+ return PyBytes_FromString(codeset);
Py_RETURN_NONE;
}
#endif
@@ -760,7 +760,7 @@ init_locale(void)
Error = PyErr_NewException("locale.Error", NULL, NULL);
PyDict_SetItemString(d, "Error", Error);
- x = PyString_FromString(locale__doc__);
+ x = PyBytes_FromString(locale__doc__);
PyDict_SetItemString(d, "__doc__", x);
Py_XDECREF(x);