]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/streams.i
some minor fixes to the docs (bugs 13271[56])
[wxWidgets.git] / wxPython / src / streams.i
index 2e87f237a90733138ea5c968e8dfb7915b05c0bf..84020cb3930c8fd28c0915f84671a3eb4b8c8e7d 100644 (file)
@@ -67,7 +67,9 @@
             Py_DECREF(arg);
 
             // set ThisOwn
-            PyObject_SetAttrString($target, "thisown", PyInt_FromLong(1));
+            PyObject* one = PyInt_FromLong(1);
+            PyObject_SetAttrString($target, "thisown", one);
+            Py_DECREF(one);
         }
     } else {
         Py_INCREF(Py_None);
@@ -371,8 +373,10 @@ public:
         if (!PyObject_HasAttrString(py, name))
             return NULL;
         PyObject* o = PyObject_GetAttrString(py, name);
-        if (!PyMethod_Check(o) && !PyCFunction_Check(o))
+        if (!PyMethod_Check(o) && !PyCFunction_Check(o)) {
+            Py_DECREF(o);
             return NULL;
+        }
         return o;
     }