X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c368d904fc27d35ae1e533155e2154dc496432e4..70541533c8e108249a82fbe2bc05ccfb73bf028d:/wxPython/src/streams.i diff --git a/wxPython/src/streams.i b/wxPython/src/streams.i index 2e87f237a9..57daa51833 100644 --- a/wxPython/src/streams.i +++ b/wxPython/src/streams.i @@ -53,26 +53,7 @@ if ($source) { _ptr = new wxPyInputStream($source); } - if (_ptr) { - char swigptr[64]; - SWIG_MakePtr(swigptr, _ptr, "_wxPyInputStream_p"); - - PyObject* classobj = PyDict_GetItemString(wxPython_dict, "wxInputStreamPtr"); - if (! classobj) { - Py_INCREF(Py_None); - $target = Py_None; - } else { - PyObject* arg = Py_BuildValue("(s)", swigptr); - $target = PyInstance_New(classobj, arg, NULL); - Py_DECREF(arg); - - // set ThisOwn - PyObject_SetAttrString($target, "thisown", PyInt_FromLong(1)); - } - } else { - Py_INCREF(Py_None); - $target = Py_None; - } + $target = wxPyConstructObject(_ptr, "wxInputStream", TRUE); } //---------------------------------------------------------------------- @@ -371,8 +352,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; } @@ -501,3 +484,10 @@ public: } +//---------------------------------------------------------------------- + +%init %{ + wxPyPtrTypeMap_Add("wxInputStream", "wxPyInputStream"); +%} + +//----------------------------------------------------------------------