diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h @@ -182,7 +182,8 @@ Reset(type, py_obj); } - PythonObject(const PythonObject &rhs) : m_py_obj(nullptr) { Reset(rhs); } + PythonObject(const PythonObject &rhs) + : PythonObject(PyRefType::Borrowed, rhs.m_py_obj) {} PythonObject(PythonObject &&rhs) { m_py_obj = rhs.m_py_obj; @@ -197,13 +198,6 @@ m_py_obj = nullptr; } - void Reset(const PythonObject &rhs) { - if (!rhs.IsValid()) - Reset(); - else - Reset(PyRefType::Borrowed, rhs.m_py_obj); - } - // PythonObject is implicitly convertible to PyObject *, which will call the // wrong overload. We want to explicitly disallow this, since a PyObject // *always* owns its reference. Therefore the overload which takes a