Charles-Francois Natali <neolo...@free.fr> added the comment:
Attached is a patch removing useless calls to
Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS for several posix
functions.
It's straigthforward, but since I only have Linux boxes, I couldn't
test it under Windows.
----------
keywords: +patch
Added file: http://bugs.python.org/file20988/gil_release_py3k.diff
_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11382>
_______________________________________
Index: Modules/posixmodule.c
===================================================================
--- Modules/posixmodule.c (révision 88734)
+++ Modules/posixmodule.c (copie de travail)
@@ -3041,9 +3041,7 @@
if (!PyArg_ParseTuple(args, "ii", &which, &who))
return NULL;
errno = 0;
- Py_BEGIN_ALLOW_THREADS
retval = getpriority(which, who);
- Py_END_ALLOW_THREADS
if (errno != 0)
return posix_error();
return PyLong_FromLong((long)retval);
@@ -3063,9 +3061,7 @@
if (!PyArg_ParseTuple(args, "iii", &which, &who, &prio))
return NULL;
- Py_BEGIN_ALLOW_THREADS
retval = setpriority(which, who, prio);
- Py_END_ALLOW_THREADS
if (retval == -1)
return posix_error();
Py_RETURN_NONE;
@@ -5712,9 +5708,7 @@
return NULL;
if (!_PyVerify_fd(fd))
return posix_error();
- Py_BEGIN_ALLOW_THREADS
fd = dup(fd);
- Py_END_ALLOW_THREADS
if (fd < 0)
return posix_error();
return PyLong_FromLong((long)fd);
@@ -5733,9 +5727,7 @@
return NULL;
if (!_PyVerify_fd_dup2(fd, fd2))
return posix_error();
- Py_BEGIN_ALLOW_THREADS
res = dup2(fd, fd2);
- Py_END_ALLOW_THREADS
if (res < 0)
return posix_error();
Py_INCREF(Py_None);
@@ -6116,9 +6108,7 @@
HFILE read, write;
APIRET rc;
- Py_BEGIN_ALLOW_THREADS
rc = DosCreatePipe( &read, &write, 4096);
- Py_END_ALLOW_THREADS
if (rc != NO_ERROR)
return os2_error(rc);
@@ -6127,9 +6117,7 @@
#if !defined(MS_WINDOWS)
int fds[2];
int res;
- Py_BEGIN_ALLOW_THREADS
res = pipe(fds);
- Py_END_ALLOW_THREADS
if (res != 0)
return posix_error();
return Py_BuildValue("(ii)", fds[0], fds[1]);
@@ -6137,9 +6125,7 @@
HANDLE read, write;
int read_fd, write_fd;
BOOL ok;
- Py_BEGIN_ALLOW_THREADS
ok = CreatePipe(&read, &write, NULL, 0);
- Py_END_ALLOW_THREADS
if (!ok)
return win32_error("CreatePipe", NULL);
read_fd = _open_osfhandle((Py_intptr_t)read, 0);
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com