davide created this revision.
davide added reviewers: aprantl, JDevlieghere, friss, zturner.

https://reviews.llvm.org/D56511

Files:
  lldb/scripts/Python/python-swigsafecast.swig
  lldb/scripts/Python/python-wrapper.swig


Index: lldb/scripts/Python/python-wrapper.swig
===================================================================
--- lldb/scripts/Python/python-wrapper.swig
+++ lldb/scripts/Python/python-wrapper.swig
@@ -826,7 +826,12 @@
     lldb::SBFrame frame_sb(frame_sp);
     PyObject *arg = SBTypeToSWIGWrapper(frame_sb);
 
-    PyObject* result = PyObject_CallMethodObjArgs(implementor, 
PyString_FromString(callee_name), arg, NULL);
+#if PY_MAJOR_VERSION >= 3
+    PyObject *str_arg = PyUnicode_FromString(callee_name);
+#else
+    PyObject *str_arg = PyString_FromString(callee_name);
+#endif
+    PyObject* result = PyObject_CallMethodObjArgs(implementor, str_arg, arg, 
NULL);
     return result;
 }
 
Index: lldb/scripts/Python/python-swigsafecast.swig
===================================================================
--- lldb/scripts/Python/python-swigsafecast.swig
+++ lldb/scripts/Python/python-swigsafecast.swig
@@ -30,7 +30,11 @@
 SBTypeToSWIGWrapper (const char* c_str)
 {
     if (c_str)
+#if PY_MAJOR_VERSION >= 3
+        return PyUnicode_FromString(c_str);
+#else
         return PyString_FromString(c_str);
+#endif
     return NULL;
 }
 


Index: lldb/scripts/Python/python-wrapper.swig
===================================================================
--- lldb/scripts/Python/python-wrapper.swig
+++ lldb/scripts/Python/python-wrapper.swig
@@ -826,7 +826,12 @@
     lldb::SBFrame frame_sb(frame_sp);
     PyObject *arg = SBTypeToSWIGWrapper(frame_sb);
 
-    PyObject* result = PyObject_CallMethodObjArgs(implementor, PyString_FromString(callee_name), arg, NULL);
+#if PY_MAJOR_VERSION >= 3
+    PyObject *str_arg = PyUnicode_FromString(callee_name);
+#else
+    PyObject *str_arg = PyString_FromString(callee_name);
+#endif
+    PyObject* result = PyObject_CallMethodObjArgs(implementor, str_arg, arg, NULL);
     return result;
 }
 
Index: lldb/scripts/Python/python-swigsafecast.swig
===================================================================
--- lldb/scripts/Python/python-swigsafecast.swig
+++ lldb/scripts/Python/python-swigsafecast.swig
@@ -30,7 +30,11 @@
 SBTypeToSWIGWrapper (const char* c_str)
 {
     if (c_str)
+#if PY_MAJOR_VERSION >= 3
+        return PyUnicode_FromString(c_str);
+#else
         return PyString_FromString(c_str);
+#endif
     return NULL;
 }
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to