Commit 894fb643 authored by Jason Madden's avatar Jason Madden

Refactoring threadpool worker to make failures in test__issue6 and related easier to find and fix.

Only happens on Travis. Recently, the failure has started including 'Fatal Python error: PyImport_GetModuleDict missing'.
parent 11c552e1
......@@ -486,10 +486,14 @@ class Hub(WaitOperationsGreenlet):
that should generally result in exiting the loop and being
thrown to the parent greenlet.
"""
if (type, value, tb) == (None, None, None):
type, value, tb = sys.exc_info()
if isinstance(value, str):
# Cython can raise errors where the value is a plain string
# e.g., AttributeError, "_semaphore.Semaphore has no attr", <traceback>
value = type(value)
if not issubclass(type, self.NOT_ERROR):
self.print_exception(context, type, value, tb)
if context is None or issubclass(type, self.SYSTEM_ERROR):
......
......@@ -29,6 +29,9 @@ class QuietHub(Hub):
EXPECTED_TEST_ERROR = (ExpectedException,)
def handle_error(self, context, type, value, tb):
if (type, value, tb) == (None, None, None):
import sys
type, value, tb = sys.exc_info()
if issubclass(type, self.EXPECTED_TEST_ERROR):
# Don't print these to cut down on the noise in the test logs
return
......
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import sys
if not sys.argv[1:]:
......@@ -27,6 +30,7 @@ elif sys.argv[1:] == ['subprocess']: # pragma: no cover
except NameError:
line = input()
print('%s chars.' % len(line))
sys.stdout.flush()
gevent.spawn(printline).join()
......
This diff is collapsed.
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