This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A remnant of old code manually checks the sign of fds, but doesn't set
errno before raising OSError:
```
>>> os.dup2(-1, 0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 0] Error
```
Remove the manual check altogether: the C library functions used to
implement os.dup2() check fd validity anyway.
@kumaraditya303 That's interesting. It seems OSError is raised with E2BIG (1) instead of EBADF (8), which doesn't make sense to me. I'm not familar with WASI, but will take a look.
Sorry @izbyshev and @kumaraditya303, I had trouble checking out the 3.11 backport branch.
Please retry by removing and re-adding the "needs backport to 3.11" label.
Alternatively, you can backport using cherry_picker on the command line. cherry_picker c2bd55d26f8eb2850eb9f9026b5d7f0ed1420b65 3.11
Thanks @izbyshev for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Mar 4, 2023
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A remnant of old code manually checks the sign of fds, but doesn't set errno before raising OSError:
Remove the manual check altogether: the C library functions used to implement os.dup2() check fd validity anyway.