Skip to content

Commit bbc6ce8

Browse files
committed
Fix bug where dummy_thread was always imported
The code always import the dummy_thread module even on platforms where the real thread module is available. This caused bugs in other packages that use this import style: try: from _thread import interrupt_main # Py 3 except ImportError: from thread import interrupt_main # Py 2 See ipython/ipython#7079
1 parent 5924c81 commit bbc6ce8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/_thread/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
__future_module__ = True
44

55
if sys.version_info[0] < 3:
6-
from dummy_thread import *
6+
try:
7+
from thread import *
8+
except ImportError:
9+
from dummy_thread import *
710
else:
811
raise ImportError('This package should not be accessible on Python 3. '
912
'Either you are trying to run from the python-future src folder '

0 commit comments

Comments
 (0)