[Lldb-commits] [lldb] af8445e - [lldb] Replace condition that always evaluates to false (#89685)

via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 22 20:17:57 PDT 2024


Author: Troy Butler
Date: 2024-04-22T20:17:51-07:00
New Revision: af8445e9ce4d9bd74775a68b694957640f29d28a

URL: https://github.com/llvm/llvm-project/commit/af8445e9ce4d9bd74775a68b694957640f29d28a
DIFF: https://github.com/llvm/llvm-project/commit/af8445e9ce4d9bd74775a68b694957640f29d28a.diff

LOG: [lldb] Replace condition that always evaluates to false (#89685)

Addresses issue #87243. 

The current code incorrectly checks the validity of ```obj``` twice when
it should be checking the new ```str_obj``` pointer.

Signed-off-by: Troy-Butler <squintik at outlook.com>
Co-authored-by: Troy-Butler <squintik at outlook.com>

Added: 
    

Modified: 
    lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
index ea0a1cdff40f1e..7c7035e0c86c9e 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -61,7 +61,7 @@ Expected<std::string> python::As<std::string>(Expected<PythonObject> &&obj) {
   if (!obj)
     return obj.takeError();
   PyObject *str_obj = PyObject_Str(obj.get().get());
-  if (!obj)
+  if (!str_obj)
     return llvm::make_error<PythonException>();
   auto str = Take<PythonString>(str_obj);
   auto utf8 = str.AsUTF8();


        


More information about the lldb-commits mailing list