Skip to content

Commit 7a85110

Browse files
DimitriPapadopoulosabravalheri
authored andcommitted
socket.error → OSError
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
1 parent 5069f6c commit 7a85110

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

setuptools/command/upload_docs.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from distutils import log
99
from distutils.errors import DistutilsOptionError
1010
import os
11-
import socket
1211
import zipfile
1312
import tempfile
1413
import shutil
@@ -201,7 +200,7 @@ def upload_file(self, filename):
201200
conn.putheader('Authorization', auth)
202201
conn.endheaders()
203202
conn.send(body)
204-
except socket.error as e:
203+
except OSError as e:
205204
self.announce(str(e), log.ERROR)
206205
return
207206

setuptools/package_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ def open_url(self, url, warning=None): # noqa: C901 # is too complex (12)
806806
'%s returned a bad status line. The server might be '
807807
'down, %s' % (url, v.line)
808808
) from v
809-
except (http.client.HTTPException, socket.error) as v:
809+
except (http.client.HTTPException, OSError) as v:
810810
if warning:
811811
self.warn(warning, v)
812812
else:

0 commit comments

Comments
 (0)