Skip to content

Python.h doesn't follow C99 standard. #120293

Closed
@ndparker

Description

@ndparker

Bug report

Bug description:

Hi,

I'm trying to test my C extensions with Python 3.13. For testing I usually enable as many error checks as possible. I'm seeing a couple of them. Python version is:

$ python3.13 -V
Python 3.13.0b1

Some errors are related to losing const qualifiers:

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

Some related to C99 compatibility (not sure what the current expected compat version is):

    /usr/include/python3.13/cpython/code.h:32:10: error: ISO C99 doesn't support unnamed structs/unions [-Werror=pedantic]
       32 |         };

Thanks,

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildThe build process and cross-buildtopic-C-APItype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions