Commit d376dd97 authored by Walter Dörwald's avatar Walter Dörwald

Simplify error formatting.

parent a29d1d7f
...@@ -904,8 +904,8 @@ PyObject_GetAttr(PyObject *v, PyObject *name) ...@@ -904,8 +904,8 @@ PyObject_GetAttr(PyObject *v, PyObject *name)
if (tp->tp_getattr != NULL) if (tp->tp_getattr != NULL)
return (*tp->tp_getattr)(v, PyUnicode_AsString(name)); return (*tp->tp_getattr)(v, PyUnicode_AsString(name));
PyErr_Format(PyExc_AttributeError, PyErr_Format(PyExc_AttributeError,
"'%.50s' object has no attribute '%.400s'", "'%.50s' object has no attribute '%U'",
tp->tp_name, PyUnicode_AsString(name)); tp->tp_name, name);
return NULL; return NULL;
} }
...@@ -951,17 +951,17 @@ PyObject_SetAttr(PyObject *v, PyObject *name, PyObject *value) ...@@ -951,17 +951,17 @@ PyObject_SetAttr(PyObject *v, PyObject *name, PyObject *value)
if (tp->tp_getattr == NULL && tp->tp_getattro == NULL) if (tp->tp_getattr == NULL && tp->tp_getattro == NULL)
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"'%.100s' object has no attributes " "'%.100s' object has no attributes "
"(%s .%.100s)", "(%s .%U)",
tp->tp_name, tp->tp_name,
value==NULL ? "del" : "assign to", value==NULL ? "del" : "assign to",
PyUnicode_AsString(name)); name);
else else
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"'%.100s' object has only read-only attributes " "'%.100s' object has only read-only attributes "
"(%s .%.100s)", "(%s .%U)",
tp->tp_name, tp->tp_name,
value==NULL ? "del" : "assign to", value==NULL ? "del" : "assign to",
PyUnicode_AsString(name)); name);
return -1; return -1;
} }
...@@ -1167,14 +1167,14 @@ PyObject_GenericSetAttr(PyObject *obj, PyObject *name, PyObject *value) ...@@ -1167,14 +1167,14 @@ PyObject_GenericSetAttr(PyObject *obj, PyObject *name, PyObject *value)
if (descr == NULL) { if (descr == NULL) {
PyErr_Format(PyExc_AttributeError, PyErr_Format(PyExc_AttributeError,
"'%.100s' object has no attribute '%.200s'", "'%.100s' object has no attribute '%U'",
tp->tp_name, PyUnicode_AsString(name)); tp->tp_name, name);
goto done; goto done;
} }
PyErr_Format(PyExc_AttributeError, PyErr_Format(PyExc_AttributeError,
"'%.50s' object attribute '%.400s' is read-only", "'%.50s' object attribute '%U' is read-only",
tp->tp_name, PyUnicode_AsString(name)); tp->tp_name, name);
done: done:
Py_DECREF(name); Py_DECREF(name);
return res; return res;
......
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