mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
python: Include <Python.h> in one place.
Previously to work around some problems in Python 2 header files we had to include <Python.h> before any other config file. For Python 3 which is all we really care about now this is no longer needed. We can move the include from three files into the local "actions.h" file, bringing all the Python definitions and workarounds into a single place.
This commit is contained in:
@@ -44,6 +44,9 @@ let rec generate_python_actions_h () =
|
||||
#include \"guestfs.h\"
|
||||
#include \"guestfs-utils.h\"
|
||||
|
||||
#define PY_SSIZE_T_CLEAN 1
|
||||
#include <Python.h>
|
||||
|
||||
#if PY_VERSION_HEX < 0x02050000
|
||||
typedef int Py_ssize_t;
|
||||
#define PY_SSIZE_T_MAX INT_MAX
|
||||
@@ -134,12 +137,6 @@ and generate_python_structs () =
|
||||
generate_header CStyle LGPLv2plus;
|
||||
|
||||
pr "\
|
||||
/* This has to be included first, else definitions conflict with
|
||||
* glibc header files. Python is broken.
|
||||
*/
|
||||
#define PY_SSIZE_T_CLEAN 1
|
||||
#include <Python.h>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -272,12 +269,6 @@ and generate_python_actions actions () =
|
||||
generate_header CStyle LGPLv2plus;
|
||||
|
||||
pr "\
|
||||
/* This has to be included first, else definitions conflict with
|
||||
* glibc header files. Python is broken.
|
||||
*/
|
||||
#define PY_SSIZE_T_CLEAN 1
|
||||
#include <Python.h>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* It is safe to call deprecated functions from this file. */
|
||||
@@ -569,12 +560,6 @@ and generate_python_module () =
|
||||
generate_header CStyle LGPLv2plus;
|
||||
|
||||
pr "\
|
||||
/* This has to be included first, else definitions conflict with
|
||||
* glibc header files. Python is broken.
|
||||
*/
|
||||
#define PY_SSIZE_T_CLEAN 1
|
||||
#include <Python.h>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -22,12 +22,6 @@
|
||||
* F<python/actions-*.c>).
|
||||
*/
|
||||
|
||||
/* This has to be included first, else definitions conflict with
|
||||
* glibc header files. Python is broken.
|
||||
*/
|
||||
#define PY_SSIZE_T_CLEAN 1
|
||||
#include <Python.h>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
Reference in New Issue
Block a user