homepage

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: Add the const qualifier to fields name and doc of public structs
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ncoghlan, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2016年11月21日 09:40 by serhiy.storchaka, last changed 2022年04月11日 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
const-name-and-doc-fields.patch serhiy.storchaka, 2016年11月21日 09:40 review
Pull Requests
URL Status Linked Edit
PR 552 closed dstufft, 2017年03月31日 16:36
Messages (4)
msg281340 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016年11月21日 09:40
Proposed patch makes the fields name and doc of structures PyMemberDef, PyGetSetDef, PyStructSequence_Field, PyStructSequence_Desc, and wrapperbase being of type "const char *" rather of "char *".
These structures often are initialized as static variables and name and doc fields are initialized from literal strings. These fields are always refer to constant string literal, NULL, or readonly UTF8 representation of a Unicode object. They are never refer to mutable data. Changing the data referred by these pointers is an error. Adding the const qualifier makes clear that this is an immutable data.
This change may need some changes in third-party code. But it needs to change only one line in CPython sources, and I believe that most third-party projects don't need any changes at all.
msg281357 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2016年11月21日 14:04
+1 from me. The only thing I noticed in the patch was that the issue number needs filling in now that you've filed it.
msg281434 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016年11月22日 05:58
New changeset 42b0ba372ec2 by Serhiy Storchaka in branch 'default':
Issue #28761: The fields name and doc of structures PyMemberDef, PyGetSetDef,
https://hg.python.org/cpython/rev/42b0ba372ec2 
msg281436 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016年11月22日 06:03
Thanks Nick.
History
Date User Action Args
2022年04月11日 14:58:39adminsetgithub: 72947
2017年03月31日 16:36:34dstufftsetpull_requests: + pull_request1068
2016年11月22日 06:04:38serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2016年11月22日 06:03:58serhiy.storchakasetmessages: + msg281436
2016年11月22日 05:58:45python-devsetnosy: + python-dev
messages: + msg281434
2016年11月21日 14:04:34ncoghlansetmessages: + msg281357
2016年11月21日 09:40:15serhiy.storchakacreate

AltStyle によって変換されたページ (->オリジナル) /