Skip to content

Commit 5430093

Browse files
authored
gh-103712: Increase the length of the type name in AttributeError messages (#103713)
1 parent 59c522f commit 5430093

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
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;

Objects/typeobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4328,7 +4328,7 @@ _Py_type_getattro_impl(PyTypeObject *type, PyObject *name, int * suppress_missin
43284328
/* Give up */
43294329
if (suppress_missing_attribute == NULL) {
43304330
PyErr_Format(PyExc_AttributeError,
4331-
"type object '%.50s' has no attribute '%U'",
4331+
"type object '%.100s' has no attribute '%U'",
43324332
type->tp_name, name);
43334333
} else {
43344334
// signal the caller we have not set an PyExc_AttributeError and gave up

0 commit comments

Comments
 (0)