1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2024-10-26 07:55:06 +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")

View File

@ -18,6 +18,9 @@
#define VIR_ENUM_SENTINELS
#define PY_SSIZE_T_CLEAN
#include <stdio.h>
#include <string.h>
#include <Python.h>
#include <libvirt/libvirt.h>
#include <libvirt/virterror.h>

View File

@ -14,6 +14,7 @@
which has over 180 autoconf-style HAVE_* definitions. Shame on them. */
#undef HAVE_PTHREAD_H
#include <stdio.h>
#include <Python.h>
#include <libvirt/libvirt-qemu.h>
#include <libvirt/virterror.h>

View File

@ -19,6 +19,8 @@
*
*/
#include <string.h>
#include <Python.h>
/* Ugly python defines that, which is also defined in errno.h */

View File

@ -12,6 +12,8 @@
* which has over 180 autoconf-style HAVE_* definitions. Shame on them. */
#undef HAVE_PTHREAD_H
#include <stdio.h>
#include <string.h>
#include "typewrappers.h"
#include "libvirt-utils.h"