diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-01 21:19:15 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-01 21:19:15 (GMT) |
commit | 3249dec02484674830177488c8f01d8d04873928 (patch) | |
tree | 6e41437d0f5066601875d2219f714367978ed178 /Objects | |
parent | 9c4f09d0f487de32444ebc2e11fdbaadf3dc5cd3 (diff) | |
download | cpython-3249dec02484674830177488c8f01d8d04873928.zip cpython-3249dec02484674830177488c8f01d8d04873928.tar.gz cpython-3249dec02484674830177488c8f01d8d04873928.tar.bz2 |
Issue #9756: When calling a method descriptor or a slot wrapper descriptor, the
check of the object type doesn't read the __class__ attribute anymore. Fix a
crash if a class override its __class__ attribute (e.g. a proxy of the str
type).
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/descrobject.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Objects/descrobject.c b/Objects/descrobject.c index 5f118ce..9eda4bd 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -226,7 +226,8 @@ methoddescr_call(PyMethodDescrObject *descr, PyObject *args, PyObject *kwds) return NULL; } self = PyTuple_GET_ITEM(args, 0); - if (!PyObject_IsInstance(self, (PyObject *)(descr->d_type))) { + if (!_PyObject_RealIsSubclass((PyObject *)Py_TYPE(self), + (PyObject *)(descr->d_type))) { PyErr_Format(PyExc_TypeError, "descriptor '%V' " "requires a '%.100s' object " @@ -284,7 +285,8 @@ wrapperdescr_call(PyWrapperDescrObject *descr, PyObject *args, PyObject *kwds) return NULL; } self = PyTuple_GET_ITEM(args, 0); - if (!PyObject_IsInstance(self, (PyObject *)(descr->d_type))) { + if (!_PyObject_RealIsSubclass((PyObject *)Py_TYPE(self), + (PyObject *)(descr->d_type))) { PyErr_Format(PyExc_TypeError, "descriptor '%V' " "requires a '%.100s' object " @@ -1065,7 +1067,8 @@ PyWrapper_New(PyObject *d, PyObject *self) assert(PyObject_TypeCheck(d, &PyWrapperDescr_Type)); descr = (PyWrapperDescrObject *)d; - assert(PyObject_IsInstance(self, (PyObject *)(descr->d_type))); + assert(_PyObject_RealIsSubclass((PyObject *)Py_TYPE(self), + (PyObject *)(descr->d_type))); wp = PyObject_GC_New(wrapperobject, &wrappertype); if (wp != NULL) { |