classification
Title: Add constantness to PyStructSequence_UnnamedField
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: corona10, eric.snow, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2019-10-30 20:01 by serhiy.storchaka, last changed 2019-11-22 19:51 by eric.snow. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 17005 merged serhiy.storchaka, 2019-10-30 20:05
Messages (4)
msg355731 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-10-30 20:01
Currently the variable PyStructSequence_UnnamedField has type "char *". It is used as a special value for setting to the name field of PyStructSequence_Field. But the type of the name field is "const char *".

I propose to change the declaration of PyStructSequence_UnnamedField to "const char * const". Makes it referring to immutable character string and make it itself immutable.

It is binary compatible change, but some user code can complain at compilation time if it uses PyStructSequence_UnnamedField in unusual way (assigns to the "char *" variable, etc). It is very unlikely.
msg356755 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-11-16 16:55
New changeset bd44a7ead9f7336d7bb45f186b2b6ca0300154f7 by Serhiy Storchaka in branch 'master':
bpo-38650: Constify PyStructSequence_UnnamedField. (GH-17005)
https://github.com/python/cpython/commit/bd44a7ead9f7336d7bb45f186b2b6ca0300154f7
msg356757 - (view) Author: Dong-hee Na (corona10) * (Python triager) Date: 2019-11-16 17:11
Looks like https://github.com/python/cpython/blob/088b63ea7a8331a3e34bc93c3b873c60354b4fad/Tools/c-analyzer/known.tsv#L1549 should be updated also.
What do you think?
msg357318 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2019-11-22 19:51
I wouldn't worry about the c-analyzer stuff for now.  I plan on re-generating the file in the near future.
History
Date User Action Args
2019-11-22 19:51:57eric.snowsetnosy: + eric.snow
messages: + msg357318
2019-11-16 17:22:45serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-11-16 17:11:50corona10setnosy: + corona10
messages: + msg356757
2019-11-16 16:55:33serhiy.storchakasetmessages: + msg356755
2019-10-30 20:05:36serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request16532
2019-10-30 20:01:43serhiy.storchakacreate