classification
Title: Issues with PyMemberDef flags
Type: Stage: resolved
Components: Documentation Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Outdated *_RESTRICTED flags in structmember.h
View: 24065
Assigned To: docs@python Nosy List: belopolsky, christian.heimes, docs@python, serhiy.storchaka, skip.montanaro
Priority: normal Keywords:

Created on 2016-10-03 18:07 by serhiy.storchaka, last changed 2016-10-03 18:35 by serhiy.storchaka. This issue is now closed.

Messages (6)
msg277972 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-03 18:07
As documented in Doc/extending/newtypes.rst, the flags field of PyMemberDef must be bitwise-or-ed combination of flag constants READONLY, READ_RESTRICTED, WRITE_RESTRICTED and RESTRICTED. There are problems with this:

1. Actually WRITE_RESTRICTED was renamed to PY_WRITE_RESTRICTED in 2.6 (a8dd8874ff2d). I didn't find mention of this backward incompatible change in Misc/NEWS and whatsnew files.

2. Since the support of restricted mode was removed in 3.x, only READONLY flag has effect. Other flags are still documented and used in CPython sources. I think we should get rid of using these flags and undocument them or document as outdated.

3. As noted by Skip Montanaro on the Python-Dev mailing list, these flags (as well as T_* type tags in Include/structmember.h) should have the PY_ prefix.
msg277974 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-03 18:14
The latter issue is a duplicate of issue2897.
msg277978 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-03 18:22
We still should correct the documentation in 2.7 and 3.x.
msg277980 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2016-10-03 18:24
Serhiy, while I see that you've raised some additional issues here, let's keep the discussion related to Include/structmember.h in one place.  I would not mind adding additional affected versions there.
msg277981 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2016-10-03 18:30
There is also #24065 ("Outdated *_RESTRICTED flags in structmember.h") which I think should be folded into #2897.
msg277983 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-03 18:35
Ah this is a duplicate of issue24065!
History
Date User Action Args
2016-10-03 18:43:06belopolskylinkissue2897 dependencies
2016-10-03 18:35:06serhiy.storchakasetstatus: open -> closed
superseder: PyMemberDef missing in limited API / Deprecate structmember.h -> Outdated *_RESTRICTED flags in structmember.h
messages: + msg277983

resolution: duplicate
stage: needs patch -> resolved
2016-10-03 18:30:49belopolskysetmessages: + msg277981
2016-10-03 18:24:50belopolskysetnosy: + belopolsky
messages: + msg277980
2016-10-03 18:22:39serhiy.storchakasetstatus: closed -> open
resolution: duplicate -> (no value)
messages: + msg277978

stage: resolved -> needs patch
2016-10-03 18:20:01belopolskysetstatus: open -> closed
superseder: PyMemberDef missing in limited API / Deprecate structmember.h
resolution: duplicate
stage: resolved
2016-10-03 18:14:17serhiy.storchakasetmessages: + msg277974
2016-10-03 18:07:59serhiy.storchakacreate