[issue38650] Add constantness to PyStructSequence_UnnamedField

Serhiy Storchaka report at bugs.python.org
Wed Oct 30 16:01:43 EDT 2019


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

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.

----------
components: Interpreter Core
messages: 355731
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Add constantness to PyStructSequence_UnnamedField
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38650>
_______________________________________


More information about the Python-bugs-list mailing list