mirror of
https://github.com/loot/libloot-python.git
synced 2026-07-27 14:14:13 -07:00
Update pybind11 to v2.4.2
v2.3.0 fixed GIL handling bugs, which means we need to explicitly stop storing the Python logging callback before exiting, or the exit will hang.
This commit is contained in:
+1
-1
@@ -40,7 +40,7 @@ configure_file("${CMAKE_SOURCE_DIR}/python/setup.py" "${CMAKE_BINARY_DIR}/genera
|
||||
# pybind11
|
||||
#######################################
|
||||
|
||||
set(PYBIND11_VERSION "2.2.4")
|
||||
set(PYBIND11_VERSION "2.4.2")
|
||||
set(PYBIND11_URL "https://github.com/pybind/pybind11/archive/v${PYBIND11_VERSION}.tar.gz")
|
||||
set(PYBIND11_DOWNLOAD_PATH "${EXTERNAL_PROJECTS_PATH}/pybind11-${PYBIND11_VERSION}.tar.gz")
|
||||
set(PYBIND11_EXTRACTED_PATH "${EXTERNAL_PROJECTS_PATH}/pybind11-${PYBIND11_VERSION}")
|
||||
|
||||
@@ -159,6 +159,13 @@ void bindClasses(pybind11::module& module) {
|
||||
void bindFunctions(pybind11::module& module) {
|
||||
module.def("set_logging_callback", &SetLoggingCallback);
|
||||
|
||||
// Need to clear the stored logging callback when exiting, or Python will
|
||||
// hang because the callback pointer is still stored by libloot.
|
||||
auto atexit = pybind11::module::import("atexit");
|
||||
atexit.attr("register")(pybind11::cpp_function([]() {
|
||||
SetLoggingCallback(nullptr);
|
||||
}));
|
||||
|
||||
module.def("is_compatible", &IsCompatible);
|
||||
|
||||
module.def("initialise_locale", &InitialiseLocale, arg("id") = "");
|
||||
|
||||
+4
-2
@@ -34,10 +34,12 @@ class GameFixture(unittest.TestCase):
|
||||
data_path = os.path.join(self.game_path, 'Data')
|
||||
master_file = os.path.join(data_path, 'Oblivion.esm')
|
||||
|
||||
os.makedirs(data_path)
|
||||
if not os.path.exists(data_path):
|
||||
os.makedirs(data_path)
|
||||
open(master_file, 'a').close()
|
||||
|
||||
os.makedirs(self.local_path)
|
||||
if not os.path.exists(self.local_path):
|
||||
os.makedirs(self.local_path)
|
||||
|
||||
def tearDown(self):
|
||||
shutil.rmtree(self.game_path)
|
||||
|
||||
Reference in New Issue
Block a user