Hi, following patch also adds Py_*_ALLOW_THREADS macros around the sane_get_devices and sane_open calls which can take a long time especially if network-scanners are accessed.

--- Imaging-1.1.7.orig/Sane/_sane.c    2009-11-01 01:44:12.000000000 +0100
+++ Imaging-1.1.7/Sane/_sane.c    2010-12-28 02:17:38.626022947 +0100
@@ -1162,8 +1162,9 @@
     {
       return NULL;
     }
-
+  Py_BEGIN_ALLOW_THREADS
   st=sane_get_devices(&devlist, local_only);
+  Py_END_ALLOW_THREADS
   if (st) return PySane_Error(st);
   if (!(list = PyList_New(0)))
         return NULL;
@@ -1191,7 +1192,9 @@
     rv = newSaneDevObject();
     if ( rv == NULL )
         return NULL;
+    Py_BEGIN_ALLOW_THREADS
     st = sane_open(name, &(rv->h));
+    Py_END_ALLOW_THREADS
     if (st)
       {
         Py_DECREF(rv);

_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to