Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

translate-c failed in converting Python headers with usage of const pointers #46

@cmpute

Description

@cmpute

Zig Version

tested with both 0.12 and 0.13

Steps to Reproduce and Observed Behavior

...\cimport.zig:7317:34: error: unable to translate C expr: unexpected token 'const'
pub const _PyObject_CAST_CONST = @compileError("unable to translate C expr: unexpected token 'const'");
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
referenced by:
    Py_IS_TYPE: C:\Users\Jacob Zhong\AppData\Local\zig\o\bba274c4df7f62ae84d6d5b4921d0f09\cimport.zig:7337:77
    PyLong_CheckExact: C:\Users\Jacob Zhong\AppData\Local\zig\o\bba274c4df7f62ae84d6d5b4921d0f09\cimport.zig:8050:54
    pack: lib.zig:21:11
    pymethod_pack: lib.zig:80:40
    pymethods: lib.zig:81:52
    module: lib.zig:96:19
    PyInit_msgpackpp: lib.zig:104:32

I called PyLong_CheckExact in zig and compilation fails. This error occurs with Python 3.10, and it seems to be fixed after Python 3.11: python/cpython#91768

An issue that might be related? #152

Expected Behavior

PyLong_CheckExact should compiles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions