Commit 0d12a273 authored by Jason Madden's avatar Jason Madden

Better CFFI exception handling due to an issue seen in 3.7b2.

parent 908e74a8
......@@ -108,7 +108,7 @@ leaktest: test_prelim
@${PYTHON} scripts/travis.py fold_end default
bench:
${PYTHON} benchmarks/bench_sendall.py --loops 3 --processes 2 --values 2 --warmups 2
${PYTHON} benchmarks/bench_sendall.py --loops 3 --processes 2 --values 2 --warmups 2 --quiet
travis_test_linters:
make lint
......@@ -180,6 +180,7 @@ develop:
# We need wheel>=0.26 on Python 3.5. See previous revisions.
time ${PYTHON} -m pip install -U -r ci-requirements.txt
GEVENTSETUP_EV_VERIFY=3 time ${PYTHON} -m pip install -U -e .
${PYTHON} -m pip freeze
ccache -s
@${PYTHON} scripts/travis.py fold_end install
......
......@@ -16,7 +16,7 @@ prospector[with_pyroma] ; python_version < '3.7'
coverage>=4.0
coveralls>=1.0
# See version requirements in setup.py
cffi ; platform_python_implementation == "CPython"
cffi >= 1.11.5 ; platform_python_implementation == "CPython"
futures
dnspython
idna
......
......@@ -208,7 +208,10 @@ class AbstractCallbacks(object):
watcher.loop.handle_error(None, t, v, tb)
return 1
else:
raise v
# Raising it causes a lot of noise from CFFI
print("WARNING: gevent: Unhandled error with no watcher",
file=sys.stderr)
traceback.print_exception(t, v, tb)
def python_stop(self, handle):
if not handle: # pragma: no cover
......
......@@ -100,8 +100,7 @@ class _AbstractLinkable(object):
switch = getcurrent().switch
self.rawlink(switch)
try:
timer = Timeout._start_new_or_dummy(timeout)
try:
with Timeout._start_new_or_dummy(timeout) as timer:
try:
result = self.hub.switch()
if result is not self: # pragma: no cover
......@@ -113,8 +112,6 @@ class _AbstractLinkable(object):
# test_set_and_clear and test_timeout in test_threading
# rely on the exact return values, not just truthish-ness
return False
finally:
timer.close()
finally:
self.unlink(switch)
......
......@@ -725,16 +725,21 @@ class idle(_base.IdleMixin, watcher):
class check(_base.CheckMixin, watcher):
pass
class OneShotCheck(check):
_watcher_skip_ffi = True
def __make_cb(self, func):
stop = self.stop
@functools.wraps(func)
def cb(*args, _stop=stop):
_stop()
return func(*args)
return cb
def start(self, callback, *args):
@functools.wraps(callback)
def _callback(*args):
self.stop()
return callback(*args)
return check.start(self, _callback, *args)
return check.start(self, self.__make_cb(callback), *args)
class prepare(_base.PrepareMixin, watcher):
pass
......@@ -128,3 +128,7 @@ test___config.py
test__destroy_default_loop.py
test__util.py
test___ident.py
test__issue639.py
test__issue_728.py
test__refcount_core.py
test__api.py
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