[Lldb-commits] [PATCH] D56511: [Python] Update PyString_FromString() to work for python 2 and 3.

Davide Italiano via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 9 14:04:04 PST 2019


davide updated this revision to Diff 180924.
davide added a comment.

Address comments


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56511/new/

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,9 @@
     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;
 }
 
Index: lldb/scripts/Python/python-swigsafecast.swig
===================================================================
--- lldb/scripts/Python/python-swigsafecast.swig
+++ lldb/scripts/Python/python-swigsafecast.swig
@@ -25,15 +25,6 @@
     return 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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56511.180924.patch
Type: text/x-patch
Size: 1108 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190109/943e8348/attachment.bin>


More information about the lldb-commits mailing list