Skip to content

In _PyIO_trap_eintr(), check if "val" is not an OSError after PyErr_NormalizeException() #9929

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 1 commit into
base: main
Choose a base branch
from

Conversation

ZackerySpytz
Copy link
Contributor

It is not safe to assume that "val" will be an OSError after
PyErr_NormalizeException(). "val" may be an arbitrary exception (for
example, MemoryError) if an error occurs during the
PyErr_NormalizeException() call.

@pitrou
Copy link
Member

pitrou commented Oct 25, 2018

@ZackerySpytz Could you open an issue explaining the underlying concern? Is this something you witnessed concretely?

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

Thanks for submitting this PR. See comment below. Also, please open an issue about this.

@@ -784,8 +784,12 @@ _PyIO_trap_eintr(void)
return 0;
PyErr_Fetch(&typ, &val, &tb);
PyErr_NormalizeException(&typ, &val, &tb);
assert(val != NULL);
if (!PyObject_TypeCheck(val, (PyTypeObject *)PyExc_OSError)) {
Copy link
Member

Choose a reason for hiding this comment

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

Please add a comment explaining why this check is necessary.

Copy link

Choose a reason for hiding this comment

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

What is LGTM...?

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@serhiy-storchaka
Copy link
Member

LGTM, but please add comments.

@Carole1
Copy link

Carole1 commented Nov 8, 2018

what is LGTM ?

@serhiy-storchaka
Copy link
Member

LGTM = Looks Good To Me.

@csabella
Copy link
Contributor

@ZackerySpytz , please address the review comments. Thanks!

@csabella
Copy link
Contributor

@ZackerySpytz ping

@erlend-aasland erlend-aasland changed the title [Skip Issue] In _PyIO_trap_eintr(), check if "val" is not an OSError after PyErr_NormalizeException() In _PyIO_trap_eintr(), check if "val" is not an OSError after PyErr_NormalizeException() Jan 5, 2024
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Apr 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting changes stale Stale PR or inactive for long period of time.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants