Skip to content

Issue with PYTHONCAPI_COMPAT_SPEC on macOS #131

Closed
@cdce8p

Description

@cdce8p

This issue seems to be specific to MacOS. Encountered while testing with mypy / mypyc.

The traceback below is with Python 3.13.1 (v3.13.1:06714517797, Dec 3 2024, 14:00:22) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin, however a slightly different error is also reproducible in CI with Python 3.9. See link below.

In file included from /.../mypyc/lib-rt/pythonsupport.h:11:
/.../mypyc/lib-rt/pythoncapi_compat.h:2086:9: error: no member named 'use_system_logger' in 'PyConfig'
        PYTHONCAPI_COMPAT_SPEC(use_system_logger, BOOL, _Py_NULL),
        ^                      ~~~~~~~~~~~~~~~~~
/.../mypyc/lib-rt/pythoncapi_compat.h:2000:15: note: expanded from macro 'PYTHONCAPI_COMPAT_SPEC'
    {#MEMBER, offsetof(PyConfig, MEMBER), \
              ^                  ~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include/stddef.h:105:24: note: expanded from macro 'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
                       ^                     ~
In file included from /.../mypyc/lib-rt/pythonsupport.h:11:
/.../mypyc/lib-rt/pythoncapi_compat.h:2098:26: error: invalid application of 'sizeof' to an incomplete type 'const PyConfigSpec[]'
    for (size_t i=0; i < Py_ARRAY_LENGTH(config_spec); i++) {
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Frameworks/Python.framework/Versions/3.13/include/python3.13/pymacro.h:100:12: note: expanded from macro 'Py_ARRAY_LENGTH'
    (sizeof(array) / sizeof((array)[0]) \

python/mypy#18535
https://github.com/python/mypy/actions/runs/12973783593/job/36182870602?pr=18535#step:9:118

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions