[issue39591] Functions in Python/traceback.c can take const pointer arguments

Andy Lester report at bugs.python.org
Sun Feb 9 10:54:03 EST 2020


Andy Lester <andy at petdance.com> added the comment:

I'm sorry, I think my comment was misleading.

The changes I had proposed were not making the object itself const, but some of the arguments in the static worker functions.  For example:

-tb_displayline(PyObject *f, PyObject *filename, int lineno, PyObject *name)
+tb_displayline(PyObject *f, PyObject *filename, int lineno, const PyObject *name)

and

-tb_printinternal(PyTracebackObject *tb, PyObject *f, long limit)
+tb_printinternal(const PyTracebackObject *tb, PyObject *f, long limit)

I've got -Wincompatible-pointer-types-discards-qualifiers and -Wcast-qual turned on, and no errors occur.

Is there somewhere in the deep internals of the Python macros where constness can be changed but the compiler isn't reporting on it?

Thanks,
Andy

----------

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


More information about the Python-bugs-list mailing list