Closed Redoubts closed 2 days ago
Good catch! Feel free to make a PR.
This is definitely correct, but I did notice a slight issue. It seems PyCharm has a bug where context managers won't be taken into account for unreachability. So the common case of a cancel-scope around sleep_forever
will give spurious unreachable warnings.
Not sure if that is sufficient to prevent changing this.
I personally don't think we should avoid changing this just because an IDE's builtin type checker has bugs. If the type checker was separate from the IDE that might be a different story, but I'm sure they can fix this eventually.
I think this would be more correct? the trio-typing stubs did this: https://github.com/python-trio/trio-typing/blob/c7d97072e630cced81cb8a7bb30c0707f1a5d235/trio-stubs/__init__.pyi#L198