The win32 implementation of os.listdir() releases the GIL around calls to FindNextFile, but not around calls to FindFirstFile. Attached is a simple patch to consistently release the GIL around any such calls.
The original patch also modifies attributes_from_dir() and attributes_from_dir_w(), but these are called with the GIL released. Modified patch committed in r83921 (py3k), r83922 (3.1) and r83923 (2.7). Thank you!