Skip to content

Commit a705d9c

Browse files
committed
Increase the length of the type name in AttributeError messages
This was inconsistently 50 or 100 or 200 at different call sites. This replaces all the 50s with 100s.
1 parent 0056701 commit a705d9c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Doc/extending/newtypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ Here is an example::
337337
}
338338

339339
PyErr_Format(PyExc_AttributeError,
340-
"'%.50s' object has no attribute '%.400s'",
340+
"'%.100s' object has no attribute '%.400s'",
341341
tp->tp_name, name);
342342
return NULL;
343343
}

Modules/_threadmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ local_setattro(localobject *self, PyObject *name, PyObject *v)
946946
}
947947
if (r == 1) {
948948
PyErr_Format(PyExc_AttributeError,
949-
"'%.50s' object attribute '%U' is read-only",
949+
"'%.100s' object attribute '%U' is read-only",
950950
Py_TYPE(self)->tp_name, name);
951951
return -1;
952952
}

Objects/object.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ PyObject_GetAttr(PyObject *v, PyObject *name)
10331033
}
10341034
else {
10351035
PyErr_Format(PyExc_AttributeError,
1036-
"'%.50s' object has no attribute '%U'",
1036+
"'%.100s' object has no attribute '%U'",
10371037
tp->tp_name, name);
10381038
}
10391039

@@ -1353,7 +1353,7 @@ _PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method)
13531353
}
13541354

13551355
PyErr_Format(PyExc_AttributeError,
1356-
"'%.50s' object has no attribute '%U'",
1356+
"'%.100s' object has no attribute '%U'",
13571357
tp->tp_name, name);
13581358

13591359
set_attribute_error_context(obj, name);
@@ -1474,7 +1474,7 @@ _PyObject_GenericGetAttrWithDict(PyObject *obj, PyObject *name,
14741474

14751475
if (!suppress) {
14761476
PyErr_Format(PyExc_AttributeError,
1477-
"'%.50s' object has no attribute '%U'",
1477+
"'%.100s' object has no attribute '%U'",
14781478
tp->tp_name, name);
14791479

14801480
set_attribute_error_context(obj, name);
@@ -1545,7 +1545,7 @@ _PyObject_GenericSetAttrWithDict(PyObject *obj, PyObject *name,
15451545
}
15461546
else {
15471547
PyErr_Format(PyExc_AttributeError,
1548-
"'%.50s' object attribute '%U' is read-only",
1548+
"'%.100s' object attribute '%U' is read-only",
15491549
tp->tp_name, name);
15501550
}
15511551
goto done;

0 commit comments

Comments
 (0)