Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just delay select.epoll to fix import after gevent monkey patching #2928

Merged
merged 7 commits into from
May 31, 2024
4 changes: 3 additions & 1 deletion src/trio/_core/_io_epoll.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ class _EpollStatistics:

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