Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch ConnectionError instead of socket.error on Python 3 #1418

Merged
merged 1 commit into from Dec 10, 2018

Conversation

Projects
None yet
1 participant
@davidism
Copy link
Member

commented Dec 10, 2018

PEP 3151 made socket.error an alias of OSError on Python 3. Our server was catching socket.error to silence client disconnects (and any other socket-related errors), but on Python 3 this silences all OSErrors.

I'm not clear why socket.error is an alias for OSError instead of ConnectionError. If that were the case, the code would have worked correctly without change. This section in PEP 3151 seems to imply the same.

This change catches ConnectionError on Python 3, and continues to catch socket.error on Python 2. Additionally, handle_error also checks for socket errors, since they weren't completely silenced on Python 2.

Closes #1127

@davidism davidism added this to the 0.15 milestone Dec 10, 2018

@davidism davidism merged commit a8692e2 into master Dec 10, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@davidism davidism deleted the socket-error branch Dec 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.