Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 877509a

Browse files
committed
Issue #11382: Trivial system calls, such as dup() or pipe(), needn't
release the GIL. Patch by Charles-François Natali.
1 parent 00bdbe1 commit 877509a

2 files changed

Lines changed: 3 additions & 14 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ Core and Builtins
113113
Library
114114
-------
115115

116+
- Issue #11382: Trivial system calls, such as dup() or pipe(), needn't
117+
release the GIL. Patch by Charles-François Natali.
118+
116119
- Issue #11223: Add threading._info() function providing informations about
117120
the thread implementation.
118121

Modules/posixmodule.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3083,9 +3083,7 @@ posix_getpriority(PyObject *self, PyObject *args)
30833083
if (!PyArg_ParseTuple(args, "ii", &which, &who))
30843084
return NULL;
30853085
errno = 0;
3086-
Py_BEGIN_ALLOW_THREADS
30873086
retval = getpriority(which, who);
3088-
Py_END_ALLOW_THREADS
30893087
if (errno != 0)
30903088
return posix_error();
30913089
return PyLong_FromLong((long)retval);
@@ -3105,9 +3103,7 @@ posix_setpriority(PyObject *self, PyObject *args)
31053103

31063104
if (!PyArg_ParseTuple(args, "iii", &which, &who, &prio))
31073105
return NULL;
3108-
Py_BEGIN_ALLOW_THREADS
31093106
retval = setpriority(which, who, prio);
3110-
Py_END_ALLOW_THREADS
31113107
if (retval == -1)
31123108
return posix_error();
31133109
Py_RETURN_NONE;
@@ -6010,9 +6006,7 @@ posix_dup(PyObject *self, PyObject *args)
60106006
return NULL;
60116007
if (!_PyVerify_fd(fd))
60126008
return posix_error();
6013-
Py_BEGIN_ALLOW_THREADS
60146009
fd = dup(fd);
6015-
Py_END_ALLOW_THREADS
60166010
if (fd < 0)
60176011
return posix_error();
60186012
return PyLong_FromLong((long)fd);
@@ -6031,9 +6025,7 @@ posix_dup2(PyObject *self, PyObject *args)
60316025
return NULL;
60326026
if (!_PyVerify_fd_dup2(fd, fd2))
60336027
return posix_error();
6034-
Py_BEGIN_ALLOW_THREADS
60356028
res = dup2(fd, fd2);
6036-
Py_END_ALLOW_THREADS
60376029
if (res < 0)
60386030
return posix_error();
60396031
Py_INCREF(Py_None);
@@ -6525,9 +6517,7 @@ posix_pipe(PyObject *self, PyObject *noargs)
65256517
HFILE read, write;
65266518
APIRET rc;
65276519

6528-
Py_BEGIN_ALLOW_THREADS
65296520
rc = DosCreatePipe( &read, &write, 4096);
6530-
Py_END_ALLOW_THREADS
65316521
if (rc != NO_ERROR)
65326522
return os2_error(rc);
65336523

@@ -6536,19 +6526,15 @@ posix_pipe(PyObject *self, PyObject *noargs)
65366526
#if !defined(MS_WINDOWS)
65376527
int fds[2];
65386528
int res;
6539-
Py_BEGIN_ALLOW_THREADS
65406529
res = pipe(fds);
6541-
Py_END_ALLOW_THREADS
65426530
if (res != 0)
65436531
return posix_error();
65446532
return Py_BuildValue("(ii)", fds[0], fds[1]);
65456533
#else /* MS_WINDOWS */
65466534
HANDLE read, write;
65476535
int read_fd, write_fd;
65486536
BOOL ok;
6549-
Py_BEGIN_ALLOW_THREADS
65506537
ok = CreatePipe(&read, &write, NULL, 0);
6551-
Py_END_ALLOW_THREADS
65526538
if (!ok)
65536539
return win32_error("CreatePipe", NULL);
65546540
read_fd = _open_osfhandle((Py_intptr_t)read, 0);

0 commit comments

Comments
 (0)