]> git.ipfire.org Git - thirdparty/mkosi.git/commit
sandbox: Work around extra file descriptor opened by importing ctypes since python...
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 25 Jun 2025 10:47:56 +0000 (12:47 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 25 Jun 2025 12:03:02 +0000 (14:03 +0200)
commit694c8d2721cd6d1081caf39641f615aa81d5f8a0
treee01ab5571fce1d3ec1223b30760856d660ebbaca
parent5d90948d6e4af28220d71f3dbdbb8747b21d9783
sandbox: Work around extra file descriptor opened by importing ctypes since python 3.14

Since python 3.14, importing ctypes opens an extra file descriptor which is used to allocate libffi
closures which are in turn used by ctypes to pass python functions as C callback function pointers. We
don't use this functionality, yet the file descriptor is still opened and messes with the file descriptor
packing logic since the file descriptor to libffi will be passed as a packed file descriptor to the
executable we're invoking. To avoid that from happening, we close libffi's file descriptor after importing
ctypes.

See https://github.com/python/cpython/issues/135893.
mkosi/sandbox.py