From 4f4f7cd95973a4b14e480d431c691e9014f09405 Mon Sep 17 00:00:00 2001 From: Michael Demoret Date: Thu, 27 Apr 2023 13:22:25 -0600 Subject: [PATCH] Update python debug detection for new version of debugpy --- .devcontainer/init.sh | 0 python/mrc/_pymrc/src/system.cpp | 5 +++-- 2 files changed, 3 insertions(+), 2 deletions(-) mode change 100644 => 100755 .devcontainer/init.sh diff --git a/.devcontainer/init.sh b/.devcontainer/init.sh old mode 100644 new mode 100755 diff --git a/python/mrc/_pymrc/src/system.cpp b/python/mrc/_pymrc/src/system.cpp index 1335b3104..7e0189d25 100644 --- a/python/mrc/_pymrc/src/system.cpp +++ b/python/mrc/_pymrc/src/system.cpp @@ -53,9 +53,10 @@ void SystemResources::add_gil_initializer() if (!trace_func.is_none()) { - auto trace_module = pybind11::getattr(trace_func, "__module__", pybind11::none()); + // Convert it to a string to quickly get its module and name + auto trace_func_str = pybind11::str(trace_func); - if (!trace_module.is_none() && !trace_module.attr("find")("pydevd").equal(pybind11::int_(-1))) + if (!trace_func_str.attr("find")("pydevd").equal(pybind11::int_(-1))) { VLOG(10) << "Found pydevd trace function. Will attempt to enable debugging for MRC threads."; has_pydevd_trace = true;