-
-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pyright
does not understand trio.open_memory_channel[int](0)
#2873
Comments
I also saw a bizarre |
For the attrs thing that's very possible because
|
OK something's fishy here: # pyright: strict
from trio._channel import MemorySendChannel, MemoryReceiveChannel, open_memory_channel
import typing
T = typing.TypeVar("T")
class omc(typing.Tuple[MemorySendChannel[T], MemoryReceiveChannel[T]]):
def __new__( # type: ignore[misc] # "must return a subtype"
cls, max_buffer_size: int | float
) -> tuple[MemorySendChannel[T], MemoryReceiveChannel[T]]:
...
def __init__(self, max_buffer_size: int | float):
...
reveal_type(omc)
reveal_type(open_memory_channel) Pyright says:
I'm not really feeling like digging deeper, this looks like a pyright bug. |
Looks like we can move some code around, check that solves it, and then ship 0.23.2 🙃 |
I believe we can just make (I do think that this should work because it's not gonna actually run at runtime and forward declaration stuff but... ugh gotta make sure it works with pyright :( ) |
mypy --strict t.py
succeeds, butpyright t.py
fails with:This is on Trio 0.23.1; if I install
trio-typing
I don't have any issues - but I'd prefer to drop the extra dependency.See also: #2734
The text was updated successfully, but these errors were encountered: