summaryrefslogtreecommitdiffstats
path: root/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
diff options
context:
space:
mode:
authorLawrence D'Anna <lawrence_danna@apple.com>2019-10-19 18:43:49 +0000
committerLawrence D'Anna <lawrence_danna@apple.com>2019-10-19 18:43:49 +0000
commit722b61892454b3217d73ec486e52156c5a92b5b3 (patch)
tree0dff7e23c3fbcf53f0ca7c9b7555687b7df0c95d /lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
parent1d509201e2d2e926654ef762524754311fafcd59 (diff)
downloadbcm5719-llvm-722b61892454b3217d73ec486e52156c5a92b5b3.tar.gz
bcm5719-llvm-722b61892454b3217d73ec486e52156c5a92b5b3.zip
eliminate nontrivial Reset(...) from TypedPythonObject
Summary: This deletes `Reset(...)`, except for the no-argument form `Reset()` from `TypedPythonObject`, and therefore from `PythonString`, `PythonList`, etc. It updates the various callers to use assignment, `As<>`, `Take<>`, and `Retain<>`, as appropriate. followon to https://reviews.llvm.org/D69080 Reviewers: JDevlieghere, clayborg, labath, jingham Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69133 llvm-svn: 375350
Diffstat (limited to 'lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp')
-rw-r--r--lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp b/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
index e51c6f0eb0c..c01dade4440 100644
--- a/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
+++ b/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
@@ -27,8 +27,7 @@ public:
void SetUp() override {
PythonTestSuite::SetUp();
- PythonString sys_module("sys");
- m_sys_module.Reset(PyRefType::Owned, PyImport_Import(sys_module.get()));
+ m_sys_module = unwrapIgnoringErrors(PythonModule::Import("sys"));
m_main_module = PythonModule::MainModule();
m_builtins_module = PythonModule::BuiltinsModule();
}
@@ -70,13 +69,10 @@ TEST_F(PythonDataObjectsTest, TestResetting) {
PythonDictionary dict(PyInitialValue::Empty);
PyObject *new_dict = PyDict_New();
- dict.Reset(PyRefType::Owned, new_dict);
+ dict = Take<PythonDictionary>(new_dict);
EXPECT_EQ(new_dict, dict.get());
- dict.Reset(PyRefType::Owned, nullptr);
- EXPECT_EQ(nullptr, dict.get());
-
- dict.Reset(PyRefType::Owned, PyDict_New());
+ dict = Take<PythonDictionary>(PyDict_New());
EXPECT_NE(nullptr, dict.get());
dict.Reset();
EXPECT_EQ(nullptr, dict.get());
OpenPOWER on IntegriCloud