diff --git a/src/gevent/_compat.py b/src/gevent/_compat.py index 04d1fa37d05cf191661065ee88f1e7b22832c148..df1014c52ac83a63ba386538da8538bd662fb8c3 100644 --- a/src/gevent/_compat.py +++ b/src/gevent/_compat.py @@ -29,7 +29,7 @@ else: ## Exceptions if PY3: def reraise(t, value, tb=None): # pylint:disable=unused-argument - if value.__traceback__ is not tb: + if value.__traceback__ is not tb and tb is not None: raise value.with_traceback(tb) raise value diff --git a/src/gevent/_tblib.py b/src/gevent/_tblib.py index 522e9d8175d5e011a839a90c763683fbd28feb7e..c705f737c8c829f14558f2227016d39ce7fe8fbe 100644 --- a/src/gevent/_tblib.py +++ b/src/gevent/_tblib.py @@ -329,6 +329,10 @@ def install(): def _unlocked_imports(f): def g(a): + if sys is None: # pragma: no cover + # interpreter shutdown on Py2 + return + gb = None if 'gevent.builtins' in sys.modules: gb = sys.modules['gevent.builtins']