classification
Title: object.h -Wcast-qual warning
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.10
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Py_IS_TYPE(): cast discards ‘const’ qualifier from pointer target type
View: 44378
Assigned To: Nosy List: leif.walsh, petere, terry.reedy, vstinner
Priority: normal Keywords:

Created on 2021-03-05 22:12 by petere, last changed 2021-07-01 00:05 by vstinner. This issue is now closed.

Messages (5)
msg388167 - (view) Author: Peter Eisentraut (petere) * Date: 2021-03-05 22:12
object.h contains an inline function that causes a -Wcast-qual warning from gcc.  Since this file ends up visible in third-party code that includes Python.h, this makes it impossible to use -Wcast-qual in such code.

The problem is the change c5cb077ab3c88394b7ac8ed4e746bd31b53e39f1, which replaced ob->ob_type by Py_TYPE(ob), which seems reasonable by itself, but Py_TYPE casts away the const, so it creates this problem.

This is a regression in Python 3.10.
msg388560 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-03-12 22:12
Victor, the apparent 3.10 regression is from your commit.
msg388607 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-03-13 11:29
> object.h contains an inline function that causes a -Wcast-qual warning from gcc.

Which function? Can you please provide the warning?

Do you want to propose a fix?
msg396793 - (view) Author: Leif Walsh (leif.walsh) Date: 2021-06-30 19:20
Duplicated by https://bugs.python.org/issue44378, which has a fix merged.
msg396803 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-07-01 00:05
> Duplicated by https://bugs.python.org/issue44378, which has a fix merged.

Right. I close the issue as a duplicate.
History
Date User Action Args
2021-07-01 00:05:49vstinnersetstatus: open -> closed
superseder: Py_IS_TYPE(): cast discards ‘const’ qualifier from pointer target type
messages: + msg396803

resolution: duplicate
stage: resolved
2021-06-30 19:20:08leif.walshsetnosy: + leif.walsh
messages: + msg396793
2021-03-13 11:29:39vstinnersetmessages: + msg388607
2021-03-12 22:12:53terry.reedysetnosy: + terry.reedy, vstinner
messages: + msg388560
2021-03-05 22:12:41peterecreate