mirror of
https://github.com/python/cpython.git
synced 2025-11-03 19:34:08 +00:00
Issue #7736: Release the GIL around calls to opendir() and closedir()
in the posix module. Patch by Marcin Bachry.
This commit is contained in:
parent
327fd40dde
commit
d3ccde8a21
2 changed files with 13 additions and 1 deletions
|
|
@ -93,6 +93,9 @@ Core and Builtins
|
||||||
Extensions
|
Extensions
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
- Issue #7736: Release the GIL around calls to opendir() and closedir()
|
||||||
|
in the posix module. Patch by Marcin Bachry.
|
||||||
|
|
||||||
- Issue #4835: make PyLong_FromSocket_t() and PyLong_AsSocket_t() private
|
- Issue #4835: make PyLong_FromSocket_t() and PyLong_AsSocket_t() private
|
||||||
to the socket module, and fix the width of socket descriptors to be
|
to the socket module, and fix the width of socket descriptors to be
|
||||||
correctly detected under 64-bit Windows.
|
correctly detected under 64-bit Windows.
|
||||||
|
|
|
||||||
|
|
@ -2580,11 +2580,16 @@ posix_listdir(PyObject *self, PyObject *args)
|
||||||
oname = PyBytes_FromString(".");
|
oname = PyBytes_FromString(".");
|
||||||
}
|
}
|
||||||
name = PyBytes_AsString(oname);
|
name = PyBytes_AsString(oname);
|
||||||
if ((dirp = opendir(name)) == NULL) {
|
Py_BEGIN_ALLOW_THREADS
|
||||||
|
dirp = opendir(name);
|
||||||
|
Py_END_ALLOW_THREADS
|
||||||
|
if (dirp == NULL) {
|
||||||
return posix_error_with_allocated_filename(oname);
|
return posix_error_with_allocated_filename(oname);
|
||||||
}
|
}
|
||||||
if ((d = PyList_New(0)) == NULL) {
|
if ((d = PyList_New(0)) == NULL) {
|
||||||
|
Py_BEGIN_ALLOW_THREADS
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
|
Py_END_ALLOW_THREADS
|
||||||
Py_DECREF(oname);
|
Py_DECREF(oname);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -2597,7 +2602,9 @@ posix_listdir(PyObject *self, PyObject *args)
|
||||||
if (errno == 0) {
|
if (errno == 0) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
Py_BEGIN_ALLOW_THREADS
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
|
Py_END_ALLOW_THREADS
|
||||||
Py_DECREF(d);
|
Py_DECREF(d);
|
||||||
return posix_error_with_allocated_filename(oname);
|
return posix_error_with_allocated_filename(oname);
|
||||||
}
|
}
|
||||||
|
|
@ -2621,7 +2628,9 @@ posix_listdir(PyObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
Py_DECREF(v);
|
Py_DECREF(v);
|
||||||
}
|
}
|
||||||
|
Py_BEGIN_ALLOW_THREADS
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
|
Py_END_ALLOW_THREADS
|
||||||
Py_DECREF(oname);
|
Py_DECREF(oname);
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue