Browse Source
bpo-39239: epoll.unregister() no longer ignores EBADF (GH-17882)
The select.epoll.unregister() method no longer ignores the EBADF
error.
pull/17901/head
Victor Stinner
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
13 additions and
6 deletions
-
Doc/library/select.rst
-
Doc/whatsnew/3.9.rst
-
Lib/test/test_epoll.py
-
Misc/NEWS.d/next/Library/2020-01-07-01-02-44.bpo-39239.r7vecs.rst
-
Modules/selectmodule.c
|
|
|
@ -355,6 +355,9 @@ Edge and Level Trigger Polling (epoll) Objects |
|
|
|
|
|
|
|
Remove a registered file descriptor from the epoll object. |
|
|
|
|
|
|
|
.. versionchanged:: 3.9 |
|
|
|
The method no longer ignores the :data:`~errno.EBADF` error. |
|
|
|
|
|
|
|
|
|
|
|
.. method:: epoll.poll(timeout=None, maxevents=-1) |
|
|
|
|
|
|
|
|
|
|
|
@ -382,6 +382,10 @@ Changes in the Python API |
|
|
|
* The :mod:`venv` activation scripts no longer special-case when |
|
|
|
``__VENV_PROMPT__`` is set to ``""``. |
|
|
|
|
|
|
|
* The :meth:`select.epoll.unregister` method no longer ignores the |
|
|
|
:data:`~errno.EBADF` error. |
|
|
|
(Contributed by Victor Stinner in :issue:`39239`.) |
|
|
|
|
|
|
|
|
|
|
|
CPython bytecode changes |
|
|
|
------------------------ |
|
|
|
|
|
|
|
@ -225,7 +225,10 @@ class TestEPoll(unittest.TestCase): |
|
|
|
self.assertFalse(then - now > 0.01) |
|
|
|
|
|
|
|
server.close() |
|
|
|
ep.unregister(fd) |
|
|
|
|
|
|
|
with self.assertRaises(OSError) as cm: |
|
|
|
ep.unregister(fd) |
|
|
|
self.assertEqual(cm.exception.errno, errno.EBADF) |
|
|
|
|
|
|
|
def test_close(self): |
|
|
|
open_file = open(__file__, "rb") |
|
|
|
|
|
|
|
@ -0,0 +1,2 @@ |
|
|
|
The :meth:`select.epoll.unregister` method no longer ignores the |
|
|
|
:data:`~errno.EBADF` error. |
|
|
|
@ -1447,11 +1447,6 @@ pyepoll_internal_ctl(int epfd, int op, int fd, unsigned int events) |
|
|
|
* though this argument is ignored. */ |
|
|
|
Py_BEGIN_ALLOW_THREADS |
|
|
|
result = epoll_ctl(epfd, op, fd, &ev); |
|
|
|
if (errno == EBADF) { |
|
|
|
/* fd already closed */ |
|
|
|
result = 0; |
|
|
|
errno = 0; |
|
|
|
} |
|
|
|
Py_END_ALLOW_THREADS |
|
|
|
break; |
|
|
|
default: |
|
|
|
|