]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-103712: Increase the length of the type name in AttributeError messages (#103713)
authorAlex Gaynor <alex.gaynor@gmail.com>
Mon, 24 Apr 2023 14:23:08 +0000 (08:23 -0600)
committerGitHub <noreply@github.com>
Mon, 24 Apr 2023 14:23:08 +0000 (08:23 -0600)
Doc/extending/newtypes.rst
Modules/_threadmodule.c
Objects/object.c
Objects/typeobject.c

index 80a1387db200c2dc5c64d131133d3b7a5d715ccb..56b40acdb69fedd8f1a69c23e376800518c07c2f 100644 (file)
@@ -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;
    }
index 9c12c6967574397a77fec6db9f75cd98e7dfe298..fd2fd9ab25f113a0a306d43f4143eb62dc28bbb0 100644 (file)
@@ -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;
     }
index e508881c67d2771187b14361817dda201df53bcd..a784e6bcbf97f92a47a08311435304e9024aa6dc 100644 (file)
@@ -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;
index 85bcd05d5a29df7b257d0b697a4d4a46b7ffea5a..748965da0b4e21f46305a8d8c385119849e4e25c 100644 (file)
@@ -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