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

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


This revision was automatically updated to reflect the committed changes.
Closed by commit rL350769: [Python] Update PyString_FromString() to work for python 2 and 3. (authored by davide, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D56511?vs=180924&id=180938#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D56511

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


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56511.180938.patch
Type: text/x-patch
Size: 1138 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190109/7bd17f22/attachment.bin>


More information about the llvm-commits mailing list