Commit b73caab4 authored by Antoine Pitrou's avatar Antoine Pitrou

Issue #6915: Under Windows, os.listdir() didn't release the Global

Interpreter Lock around all system calls.  Original patch by Ryan Kelly.
parent 5af4f4b9
...@@ -419,6 +419,7 @@ Jacob Kaplan-Moss ...@@ -419,6 +419,7 @@ Jacob Kaplan-Moss
Lou Kates Lou Kates
Hiroaki Kawai Hiroaki Kawai
Sebastien Keim Sebastien Keim
Ryan Kelly
Robert Kern Robert Kern
Randall Kern Randall Kern
Magnus Kessler Magnus Kessler
......
...@@ -30,6 +30,9 @@ Core and Builtins ...@@ -30,6 +30,9 @@ Core and Builtins
Extensions Extensions
---------- ----------
- Issue #6915: Under Windows, os.listdir() didn't release the Global
Interpreter Lock around all system calls. Original patch by Ryan Kelly.
- Issue #8524: Add a detach() method to socket objects, so as to put the - Issue #8524: Add a detach() method to socket objects, so as to put the
socket into the closed state without closing the underlying file socket into the closed state without closing the underlying file
descriptor. descriptor.
......
...@@ -1229,7 +1229,7 @@ win32_stat_w(const wchar_t* path, struct win32_stat *result) ...@@ -1229,7 +1229,7 @@ win32_stat_w(const wchar_t* path, struct win32_stat *result)
/* FILE_FLAG_BACKUP_SEMANTICS is required to open a directory */ /* FILE_FLAG_BACKUP_SEMANTICS is required to open a directory */
FILE_ATTRIBUTE_NORMAL|FILE_FLAG_BACKUP_SEMANTICS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_BACKUP_SEMANTICS,
NULL); NULL);
if(hFile == INVALID_HANDLE_VALUE) { if(hFile == INVALID_HANDLE_VALUE) {
/* Either the target doesn't exist, or we don't have access to /* Either the target doesn't exist, or we don't have access to
get a handle to it. If the former, we need to return an error. get a handle to it. If the former, we need to return an error.
...@@ -2353,7 +2353,9 @@ posix_listdir(PyObject *self, PyObject *args) ...@@ -2353,7 +2353,9 @@ posix_listdir(PyObject *self, PyObject *args)
free(wnamebuf); free(wnamebuf);
return NULL; return NULL;
} }
Py_BEGIN_ALLOW_THREADS
hFindFile = FindFirstFileW(wnamebuf, &wFileData); hFindFile = FindFirstFileW(wnamebuf, &wFileData);
Py_END_ALLOW_THREADS
if (hFindFile == INVALID_HANDLE_VALUE) { if (hFindFile == INVALID_HANDLE_VALUE) {
int error = GetLastError(); int error = GetLastError();
if (error == ERROR_FILE_NOT_FOUND) { if (error == ERROR_FILE_NOT_FOUND) {
...@@ -2430,7 +2432,9 @@ posix_listdir(PyObject *self, PyObject *args) ...@@ -2430,7 +2432,9 @@ posix_listdir(PyObject *self, PyObject *args)
if ((d = PyList_New(0)) == NULL) if ((d = PyList_New(0)) == NULL)
return NULL; return NULL;
Py_BEGIN_ALLOW_THREADS
hFindFile = FindFirstFile(namebuf, &FileData); hFindFile = FindFirstFile(namebuf, &FileData);
Py_END_ALLOW_THREADS
if (hFindFile == INVALID_HANDLE_VALUE) { if (hFindFile == INVALID_HANDLE_VALUE) {
int error = GetLastError(); int error = GetLastError();
if (error == ERROR_FILE_NOT_FOUND) if (error == ERROR_FILE_NOT_FOUND)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment