Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Can't include Python.h from C++ code on macOS Sonoma / Clang 15 #110845

Closed as not planned
@lunixbochs

Description

@lunixbochs

Bug report

Bug description:

Including Python.h on <3.13 from a .cpp file results in the following:

In file included from include/python3.11/Python.h:50:
include/python3.11/bytesobject.h:10:1: error: import of C++ module 'Darwin.C.stdarg' appears within extern "C" language linkage specification [-Wmodule-import-in-extern-c]

You can work around this on a per project basis with -Wno-module-import-in-extern-c, but that's still pretty annoying.

This is due to an include of a system header from inside an extern "C" block, which LLVM doesn't seem to like anymore with default flags on macOS.

I believe the changes related to #108769 will fix this. Can we get them backported?

CPython versions tested on:

3.11, 3.12

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions