diff options
author | Alex Gorrod <alexg@wiredtiger.com> | 2013-08-28 10:13:26 +0000 |
---|---|---|
committer | Alex Gorrod <alexg@wiredtiger.com> | 2013-08-28 10:13:26 +0000 |
commit | 99ee0bd6f99c9d657abab711914b70a7a45be8d3 (patch) | |
tree | b6920f3ef0deabf645d456d88eba426270289423 /lang | |
parent | 7dc87a0f10cc622c4662e51704f12fb2b8f53c1f (diff) | |
download | mongo-99ee0bd6f99c9d657abab711914b70a7a45be8d3.tar.gz |
Remove Python custom error and message callback implementations.
They cause problems with the Python test suite.
Diffstat (limited to 'lang')
-rw-r--r-- | lang/python/wiredtiger.i | 63 |
1 files changed, 1 insertions, 62 deletions
diff --git a/lang/python/wiredtiger.i b/lang/python/wiredtiger.i index bac33181384..2bb0821a1f0 100644 --- a/lang/python/wiredtiger.i +++ b/lang/python/wiredtiger.i @@ -445,73 +445,12 @@ typedef int int_void; /* Add event handler support. */ %{ - -static int writeToPythonStream(const char *streamname, const char *message) { - PyObject *sys = NULL; - PyObject *se = NULL; - PyObject *sys_stderr_write = NULL; - PyObject *written = NULL; - PyObject *arglist = NULL; - int ret = 0; - /*PyGILState_STATE gstate;*/ - - /* Aquire python Global Interpreter Lock. Otherwise can segfault. */ - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - /*gstate = PyGILState_Ensure();*/ - - sys = PyImport_ImportModule("sys"); - if (!sys) { - ret = 1; - goto err; - } - se = PyObject_GetAttrString(sys, streamname); - if (!se) { - ret = 1; - goto err; - } - sys_stderr_write = PyObject_GetAttrString(se, "write"); - if (!sys_stderr_write) { - ret = 1; - goto err; - } - - arglist = Py_BuildValue("(s)", message); - if (!arglist) { - ret = 1; - goto err; - } - written = PyObject_CallObject(sys_stderr_write, arglist); -err: /* Release python Global Interpreter Lock */ - SWIG_PYTHON_THREAD_END_BLOCK; - /*PyGILState_Release(gstate);*/ - if (arglist) - Py_XDECREF(arglist); - if (sys_stderr_write) - Py_XDECREF(sys_stderr_write); - if (se) - Py_XDECREF(se); - if (sys) - Py_XDECREF(sys); - if (written) - Py_XDECREF(written); - return ret; -} -static int pythonErrorCallback(WT_EVENT_HANDLER *handler, int err, const char *message) -{ - return writeToPythonStream("stderr", message); -} - -static int pythonMessageCallback(WT_EVENT_HANDLER *handler, const char *message) -{ - return writeToPythonStream("stdout", message); -} - static int pythonCloseCallback(WT_EVENT_HANDLER *handler, WT_SESSION *session, WT_CURSOR *cursor) { return 0; } -WT_EVENT_HANDLER pyApiEventHandler = {pythonErrorCallback, pythonMessageCallback, NULL, pythonCloseCallback}; +WT_EVENT_HANDLER pyApiEventHandler = {NULL, NULL, NULL, pythonCloseCallback}; %} %pythoncode %{ |