Skip to content

Use macro for exception raising #3485

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

MightyJosip
Copy link
Member

In #2371 we added support for one liner for setting exception and returning the value from the functions. If the return value is NULL, we have the same support for 10+ years. In this PR I replaced all the calls to PyErr_SetString (and returning the value) with those macros. There is still work to be done with PyErr_Format, but that would make this commit too big, so I will do that in the future.

@MightyJosip MightyJosip requested a review from a team as a code owner June 7, 2025 21:08
Copy link
Member

@ankith26 ankith26 left a comment

Choose a reason for hiding this comment

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

Overall I really like this idea but I think we should only introduce the macro for the return -1 case. The current raise could remain RAISE as it is a better shorthand.

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