1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-12-08 08:23:47 +03:00

add missing includes for C library functions

We use various C library functions like printf, strcmp, free
but don't have the corresponding #includes, getting them
indirectly via Python.h. This is a bad idea as Python.h is
not guaranteed to provided these, and indeed will omit them
when Py_LIMITED_API is greater then 0x030a0000.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé
2023-09-20 18:27:20 +01:00
committed by Jiri Denemark
parent c4ede87284
commit 85e58cb2ee
5 changed files with 9 additions and 0 deletions

View File

@@ -881,6 +881,7 @@ def emit_c_code(module: str) -> None:
wrapper = open(wrapper_file, "w")
wrapper.write("/* Generated by generator.py */\n\n")
wrapper.write("#include <stdlib.h>\n")
wrapper.write("#include <Python.h>\n")
wrapper.write("#include <libvirt/%s.h>\n" % (module,))
wrapper.write("#include \"typewrappers.h\"\n")