diff options
-rw-r--r-- | Misc/ACKS | 1 | ||||
-rw-r--r-- | Misc/NEWS | 3 | ||||
-rw-r--r-- | Modules/posixmodule.c | 4 |
3 files changed, 8 insertions, 0 deletions
@@ -409,6 +409,7 @@ Jacob Kaplan-Moss Lou Kates Hiroaki Kawai Sebastien Keim +Ryan Kelly Robert Kern Randall Kern Magnus Kessler @@ -29,6 +29,9 @@ Core and Builtins Library ------- +- Issue #6915: Under Windows, os.listdir() didn't release the Global + Interpreter Lock around all system calls. Original patch by Ryan Kelly. + - Issue #3757: thread-local objects now support cyclic garbage collection. Thread-local objects involved in reference cycles will be deallocated timely by the cyclic GC, even if the underlying thread is still running. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index d0d68c9..5237f14 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -2127,7 +2127,9 @@ posix_listdir(PyObject *self, PyObject *args) free(wnamebuf); return NULL; } + Py_BEGIN_ALLOW_THREADS hFindFile = FindFirstFileW(wnamebuf, &wFileData); + Py_END_ALLOW_THREADS if (hFindFile == INVALID_HANDLE_VALUE) { int error = GetLastError(); if (error == ERROR_FILE_NOT_FOUND) { @@ -2197,7 +2199,9 @@ posix_listdir(PyObject *self, PyObject *args) if ((d = PyList_New(0)) == NULL) return NULL; + Py_BEGIN_ALLOW_THREADS hFindFile = FindFirstFile(namebuf, &FileData); + Py_END_ALLOW_THREADS if (hFindFile == INVALID_HANDLE_VALUE) { int error = GetLastError(); if (error == ERROR_FILE_NOT_FOUND) |