Skip to content

Commit 36014e6

Browse files
committed
don't catch attributeerror
1 parent 4211775 commit 36014e6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/pip/_internal/utils/glibc.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ def glibc_version_string_confstr() -> Optional[str]:
1717
if sys.platform == "win32":
1818
return None
1919
try:
20+
gnu_libc_version = os.confstr("CS_GNU_LIBC_VERSION")
21+
if gnu_libc_version is None:
22+
return None
2023
# os.confstr("CS_GNU_LIBC_VERSION") returns a string like "glibc 2.17":
21-
_, version = os.confstr("CS_GNU_LIBC_VERSION").split() # type: ignore
22-
except (AttributeError, OSError, ValueError):
24+
_, version = gnu_libc_version
25+
except (OSError, ValueError):
2326
# os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)...
2427
return None
2528
return version

0 commit comments

Comments
 (0)