Skip to content

Commit

Permalink
fixed threadstate swap
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto@debian32 committed Jun 25, 2011
1 parent 55c3ba7 commit 576a1e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions plugins/python/python_plugin.c
Expand Up @@ -859,8 +859,10 @@ void uwsgi_python_enable_threads() {
up.gil_get = gil_real_get;
up.gil_release = gil_real_release;

up.swap_ts = threaded_swap_ts;
up.reset_ts = threaded_reset_ts;
if (uwsgi.threads > 1) {
up.swap_ts = threaded_swap_ts;
up.reset_ts = threaded_reset_ts;
}
uwsgi_log("threads support enabled\n");

}
Expand Down
4 changes: 4 additions & 0 deletions plugins/python/pyutils.c
Expand Up @@ -12,8 +12,12 @@ PyObject *python_call(PyObject *callable, PyObject *args, int catch) {

PyObject *pyret;

uwsgi_log("ready to call %p %p\n", callable, args);

pyret = PyEval_CallObject(callable, args);

uwsgi_log("called\n");

if (PyErr_Occurred()) {
if (PyErr_ExceptionMatches(PyExc_MemoryError)) {
uwsgi_log("Memory Error detected !!!\n");
Expand Down
3 changes: 1 addition & 2 deletions plugins/python/uwsgi_pymodule.c
Expand Up @@ -436,8 +436,7 @@ PyObject *py_uwsgi_register_rpc(PyObject * self, PyObject * args) {


if (uwsgi_register_rpc(name, 0, argc, func)) {
Py_INCREF(Py_None);
return Py_None;
return PyErr_Format(PyExc_ValueError, "unable to register rpc function");
}

Py_INCREF(Py_True);
Expand Down

0 comments on commit 576a1e7

Please sign in to comment.