diff --git a/CHANGES.current b/CHANGES.current index efca7023b..84c5c6035 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,6 +1,14 @@ Version 1.3.40 (in progress) ============================ +2009-04-29: olly + [Python] Don't attempt to acquire the GIL in situations where we + know that it will already be locked. This avoids some dead-locks + with mod_python (due to mod_python bugs which are apparently + unlikely to ever be fixed), and results in smaller wrappers which + run a little faster (in tests with Xapian on x86-64 Ubuntu 9.04, + the stripped wrapper library was 11% smaller and ran 2.7% faster). + 2009-04-21: wsfulton [C#] Fix #2753469 - bool &OUTPUT and bool *OUTPUT typemaps initialisation. diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index ffeea430d..bd22e79a6 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -1739,7 +1739,6 @@ public: /* Last node in overloaded chain */ int maxargs; - int allow_thread = threads_enable(n); String *tmp = NewString(""); String *dispatch; @@ -1762,8 +1761,6 @@ public: Wrapper_add_local(f, "argc", "int argc"); Printf(tmp, "PyObject *argv[%d]", maxargs + 1); Wrapper_add_local(f, "argv", tmp); - if (allow_thread) - thread_begin_block(n, f->code); if (!fastunpack) { Wrapper_add_local(f, "ii", "int ii"); @@ -1780,19 +1777,8 @@ public: Replaceall(dispatch, "$args", "self,args"); - if (allow_thread) { - String *ret = NewStringEmpty(); - thread_end_block(n, ret); - Append(ret, "return "); - Replaceall(dispatch, "return ", ret); - Delete(ret); - } - Printv(f->code, dispatch, "\n", NIL); - if (allow_thread) - thread_end_block(n, f->code); - if (GetFlag(n, "feature:python:maybecall")) { Append(f->code, "fail:\n"); Append(f->code, "Py_INCREF(Py_NotImplemented);\n"); @@ -1899,8 +1885,6 @@ public: kwargs = NewString(""); int allow_thread = threads_enable(n); - if (allow_thread) - thread_begin_block(n, f->code); Wrapper_add_local(f, "resultobj", "PyObject *resultobj = 0"); @@ -2331,8 +2315,6 @@ public: } } - if (allow_thread) - thread_end_block(n, f->code); Append(f->code, " return resultobj;\n"); /* Error handling code */ @@ -2341,8 +2323,6 @@ public: if (need_cleanup) { Printv(f->code, cleanup, NIL); } - if (allow_thread) - thread_end_block(n, f->code); Printv(f->code, " return NULL;\n", NIL); @@ -3858,10 +3838,8 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) { int allow_thread = threads_enable(n); - if (allow_thread) - thread_begin_block(n, w->code); - if (allow_thread) { + thread_begin_block(n, w->code); Append(w->code, "{\n"); }