diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2022-04-25 20:14:44 -0700 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2022-04-27 08:26:25 -0700 |
commit | 90537673302f13e92ffabba84901164c6b974b2d (patch) | |
tree | cd66c08919923e7809fa146451a4e8df47f0f847 /lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp | |
parent | 16baf59c6d0b3bf7392995e3e55fc9e2ba9cb5e7 (diff) | |
download | llvm-90537673302f13e92ffabba84901164c6b974b2d.zip llvm-90537673302f13e92ffabba84901164c6b974b2d.tar.gz llvm-90537673302f13e92ffabba84901164c6b974b2d.tar.bz2 |
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
Diffstat (limited to 'lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp')
-rw-r--r-- | lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp b/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp index 9bfbb37..8dd55a5 100644 --- a/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp +++ b/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp @@ -164,18 +164,6 @@ TEST_F(PythonDataObjectsTest, TestDictionaryResolutionWithDot) { TEST_F(PythonDataObjectsTest, TestPythonInteger) { // Test that integers behave correctly when wrapped by a PythonInteger. -#if PY_MAJOR_VERSION < 3 - // Verify that `PythonInt` works correctly when given a PyInt object. - // Note that PyInt doesn't exist in Python 3.x, so this is only for 2.x - PyObject *py_int = PyInt_FromLong(12); - EXPECT_TRUE(PythonInteger::Check(py_int)); - PythonInteger python_int(PyRefType::Owned, py_int); - - EXPECT_EQ(PyObjectType::Integer, python_int.GetObjectType()); - auto python_int_value = As<long long>(python_int); - EXPECT_THAT_EXPECTED(python_int_value, llvm::HasValue(12)); -#endif - // Verify that `PythonInteger` works correctly when given a PyLong object. PyObject *py_long = PyLong_FromLong(12); EXPECT_TRUE(PythonInteger::Check(py_long)); @@ -225,13 +213,8 @@ TEST_F(PythonDataObjectsTest, TestPythonBytes) { EXPECT_TRUE(PythonBytes::Check(py_bytes)); PythonBytes python_bytes(PyRefType::Owned, py_bytes); -#if PY_MAJOR_VERSION < 3 - EXPECT_TRUE(PythonString::Check(py_bytes)); - EXPECT_EQ(PyObjectType::String, python_bytes.GetObjectType()); -#else EXPECT_FALSE(PythonString::Check(py_bytes)); EXPECT_EQ(PyObjectType::Bytes, python_bytes.GetObjectType()); -#endif llvm::ArrayRef<uint8_t> bytes = python_bytes.GetBytes(); EXPECT_EQ(bytes.size(), strlen(test_bytes)); @@ -258,23 +241,12 @@ TEST_F(PythonDataObjectsTest, TestPythonString) { static const char *test_string = "PythonDataObjectsTest::TestPythonString1"; static const char *test_string2 = "PythonDataObjectsTest::TestPythonString2"; -#if PY_MAJOR_VERSION < 3 - // Verify that `PythonString` works correctly when given a PyString object. - // Note that PyString doesn't exist in Python 3.x, so this is only for 2.x - PyObject *py_string = PyString_FromString(test_string); - EXPECT_TRUE(PythonString::Check(py_string)); - PythonString python_string(PyRefType::Owned, py_string); - - EXPECT_EQ(PyObjectType::String, python_string.GetObjectType()); - EXPECT_STREQ(test_string, python_string.GetString().data()); -#else // Verify that `PythonString` works correctly when given a PyUnicode object. PyObject *py_unicode = PyUnicode_FromString(test_string); EXPECT_TRUE(PythonString::Check(py_unicode)); PythonString python_unicode(PyRefType::Owned, py_unicode); EXPECT_EQ(PyObjectType::String, python_unicode.GetObjectType()); EXPECT_STREQ(test_string, python_unicode.GetString().data()); -#endif // Test that creating a `PythonString` object works correctly with the // string constructor |