From 178b6bb8f4114e45d2afa93cc09e8c75a1352431 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 2 Dec 2021 13:27:21 -0800 Subject: [PATCH] csv: Make _Writer.write positional-only (#6475) At runtime it only uses positional parameters. I think this works fortuitously in mypy and pyright because mypy ignores parameter names in protocols and pyright has a bug that allows passing positional-only to pos-or-keyword params (microsoft/pyright#2652) and the parameter to `io.TextIO.write` happens to be `__s`. --- stdlib/_csv.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/_csv.pyi b/stdlib/_csv.pyi index 4329a875b..734c5654e 100644 --- a/stdlib/_csv.pyi +++ b/stdlib/_csv.pyi @@ -34,7 +34,7 @@ class _writer: def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ... class _Writer(Protocol): - def write(self, s: str) -> Any: ... + def write(self, __s: str) -> object: ... def writer(csvfile: _Writer, dialect: _DialectLike = ..., **fmtparams: Any) -> _writer: ... def reader(csvfile: Iterable[str], dialect: _DialectLike = ..., **fmtparams: Any) -> _reader: ...