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
We don't have a good solution for that. I'd be in favour of putting the whole module under a sys.platform check (we used to do this for sys.version_info before VERSIONS and it worked passably well).
Could also complicate the specification of VERSIONS, but it'd require support from all type checkers.
(Obviously there will still be false-negative type-checking errors with import winreg, but accessing anything from winreg on linux will at least cause an error.)
curses is not available on Windows. Do we want to put all the submodules under a sys.platform check? Or just add one in curses.__init__? Or not bother?
Activity
hauntsaninja commentedon Dec 29, 2021
We don't have a good solution for that. I'd be in favour of putting the whole module under a
sys.platformcheck (we used to do this forsys.version_infobeforeVERSIONSand it worked passably well).Could also complicate the specification of
VERSIONS, but it'd require support from all type checkers.AlexWaygood commentedon Dec 29, 2021
The whole of
posix.pyiis under asys.platformcheck: https://github.com/python/typeshed/blob/master/stdlib/posix.pyiSeems sensible to do the same thing for
winreg.(Obviously there will still be false-negative type-checking errors with
import winreg, but accessing anything fromwinregon linux will at least cause an error.)sobolevn commentedon Dec 29, 2021
Ok, I will send a PR to winreg today!
I think that using something like
platformspec in pip might be a good idea.`resource` is not available on Windows
`crypt` is not available on Windows
`fcntl` is not available on Windows
`grp` is not available on Windows
`pty` is not available on Windows
`pwd` is not available on Windows
`readline` is not available on Windows
`spwd` is not available on Windows
`syslog` is not available on Windows
`termios` is not available on Windows
`tty` is not available on Windows
AlexWaygood commentedon Dec 29, 2021
cursesis not available on Windows. Do we want to put all the submodules under asys.platformcheck? Or just add one incurses.__init__? Or not bother?Akuli commentedon Dec 29, 2021
I think it's fine to add a
sys.platformcheck to all submodules. There's not too many of them.hauntsaninja commentedon Jan 4, 2022
Thanks everyone, seems like we're in a decent place.
Closing since I don't think there's anything more to do (unless someone feels strongly about pushing for a change to the
VERSIONSformat).