python-hyper / hyper

HTTP/2 for Python.
http://hyper.rtfd.org/en/latest/
MIT License
1.05k stars 191 forks source link

Socket Error Seems to be Raised Incorrectly #353

Closed jeffsawatzky closed 5 years ago

jeffsawatzky commented 6 years ago

According to "https://docs.python.org/2/library/socket.html#socket.error" a socket error should be raised with either a string, or a pair (errno, string).

I seem to be getting error: 104 from: https://github.com/Lukasa/hyper/blob/070dd32ec9caafebe7fa766fe9e73ff85babf07a/hyper/ssl_compat.py#L130

which suggests that the error is being raised with just the error code and therefore the errno property is not available to compare to a constant in the errno module.

Lukasa commented 6 years ago

Ah, in Python 3 socket.error is an OSError which is why the code is written this way.

If you can write a failing test for Python 2 I'd be happy to add a fix for this.