#628 win32print.OpenPrinter is blocking

closed-fixed
nobody
win32 (141)
5
2013-03-24
2013-02-27
Anonymous
No

In win32print\win32print.cpp, the call to OpenPrinter is not enclosed in a pair Py_BEGIN_ALLOW_THREADS / Py_END_ALLOW_THREADS.
This causes multi-threaded programs to freeze until OpenPrinter returns.

OpenPrinter can generally be very slow (see remarks in the Microsoft docs). In my tests it took between 4 and 90 (!) seconds when I tried to access a printer which is connected to a powered-off network PC, before OpenPrinter would return an error.
The fix should be simple enough.

Discussion

  • Roger Upole
    Roger Upole
    2013-03-24

    • status: open --> closed-fixed
     
  • Roger Upole
    Roger Upole
    2013-03-24

    This has been fixed.