Skip to content

Commit 930f3ff

Browse files
committed
fix _thread when no eventlet
1 parent 3f090fb commit 930f3ff

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

pigwig/reloader_linux.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
from __future__ import annotations
22

3-
import _thread # noqa: F401
3+
try:
4+
import eventlet
5+
except ImportError:
6+
import _thread
7+
else:
8+
_thread = eventlet.patcher.original('_thread')
49
import os
510
import sys
611
import typing
@@ -20,12 +25,6 @@ def init() -> None:
2025
wd = inotify.add_watch(fd, pathname, inotify.IN.CLOSE_WRITE)
2126
wds[wd] = pathname
2227

23-
try:
24-
import eventlet
25-
except ImportError:
26-
pass
27-
else:
28-
_thread = eventlet.patcher.original('_thread')
2928
_thread.start_new_thread(_reloader, (fd, wds))
3029

3130
def _reloader(fd: int, wds: dict[int, str]) -> typing.NoReturn:

0 commit comments

Comments
 (0)