Author: davide
Date: Wed Jan  9 14:52:47 2019
New Revision: 350769

URL: http://llvm.org/viewvc/llvm-project?rev=350769&view=rev
Log:
[Python] Update PyString_FromString() to work for python 2 and 3.

Reviewers: aprantl, JDevlieghere, friss, zturner

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D56511

Modified:
    lldb/trunk/scripts/Python/python-swigsafecast.swig
    lldb/trunk/scripts/Python/python-wrapper.swig

Modified: lldb/trunk/scripts/Python/python-swigsafecast.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-swigsafecast.swig?rev=350769&r1=350768&r2=350769&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/python-swigsafecast.swig (original)
+++ lldb/trunk/scripts/Python/python-swigsafecast.swig Wed Jan  9 14:52:47 2019
@@ -27,15 +27,6 @@ SBTypeToSWIGWrapper (PyObject* py_object
 
 template <>
 PyObject*
-SBTypeToSWIGWrapper (const char* c_str)
-{
-    if (c_str)
-        return PyString_FromString(c_str);
-    return NULL;
-}
-
-template <>
-PyObject*
 SBTypeToSWIGWrapper (unsigned int* c_int)
 {
     if (!c_int)

Modified: lldb/trunk/scripts/Python/python-wrapper.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-wrapper.swig?rev=350769&r1=350768&r2=350769&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/python-wrapper.swig (original)
+++ lldb/trunk/scripts/Python/python-wrapper.swig Wed Jan  9 14:52:47 2019
@@ -826,7 +826,9 @@ LLDBSwigPython_GetRecognizedArguments
     lldb::SBFrame frame_sb(frame_sp);
     PyObject *arg = SBTypeToSWIGWrapper(frame_sb);
 
-    PyObject* result = PyObject_CallMethodObjArgs(implementor, 
PyString_FromString(callee_name), arg, NULL);
+    PythonString str(callee_name);
+    PyObject* result = PyObject_CallMethodObjArgs(implementor, str.get(), arg,
+                                                  NULL);
     return result;
 }
 


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to