Repository navigation
Conversation
The python-future ( http://python-future.org/ ) package provides a dummy version the _thread module for python2. This causes the dummy library to be loaded instead. The effect is that for example the 'Interrupt' button in ipython notebook doesn't work. This fix ensures that we try to import the python 2 code first, thus preventing the _thread module from being imported when the future package is installed.
|
Oof, that seems like a pretty bad bug in python-future. |
|
The annoying part about a fix like this is that it's completely non-obvious what it's "fixing". If another dev decides to switch the conditional around, they should "be the same right"? |
|
Hang on, why is that breaking things? python-future is there for compatibility; shouldn't its |
|
Yeah, I think that's a plain and simple bug: the https://github.com/PythonCharmers/python-future/blob/master/src/_thread/__init__.py Closing as not our bug. If other packages install standard library shims, it's up to them to get that right. |
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
|
I agree that this is not your bug. It is kind of annoying thus, as python-future is included by default in the anaconda python distribution. I have created a pull request for the python-future package Enlighten me, would it not be a better practice to actually check the python version when importing instead of assuming that _thread is not availble on python2. |
|
This bug is now fixed in python-future v0.14.3. |
|
Thanks @edschofield |
The python-future ( http://python-future.org/ ) package provides a dummy version the _thread module for python2. This causes the dummy library to be loaded instead. The effect is that for example the 'Interrupt' button in ipython notebook doesn't work.
This fix ensures that we try to import the python 2 code first, thus preventing the _thread module from being imported when the future package is installed.