Author: walter.doerwald
Date: Mon Jun 11 17:37:20 2007
New Revision: 55894

Modified:
   python/branches/py3k-struni/Objects/object.c
Log:
Simplify error formatting.


Modified: python/branches/py3k-struni/Objects/object.c
==============================================================================
--- python/branches/py3k-struni/Objects/object.c        (original)
+++ python/branches/py3k-struni/Objects/object.c        Mon Jun 11 17:37:20 2007
@@ -904,8 +904,8 @@
        if (tp->tp_getattr != NULL)
                return (*tp->tp_getattr)(v, PyUnicode_AsString(name));
        PyErr_Format(PyExc_AttributeError,
-                    "'%.50s' object has no attribute '%.400s'",
-                    tp->tp_name, PyUnicode_AsString(name));
+                    "'%.50s' object has no attribute '%U'",
+                    tp->tp_name, name);
        return NULL;
 }
 
@@ -951,17 +951,17 @@
        if (tp->tp_getattr == NULL && tp->tp_getattro == NULL)
                PyErr_Format(PyExc_TypeError,
                             "'%.100s' object has no attributes "
-                            "(%s .%.100s)",
+                            "(%s .%U)",
                             tp->tp_name,
                             value==NULL ? "del" : "assign to",
-                            PyUnicode_AsString(name));
+                            name);
        else
                PyErr_Format(PyExc_TypeError,
                             "'%.100s' object has only read-only attributes "
-                            "(%s .%.100s)",
+                            "(%s .%U)",
                             tp->tp_name,
                             value==NULL ? "del" : "assign to",
-                            PyUnicode_AsString(name));
+                            name);
        return -1;
 }
 
@@ -1167,14 +1167,14 @@
 
        if (descr == NULL) {
                PyErr_Format(PyExc_AttributeError,
-                            "'%.100s' object has no attribute '%.200s'",
-                            tp->tp_name, PyUnicode_AsString(name));
+                            "'%.100s' object has no attribute '%U'",
+                            tp->tp_name, name);
                goto done;
        }
 
        PyErr_Format(PyExc_AttributeError,
-                    "'%.50s' object attribute '%.400s' is read-only",
-                    tp->tp_name, PyUnicode_AsString(name));
+                    "'%.50s' object attribute '%U' is read-only",
+                    tp->tp_name, name);
   done:
        Py_DECREF(name);
        return res;
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to