Title: `platform.system` is not treated the same way as `sys.platform` · Issue #19039 · python/mypy · GitHub
Open Graph Title: `platform.system` is not treated the same way as `sys.platform` · Issue #19039 · python/mypy
X Title: `platform.system` is not treated the same way as `sys.platform` · Issue #19039 · python/mypy
Description: Bug Report It seems that conditions using platform.system() are not treated the same way as those using sys.platform. I'm not sure if this is a bug or a missing feature. To Reproduce import platform import sys def works() -> None: if sys...
Open Graph Description: Bug Report It seems that conditions using platform.system() are not treated the same way as those using sys.platform. I'm not sure if this is a bug or a missing feature. To Reproduce import platfor...
X Description: Bug Report It seems that conditions using platform.system() are not treated the same way as those using sys.platform. I'm not sure if this is a bug or a missing feature. To Reproduce import pla...
Opengraph URL: https://github.com/python/mypy/issues/19039
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`platform.system` is not treated the same way as `sys.platform`","articleBody":"**Bug Report**\n\nIt seems that conditions using `platform.system()` are not treated the same way as those using `sys.platform`. I'm not sure if this is a bug or a missing feature.\n\n**To Reproduce**\n\n```python\nimport platform\nimport sys\n\n\ndef works() -> None:\n if sys.platform == \"win32\":\n import some_win_dependency\n some_win_dependency.do_stuff()\n return\n ...\n return\n\ndef doesnt_work() -> None:\n if platform.system() == \"Windows\":\n import some_win_dependency # got [import-not-found]\n some_win_dependency.do_stuff()\n return\n ...\n return\n```\n\n\n**Your Environment**\n\n\u003c!-- Include as many relevant details about the environment you experienced the bug in -->\n\n- Mypy version used: 1.15.0\n- Mypy command-line flags:\n- Mypy configuration options from `mypy.ini` (and other config files):\n- Python version used: 3.13\n\n\u003c!-- You can freely edit this text, please remove all the lines you believe are unnecessary. -->\n","author":{"url":"https://github.com/dzherb","@type":"Person","name":"dzherb"},"datePublished":"2025-05-05T19:11:30Z","url":"https://github.com/python/mypy/issues/19039"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e146be85-70a0-0a90-a34e-30339f7dd585 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 85D0:1F5A:DAA9D:182F3D:6B002D7A |
| html-safe-nonce | d7d1df9dfc103b3e6857bed28ac5ae2073d1147148a0c0012f43d8d5fa90fcd1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NUQwOjFGNUE6REFBOUQ6MTgyRjNEOjZCMDAyRDdBIiwidmlzaXRvcl9pZCI6IjU0NjYyMjU3MTQzMDA3MjY2NTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 94f0667637bac6be2a4a56da0d5ba5931e9e44f9676b1bf2dac1c4ca34d847dd |
| hovercard-subject-tag | issue:3040568779 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/19039/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6d2032a36dc92b80914ba346655b0e2144ab7d09a9194a25fb4ff39fe666a43d/python/mypy/issues/19039 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6d2032a36dc92b80914ba346655b0e2144ab7d09a9194a25fb4ff39fe666a43d/python/mypy/issues/19039 |
| og:image:alt | Bug Report It seems that conditions using platform.system() are not treated the same way as those using sys.platform. I'm not sure if this is a bug or a missing feature. To Reproduce import platfor... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dzherb |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width