Commit 9b9905b2 authored by Martin v. Löwis's avatar Martin v. Löwis

Expect unicode in class_name.

parent 826b9ddb
...@@ -1010,7 +1010,7 @@ class_name(PyObject *cls) ...@@ -1010,7 +1010,7 @@ class_name(PyObject *cls)
} }
if (name == NULL) if (name == NULL)
return NULL; return NULL;
if (!PyString_Check(name)) { if (!PyUnicode_Check(name)) {
Py_DECREF(name); Py_DECREF(name);
return NULL; return NULL;
} }
...@@ -1032,7 +1032,7 @@ check_duplicates(PyObject *list) ...@@ -1032,7 +1032,7 @@ check_duplicates(PyObject *list)
o = class_name(o); o = class_name(o);
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"duplicate base class %s", "duplicate base class %s",
o ? PyString_AS_STRING(o) : "?"); o ? PyUnicode_AsString(o) : "?");
Py_XDECREF(o); Py_XDECREF(o);
return -1; return -1;
} }
...@@ -1078,7 +1078,7 @@ consistent method resolution\norder (MRO) for bases"); ...@@ -1078,7 +1078,7 @@ consistent method resolution\norder (MRO) for bases");
while (PyDict_Next(set, &i, &k, &v) && (size_t)off < sizeof(buf)) { while (PyDict_Next(set, &i, &k, &v) && (size_t)off < sizeof(buf)) {
PyObject *name = class_name(k); PyObject *name = class_name(k);
off += PyOS_snprintf(buf + off, sizeof(buf) - off, " %s", off += PyOS_snprintf(buf + off, sizeof(buf) - off, " %s",
name ? PyString_AS_STRING(name) : "?"); name ? PyUnicode_AsString(name) : "?");
Py_XDECREF(name); Py_XDECREF(name);
if (--n && (size_t)(off+1) < sizeof(buf)) { if (--n && (size_t)(off+1) < sizeof(buf)) {
buf[off++] = ','; buf[off++] = ',';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment