from __future__ import absolute_import
import sys
__future_module__ = True

if sys.version_info[0] < 3:
    from dummy_thread import *
else:
    raise ImportError('This package should not be accessible on Python 3. '
                      'Either you are trying to run from the python-future src folder '
                      'or your installation of python-future is corrupted.')

from __future__ import absolute_import
import sys
__future_module__ = True

if sys.version_info[0] < 3:
    try:
        from thread import *
    except ImportError:
        from dummy_thread import *
else:
    raise ImportError('This package should not be accessible on Python 3. '
                      'Either you are trying to run from the python-future src folder '
                      'or your installation of python-future is corrupted.')

Fix bug where dummy_thread was always imported
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  https://github.com/ipython/ipython/pull/7079
  from __future__ import absolute_import
  import sys
  __future_module__ = True
  
  if sys.version_info[0] < 3:
+     try:
+         from thread import *
+     except ImportError:
-     from dummy_thread import *
+         from dummy_thread import *
  else:
      raise ImportError('This package should not be accessible on Python 3. '
                        'Either you are trying to run from the python-future src folder '
                        'or your installation of python-future is corrupted.')
  
Fix bug where dummy_thread was always imported
## Code Before:
from __future__ import absolute_import
import sys
__future_module__ = True

if sys.version_info[0] < 3:
    from dummy_thread import *
else:
    raise ImportError('This package should not be accessible on Python 3. '
                      'Either you are trying to run from the python-future src folder '
                      'or your installation of python-future is corrupted.')

## Instruction:
Fix bug where dummy_thread was always imported
## Code After:
from __future__ import absolute_import
import sys
__future_module__ = True

if sys.version_info[0] < 3:
    try:
        from thread import *
    except ImportError:
        from dummy_thread import *
else:
    raise ImportError('This package should not be accessible on Python 3. '
                      'Either you are trying to run from the python-future src folder '
                      'or your installation of python-future is corrupted.')
