A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-May/140035.html below:

[Python-Dev] PyObject_IsInstance is dangerous

[Python-Dev] PyObject_IsInstance is dangerous [Python-Dev] PyObject_IsInstance is dangerousGreg Ewing greg.ewing at canterbury.ac.nz
Mon May 18 14:14:24 CEST 2015
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 requires a particular C layout should be using
PyObject_TypeCheck, not PyObject_IsInstance.

-- 
Greg

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4