--- _syckmodule.c.orig	2007-11-18 00:25:07.000000000 +0200
+++ _syckmodule.c	2007-11-18 00:26:52.000000000 +0200
@@ -1029,8 +1029,6 @@
 static SYMID
 PySyckParser_node_handler(SyckParser *parser, SyckNode *node)
 {
-    PyGILState_STATE gs;
-
     PySyckParserObject *self = (PySyckParserObject *)parser->bonus;
 
     SYMID index;
@@ -1042,8 +1040,6 @@
     if (self->halt)
         return -1;
 
-    gs = PyGILState_Ensure();
-
     switch (node->kind) {
 
         case syck_str_kind:
@@ -1104,12 +1100,10 @@
     Py_DECREF(object);
 
     index = PyList_GET_SIZE(self->symbols);
-    PyGILState_Release(gs);
     return index;
 
 error:
     Py_XDECREF(object);
-    PyGILState_Release(gs);
     self->halt = 1;
     return -1;
 }
@@ -1117,15 +1111,11 @@
 static void
 PySyckParser_error_handler(SyckParser *parser, char *str)
 {
-    PyGILState_STATE gs;
-
     PySyckParserObject *self = (PySyckParserObject *)parser->bonus;
     PyObject *value;
 
     if (self->halt) return;
 
-    gs = PyGILState_Ensure();
-
     self->halt = 1;
 
     value = Py_BuildValue("(sii)", str,
@@ -1134,23 +1124,16 @@
         PyErr_SetObject(PySyck_Error, value);
     }
 
-    PyGILState_Release(gs);
 }
 
 SyckNode *
 PySyckParser_bad_anchor_handler(SyckParser *parser, char *anchor)
 {
-    PyGILState_STATE gs;
-
     PySyckParserObject *self = (PySyckParserObject *)parser->bonus;
 
     if (!self->halt) {
-        gs = PyGILState_Ensure();
-
         self->halt = 1;
         PyErr_SetString(PyExc_TypeError, "recursive anchors are not implemented");
-
-        PyGILState_Release(gs);
     }
 
     return syck_alloc_str();
@@ -1159,8 +1142,6 @@
 static long
 PySyckParser_read_handler(char *buf, SyckIoFile *file, long max_size, long skip)
 {
-    PyGILState_STATE gs;
-
     PySyckParserObject *self = (PySyckParserObject *)file->ptr;
 
     PyObject *value;
@@ -1176,14 +1157,10 @@
     
     max_size -= skip;
 
-    gs = PyGILState_Ensure();
-
     value = PyObject_CallMethod(self->source, "read", "(i)", max_size);
     if (!value) {
         self->halt = 1;
 
-        PyGILState_Release(gs);
-
         return skip;
     }
 
@@ -1192,8 +1169,6 @@
         PyErr_SetString(PyExc_TypeError, "file-like object should return a string");
         self->halt = 1;
         
-        PyGILState_Release(gs);
-
         return skip;
     }
 
@@ -1202,8 +1177,6 @@
     if (!length) {
         Py_DECREF(value);
 
-        PyGILState_Release(gs);
-
         return skip;
     }
 
@@ -1212,8 +1185,6 @@
         PyErr_SetString(PyExc_ValueError, "read returns an overly long string");
         self->halt = 1;
 
-        PyGILState_Release(gs);
-
         return skip;
     }
 
@@ -1223,8 +1194,6 @@
 
     Py_DECREF(value);
 
-    PyGILState_Release(gs);
-
     return length;
 }
 
@@ -1305,9 +1274,7 @@
     }
 
     self->parsing = 1;
-    Py_BEGIN_ALLOW_THREADS
     index = syck_parse(self->parser)-1;
