use formats that work on 2.7

This commit is contained in:
Benjamin Peterson 2012-05-01 10:16:33 -04:00
parent 042c47b2c7
commit f3ad1f94a8
1 changed files with 6 additions and 7 deletions

View File

@ -262,28 +262,27 @@ classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args,
argc = PyTuple_GET_SIZE(args); argc = PyTuple_GET_SIZE(args);
if (argc < 1) { if (argc < 1) {
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"descriptor '%V' of '%.100s' " "descriptor '%s' of '%.100s' "
"object needs an argument", "object needs an argument",
descr_name((PyDescrObject *)descr), "?", descr_name((PyDescrObject *)descr),
descr->d_type->tp_name); descr->d_type->tp_name);
return NULL; return NULL;
} }
self = PyTuple_GET_ITEM(args, 0); self = PyTuple_GET_ITEM(args, 0);
if (!PyType_Check(self)) { if (!PyType_Check(self)) {
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"descriptor '%V' requires a type " "descriptor '%s' requires a type "
"but received a '%.100s'", "but received a '%.100s'",
descr_name((PyDescrObject *)descr), "?", descr_name((PyDescrObject *)descr),
descr->d_type->tp_name,
self->ob_type->tp_name); self->ob_type->tp_name);
return NULL; return NULL;
} }
if (!PyType_IsSubtype((PyTypeObject *)self, descr->d_type)) { if (!PyType_IsSubtype((PyTypeObject *)self, descr->d_type)) {
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"descriptor '%V' " "descriptor '%s' "
"requires a subtype of '%.100s' " "requires a subtype of '%.100s' "
"but received '%.100s", "but received '%.100s",
descr_name((PyDescrObject *)descr), "?", descr_name((PyDescrObject *)descr),
descr->d_type->tp_name, descr->d_type->tp_name,
self->ob_type->tp_name); self->ob_type->tp_name);
return NULL; return NULL;