[proxy] github.com← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light
/ cpython Public

Conversation

Copy link
Contributor

gousaiyang commented Jul 4, 2020

As per #18580, msvcrt_get_osfhandle_impl should also return -1 instead of NULL when PySys_Audit fails.

https://bugs.python.org/issue39184

Copy link
Contributor Author

Hi @zooba, could you review this PR if you have time? This PR seems necessary to correct a mistake I made previously.

Copy link
Contributor

nanjekyejoannah left a comment

Choose a reason for hiding this comment

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

Dont we need any tests for this change?

Copy link
Member

zooba commented Oct 10, 2022

If we had failure tests for all APIs with audit hooks, then I'd insist upon it. But we don't, and this only would've been caught by having broad testing (100+ new tests).

It's worth creating an issue for adding that set of tests. They ought to be fairly quick as well (though some will require e.g. making a real network connection, and most will require starting a new Python process for each API), but I think we can take this fix without adding all that.

Copy link

ghost commented Oct 10, 2022

The following commit authors need to sign the Contributor License Agreement:

Click the button to sign:

Copy link
Contributor

kumaraditya303 left a comment

Choose a reason for hiding this comment

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

The CLA needs to be signed.

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.

AlexWaygood changed the title bpo-39184: Fix incorrect return value in msvcrt_get_osfhandle_impl gh-83365: Fix incorrect return value in msvcrt_get_osfhandle_impl Dec 21, 2022
{
if (PySys_Audit("msvcrt.get_osfhandle", "(i)", fd) < 0) {
return NULL;
return -1;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return -1;
return (void*)-1;

Copy link
Member

zooba commented Mar 6, 2023

Nothing heard from the OP, but also it doesn't seem to be necessary. This function call checks for any error, without looking at the return value.

zooba closed this Mar 6, 2023
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.

7 participants