[Lldb-commits] [lldb] r373679 - Python3 doesn't seem to allow you to tell whether an object is a class

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 3 16:57:34 PDT 2019


Author: jingham
Date: Thu Oct  3 16:57:34 2019
New Revision: 373679

URL: http://llvm.org/viewvc/llvm-project?rev=373679&view=rev
Log:
Python3 doesn't seem to allow you to tell whether an object is a class

PyClass_Check and everything it relied on seems gone from Python3.7.  So
I won't check whether it is a class first...

Also cleaned up a couple of warnings.

Modified:
    lldb/trunk/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
    lldb/trunk/source/Interpreter/OptionGroupPythonClassWithDict.cpp
    lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp

Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h?rev=373679&r1=373678&r2=373679&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h Thu Oct  3 16:57:34 2019
@@ -27,7 +27,7 @@ public:
                       int class_option = 'C',
                       int key_option = 'k', 
                       int value_option = 'v',
-                      char *class_long_option = "python-class",
+                      const char *class_long_option = "python-class",
                       const char *key_long_option = "python-class-key",
                       const char *value_long_option = "python-class-value",
                       bool required = false);

Modified: lldb/trunk/source/Interpreter/OptionGroupPythonClassWithDict.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupPythonClassWithDict.cpp?rev=373679&r1=373678&r2=373679&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupPythonClassWithDict.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupPythonClassWithDict.cpp Thu Oct  3 16:57:34 2019
@@ -18,7 +18,7 @@ OptionGroupPythonClassWithDict::OptionGr
      int class_option,
      int key_option, 
      int value_option,
-     char *class_long_option,
+     const char *class_long_option,
      const char *key_long_option,
      const char *value_long_option,
      bool required) {
@@ -77,7 +77,6 @@ Status OptionGroupPythonClassWithDict::S
     llvm::StringRef option_arg,
     ExecutionContext *execution_context) {
   Status error;
-  const int short_option = m_option_definition[option_idx].short_option;
   switch (option_idx) {
   case 0: {
     m_class_name.assign(option_arg);

Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp?rev=373679&r1=373678&r2=373679&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp Thu Oct  3 16:57:34 2019
@@ -892,8 +892,6 @@ PythonCallable::ArgInfo PythonCallable::
   if (!IsValid())
     return result;
   PyObject *py_func_obj = m_py_obj;
-  if (!PyClass_Check(m_py_obj))
-    return result;
 
   PythonObject __init__ = GetAttributeValue("__init__");
   if (__init__.IsValid() ) {




More information about the lldb-commits mailing list