summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/_ctypes.c5
-rw-r--r--Modules/_ctypes/callproc.c4
-rw-r--r--Modules/ossaudiodev.c9
3 files changed, 11 insertions, 7 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 2935292..2f3495e 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -734,8 +734,7 @@ PyCStructType_setattro(PyObject *self, PyObject *key, PyObject *value)
return -1;
if (value && PyUnicode_Check(key) &&
- /* XXX struni _PyUnicode_AsString can fail (also in other places)! */
- 0 == strcmp(_PyUnicode_AsString(key), "_fields_"))
+ _PyUnicode_EqualToASCIIString(key, "_fields_"))
return PyCStructUnionType_update_stgdict(self, value, 1);
return 0;
}
@@ -749,7 +748,7 @@ UnionType_setattro(PyObject *self, PyObject *key, PyObject *value)
return -1;
if (PyUnicode_Check(key) &&
- 0 == strcmp(_PyUnicode_AsString(key), "_fields_"))
+ _PyUnicode_EqualToASCIIString(key, "_fields_"))
return PyCStructUnionType_update_stgdict(self, value, 0);
return 0;
}
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 30e3a96..abd3bc9 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -1670,7 +1670,9 @@ POINTER(PyObject *self, PyObject *cls)
return result;
}
if (PyUnicode_CheckExact(cls)) {
- char *name = _PyUnicode_AsString(cls);
+ const char *name = PyUnicode_AsUTF8(cls);
+ if (name == NULL)
+ return NULL;
buf = PyMem_Malloc(strlen(name) + 3 + 1);
if (buf == NULL)
return PyErr_NoMemory();
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index d2fd5c8..5423308 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -925,11 +925,14 @@ static PyMethodDef oss_mixer_methods[] = {
static PyObject *
oss_getattro(oss_audio_t *self, PyObject *nameobj)
{
- char *name = "";
+ const char *name = "";
PyObject * rval = NULL;
- if (PyUnicode_Check(nameobj))
- name = _PyUnicode_AsString(nameobj);
+ if (PyUnicode_Check(nameobj)) {
+ name = PyUnicode_AsUTF8(nameobj);
+ if (name == NULL)
+ return NULL;
+ }
if (strcmp(name, "closed") == 0) {
rval = (self->fd == -1) ? Py_True : Py_False;