All pastes #28916 Raw Edit

Diff

public text v1 · immutable
#28916 ·published 2005-11-16 16:22 UTC
rendered paste body
diff -ruN python-xml-0.8.4/extensions/pyexpat.c python-xml-0.8.4-gil/extensions/pyexpat.c--- python-xml-0.8.4/extensions/pyexpat.c	2004-11-29 13:36:22.000000000 +0100+++ python-xml-0.8.4-gil/extensions/pyexpat.c	2005-11-16 17:21:12.000000000 +0100@@ -125,6 +125,7 @@ {     PyObject *err;     char buffer[256];+    PyGILState_STATE state;     XML_Parser parser = self->itself;     int lineno = XML_GetErrorLineNumber(parser);     int column = XML_GetErrorColumnNumber(parser);@@ -133,7 +134,11 @@        even for 64-bit integers, there is sufficient space. */     sprintf(buffer, "%.200s: line %i, column %i",             XML_ErrorString(code), lineno, column);++    state = PyGILState_Acquire();     err = PyObject_CallFunction(ErrorObject, "s", buffer);+    PyGILState_Release(state);+         if (  err != NULL           && set_error_attr(err, "code", code)           && set_error_attr(err, "offset", column)@@ -369,6 +374,7 @@                 xmlparseobject *self) {     PyThreadState *tstate = PyThreadState_GET();+    PyGILState_STATE state;     PyFrameObject *f;     PyObject *res; @@ -384,7 +390,11 @@ 	return NULL;     } #endif+   +   	state = PyGILState_Acquire();     res = PyEval_CallObject(func, args);+    PyGILState_Release(state);+         if (res == NULL) { 	if (tstate->curexc_traceback == NULL) 	    PyTraceBack_Here(f);@@ -929,6 +939,7 @@ static int readinst(char *buf, int buf_size, PyObject *meth) {+	PyGILState_STATE state;     PyObject *arg = NULL;     PyObject *bytes = NULL;     PyObject *str = NULL;@@ -944,11 +955,13 @@      PyTuple_SET_ITEM(arg, 0, bytes); +	state = PyGILState_Acquire(); #if PY_VERSION_HEX < 0x02020000     str = PyObject_CallObject(meth, arg); #else     str = PyObject_Call(meth, arg, NULL); #endif+	PyGILState_Release(state);     if (str == NULL)         goto finally;