Skip to content

pyatomic_gcc.h with GCC discards const qualifier  #120593

Closed
@ndparker

Description

@ndparker

Bug report

Bug description:

Hi,

including Python.h with gcc and -Wcast-qual raises the following issue (Regression from 3.12):

    /usr/include/python3.13/cpython/pyatomic_gcc.h: In function '_Py_atomic_load_ptr':
    /usr/include/python3.13/cpython/pyatomic_gcc.h:300:34: error: cast discards 'const' qualifier from pointer target type [-Werror=cast-qual]
      300 | { return (void *)__atomic_load_n((void **)obj, __ATOMIC_SEQ_CST); }
          |                                  ^
    /usr/include/python3.13/cpython/pyatomic_gcc.h: In function '_Py_atomic_load_ptr_relaxed':
    /usr/include/python3.13/cpython/pyatomic_gcc.h:359:34: error: cast discards 'const' qualifier from pointer target xt (line 8))
$ python3.13 -V
Python 3.13.0b1

This is a follow-up to #120293

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions