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

merge PyErr internal states for simplicity #3323

Merged
merged 1 commit into from
Jul 17, 2023

Conversation

davidhewitt
Copy link
Member

Split out from #3306

This PR merges PyErrState's LazyTypeAndValue and LazyValue variants into a single Lazy variant. As per #3306, this was clearly a premature optimization from me as the result is shorter code and slightly faster, if anything.

The performance difference is within 5% so I don't think it's anything worth calling out in the CHANGELOG.

@davidhewitt davidhewitt added the CI-skip-changelog Skip checking changelog entry label Jul 16, 2023
src/err/err_state.rs Outdated Show resolved Hide resolved
Copy link
Member

@adamreichold adamreichold left a comment

Choose a reason for hiding this comment

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

I see one semantic change: The lazy value construction is now called before the PyExceptionClass_Check instead of after it, but I guess when that would be problem, the cause would be in our code base as well and we could fix it.

@davidhewitt davidhewitt force-pushed the pyerr-simplification branch from 2448d67 to 2d1b8e0 Compare July 17, 2023 21:21
@davidhewitt
Copy link
Member Author

I see one semantic change: The lazy value construction is now called before the PyExceptionClass_Check instead of after it, but I guess when that would be problem, the cause would be in our code base as well and we could fix it.

Yes, indeed passing an invalid exception type will be handled during the creation of the exception object.

@davidhewitt davidhewitt enabled auto-merge July 17, 2023 21:23
@davidhewitt davidhewitt added this pull request to the merge queue Jul 17, 2023
Merged via the queue into PyO3:main with commit 421e13a Jul 17, 2023
@davidhewitt davidhewitt deleted the pyerr-simplification branch July 17, 2023 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI-skip-changelog Skip checking changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants