Skip to content

Commit

Permalink
Call PyGILState_Check first to see if we need to gil, borrowed from M…
Browse files Browse the repository at this point in the history
…RC's PyObjectWrapper
  • Loading branch information
dagardner-nv committed Aug 15, 2023
1 parent 2909695 commit 7394f23
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions morpheus/_lib/src/objects/python_data_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,16 @@ PyDataTable::~PyDataTable()
{
if (m_py_table)
{
pybind11::gil_scoped_acquire gil;
if (PyGILState_Check() == 0)
{
pybind11::gil_scoped_acquire gil;

// Clear out the python object
m_py_table = pybind11::object();
pybind11::object tmp = std::move(m_py_table);
}
else
{
pybind11::object tmp = std::move(m_py_table);
}
}
}

Expand Down

0 comments on commit 7394f23

Please sign in to comment.