Commit 2e4508b7 authored by Jason Madden's avatar Jason Madden

Workaround the hangs in threading for Python 3.4 and re-enable it in the test matrix.

parent 3db30e93
...@@ -3,6 +3,7 @@ python: ...@@ -3,6 +3,7 @@ python:
- "2.6" - "2.6"
- "2.7" - "2.7"
- "3.3" - "3.3"
- "3.4"
- "pypy" - "pypy"
script: script:
- if [[ $TRAVIS_PYTHON_VERSION == 'pypy' ]]; then NWORKERS=4 PYTHON=pypy make travis_pypy; fi - if [[ $TRAVIS_PYTHON_VERSION == 'pypy' ]]; then NWORKERS=4 PYTHON=pypy make travis_pypy; fi
......
...@@ -44,3 +44,33 @@ if PYPY: ...@@ -44,3 +44,33 @@ if PYPY:
k,v = __threading__._active.items()[0] k,v = __threading__._active.items()[0]
del __threading__._active[k] del __threading__._active[k]
__threading__._active[_get_ident()] = v __threading__._active[_get_ident()] = v
import sys
if sys.version_info[:2] >= (3, 4):
# XXX: Issue 18808 breaks us on Python 3.4.
# Thread objects now expect a callback from the interpreter itself
# (threadmodule.c:release_sentinel). Because this never happens
# when a greenlet exits, join() and friends will block forever.
# The solution below involves capturing the greenlet when it is
# started and deferring the known broken methods to it.
class Thread(__threading__.Thread):
_greenlet = None
def is_alive(self):
return bool(self._greenlet)
isAlive = is_alive
def _set_tstate_lock(self):
self._greenlet = getcurrent()
def join(self, timeout=None):
if self._greenlet is None:
return
self._greenlet.join(timeout=timeout)
def _wait_for_tstate_lock(self, *args, **kwargs):
raise NotImplementedError()
__implements__.append('Thread')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment