-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mypy does not recognize os.name #13002
Labels
Comments
AlexWaygood
added
feature
priority-2-low
and removed
bug
mypy got something wrong
labels
Jun 21, 2022
QuLogic
added a commit
to QuLogic/matplotlib
that referenced
this issue
Aug 18, 2023
mypy does not recognize the latter [1], and there is a typing failure on Windows because of `os.geteuid`. [1] python/mypy#13002
QuLogic
added a commit
to QuLogic/matplotlib
that referenced
this issue
Aug 22, 2023
mypy does not recognize the latter [1], and there is a typing failure on Windows because of `os.geteuid`. [1] python/mypy#13002
1 task
Similar to #8166 (comment) setuptools for example, has this snippet of code, which causes have_rtld = False
use_stubs = False
if sys.platform == "darwin":
use_stubs = True
elif os.name != 'nt':
try:
import dl # type: ignore[import-not-found] # https://github.com/python/mypy/issues/13002
use_stubs = have_rtld = hasattr(dl, 'RTLD_NOW')
except ImportError:
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
mypy respects platform conditions using
sys.platform
variable, but do not recognizeos.name
.Related issue: #8166
To Reproduce
Consider this piece of code, assuming we are on Linux:
Expected Behavior
mypy should not raise any error.
Actual Behavior
mypy fails with:
Note that replacing
os.name == 'nt'
withsys.platform == 'win32'
fixes this issue.Environment
The text was updated successfully, but these errors were encountered: