-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
featuregood-second-issuepriority-1-normaltopic-runtime-semanticsmypy doesn't model runtime semantics correctlymypy doesn't model runtime semantics correctly
Description
Note: if you are reporting a wrong signature of a function or a class in
the standard library, then the typeshed tracker is better suited
for this report: https://github.com/python/typeshed/issues
Please provide more information to help us understand the issue:
- Are you reporting a bug, or opening a feature request? feature request
- Please insert below the code you are checking with mypy,
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
if platform.system() != "Windows": # sys.platform != "win32":
try:
# os.confstr("CS_GNU_LIBC_VERSION") returns a string like "glibc 2.17".
version_string = os.confstr("CS_GNU_LIBC_VERSION")
assert version_string is not None
_, version = version_string.split()
except (AssertionError, OSError, ValueError):
# os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)...
return None
return version
return None
- What is the actual behavior/output? "error: Module has no attribute "confstr""
- What is the behavior/output you expect? No error when run under Windows
- What are the versions of mypy and Python you are using? mypy 0.750, Python 3.7.4
Basically it would be nice to get to use platform.system()
instead of having to use sys.platform
to make mypy happy with code that is conditional on the platform.
Avasam, XuehaiPan and jorenham
Metadata
Metadata
Assignees
Labels
featuregood-second-issuepriority-1-normaltopic-runtime-semanticsmypy doesn't model runtime semantics correctlymypy doesn't model runtime semantics correctly