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

Replace use of deprecated socket.timeout and socket.error errors #607

Closed
michaeloliverx opened this issue Nov 17, 2022 · 2 comments
Closed
Assignees
Labels

Comments

@michaeloliverx
Copy link
Member

I noticed that we are using socket.error and socket.timeout in a few places e.g.

exc_map = {socket.timeout: ReadTimeout, socket.error: ReadError}

According to the docs they are now aliased to OSError and TimeoutError respectively.

Should we replace all references of these?

@michaeloliverx michaeloliverx changed the title Replace use of deprecated socket.error and socket.error errors Replace use of deprecated socket.timeout and socket.error errors Nov 17, 2022
@tomchristie
Copy link
Member

On first sight that looks like a sensible change to me.

But... I'm not sure that works prior to Python 3.10.

I think for Python 3.9 and lower we still need to use socket.timeout...

$ python 
Python 3.9.7 (v3.9.7:1016ef3790, Aug 30 2021, 16:39:15) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.timeout
<class 'socket.timeout'>
>>> socket.timeout.__mro__
(<class 'socket.timeout'>, <class 'OSError'>, <class 'Exception'>, <class 'BaseException'>, <class 'object'>)

@tomchristie
Copy link
Member

Closed via #609.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants