Skip to content

Add async function support to profile decorator - #3

Open
valentinstn wants to merge 1 commit into
mainfrom
feat/async-support
Open

Add async function support to profile decorator#3
valentinstn wants to merge 1 commit into
mainfrom
feat/async-support

Conversation

@valentinstn

Copy link
Copy Markdown
Owner

Summary

  • `@profile()` now works on `async def` functions by detecting coroutine functions via `asyncio.iscoroutinefunction`
  • The async wrapper uses `await` so the event loop is not blocked
  • No change to sync function behavior or context manager mode

Test plan

  • `@profile(open_flamechart=False)` on an `async def` function produces a `.prof` file
  • Sync decorator behavior is unchanged

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.

1 participant