Skip to content

Commit 97cf25c

Browse files
committed
Apply suggestions
1 parent 8c142f3 commit 97cf25c

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Objects/abstract.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue)
145145
}
146146
if (res < 0) {
147147
PyErr_Format(PyExc_ValueError,
148-
"%T.__length_hint__() must return a positive int", o);
148+
"%T.__length_hint__() must return a non-negative int", o);
149149
return -1;
150150
}
151151
return res;
@@ -2817,7 +2817,7 @@ PyObject_GetIter(PyObject *o)
28172817
PyObject *res = (*f)(o);
28182818
if (res != NULL && !PyIter_Check(res)) {
28192819
PyErr_Format(PyExc_TypeError,
2820-
"%T.iter() must return an iterator, not %T",
2820+
"%T.__iter__() must return an iterator, not %T",
28212821
o, res);
28222822
Py_SETREF(res, NULL);
28232823
}
@@ -2837,7 +2837,7 @@ PyObject_GetAIter(PyObject *o) {
28372837
PyObject *it = (*f)(o);
28382838
if (it != NULL && !PyAIter_Check(it)) {
28392839
PyErr_Format(PyExc_TypeError,
2840-
"%T.aiter() must return an async iterator, not %T",
2840+
"%T.__aiter__() must return an async iterator, not %T",
28412841
o, it);
28422842
Py_SETREF(it, NULL);
28432843
}

Objects/typeobject.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3508,17 +3508,16 @@ mro_check(PyTypeObject *type, PyObject *mro)
35083508
PyObject *obj = PyTuple_GET_ITEM(mro, i);
35093509
if (!PyType_Check(obj)) {
35103510
PyErr_Format(PyExc_TypeError,
3511-
"%s.mro() returned a non-class ('%T')",
3512-
type->tp_name, obj);
3511+
"%N.mro() returned a non-class ('%T')", type, obj);
35133512
return -1;
35143513
}
35153514
PyTypeObject *base = (PyTypeObject*)obj;
35163515

35173516
if (!is_subtype_with_mro(lookup_tp_mro(solid), solid, solid_base(base))) {
35183517
PyErr_Format(
35193518
PyExc_TypeError,
3520-
"%s.mro() returned base with unsuitable layout ('%.500s')",
3521-
type->tp_name, base->tp_name);
3519+
"%N.mro() returned base with unsuitable layout ('%.500s')",
3520+
type, base->tp_name);
35223521
return -1;
35233522
}
35243523
}

0 commit comments

Comments
 (0)