[New-bugs-announce] [issue24436] _PyTraceback_Add has no const qualifier for its char * arguments

Michael Ensslin report at bugs.python.org
Thu Jun 11 22:24:52 CEST 2015

New submission from Michael Ensslin:

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).

components: Interpreter Core
files: const.patch
keywords: patch
messages: 245185
nosy: mic-e
priority: normal
severity: normal
status: open
title: _PyTraceback_Add has no const qualifier for its char * arguments
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file39685/const.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list