-
Notifications
You must be signed in to change notification settings - Fork 135
Closed as duplicate of#544
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
Given this input test.py:
f = open("myfile", "ab+")
f.write(b"mybytes")
Running ty results in
$ uvx ty check test.py
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
error[invalid-argument-type]: Argument to bound method `write` is incorrect
--> /Users/heiner/src/test.py:2:9
|
1 | f = open("myfile", "ab+")
2 | f.write(b"mybytes")
| ^^^^^^^^^^ Expected `str`, found `Literal[b"mybytes"]`
|
info: Function defined here
--> stdlib/_io.pyi:125:9
|
123 | def __next__(self) -> str: ... # type: ignore[override]
124 | def detach(self) -> BinaryIO: ...
125 | def write(self, s: str, /) -> int: ...
| ^^^^^ ------ Parameter declared here
126 | def writelines(self, lines: Iterable[str], /) -> None: ... # type: ignore[override]
127 | def readline(self, size: int = -1, /) -> str: ... # type: ignore[override]
|
info: rule `invalid-argument-type` is enabled by default
Found 1 diagnostic
Version
ty 0.0.1-alpha.1 (12f466e 2025-05-13)
aldanor and merlinz01
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working