Skip to content

Add aiofiles.threadpool.wrap to type stubs#15626

Open
qorexdev wants to merge 1 commit intopython:mainfrom
qorexdev:add-aiofiles-threadpool-wrap
Open

Add aiofiles.threadpool.wrap to type stubs#15626
qorexdev wants to merge 1 commit intopython:mainfrom
qorexdev:add-aiofiles-threadpool-wrap

Conversation

@qorexdev
Copy link
Copy Markdown

@qorexdev qorexdev commented Apr 7, 2026

aiofiles.threadpool.wrap is a functools.singledispatch function used to register custom file types for async wrapping. It's currently missing from the stubs, so accessing threadpool.wrap or calling wrap.register(...) gives a mypy attr-defined error.

Added it as _SingleDispatchCallable[Any] which matches the runtime type and gives users access to .register() and .dispatch().

Closes #15624

Expose the singledispatch `wrap` function in aiofiles.threadpool stubs.
This was missing, causing mypy attr-defined errors when accessing
threadpool.wrap or calling wrap.register().

Closes python#15624
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aiofiles.threadpool.wrap not exposed in types-aiofiles

1 participant