diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2023-04-24 14:23:08 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-24 14:23:08 (GMT) |
commit | 543009347e7cfcc495ca8553fab8d622dcfd18e3 (patch) | |
tree | 6ca45ebf28af6adee5c85b707b21c8f18ad57a91 | |
parent | 59c522f9650c22dc986debce483b83a4ffc6dc0d (diff) | |
download | cpython-543009347e7cfcc495ca8553fab8d622dcfd18e3.zip cpython-543009347e7cfcc495ca8553fab8d622dcfd18e3.tar.gz cpython-543009347e7cfcc495ca8553fab8d622dcfd18e3.tar.bz2 |
gh-103712: Increase the length of the type name in AttributeError messages (#103713)
-rw-r--r-- | Doc/extending/newtypes.rst | 2 | ||||
-rw-r--r-- | Modules/_threadmodule.c | 2 | ||||
-rw-r--r-- | Objects/object.c | 8 | ||||
-rw-r--r-- | Objects/typeobject.c | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst index 80a1387..56b40ac 100644 --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -337,7 +337,7 @@ Here is an example:: } PyErr_Format(PyExc_AttributeError, - "'%.50s' object has no attribute '%.400s'", + "'%.100s' object has no attribute '%.400s'", tp->tp_name, name); return NULL; } diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index 9c12c69..fd2fd9a 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -946,7 +946,7 @@ local_setattro(localobject *self, PyObject *name, PyObject *v) } if (r == 1) { PyErr_Format(PyExc_AttributeError, - "'%.50s' object attribute '%U' is read-only", + "'%.100s' object attribute '%U' is read-only", Py_TYPE(self)->tp_name, name); return -1; } diff --git a/Objects/object.c b/Objects/object.c index e508881..a784e6b 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -1033,7 +1033,7 @@ PyObject_GetAttr(PyObject *v, PyObject *name) } else { PyErr_Format(PyExc_AttributeError, - "'%.50s' object has no attribute '%U'", + "'%.100s' object has no attribute '%U'", tp->tp_name, name); } @@ -1353,7 +1353,7 @@ _PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) } PyErr_Format(PyExc_AttributeError, - "'%.50s' object has no attribute '%U'", + "'%.100s' object has no attribute '%U'", tp->tp_name, name); set_attribute_error_context(obj, name); @@ -1474,7 +1474,7 @@ _PyObject_GenericGetAttrWithDict(PyObject *obj, PyObject *name, if (!suppress) { PyErr_Format(PyExc_AttributeError, - "'%.50s' object has no attribute '%U'", + "'%.100s' object has no attribute '%U'", tp->tp_name, name); set_attribute_error_context(obj, name); @@ -1545,7 +1545,7 @@ _PyObject_GenericSetAttrWithDict(PyObject *obj, PyObject *name, } else { PyErr_Format(PyExc_AttributeError, - "'%.50s' object attribute '%U' is read-only", + "'%.100s' object attribute '%U' is read-only", tp->tp_name, name); } goto done; diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 85bcd05..748965d 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -4328,7 +4328,7 @@ _Py_type_getattro_impl(PyTypeObject *type, PyObject *name, int * suppress_missin /* Give up */ if (suppress_missing_attribute == NULL) { PyErr_Format(PyExc_AttributeError, - "type object '%.50s' has no attribute '%U'", + "type object '%.100s' has no attribute '%U'", type->tp_name, name); } else { // signal the caller we have not set an PyExc_AttributeError and gave up |