-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
ctypes: improve bytes handling #9029
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@@ -194,7 +194,7 @@ class _SimpleCData(Generic[_T], _CData): | |||
class c_byte(_SimpleCData[int]): ... | |||
|
|||
class c_char(_SimpleCData[bytes]): | |||
def __init__(self, value: int | bytes = ...) -> None: ... | |||
def __init__(self, value: int | bytes | bytearray = ...) -> None: ... |
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 failed to trace through the code for this, but I trust this is correct.
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 didn't find the code either but tried it in the REPL. This one allows bytearray but c_char_p
doesn't.
@@ -367,6 +367,8 @@ _ctypes.sizeof | |||
# Allowlist entries that cannot or should not be fixed | |||
# ========== | |||
|
|||
ctypes.Array.raw # exists but stubtest can't see it |
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.
Nit: Maybe copy the comment from the stub?
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
No description provided.