gh-130821: Add type info to error messages for __len__ and __sizeof__ by tangyuan0821 · Pull Request #151894 · python/cpython · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -10625,8 +10625,8 @@ slot_sq_length(PyObject *self)
assert(PyLong_Check(res));
if (_PyLong_IsNegative((PyLongObject *)res)) {
Py_DECREF(res);
PyErr_SetString(PyExc_ValueError,
"__len__() should return >= 0");
PyErr_Format(PyExc_ValueError,
"%T.__len__() must return >= 0", self);
return -1;
}

Expand Down
4 changes: 2 additions & 2 deletions Python/sysmodule.c
Loading