From 90537673302f13e92ffabba84901164c6b974b2d Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 25 Apr 2022 20:14:44 -0700 Subject: Remove Python 2 support from the ScriptInterpreter plugin We dropped downstream support for Python 2 in the previous release. Now that we have branched for the next release the window where this kind of change could introduce conflicts is closing too. Start by getting rid of Python 2 support in the Script Interpreter plugin. Differential revision: https://reviews.llvm.org/D124429 --- .../Plugins/ScriptInterpreter/Python/PythonDataObjects.h | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h') diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h index 2094f0b..8f379d4 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h @@ -181,13 +181,7 @@ inline llvm::Error keyError() { "key not in dict"); } -#if PY_MAJOR_VERSION < 3 -// The python 2 API declares some arguments as char* that should -// be const char *, but it doesn't actually modify them. -inline char *py2_const_cast(const char *s) { return const_cast(s); } -#else inline const char *py2_const_cast(const char *s) { return s; } -#endif enum class PyInitialValue { Invalid, Empty }; @@ -391,14 +385,9 @@ llvm::Expected As(llvm::Expected &&obj); template class TypedPythonObject : public PythonObject { public: - // override to perform implicit type conversions on Reset - // This can be eliminated once we drop python 2 support. - static void Convert(PyRefType &type, PyObject *&py_obj) {} - TypedPythonObject(PyRefType type, PyObject *py_obj) { if (!py_obj) return; - T::Convert(type, py_obj); if (T::Check(py_obj)) PythonObject::operator=(PythonObject(type, py_obj)); else if (type == PyRefType::Owned) @@ -453,7 +442,6 @@ public: explicit PythonString(llvm::StringRef string); // safe, null on error static bool Check(PyObject *py_obj); - static void Convert(PyRefType &type, PyObject *&py_obj); llvm::StringRef GetString() const; // safe, empty string on error @@ -475,7 +463,6 @@ public: explicit PythonInteger(int64_t value); static bool Check(PyObject *py_obj); - static void Convert(PyRefType &type, PyObject *&py_obj); void SetInteger(int64_t value); -- cgit v1.1