diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-03-26 02:47:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-26 02:47:08 -0700 |
commit | 03440850e7266aa7fd531c7f281a3fdcf17f90a4 (patch) | |
tree | 0f83ce443ba3b81680ebdfaa40b76cbdf9deb916 /Objects | |
parent | e0fe25be1ecbdf4abd1b0edd4aabacc4d75dec41 (diff) | |
download | cpython-git-03440850e7266aa7fd531c7f281a3fdcf17f90a4.tar.gz |
bpo-36433: fix confusing error messages in classmethoddescr_call (GH-12556)
https://bugs.python.org/issue36433
(cherry picked from commit 871309c775fd4d72048bfaa31affd54f9934f7dd)
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/descrobject.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Objects/descrobject.c b/Objects/descrobject.c index 277fed9956..370b7a75e8 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -313,20 +313,18 @@ classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args, if (!PyType_Check(self)) { PyErr_Format(PyExc_TypeError, "descriptor '%V' requires a type " - "but received a '%.100s'", + "but received a '%.100s' instance", descr_name((PyDescrObject *)descr), "?", - PyDescr_TYPE(descr)->tp_name, self->ob_type->tp_name); return NULL; } if (!PyType_IsSubtype((PyTypeObject *)self, PyDescr_TYPE(descr))) { PyErr_Format(PyExc_TypeError, - "descriptor '%V' " - "requires a subtype of '%.100s' " - "but received '%.100s", + "descriptor '%V' requires a subtype of '%.100s' " + "but received '%.100s'", descr_name((PyDescrObject *)descr), "?", PyDescr_TYPE(descr)->tp_name, - self->ob_type->tp_name); + ((PyTypeObject*)self)->tp_name); return NULL; } |