You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add the const qualifier for char and wchar_t pointers to unmodifiable strings #76422
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=Noneclosed_at=<Date2017-12-12.11:55:32.591>created_at=<Date2017-12-07.13:54:04.793>labels= ['interpreter-core', 'type-feature', '3.7']
title='Add the const qualifier for char and wchar_t pointers to unmodifiable strings'updated_at=<Date2017-12-12.11:55:32.590>user='https://github.com/serhiy-storchaka'
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.
New changeset 4ae06c5 by Serhiy Storchaka in branch 'master': bpo-32241: Add the const qualifire to declarations of umodifiable strings. (bpo-4748) 4ae06c5
Activity
serhiy-storchaka commentedon Dec 7, 2017
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.
serhiy-storchaka commentedon Dec 12, 2017
New changeset 4ae06c5 by Serhiy Storchaka in branch 'master':
bpo-32241: Add the const qualifire to declarations of umodifiable strings. (bpo-4748)
4ae06c5