Skip to content

Commit 351f4ed

Browse files
committed
using dynamic import
1 parent cece208 commit 351f4ed

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

wolframclient/utils/lock.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
from __future__ import absolute_import, print_function, unicode_literals
22

3-
import warnings
3+
from wolframclient.utils.importutils import safe_import_string_and_call
44

55
try:
6-
import multithreading
7-
8-
_lock = multithreading.Lock()
96

7+
_lock = safe_import_string_and_call('multithreading.Lock')
108
def Lock():
119
return _lock
1210

13-
1411
except (ImportError, OSError):
1512

1613
# JYTHON is raising an ImportError when running "import multithreading"
1714
# GVisor is raising an OSError when running "multithreading.Lock()" because the feature is not implemented
1815

1916
from contextlib import contextmanager
17+
import warnings
2018

2119
@contextmanager
2220
def Lock():

0 commit comments

Comments
 (0)