Re: [Python-Dev] PyObject_IsInstance is dangerous

2015-05-18 Thread Greg Ewing
Serhiy Storchaka wrote: May be modify PyObject_IsInstance so that it will never return true if layouts are not compatible? That wouldn't be a good idea, since PyObject_IsInstance is meant to reflect the behaviour of python's isinstance() function, which doesn't care about C layouts. -- Greg __

Re: [Python-Dev] PyObject_IsInstance is dangerous

2015-05-18 Thread Serhiy Storchaka
On 18.05.15 15:14, Greg Ewing wrote: Serhiy Storchaka wrote: PyObject_IsInstance is not safe when used to check if the object is an instance of specified builtin type. The __class__ attribute can be modified and PyObject_IsInstance() can return true if the object has not layout compatible with

Re: [Python-Dev] PyObject_IsInstance is dangerous

2015-05-18 Thread Greg Ewing
Serhiy Storchaka wrote: PyObject_IsInstance is not safe when used to check if the object is an instance of specified builtin type. The __class__ attribute can be modified and PyObject_IsInstance() can return true if the object has not layout compatible with specified structure. Code that re