michilu / python-functools32

Backport of the functools module from Python 3.2.3 for use with Python 2.7 and PyPy. Includes `lru_cache` (Least-recently-used cache decorator)
http://pypi.python.org/pypi/functools32
Other
52 stars 14 forks source link

Fix `thread` module import on Python 2.7 #2

Closed nmussat closed 9 years ago

nmussat commented 9 years ago

The Python 2.7 thread module has been renamed to _thread in Python3. This package was importing the _thread anyway, and was thus fallbacking to the dummy_thread32 module everytime, which is far from failproof (eg. lru_cache decorator used in a WSGI app started on uWSGI with threads enabled and high concurrency raises exceptions).

This fix loads the thread module accordingly, without trying to load Python3 _thread module since setup.py prevents installation on Python 3 explicitly.

michilu commented 9 years ago

@nmussat Thank you!