Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b9905b

Browse files
committed
Expect unicode in class_name.
1 parent 826b9dd commit 9b9905b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Objects/typeobject.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ class_name(PyObject *cls)
10101010
}
10111011
if (name == NULL)
10121012
return NULL;
1013-
if (!PyString_Check(name)) {
1013+
if (!PyUnicode_Check(name)) {
10141014
Py_DECREF(name);
10151015
return NULL;
10161016
}
@@ -1032,7 +1032,7 @@ check_duplicates(PyObject *list)
10321032
o = class_name(o);
10331033
PyErr_Format(PyExc_TypeError,
10341034
"duplicate base class %s",
1035-
o ? PyString_AS_STRING(o) : "?");
1035+
o ? PyUnicode_AsString(o) : "?");
10361036
Py_XDECREF(o);
10371037
return -1;
10381038
}
@@ -1078,7 +1078,7 @@ consistent method resolution\norder (MRO) for bases");
10781078
while (PyDict_Next(set, &i, &k, &v) && (size_t)off < sizeof(buf)) {
10791079
PyObject *name = class_name(k);
10801080
off += PyOS_snprintf(buf + off, sizeof(buf) - off, " %s",
1081-
name ? PyString_AS_STRING(name) : "?");
1081+
name ? PyUnicode_AsString(name) : "?");
10821082
Py_XDECREF(name);
10831083
if (--n && (size_t)(off+1) < sizeof(buf)) {
10841084
buf[off++] = ',';

0 commit comments

Comments
 (0)