-
Notifications
You must be signed in to change notification settings - Fork 306
Implement syscall ioctl
#1903
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
Merged
Merged
Implement syscall ioctl
#1903
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I should have suggested this in the last PR, but what about using
PythonOps.Index(arg)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at it too, but it doesn't do what is needed here:
System.Reflection.Missinguint,long,ulongobjectso aswitchis still needed to cast to an unmanaged type__index__and this is not what Python does hereBut now this code is being used in two places so I guess I might as well factor it out. I'm not sure it deserves to be promoted to
PythonOps, but something similar is used intermios, except for the error message. Maybe I just leave it here and make internal;termiosis already using some helper methods fromfcntl, and these two modules are somewhat coupled.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They don't have a fast path since they're not typically expected in Python code, but they do end up being resolves via
__index__calls.True. Could have an some helpers such as
PythonOps.IndexAsLong.In recent versions of Python,
__index__is supported pretty much everywhere. For example (only tried on 3.10.12, I guess it's always possible they reverted since):Anyway, I don't have an objection to what you're proposing it just looked a lot like what index does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. On maxOS I am using 3.7 and on Linux 3.6 for testing (which are the oldest I could easily get, 3.4 is nowhere easily available anymore). I see that 3.8 – 3.12 all support
__index__. It's moving target…I like the idea. From my memory, this or a similar conversion is happening in more places. I think
PythonOps.TryGetInt64that doesn't do unnecessary try/catch would be more practical. Anyway, I'll keep it in mind, this is not something for this PR.