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

Simplify callback code using callback_body! macro #901

Merged
merged 1 commit into from
May 5, 2020

Conversation

davidhewitt
Copy link
Member

While finishing off #797 I had an idea how to remove the run_callback function and instead use a macro. This had three benefits:

  1. Now run_callback no longer appears in the stack trace when panicking
  2. The new macro is also able to set up the pool with GILPool::new(), pool.python()
  3. The new macro is able to automatically convert the output with callback::convert()

As a result, all callback code now uses this macro instead of run_callback, making all callback code shorter and easier to read 😄

@davidhewitt davidhewitt force-pushed the simplify-callbacks branch from 0ce3193 to 6e0af3d Compare May 4, 2020 22:15
Copy link
Member

@kngwyu kngwyu left a comment

Choose a reason for hiding this comment

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

💯

@kngwyu
Copy link
Member

kngwyu commented May 5, 2020

Thank you!

@kngwyu kngwyu merged commit 9f18610 into PyO3:master May 5, 2020
@davidhewitt davidhewitt deleted the simplify-callbacks branch August 10, 2021 07:19
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.

2 participants