[issue32400] inspect.isdatadescriptor fasle negative

Lior Cohen report at bugs.python.org
Thu Dec 21 13:57:05 EST 2017


New submission from Lior Cohen <chnlior at gmail.com>:

According to the c code in Include/descrobject.h

#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)

and according to the "data model" chapter,
a data descriptor is an object who has __set__ and /or __delete__.

the "inspect.isdatadescriptor" checks for existence of __get__ and __set__ which IMHO is wrong. an object with __set__/__delete__ only will return falsely False (should be True).  

This is related to @Serhiy Storchaka comment in issue 26103 opened by @Aaron Hall.

----------
assignee: docs at python
components: Documentation, Library (Lib)
messages: 308895
nosy: chnlior, docs at python
priority: normal
severity: normal
status: open
title: inspect.isdatadescriptor  fasle negative
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32400>
_______________________________________


More information about the Python-bugs-list mailing list