Python Gtk app fail inside Flatpak

Recent version of my app (CoBang), failed to start with this error:

python3: /usr/include/python3.12/cpython/listobject.h:34: PyList_GET_SIZE: Assertion `PyList_Check(op)' failed.

It is Ok if running outside Flatpak (installed from deb package) or running in development with flatpak-builder.

Could someone guide me to debug and fix?

It may happen when I added the feature to let it open a file from command line (13d691c commit).

Possibly a mismatch between pygobject and your installed Python? Pygobject is a CPython module, so it needs to match the version of Python on the system.

It only appears for Flatpak package, published to FlatHub, so, the PyGObject and Python all come from the org.gnome.Platform 47. I don’t modify the Python and PyGObject there.

Oh, I misread and I thought it was working inside Flatpak.

I’d recommend running under a debugger, to get a backtrace and see where the assertion is being invoked.

Fixed it. The reason is that, the app uses a Python library which is built with Cython. But in the Flatpak package, I added the wrong version of Cython and CFFI (added the ones for Python 3.11 instead of Python 3.12, which is the Python of the org.gnome.Platform 47 runtime).

1 Like