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

bpo-45635: refactor print_exception_recursive into smaller functions to standardize error handling #30015

Merged
merged 5 commits into from
Dec 10, 2021

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Dec 9, 2021

Comment on lines +1457 to +1459
if (err) {
/* don't do anything else */
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it be clearer to just return if we don't need to do anything else? Actually, seeing that err is only set twice, I wonder if it could be worth it to just inline the error handling (PyErr_Clear()) and remove err 🤔 Nitpicking 😎

Copy link
Member Author

Choose a reason for hiding this comment

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

This will happen, once this function stops swallowing errors (that's a behaviour change rather than a refactor). Right now we have the PyErr_Clear() at the end.

iritkatriel and others added 2 commits December 10, 2021 14:49
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

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

One last PEP 7 comment. Other than that, looks good to me!

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
@iritkatriel iritkatriel merged commit 0fe104f into python:main Dec 10, 2021
@iritkatriel iritkatriel deleted the bpo-45635-pythonrun branch January 13, 2022 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants