Commit 9c8ec172 authored by Denis Bilenko's avatar Denis Bilenko

Merge pull request #358 from fantix/exc_clear

Ignore sys.exc_clear() for PY3.
parents 2960692c 7483cef1
......@@ -30,6 +30,7 @@ from code import InteractiveConsole
from gevent import socket
from gevent.greenlet import Greenlet
from gevent.hub import PY3
from gevent.server import StreamServer
__all__ = ['BackdoorServer']
......@@ -79,6 +80,7 @@ class SocketConsole(Greenlet):
console.locals["builtins"] = builtins
console.interact(banner=self.banner)
except SystemExit: # raised by quit()
if not PY3:
sys.exc_clear()
finally:
self.switch_out()
......
......@@ -8,7 +8,7 @@ from __future__ import absolute_import
import os
import sys
from gevent.hub import get_hub, reinit
from gevent.hub import get_hub, reinit, PY3
import errno
EAGAIN = getattr(errno, 'EAGAIN', 11)
......@@ -52,6 +52,7 @@ if fcntl:
except OSError as e:
if e.errno not in ignored_errors:
raise
if not PY3:
sys.exc_clear()
if hub is None:
hub = get_hub()
......@@ -71,6 +72,7 @@ if fcntl:
except OSError as e:
if e.errno not in ignored_errors:
raise
if not PY3:
sys.exc_clear()
if hub is None:
hub = get_hub()
......
......@@ -13,6 +13,7 @@ from gevent import socket
import gevent
from gevent.server import StreamServer
from gevent.hub import GreenletExit
from gevent.hub import PY3
__all__ = ['WSGIHandler', 'WSGIServer']
......@@ -321,6 +322,7 @@ class WSGIHandler(object):
except socket.error as ex:
# Broken pipe, connection reset by peer
if ex.args[0] in (errno.EPIPE, errno.ECONNRESET):
if not PY3:
sys.exc_clear()
return
else:
......
import gevent
import sys
import greentest
import six
sys.exc_clear()
if not six.PY3:
sys.exc_clear()
class ExpectedError(Exception):
......
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