mirror of https://github.com/python/cpython
bpo-39239: epoll.unregister() no longer ignores EBADF (GH-17882)
The select.epoll.unregister() method no longer ignores the EBADF error.
This commit is contained in:
parent
10ac0cded2
commit
5b23f7618d
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue