#include <wx/stream.h>
#include <wx/list.h>
-static PyObject* l_output_helper(PyObject* target, PyObject* o) {
- PyObject* o2;
- if (!target) {
- target = o;
- } else if (target == Py_None) {
- Py_DECREF(Py_None);
- target = o;
- } else {
- if (!PyList_Check(target)) {
- o2 = target;
- target = PyList_New(0);
- PyList_Append(target, o2);
- Py_XDECREF(o2);
- }
- PyList_Append(target,o);
- Py_XDECREF(o);
- }
- return target;
-}
static PyObject* t_output_helper(PyObject* target, PyObject* o) {
PyObject* o2;
if (bufsize == 0)
return 0;
- bool doSave = wxPyRestoreThread();
+ wxPyTState* state = wxPyBeginBlockThreads();
PyObject* arglist = Py_BuildValue("(i)", bufsize);
PyObject* result = PyEval_CallObject(read, arglist);
Py_DECREF(arglist);
}
else
m_lasterror = wxSTREAM_READ_ERROR;
- wxPySaveThread(doSave);
+ wxPyEndBlockThreads(state);
m_lastcount = o;
return o;
}
}
virtual off_t OnSysSeek(off_t off, wxSeekMode mode){
- bool doSave = wxPyRestoreThread();
+ wxPyTState* state = wxPyBeginBlockThreads();
PyObject*arglist = Py_BuildValue("(ii)", off, mode);
PyObject*result = PyEval_CallObject(seek, arglist);
Py_DECREF(arglist);
Py_XDECREF(result);
- wxPySaveThread(doSave);
+ wxPyEndBlockThreads(state);
return OnSysTell();
}
virtual off_t OnSysTell() const{
- bool doSave = wxPyRestoreThread();
+ wxPyTState* state = wxPyBeginBlockThreads();
PyObject* arglist = Py_BuildValue("()");
PyObject* result = PyEval_CallObject(tell, arglist);
Py_DECREF(arglist);
o = PyInt_AsLong(result);
Py_DECREF(result);
};
- wxPySaveThread(doSave);
+ wxPyEndBlockThreads(state);
return o;
}
public:
~wxPyCBInputStream() {
- bool doSave = wxPyRestoreThread();
+ wxPyTState* state = wxPyBeginBlockThreads();
Py_XDECREF(py);
Py_XDECREF(read);
Py_XDECREF(seek);
Py_XDECREF(tell);
- wxPySaveThread(doSave);
+ wxPyEndBlockThreads(state);
}
virtual size_t GetSize() {
{ "_EBool","_int",0},
{ "_EBool","_wxWindowID",0},
{ "_unsigned_long","_long",0},
- { "_wxPyInputStream","_class_wxPyInputStream",0},
- { "_class_wxOutputStream","_wxOutputStream",0},
{ "_signed_int","_wxCoord",0},
{ "_signed_int","_wxPrintQuality",0},
{ "_signed_int","_EBool",0},
{ "_WXTYPE","_unsigned_short",0},
{ "_unsigned_short","_WXTYPE",0},
{ "_unsigned_short","_short",0},
- { "_class_wxPyInputStream","_wxPyInputStream",0},
{ "_signed_short","_WXTYPE",0},
{ "_signed_short","_short",0},
{ "_unsigned_char","_byte",0},
{ "_wxCoord","_size_t",0},
{ "_wxCoord","_time_t",0},
{ "_wxCoord","_wxPrintQuality",0},
- { "_wxOutputStream","_class_wxOutputStream",0},
{0,0,0}};
static PyObject *SWIG_globals;