Control: tags -1 + patch fixed-upstream

There's an upstream commit [1] that seems to fix the build with Python 3.11.


[1] 
https://github.com/regina-normal/regina/commit/8a583ee4ed8066103c530b91c6df4efa512203aa
From 8a583ee4ed8066103c530b91c6df4efa512203aa Mon Sep 17 00:00:00 2001
From: Benjamin Burton <b...@maths.uq.edu.au>
Date: Thu, 17 Nov 2022 23:46:32 +1000
Subject: [PATCH] A quick hack for now to ensure that the basic embedded
 interpreter in the test suite (python/testsuite/basic.cpp) will respect
 PYTHONPATH, so that it can be run directly out of the build tree.

---
 python/pybind11/embed.h         |  4 ++++
 python/pybind11/regina.patch    | 15 +++++++++++++++
 python/testsuite/CMakeLists.txt |  1 +
 3 files changed, 20 insertions(+)

diff --git a/python/pybind11/embed.h b/python/pybind11/embed.h
index d6999cd77..31dd7950b 100644
--- a/python/pybind11/embed.h
+++ b/python/pybind11/embed.h
@@ -150,6 +150,10 @@ inline void initialize_interpreter(bool init_signal_handlers = true,
 #else
     PyConfig config;
     PyConfig_InitIsolatedConfig(&config);
+#if REGINA_PYTHON_USE_PYTHONPATH
+    config.use_environment = 1;
+    config.isolated = 0;
+#endif
     config.install_signal_handlers = init_signal_handlers ? 1 : 0;
 
     PyStatus status = PyConfig_SetBytesArgv(&config, argc, const_cast<char *const *>(argv));
diff --git a/python/pybind11/regina.patch b/python/pybind11/regina.patch
index a9a1cf4c1..6da9bd828 100644
--- a/python/pybind11/regina.patch
+++ b/python/pybind11/regina.patch
@@ -156,3 +156,18 @@ index d61dcd5c7..9675827af 100644
          pybind11::function override                                                               \
              = pybind11::get_override(static_cast<const cname *>(this), name);                     \
          if (override) {                                                                           \
+diff --git a/python/pybind11/embed.h b/python/pybind11/embed.h
+index d6999cd77..31dd7950b 100644
+--- a/python/pybind11/embed.h
++++ b/python/pybind11/embed.h
+@@ -150,6 +150,10 @@ inline void initialize_interpreter(bool init_signal_handlers = true,
+ #else
+     PyConfig config;
+     PyConfig_InitIsolatedConfig(&config);
++#if REGINA_PYTHON_USE_PYTHONPATH
++    config.use_environment = 1;
++    config.isolated = 0;
++#endif
+     config.install_signal_handlers = init_signal_handlers ? 1 : 0;
+ 
+     PyStatus status = PyConfig_SetBytesArgv(&config, argc, const_cast<char *const *>(argv));
diff --git a/python/testsuite/CMakeLists.txt b/python/testsuite/CMakeLists.txt
index fabf36891..4e01572f0 100644
--- a/python/testsuite/CMakeLists.txt
+++ b/python/testsuite/CMakeLists.txt
@@ -12,6 +12,7 @@ CONFIGURE_FILE(
 
 # A very basic interpreter to use for testing:
 INCLUDE_DIRECTORIES(${Python_INCLUDE_DIRS} ${ENGINE_INCLUDES} "${PROJECT_BINARY_DIR}/engine")
+ADD_COMPILE_DEFINITIONS(REGINA_PYTHON_USE_PYTHONPATH=1)
 ADD_LINK_OPTIONS(${Python_LINK_OPTIONS})
 add_executable(basic
   basic.cpp

Reply via email to