Skip to content

Commit 4418bc6

Browse files
committed
fix mypy linting: python/mypy#9242
1 parent ea466cf commit 4418bc6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/pip/_internal/commands/install.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,11 @@ def add_options(self):
225225
@with_cleanup
226226
def run(self, options, args):
227227
# type: (Values, List[str]) -> int
228-
try: # Unix
228+
if sys.platform == 'darwin' or sys.platform == 'linux': # Unix
229229
is_su = os.getuid() == 0 # type: ignore
230-
except AttributeError: # Windows
230+
elif sys.platform == 'win32' or sys.platform == 'cygwin': # Windows
231231
is_su = ctypes.windll.shell32.IsUserAnAdmin() != 0 # type: ignore
232-
except Exception: # Unknown
232+
except AttributeError: # Unknown
233233
is_su = False
234234
if is_su:
235235
sudo_warning = ("Running pip as root is not recommended. "

0 commit comments

Comments
 (0)