-    Py_END_ALLOW_THREADS
     self->parsing = 0;
 
     if (self->halt || self->parser->eof) {
@@ -1589,8 +1556,6 @@
 static void
 PySyckEmitter_node_handler(SyckEmitter *emitter, st_data_t id)
 {
-    PyGILState_STATE gs;
-
     PySyckEmitterObject *self = (PySyckEmitterObject *)emitter->bonus;
 
     PySyckNodeObject *node;
@@ -1604,13 +1569,10 @@
 
     if (self->halt) return;
 
-    gs = PyGILState_Ensure();
-
     node = (PySyckNodeObject *)PyList_GetItem(self->symbols, id);
     if (!node) {
         PyErr_SetString(PyExc_RuntimeError, "unknown data id");
         self->halt = 1;
-        PyGILState_Release(gs);
         return;
     }
 
@@ -1618,7 +1580,6 @@
         tag = PyString_AsString(node->tag);
         if (!tag) {
             self->halt = 1;
-            PyGILState_Release(gs);
             return;
         }
     }
@@ -1630,7 +1591,6 @@
         if (!PyList_Check(node->value)) {
             PyErr_SetString(PyExc_TypeError, "value of _syck.Seq must be a list");
             self->halt = 1;
-            PyGILState_Release(gs);
             return;
         }
         l = PyList_GET_SIZE(node->value);
@@ -1639,14 +1599,12 @@
             if ((index = PyDict_GetItem(self->nodes, item))) {
                 syck_emit_item(emitter, PyInt_AS_LONG(index));
                 if (self->halt) {
-                    PyGILState_Release(gs);
                     return;
                 }
             }
             else {
                 PyErr_SetString(PyExc_RuntimeError, "sequence item is not marked");
                 self->halt = 1;
-                PyGILState_Release(gs);
                 return;
             }
         }
@@ -1665,7 +1623,6 @@
                     PyErr_SetString(PyExc_TypeError,
                             "value of _syck.Map must be a list of pairs or a dictionary");
                     self->halt = 1;
-                    PyGILState_Release(gs);
                     return;
                 }
                 for (j = 0; j < 2; j++) {
@@ -1673,14 +1630,12 @@
                     if ((index = PyDict_GetItem(self->nodes, item))) {
                         syck_emit_item(emitter, PyInt_AS_LONG(index));
                         if (self->halt) {
-                            PyGILState_Release(gs);
                             return;
                         }
                     }
                     else {
                         PyErr_SetString(PyExc_RuntimeError, "mapping item is not marked");
                         self->halt = 1;
-                        PyGILState_Release(gs);
                         return;
                     }
                 }
@@ -1694,14 +1649,12 @@
                     if ((index = PyDict_GetItem(self->nodes, item))) {
                         syck_emit_item(emitter, PyInt_AS_LONG(index));
                         if (self->halt) {
-                            PyGILState_Release(gs);
                             return;
                         }
                     }
                     else {
                         PyErr_SetString(PyExc_RuntimeError, "mapping item is not marked");
                         self->halt = 1;
-                        PyGILState_Release(gs);
                         return;
                     }
                 }
@@ -1711,7 +1664,6 @@
             PyErr_SetString(PyExc_TypeError,
                     "value of _syck.Map must be a list of pairs or a dictionary");
             self->halt = 1;
-            PyGILState_Release(gs);
             return;
         }
 
@@ -1721,7 +1673,6 @@
     else if (PyObject_TypeCheck((PyObject *)node, &PySyckScalar_Type)) {
         if (PyString_AsStringAndSize(node->value, &str, &len) < 0) {
             self->halt = 1;
-            PyGILState_Release(gs);
             return;
         }
         syck_emit_scalar(emitter, tag, ((PySyckScalarObject *)node)->style,
@@ -1733,25 +1684,17 @@
     else {
         PyErr_SetString(PyExc_TypeError, "Node instance is required");
         self->halt = 1;
-        PyGILState_Release(gs);
         return;
     }   
-    PyGILState_Release(gs);
 }
 
 static void
 PySyckEmitter_write_handler(SyckEmitter *emitter, char *buf, long len)
 {
-    PyGILState_STATE gs;
-
     PySyckEmitterObject *self = (PySyckEmitterObject *)emitter->bonus;
 
-    gs = PyGILState_Ensure();
-
     if (!PyObject_CallMethod(self->output, "write", "(s#)", buf, len))
         self->halt = 1;
-
-    PyGILState_Release(gs);
 }
 
 static int
@@ -2011,10 +1954,8 @@
         return NULL;
     }
 
-    Py_BEGIN_ALLOW_THREADS
     syck_emit(self->emitter, 0);
     syck_emitter_flush(self->emitter, 0);
-    Py_END_ALLOW_THREADS
 
     syck_free_emitter(self->emitter);
     self->emitter = NULL;
@@ -2138,8 +2079,6 @@
 {
     PyObject *m;
 
-    PyEval_InitThreads();   /* Fix segfault for Python 2.3 */
-
     if (PyType_Ready(&PySyckNode_Type) < 0)
         return;
     if (PyType_Ready(&PySyckScalar_Type) < 0)
