Skip to content

Commit 25deb90

Browse files
committed
BLD: Include Python.h before pybind11/pybind11.h
pybind11 assumes Python.h is included first.
1 parent c0f19da commit 25deb90

File tree

7 files changed

+14
-7
lines changed

7 files changed

+14
-7
lines changed

src/_image_wrapper.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <Python.h>
12
#include <pybind11/pybind11.h>
23
#include <pybind11/numpy.h>
34

src/_qhull_wrapper.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* triangulation, construct an instance of the matplotlib.tri.Triangulation
66
* class without specifying a triangles array.
77
*/
8+
#include <Python.h>
89
#include <pybind11/pybind11.h>
910
#include <pybind11/numpy.h>
1011

src/_ttconv.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
Python wrapper for TrueType conversion library in ../ttconv.
77
*/
8+
#include <Python.h>
89
#include "mplutils.h"
910

1011
#include <pybind11/pybind11.h>

src/ft2font.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22

33
/* A python interface to FreeType */
44
#pragma once
5+
56
#ifndef MPL_FT2FONT_H
67
#define MPL_FT2FONT_H
8+
9+
#define PY_SSIZE_T_CLEAN
10+
#include <Python.h>
11+
712
#include <vector>
813
#include<set>
914
#include <stdint.h>
@@ -19,9 +24,6 @@ extern "C" {
1924
#include FT_TRUETYPE_TABLES_H
2025
}
2126

22-
#define PY_SSIZE_T_CLEAN
23-
#include <Python.h>
24-
2527
/*
2628
By definition, FT_FIXED as 2 16bit values stored in a single long.
2729
*/

src/numpy_cpp.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
* original.
1515
*/
1616

17-
#include "py_exceptions.h"
18-
19-
#include <complex>
20-
2117
#ifdef _POSIX_C_SOURCE
2218
# undef _POSIX_C_SOURCE
2319
#endif
@@ -40,6 +36,10 @@
4036
#include <Python.h>
4137
#include <numpy/ndarrayobject.h>
4238

39+
#include "py_exceptions.h"
40+
41+
#include <complex>
42+
4343
namespace numpy
4444
{
4545

src/py_converters_11.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
// pybind11 equivalent of py_converters.h
55

6+
#include <Python.h>
67
#include <pybind11/pybind11.h>
78
#include <pybind11/numpy.h>
89

src/tri/_tri.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#ifndef MPL_TRI_H
6464
#define MPL_TRI_H
6565

66+
#include <Python.h>
6667
#include <pybind11/pybind11.h>
6768
#include <pybind11/numpy.h>
6869

0 commit comments

Comments
 (0)