You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While pyrefly correctly handles sys.platform guards (recognizing them as platform narrowing), it does not recognize os.name as a platform guard. This causes false positives for Windows-only attributes that are conditionally accessed behind os.name == "nt" checks.
Minimal repro:
importosimportsubprocessifos.name=="nt":
flags=subprocess.CREATE_NO_WINDOW# FP: No attribute `CREATE_NO_WINDOW`else:
flags=0
Describe the Bug
While pyrefly correctly handles
sys.platformguards (recognizing them as platform narrowing), it does not recognizeos.nameas a platform guard. This causes false positives for Windows-only attributes that are conditionally accessed behindos.name == "nt"checks.Minimal repro:
Sandbox Link
https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSIEAtsbgE4AuABLnADrrW2NNwCu2YnVwBjeO05gWcQulRUYTALxKmbEOgbrEHJnqZgoqAOZxlvAUNHjCAYQBKAUQCCAFUcB9AHIB5DwHUASS8AER9-PQBiJgAxAAVEJi9cJlQGBjoIbD4GRQADBxd3bz8g0PC8jhgoOBgddH0DI1NzAAYQABoQHOgZMgpogFUGaAgGUgM%2BdBER3HQJDkwYKTB6KjSPdD4qbBg6AAp8RIhNAEomAFoAPl4M%2Bsa6GAY%2BOgawdS9t3bpE4HwAX3UHE6IDIj0MpEIDFwVCgAyYcVI4KgEzQWDw%2BCYIjmkGMLzSEDmhA40QAyjBFAALdLEOCIAD09LByxRhHoxnpMHQ9Mwojg9Ox6Fx%2BNm3IM9FSADdUNBUNhYFicRA8XQCXMWMRRTIOGQGJS5hdJXs4ISGqp1ABmQgARgATED0CB-l1UDMIEaYtAYBQ0TgCCRyP8gA
(Only applicable for extension issues) IDE Information
No response