mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
python: Include <Python.h> first
Python is broken and requires that we include <Python.h> before all other headers so it can make inadvisable definitions of _POSIX_C_SOURCE and other things. This wasn't a problem before, but a recent change to glibc makes this necessary now. See also a similar commit in nbdkit:f924c3c34bI also removed the -Wcast-align suppression as that is no longer needed. (cherry picked from commit18d9769dc3)
This commit is contained in:
@@ -44,13 +44,6 @@ let rec generate_python_actions_h () =
|
|||||||
#include \"guestfs.h\"
|
#include \"guestfs.h\"
|
||||||
#include \"guestfs-stringlists-utils.h\"
|
#include \"guestfs-stringlists-utils.h\"
|
||||||
|
|
||||||
#define PY_SSIZE_T_CLEAN 1
|
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored \"-Wcast-align\"
|
|
||||||
#include <Python.h>
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
|
|
||||||
static inline guestfs_h *
|
static inline guestfs_h *
|
||||||
get_handle (PyObject *obj)
|
get_handle (PyObject *obj)
|
||||||
{
|
{
|
||||||
@@ -119,6 +112,10 @@ and generate_python_structs () =
|
|||||||
generate_header CStyle LGPLv2plus;
|
generate_header CStyle LGPLv2plus;
|
||||||
|
|
||||||
pr "\
|
pr "\
|
||||||
|
/* This must be included first. */
|
||||||
|
#define PY_SSIZE_T_CLEAN 1
|
||||||
|
#include <Python.h>
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -255,6 +252,10 @@ and generate_python_actions actions () =
|
|||||||
generate_header CStyle LGPLv2plus;
|
generate_header CStyle LGPLv2plus;
|
||||||
|
|
||||||
pr "\
|
pr "\
|
||||||
|
/* This must be included first. */
|
||||||
|
#define PY_SSIZE_T_CLEAN 1
|
||||||
|
#include <Python.h>
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
/* It is safe to call deprecated functions from this file. */
|
/* It is safe to call deprecated functions from this file. */
|
||||||
@@ -527,6 +528,10 @@ and generate_python_module () =
|
|||||||
generate_header CStyle LGPLv2plus;
|
generate_header CStyle LGPLv2plus;
|
||||||
|
|
||||||
pr "\
|
pr "\
|
||||||
|
/* This must be included first. */
|
||||||
|
#define PY_SSIZE_T_CLEAN 1
|
||||||
|
#include <Python.h>
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|||||||
@@ -22,6 +22,10 @@
|
|||||||
* F<python/actions-*.c>).
|
* F<python/actions-*.c>).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* This must be included first. */
|
||||||
|
#define PY_SSIZE_T_CLEAN 1
|
||||||
|
#include <Python.h>
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user