Skip to content

Commit

Permalink
socket.error → OSError
Browse files Browse the repository at this point in the history
In Python ≥ 3.3, socket.error is an alias of OSError.

https://docs.python.org/3/library/socket.html#socket.error

This is a suggestion from pyupgrade:
https://github.com/asottile/pyupgrade#oserror-aliases
  • Loading branch information
DimitriPapadopoulos committed Nov 17, 2023
1 parent 2f36dd6 commit eecbde6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setuptools/command/upload_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def upload_file(self, filename):
conn.putheader('Authorization', auth)
conn.endheaders()
conn.send(body)
except socket.error as e:
except OSError as e:
self.announce(str(e), log.ERROR)
return

Expand Down
2 changes: 1 addition & 1 deletion setuptools/package_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ def open_url(self, url, warning=None): # noqa: C901 # is too complex (12)
'%s returned a bad status line. The server might be '
'down, %s' % (url, v.line)
) from v
except (http.client.HTTPException, socket.error) as v:
except (http.client.HTTPException, OSError) as v:
if warning:
self.warn(warning, v)
else:
Expand Down

0 comments on commit eecbde6

Please sign in to comment.