[aiofiles] Fix NamedTemporaryFile name type - #16162
Conversation
This comment has been minimized.
This comment has been minimized.
|
Please remove the tests. In typeshed, we only add regression tests for functions and classes which are known to have caused complex problems in the past, or where stubs are difficult to get right. 100% test coverage for typeshed is neither necessary nor desirable, as it would lead to code duplication. See |
|
Removed the regression test in 72d696c as requested. I reran |
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
| loop: AbstractEventLoop | None = None, | ||
| executor: Executor | None = None, | ||
| ) -> AiofilesContextManager[AsyncTextIOWrapper]: ... | ||
| ) -> AiofilesContextManager[_NamedAsyncTextIOWrapper]: ... |
There was a problem hiding this comment.
This is incorrect, it returns a bytes name with NamedTemporaryFile(suffix=b""). Probably this should be generic over AnyStr?
72d696c to
47afe7f
Compare
|
I updated the wrapper types to preserve bytes names using a generic path type. The branch history needed repair and GitHub closed this PR, so the corrected one-file diff is now in #16357. Sorry for the churn. |
Fixes #13551.
Narrows
nametostronly on wrappers returned byaiofiles.tempfile.NamedTemporaryFile(), while retaining the broader type on general async file wrappers.OpenAI Codex was used to prepare this change.