More expressive sys.platform gating
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 516
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the Bug
```
import sys
assert sys.platform == "win32"
import winreg
winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, key_path)
```
or
```
import sys
if sys.platform != "win32":
raise EnvironmentError("Couldn't locate HKEY_LOCAL_MACHINE because it's only available on Windows system")
import winreg
winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, key_path)
```
This works with MyPy but doesn't work with Pyrefly.
### Sandbox Link
https://pyrefly.org/sandbox/?code=JYWwDg9gTgLgBAZwJ4IFCoIYIQU1olAOjABsMYAzaEOAXlrgCIB3YAOwGYAmR1OfuKlCR8rNlBwBzVGImTCAeTA42AaRxIAogA8AFLKmEAEqs0BNAPoAZBQGEAglYsBZe7aMBJAHKaANHABrDQswcgALAEpUIA
### (Only applicable for extension issues) IDE Information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.