Skip to content

Commit 45f4ddb

Browse files
committed
Respond to comments about giving typeerror without hint and changing the error message
1 parent 5c6f5c1 commit 45f4ddb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Python/ceval.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,11 +1620,11 @@ too_many_positional(PyThreadState *tstate, PyCodeObject *co,
16201620
}
16211621
if (suggest_missing_self) {
16221622
self_hint = PyUnicode_FromString(
1623-
". Did you forget to declare 'self' as the first parameter?");
1623+
". Did you forget the 'self' parameter in the function definition?");
16241624
if (self_hint == NULL) {
1625+
self_hint = Py_GetConstant(Py_CONSTANT_EMPTY_STR)
16251626
Py_DECREF(sig);
16261627
Py_DECREF(kwonly_sig);
1627-
return;
16281628
}
16291629
}
16301630
_PyErr_Format(tstate, PyExc_TypeError,
@@ -1653,7 +1653,7 @@ suggest_missing_self(PyFunctionObject *func, PyCodeObject *co,
16531653

16541654
PyObject *self = PyStackRef_AsPyObjectBorrow(args[0]);
16551655
if (self == NULL) {
1656-
// When first arg is NULL, its not really about self
1656+
// When first arg is NULL, it's not really about self
16571657
return 0;
16581658
}
16591659

0 commit comments

Comments
 (0)