Support unicode names
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index 6dc7d08..8c324f3 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -166,8 +166,8 @@
"__name__");
if (nameobj == NULL)
PyErr_Clear();
- else if (PyString_Check(nameobj))
- name = PyString_AS_STRING(nameobj);
+ else if (PyUnicode_Check(nameobj))
+ name = PyUnicode_AsString(nameobj);
PyOS_snprintf(buffer, sizeof(buffer),
name ? "<weakref at %p; to '%.50s' at %p (%s)>"
: "<weakref at %p; to '%.50s' at %p>",