zaml
zaml copied to clipboard
Implicit python version dependency from ob_refcnt change?
Replicating build with zig 0.10.0 at commit 9adce96 (e.g., your talk) on Windows, I experience the following issue when running via pip install
:
× Building wheel for zaml (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [15 lines of output]
running bdist_wheel
running build
running build_ext
zig build-lib -O ReleaseFast -lc -target x86_64-windows-msvc -femit-bin=build\lib.win-amd64-cpython-312\zaml.cp312-win_amd64.pyd -fallow-shlib-undefined -dynamic -I%PYPATH%\Python312\include -I%PYPATH%\Python312\Include -L%PYPATH%\Python312\Libs -lpython3 zamlmodule.zig
zamlmodule.zig:39:26: error: no field named 'ob_refcnt' in struct '%ZIGPATH%.zig.o.f50a540243561e8d55a8f2208b6843e4.cimport.struct__object'
.ob_refcnt = 1,
^
%ZIGPATH%\o\f50a540243561e8d55a8f2208b6843e4\cimport.zig:2324:35: note: struct declared here
pub const struct__object = extern struct {
~~~~~~~^~~~~~
referenced by:
PyInit_zaml: zamlmodule.zig:57:29
remaining reference traces hidden; use '-freference-trace' to see all reference traces
error: command '%ZIGPATH%\\zig.EXE' failed with exit code 1
[end of output]
My best guess is, the C API changed some time around 3.10/3.11 (I'm on 3.12): https://docs.python.org/3/c-api/refcounting.html
If you'd be so kind as to let me know what version of Python you were using, I can try to replicate and narrow this down to the point where I can take a stab at a fix and/or update.
Alternative explanations include specific zig cimport implementations (zigup applied v0.10.0 with f50a5402
) but the issue seems consistent across zig versions so I suspect this is less likely.