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: _PyTraceback_Add has no const qualifier for its char * arguments
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.6, Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Mark.Shannon, mic-e, pitrou, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2015-06-11 20:24 by mic-e, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
const.patch mic-e, 2015-06-11 20:24 review
Messages (4)
msg245185 - (view) Author: Michael Ensslin (mic-e) * Date: 2015-06-11 20:24
The prototype for the public API function _PyTraceback_Add is declared

_PyTraceback_Add(char *, char *, int);

Internally, its char * arguments are passed verbatim to PyCode_NewEmpty, which takes const char * arguments.

The missing 'const' qualifier for the arguments of _PyTraceback_Add thus serves no purpose, and means that C++ code can't invoke the method with const char * arguments.

I've attached a proposed patch.

I can't think of any negative consequences from adding the 'const' qualifier (famous last words).
msg245191 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-06-11 21:57
LGTM.
msg245594 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-06-21 13:01
New changeset 6f659b9f7fbc by Serhiy Storchaka in branch '3.4':
Issue #24436: Added const qualifiers for char* arguments of _PyTraceback_Add.
https://hg.python.org/cpython/rev/6f659b9f7fbc

New changeset 9602b8313dd5 by Serhiy Storchaka in branch '3.5':
Issue #24436: Added const qualifiers for char* arguments of _PyTraceback_Add.
https://hg.python.org/cpython/rev/9602b8313dd5

New changeset 4cd00e6fa2ee by Serhiy Storchaka in branch 'default':
Issue #24436: Added const qualifiers for char* arguments of _PyTraceback_Add.
https://hg.python.org/cpython/rev/4cd00e6fa2ee
msg245595 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-06-21 13:22
Thank you for your contribution Michael.
History
Date User Action Args
2022-04-11 14:58:18adminsetgithub: 68624
2015-06-21 13:22:21serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg245595

stage: commit review -> resolved
2015-06-21 13:01:24python-devsetnosy: + python-dev
messages: + msg245594
2015-06-21 12:48:52serhiy.storchakasetversions: + Python 3.4
2015-06-21 12:43:15serhiy.storchakasetassignee: serhiy.storchaka
2015-06-11 21:57:22serhiy.storchakasetnosy: + Mark.Shannon, serhiy.storchaka, pitrou

messages: + msg245191
stage: commit review
2015-06-11 20:25:44mic-esettype: enhancement
2015-06-11 20:24:52mic-ecreate