nix-community / poetry2nix

Convert poetry projects to nix automagically [maintainer=@adisbladis,@cpcloud]
MIT License
885 stars 451 forks source link

datamodel-code-generator crashes with Python 3.11 #1029

Open zupo opened 1 year ago

zupo commented 1 year ago

Describe the issue

When installing datamodel-code-generator for Python 3.11, it crashes when running.

Given a minimal poetry2nix based env with only datamodel-code-generator as dependency, when I run datamodel-codegen --input foo --output bar, the command crashes with the following error:

$ datamodel-codegen --input foo --output bar
Assertion failed: (PyCFunction_Check(func)), function PyCFunction_GET_FLAGS, file /nix/store/28ay1fi5968xk2vhnxc3r9rq0x1iipnf-python3-3.11.1/include/python3.11/cpython/methodobject.h, line 59.
Abort trap: 6

Using Python 3.10 works fine.

I'm not entirely sure if this is a poetry2nix problem, or I should report to nixpkgs?

Additional context

Full runnable example at https://github.com/zupo/ventura-poetry-test.

NorfairKing commented 1 year ago

Looks like this is a python bug: https://github.com/cython/cython/issues/4804 I'll see if using a newer python311 would work.

NorfairKing commented 1 year ago

Hm I get the same failure with 3.11.2:

python3.11: /nix/store/16sf5dynfkh8wws2jn82y48g3xqmxc2v-python3-3.11.2/include/python3.11/cpython/methodobject.h:59: PyCFunction_GET_FLAGS: Assertion `PyCFunction_Check(func)' failed.
Aborted (core dumped)

EDIT: Hey wait a second, that's a different error! Second EDIT: it's the same error, differently formatted.