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
__
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
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
PyObject_IsInstance is not safe when used to check if the object is an
instance of specified builtin type. Typical code:
rc = PyObject_IsInstance(obj, &Someting_Type);
if (rc < 0) return NULL;
if (rc) {
SometingObject *something = (SometingObject *)obj;
something->som