Skip to content

Commit e703620

Browse files
committed
fix mypy linting: python/mypy#9242
1 parent 7814d1c commit e703620

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/pip/_internal/commands/install.py

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

0 commit comments

Comments
 (0)