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

Refactor the exception macros #291

Merged
merged 1 commit into from
Dec 1, 2018
Merged

Refactor the exception macros #291

merged 1 commit into from
Dec 1, 2018

Conversation

konstin
Copy link
Member

@konstin konstin commented Nov 27, 2018

  • Renamed py_exception to create_exception
  • The split up of the macros makes it possible to create exception structs with bodies to mimic python exceptions' members
  • Used Once to fix a (theoretical) race condition with the is_null check

  * Renamed `py_exception` to `create_exception`
  * The split up of the macros makes it possible to create exception structs with bodies to mimic python exceptions' members
  * Used `Once` to fix a (theoretical) race condition with the is_null check
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.

LGTM

@kngwyu
Copy link
Member

kngwyu commented Nov 30, 2018

I think this PR itself is good.
But maybe we should consider replacing this macro with proc-macro, in the long run.

@konstin
Copy link
Member Author

konstin commented Dec 1, 2018

The plan is to have a custom derive, which was originally suggested by mre in mre/hyperjson#54. This PR is the base work for a custom derive by splitting out the reusable parts.

@konstin konstin merged commit 790a103 into master Dec 1, 2018
@konstin konstin deleted the exception_macros branch December 1, 2018 12:04
@konstin
Copy link
Member Author

konstin commented Dec 1, 2018

Turns out we should use a full proc macro instead a custom derive, but that shouldn't really matter. I've written #295 with detailed mentoring instructions.

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