win32print.OpenPrinter is blocking
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
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.
This has been fixed.