Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unwrapping exceptions from decorated functions #197

Merged

Conversation

mwaskom
Copy link
Contributor

@mwaskom mwaskom commented Dec 19, 2024

Fixes an issue introduced in #194 where synchronicity would raise its internal UserCodeException class when exceptions were triggered within:

  • async functions
  • wrapped with a decorator
  • invoked via the .aio interface

The correct behavior would be to unwrap the UserCodeException and propagate the underlying exception.

@mwaskom mwaskom requested review from erikbern and freider December 19, 2024 16:36
@mwaskom
Copy link
Contributor Author

mwaskom commented Dec 19, 2024

Confirmed the only other direct uses of inspect.iscoroutinefunction are in the unit tests

@mwaskom mwaskom force-pushed the michael/2024-12-19-fix-exception-unwrapping-wrapped-aio branch from 7b2055f to 1ff9405 Compare December 19, 2024 17:05
Copy link
Collaborator

@erikbern erikbern left a comment

Choose a reason for hiding this comment

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

great to have a test!

@mwaskom mwaskom merged commit b2d6bfb into main Dec 19, 2024
10 checks passed
@mwaskom mwaskom deleted the michael/2024-12-19-fix-exception-unwrapping-wrapped-aio branch December 19, 2024 18:58
@freider
Copy link
Contributor

freider commented Dec 20, 2024

Nice catch! Side note: I think we should be able to get rid of wraps_by_interface - it sort of served the same purpose as is_coroutine_function_follow_wrapped.

The added benefit of being able to inspect.iscoroutinefunction on the wrapped function feels a bit unnecessary if we aren't doing it ourselves anyways

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.

3 participants