[New-bugs-announce] [issue32241] Add the const qualifier for char and wchar_t pointers to unmodifiable strings

Serhiy Storchaka report at bugs.python.org
Thu Dec 7 08:54:04 EST 2017


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

Py_SetProgramName() and Py_SetPythonHome() take a pointer to a string that shouldn't be changed for the duration of the program's execution. But the type of their arguments is "wchar_t *", therefore passing just a pointer to a constant static string will cause a compiler warning. The proposed PR changes the type to "const wchar_t *". This is backward compatible change.

The PR also adds the const qualifier to internal pointers that point on to unmodifiable strings. This could help to distinguish them from pointers on modifiable strings and can prevent unintentional modifications.

----------
components: Interpreter Core
messages: 307802
nosy: serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Add the const qualifier for char and wchar_t pointers to unmodifiable strings
type: enhancement
versions: Python 3.7

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


More information about the New-bugs-announce mailing list