Skip to content

Commit 93933b5

Browse files
authored
Just delay select.epoll to fix import after gevent monkey patching (#2928)
1 parent 71457f7 commit 93933b5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/trio/_core/_io_epoll.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ class _EpollStatistics:
200200

201201
@attrs.define(eq=False, hash=False)
202202
class EpollIOManager:
203-
_epoll: select.epoll = attrs.Factory(select.epoll)
203+
# Using lambda here because otherwise crash on import with gevent monkey patching
204+
# See https://github.com/python-trio/trio/issues/2848
205+
_epoll: select.epoll = attrs.Factory(lambda: select.epoll())
204206
# {fd: EpollWaiters}
205207
_registered: defaultdict[int, EpollWaiters] = attrs.Factory(
206208
lambda: defaultdict(EpollWaiters)

0 commit comments

Comments
 (0)