From: Victor Stinner Date: Sun, 1 May 2011 21:31:36 +0000 (+0200) Subject: (Merge 3.1) Issue #9756: When calling a method descriptor or a slot wrapper X-Git-Tag: v3.2.1b1~39 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d9561318d849df12775d7a111aa85bbf62a54c0f;p=python (Merge 3.1) 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). --- d9561318d849df12775d7a111aa85bbf62a54c0f diff --cc Misc/NEWS index 07b7714d4c,41bda2a6a7..381c7f27a6 --- a/Misc/NEWS +++ b/Misc/NEWS @@@ -10,14 -10,11 +10,19 @@@ What's New in Python 3.2.1 Core and Builtins ----------------- + - 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). + +- Issue #10914: Initialize correctly the filesystem codec when creating a new + subinterpreter to fix a bootstrap issue with codecs implemented in Python, as + the ISO-8859-15 codec. + +- Issue #10517: After fork(), reinitialize the TLS used by the PyGILState_* + APIs, to avoid a crash with the pthread implementation in RHEL 5. Patch + by Charles-François Natali. + - Issue #6780: fix starts/endswith error message to mention that tuples are accepted too. diff --cc Objects/descrobject.c index 11c68d336c,9eda4bdd7d..93daefd75f --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@@ -226,7 -226,8 +226,8 @@@ methoddescr_call(PyMethodDescrObject *d return NULL; } self = PyTuple_GET_ITEM(args, 0); - if (!PyObject_IsInstance(self, (PyObject *)PyDescr_TYPE(descr))) { + if (!_PyObject_RealIsSubclass((PyObject *)Py_TYPE(self), - (PyObject *)(descr->d_type))) { ++ (PyObject *)PyDescr_TYPE(descr))) { PyErr_Format(PyExc_TypeError, "descriptor '%V' " "requires a '%.100s' object " @@@ -284,7 -285,8 +285,8 @@@ wrapperdescr_call(PyWrapperDescrObject return NULL; } self = PyTuple_GET_ITEM(args, 0); - if (!PyObject_IsInstance(self, (PyObject *)PyDescr_TYPE(descr))) { + if (!_PyObject_RealIsSubclass((PyObject *)Py_TYPE(self), - (PyObject *)(descr->d_type))) { ++ (PyObject *)PyDescr_TYPE(descr))) { PyErr_Format(PyExc_TypeError, "descriptor '%V' " "requires a '%.100s' object " @@@ -1065,7 -1067,8 +1067,8 @@@ PyWrapper_New(PyObject *d, PyObject *se assert(PyObject_TypeCheck(d, &PyWrapperDescr_Type)); descr = (PyWrapperDescrObject *)d; - assert(PyObject_IsInstance(self, (PyObject *)PyDescr_TYPE(descr))); + assert(_PyObject_RealIsSubclass((PyObject *)Py_TYPE(self), - (PyObject *)(descr->d_type))); ++ (PyObject *)PyDescr_TYPE(descr))); wp = PyObject_GC_New(wrapperobject, &wrappertype); if (wp != NULL) {