New submission from Serhiy Storchaka:

PyObject_IsInstance() is used incorrectly for testing if Python object is an 
instance of specified builtin type before direct access to internals of object. 
This is not correct, because PyObject_IsInstance() checks the __class__ 
attribute that can be modified and even can be dynamic property. Correct way is 
to check static type. Proposed patch replaces PyObject_IsInstance() with 
PyObject_TypeCheck() if this is appropriate.

See also similar issues issue24102 and issue24091.

----------
components: Extension Modules, Interpreter Core
files: typecheck.patch
keywords: patch
messages: 243739
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Incorrect use of PyObject_IsInstance
type: crash
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file39450/typecheck.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24257>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to