]> git.saurik.com Git - wxWidgets.git/commitdiff
workaround bug in SWIG's t_output_helper
authorRobin Dunn <robin@alldunn.com>
Mon, 13 Sep 2004 18:18:38 +0000 (18:18 +0000)
committerRobin Dunn <robin@alldunn.com>
Mon, 13 Sep 2004 18:18:38 +0000 (18:18 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29124 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/src/my_fragments.i

index 1b1f06bedba868d0316d8f0be0fafc22544500bf..1406d4ee50a6c8d2b07e453feaad23f2a02ced29 100644 (file)
@@ -1,3 +1,37 @@
+// There is a bug in the standard t_output_helper, this one will replace it
+// until it is fixed.
+
+
+%fragment("t_output_helper","header") %{
+  static PyObject* t_output_helper(PyObject* target, PyObject* o) {
+    PyObject*   o2;
+    PyObject*   o3;
+    
+    if (!target) {                   
+        target = o;
+    } else if (target == Py_None) {  
+        Py_DECREF(Py_None);
+        target = o;
+    } else {
+        if (!PyTuple_Check(target)) {
+            o2 = target;
+            target = PyTuple_New(1);
+            PyTuple_SetItem(target, 0, o2);
+        }            
+        o3 = PyTuple_New(1);            
+        PyTuple_SetItem(o3, 0, o);      
+
+        o2 = target;
+        target = PySequence_Concat(o2, o3); 
+        Py_DECREF(o2);                      
+        Py_DECREF(o3);
+    }
+    return target;
+}
+%}
+
+
+
 // These fragments are inserted in modules that need to convert PyObjects to
 // integer values, my versions allow any numeric type to be used, as long as
 // it can be converted to a PyInt.  (Specifically, I allow floats where the