Skip to content

Add aiofiles.threadpool.wrap to type stubs#15626

Merged
srittau merged 1 commit intopython:mainfrom
qorexdev:add-aiofiles-threadpool-wrap
Apr 8, 2026
Merged

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

Conversation

@qorexdev
Copy link
Copy Markdown
Contributor

@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. 🤖🎉

Copy link
Copy Markdown
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@srittau srittau merged commit 86e2b85 into python:main Apr 8, 2026
39 checks passed
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

2 participants