Skip to content

Commit e37afcf

Browse files
jmrcopybara-github
authored andcommitted
pybind11_abseil: Include <Python.h> via pybind11 for Windows debug builds
The Windows Bazel debug build fails with "LNK1104: cannot open file 'python312_d.lib'": MSVC debug builds define `_DEBUG`, which makes <Python.h> request the debug Python library, and regular Python installations do not include it. pybind11 avoids this by hiding `_DEBUG` while including <Python.h>, in pybind11/conduit/wrap_include_python_h.h, but many pybind11_abseil files include <Python.h> directly. Include pybind11's wrapper instead of <Python.h> everywhere. It was added in pybind11 v3.0.0, which both builds now use. PiperOrigin-RevId: 1016178762
1 parent 1100059 commit e37afcf

18 files changed

Lines changed: 18 additions & 18 deletions

‎pybind11_abseil/compat/py_base_utilities.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "pybind11_abseil/compat/py_base_utilities.h"
22

3-
#include <Python.h>
3+
#include <pybind11/conduit/wrap_include_python_h.h>
44

55
#include <string>
66

‎pybind11_abseil/compat/py_base_utilities.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define PYBIND11_ABSEIL_COMPAT_PY_BASE_UTILITIES_H_
33

44
#define PY_SSIZE_T_CLEAN
5-
#include <Python.h>
5+
#include <pybind11/conduit/wrap_include_python_h.h>
66

77
#include <string>
88

‎pybind11_abseil/compat/status_from_core_py_exc.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "pybind11_abseil/compat/status_from_core_py_exc.h"
22

3-
#include <Python.h>
3+
#include <pybind11/conduit/wrap_include_python_h.h>
44

55
#include <string>
66

‎pybind11_abseil/compat/status_from_py_exc.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "pybind11_abseil/compat/status_from_py_exc.h"
22

3-
#include <Python.h>
3+
#include <pybind11/conduit/wrap_include_python_h.h>
44

55
#include "absl/log/absl_check.h"
66
#include "absl/log/absl_log.h"

‎pybind11_abseil/compat/status_from_py_exc.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define PYBIND11_ABSEIL_COMPAT_STATUS_FROM_PY_EXC_H_
33

44
#define PY_SSIZE_T_CLEAN
5-
#include <Python.h>
5+
#include <pybind11/conduit/wrap_include_python_h.h>
66

77
#include <string>
88

‎pybind11_abseil/cpp_capsule_tools/make_shared_ptr_capsule.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define PYBIND11_ABSEIL_CPP_CAPSULE_TOOLS_MAKE_SHARED_PTR_CAPSULE_H_
33

44
// Must be first include (https://docs.python.org/3/c-api/intro.html).
5-
#include <Python.h>
5+
#include <pybind11/conduit/wrap_include_python_h.h>
66

77
#include <cassert>
88
#include <memory>

‎pybind11_abseil/cpp_capsule_tools/raw_ptr_from_capsule.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define PYBIND11_ABSEIL_CPP_CAPSULE_TOOLS_RAW_PTR_FROM_CAPSULE_H_
33

44
// Must be first include (https://docs.python.org/3/c-api/intro.html).
5-
#include <Python.h>
5+
#include <pybind11/conduit/wrap_include_python_h.h>
66

77
#include "absl/status/statusor.h"
88
#include "pybind11_abseil/cpp_capsule_tools/void_ptr_from_capsule.h"

‎pybind11_abseil/cpp_capsule_tools/shared_ptr_from_capsule.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define PYBIND11_ABSEIL_CPP_CAPSULE_TOOLS_SHARED_PTR_FROM_CAPSULE_H_
33

44
// Must be first include (https://docs.python.org/3/c-api/intro.html).
5-
#include <Python.h>
5+
#include <pybind11/conduit/wrap_include_python_h.h>
66

77
#include <memory>
88
#include <utility>

‎pybind11_abseil/cpp_capsule_tools/void_ptr_from_capsule.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "pybind11_abseil/cpp_capsule_tools/void_ptr_from_capsule.h"
22

3-
#include <Python.h>
3+
#include <pybind11/conduit/wrap_include_python_h.h>
44

55
#include <string>
66
#include <utility>

‎pybind11_abseil/cpp_capsule_tools/void_ptr_from_capsule.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define PYBIND11_ABSEIL_CPP_CAPSULE_TOOLS_VOID_PTR_FROM_CAPSULE_H_
33

44
// Must be first include (https://docs.python.org/3/c-api/intro.html).
5-
#include <Python.h>
5+
#include <pybind11/conduit/wrap_include_python_h.h>
66

77
#include <utility>
88

0 commit comments

Comments
 (0)