This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: inspect.isdatadescriptor false negative
Type: behavior Stage: resolved
Components: Documentation, Library (Lib) Versions: Python 3.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Contradiction in definition of "data descriptor" between (dotted lookup behavior/datamodel documentation) and (inspect lib/descriptor how-to)
View: 26103
Assigned To: docs@python Nosy List: Aaron Hall, chnlior, corona10, docs@python, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2017-12-21 18:57 by chnlior, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg308895 - (view) Author: Lior Cohen (chnlior) Date: 2017-12-21 18:57
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.
msg319204 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2018-06-10 08:03
@Serhiy Storchaka
This issue can be closed due to PR 1959
History
Date User Action Args
2022-04-11 14:58:55adminsetgithub: 76581
2018-06-10 11:24:32berker.peksagsetstatus: open -> closed
superseder: Contradiction in definition of "data descriptor" between (dotted lookup behavior/datamodel documentation) and (inspect lib/descriptor how-to)
resolution: duplicate
stage: patch review -> resolved
2018-06-10 08:03:55corona10setpull_requests: - pull_request7206
2018-06-10 08:03:42corona10setnosy: + serhiy.storchaka, corona10
messages: + msg319204
pull_requests: + pull_request7206

keywords: + patch
stage: patch review
2018-05-22 20:30:13Aaron Hallsetnosy: + Aaron Hall
2017-12-21 18:57:44chnliorsettitle: inspect.isdatadescriptor fasle negative -> inspect.isdatadescriptor false negative
2017-12-21 18:57:04chnliorcreate