GeezerVison is showing github.com — PyMemberDef missing in limited API / Deprecate structmember.h · Issue #47146 · python/cpython
PyMemberDef missing in limited API / Deprecate structmember.h #47146Description
| BPO |
2897 |
| Nosy |
@loewis, @smontanaro, @birkenfeld, @rhettinger, @abalkin, @vstinner, @benjaminp, @berkerpeksag, @serhiy-storchaka, @matrixise, @erlend-aasland, @MatzeB |
| PRs |
bpo-2897: Make PyMemberDef part of stable ABI; deprecate structmember.h #20462bpo-41861: Clean up sqlite3 header files wrt. PEP 384 #22419 |
| Dependencies |
bpo-24065: Outdated *_RESTRICTED flags in structmember.hbpo-28349: Issues with PyMemberDef flags |
| Files |
issue2897.diffissue2897-docs-3x.diff |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = 'https://github.com/abalkin'
closed_at = None
created_at = <Date 2008-05-16.22:45:11.685>
labels = ['interpreter-core', 'expert-C-API', 'type-feature', '3.10', 'docs']
title = 'PyMemberDef missing in limited API / Deprecate structmember.h'
updated_at = <Date 2020-09-26.20:51:31.703>
user = 'https://github.com/benjaminp'
bugs.python.org fields:
activity = <Date 2020-09-26.20:51:31.703>
actor = 'erlendaasland'
assignee = 'belopolsky'
closed = False
closed_date = None
closer = None
components = ['Documentation', 'Interpreter Core', 'C API']
creation = <Date 2008-05-16.22:45:11.685>
creator = 'benjamin.peterson'
dependencies = ['24065', '28349']
files = ['44943', '44976']
hgrepos = []
issue_num = 2897
keywords = ['patch']
message_count = 21.0
messages = ['66972', '67028', '67062', '79242', '79244', '277971', '277973', '277976', '277982', '277985', '277986', '277988', '278136', '342468', '370098', '370100', '370101', '370104', '370106', '370107', '370138']
nosy_count = 15.0
nosy_names = ['loewis', 'skip.montanaro', 'georg.brandl', 'rhettinger', 'belopolsky', 'vstinner', 'benjamin.peterson', 'Arfrever', 'herzbube', 'docs@python', 'berker.peksag', 'serhiy.storchaka', 'matrixise', 'erlendaasland', 'Matthias Braun']
pr_nums = ['20462', '22419']
priority = 'normal'
resolution = None
stage = 'patch review'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue2897'
versions = ['Python 3.10']
Activitybenjaminp commented on May 16, 2008 ContributorAuthor More actions As the comment in descrobject.c says:
/* Why is this not included in Python.h? */ birkenfeld commented on May 18, 2008 We could include it in Py3k. abalkin commented on May 19, 2008 Note that structmember.h pollutes global namespace with macros that do not
have conventional Py_ or PY_ prefix. READONLY and RESTRICTED macros seem
to be most likely to conflict with other code. I would be -0 on including tructmember.h in Python.h if flags macros are not properly renamed. +0
otherwise. T_* macros are probably OK, but T prefix is reminiscent of
popular (in some circles) Taligent naming conventions:
http://pcroot.cern.ch/TaligentDocs/TaligentOnline/DocumentRoot/1.0/Docs/bo
oks/WM/WM_63.html#HEADING77 rhettinger commented on Jan 6, 2009 Martin, do you want to make the call on this one? loewis commented on Jan 6, 2009 I agree with Alexander; the header shouldn't be included into Python.h
as-is.
I would propose to eliminate it eventually, with the following steps:
- move PyMemberDef and the function declarations into object.h
- (simultaneously) introduce properly-prefixed macros in object.h
- deprecate structmember.h
- remove it
abalkin commented on Oct 3, 2016 I am attaching a patch that implements steps 1 and 2 of Martin's plan. There are over 50 files that include structmember.h. I am not sure it is worth the trouble to update all those files before structmember.h is actually removed. If we agree that this is the right way forward, I'll make the necessary changes to the docs. abalkin commented on Oct 3, 2016 I would also like this opportunity to rename T_PYSSIZET to something more readable: maybe PY_T_PY_SSIZE_T or PY_T_SSIZE_T. serhiy-storchaka commented on Oct 3, 2016 Please don't forget to use "hg copy" for creating object.h from structmember.h. This preserves the history.
structmember.h should be implemented using object.h. Include object.h and add aliases.
Only READONLY flag is used in 3.x (bpo-28349). Other flags can be removed. vstinner commented on May 27, 2020
The proposed patch here, would fix this!
The issue title is misleading, it says "Deprecate structmember.h". Is the plan still to deprecate it? Or to make it usable in the limited C API? Please update the title. vstinner commented on May 27, 2020
Note that structmember.h pollutes global namespace with macros that do not have conventional Py_ or PY_ prefix. READONLY and RESTRICTED macros seem to be most likely to conflict with other code.
One small enhance would be to add such prefix when Py_LIMITED_API is defined. MatzeB commented on May 27, 2020
The issue title is misleading, it says "Deprecate structmember.h". Is the plan still to deprecate it? Or to make it usable in the limited C API? Please update the title.
As far as I understand it: The attached diff, moves the interesting declaration to object.h solving the limited API problem. And only leaves structmember.h around for backward compatibility for people using the "old" names READONLY or RESTRICTED. So in that sense it does deprecate structmember.h
But indeed I hijacked this issue with my complaints about the limited API which may not have been the original intention here, but they get solved nonetheless. vstinner commented on May 27, 2020 Also, the bare minimum enhancement would be add rename READONLY to PY_READONLY, but keep a deprecated alias READONLY to PY_READONLY, and update CPython code base to use PY_READONLY. (Same for other similar flags.) MatzeB changed the title [-]Deprecate structmember.h[/-] [+]PyMemberDef missing in limited API / Deprecate structmember.h[/+] on May 27, 2020MatzeB commented on May 27, 2020 Happy to take the proposed diff here (assuming @belopolsky wont mind) and include it into a pull request that also renames the uses of the READONLY flags (and maybe removes the RESTRICTED flags) within cpython source itself. MatzeB commented on May 27, 2020 While working on the pull request I felt that the type and constants better fit descrobject.h rather than object.h. encukou commented on Nov 2, 2022 I ran into this issue, so I made a PR: #99014
The twist is that old code doesn't need to change. That would be unnecessary churn. Keeping a few weirdly named aliases around is not a maintenance burden, and since they need the extra header they won't pollute new code. added a commit that references this issue on Nov 22, 2022gh-47146: Soft-deprecate structmember.h, expose its contents via Pyth… added 2 commits that reference this issue on Jul 18, 2023pythongh-47146: Fix reference counting in _testcapi.structmember init… gh-47146: Fix reference counting in _testcapi.structmember initializer (
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|