Skip to content

Commit 189c3cf

Browse files
committed
Remove imp.acquire_lock and imp.release_lock.
Global import locks have been removed since Python 3.3, so they are likely just not needed anymore.
1 parent 4e3b101 commit 189c3cf

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

labscript_utils/modulewatcher.py

+2-16
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717
import site
1818
import sysconfig
1919

20-
# deal with removal of imp from python 3.12
21-
try:
22-
import imp
23-
except ImportError:
24-
import _imp as imp
25-
2620

2721
# Directories in which the standard library and installed packages may be located.
2822
# Modules in these locations will be whitelisted:
@@ -63,16 +57,8 @@ def mainloop(self):
6357
while True:
6458
time.sleep(1)
6559
with self.lock:
66-
# Acquire the import lock so that we don't unload modules whilst an
67-
# import is in progess:
68-
imp.acquire_lock()
69-
try:
70-
if self.check():
71-
self.unload()
72-
finally:
73-
# We're done mucking around with the cached modules, normal imports
74-
# in other threads may resume:
75-
imp.release_lock()
60+
if self.check():
61+
self.unload()
7662

7763
def check(self):
7864
unload_required = False

0 commit comments

Comments
 (0)