Skip to content

Commit 5bb4de0

Browse files
authored
Fix for Python debug build (#128)
* Minor updates for debug Python/PyQt. * Fix issue with destructor of lambda in shared holder.
1 parent 8c044e2 commit 5bb4de0

File tree

6 files changed

+15
-11
lines changed

6 files changed

+15
-11
lines changed

CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ set(PYTHON_BUILD_PATH ${PYTHON_ROOT}/PCBuild/amd64)
1616
set(Python_USE_STATIC_LIBS False)
1717
set(Python_INCLUDE_DIR ${PYTHON_ROOT}/Include)
1818
set(Python_EXECUTABLE ${PYTHON_BUILD_PATH}/python.exe)
19+
if (EXISTS "${PYTHON_BUILD_PATH}/python_d.exe")
20+
set(Python_EXECUTABLE ${PYTHON_BUILD_PATH}/python_d.exe)
21+
endif()
1922
file(GLOB Python_LIBRARY ${PYTHON_BUILD_PATH}/python[0-9][0-9]*.lib)
2023
find_package(Python COMPONENTS Interpreter Development REQUIRED)
2124

src/plugin_python_en.ts

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ Do you want to try initializing python again (at the risk of another crash)?
5454
<message>
5555
<location filename="proxy/proxypython.cpp" line="260"/>
5656
<source>The path to Mod Organizer (%1) contains a semicolon.&lt;br&gt;While this is legal on NTFS drives, many applications do not handle it correctly.&lt;br&gt;Unfortunately MO depends on libraries that seem to fall into that group.&lt;br&gt;As a result the python plugin cannot be loaded, and the only solution we can offer is to remove the semicolon or move MO to a path without a semicolon.</source>
57-
<oldsource>The path to Mod Organizer (%1) contains a semicolon. &lt;br&gt;While this is legal on NTFS drives, many softwares do not handle it correctly.&lt;br&gt;Unfortunately MO depends on libraries that seem to fall into that group.&lt;br&gt;As a result the python plugin cannot be loaded, and the only solution we canoffer is to remove the semicolon or move MO to a path without a semicolon.</oldsource>
5857
<translation type="unfinished"></translation>
5958
</message>
6059
<message>

src/proxy/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ mo2_add_translations(proxy
3434
set(DLL_DIRS ${PLUGIN_PYTHON_DIR}/dlls)
3535
file(GLOB dlls_to_install
3636
${PYTHON_BUILD_PATH}/libffi*.dll
37-
${PYTHON_BUILD_PATH}/python${Python_VERSION_SHORT}.dll)
37+
${PYTHON_BUILD_PATH}/python${Python_VERSION_SHORT}*.dll)
3838
install(FILES ${dlls_to_install} DESTINATION ${DLL_DIRS})
3939

4040
# install Python files

src/pybind11-qt/include/pybind11_qt/pybind11_qt_holder.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace pybind11::detail::qt {
2929
~qobject_holder_impl()
3030
{
3131
gil_scoped_acquire s;
32-
p_ = std::move(none());
32+
p_ = object();
3333
}
3434
};
3535

src/pybind11-utils/include/pybind11_utils/shared_cpp_owner.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ namespace mo2::python::detail {
5454
holder.reset(holder.get(), [pyobj = py::reinterpret_borrow<py::object>(
5555
src)](auto*) mutable {
5656
py::gil_scoped_acquire s;
57-
pyobj = std::move(py::none());
57+
pyobj = py::object();
5858

5959
// we do NOT delete the object here - if this was the last reference to
6060
// the Python object, the Python object will delete it

src/runner/pythonrunner.cpp

+9-7
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,15 @@ namespace mo2::python {
132132
return false;
133133
}
134134

135-
py::module_ mainModule = py::module_::import("__main__");
136-
py::object mainNamespace = mainModule.attr("__dict__");
137-
mainNamespace["sys"] = py::module_::import("sys");
138-
mainNamespace["mobase"] = py::module_::import("mobase");
139-
140-
mo2::python::configure_python_stream();
141-
mo2::python::configure_python_logging(mainNamespace["mobase"]);
135+
{
136+
py::module_ mainModule = py::module_::import("__main__");
137+
py::object mainNamespace = mainModule.attr("__dict__");
138+
mainNamespace["sys"] = py::module_::import("sys");
139+
mainNamespace["mobase"] = py::module_::import("mobase");
140+
141+
mo2::python::configure_python_stream();
142+
mo2::python::configure_python_logging(mainNamespace["mobase"]);
143+
}
142144

143145
// we need to release the GIL here - which is what this does
144146
//

0 commit comments

Comments
 (0)