-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-126937: ctypes: fix TypeError when a field's size is >65535 bytes #126938
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
Changes from 1 commit
1962567
1900cf5
2bd972b
d2954cd
0d21229
d8a6f08
16bfb44
7402a8f
8994ad0
db171e0
7bc0ceb
cd8c011
a3bd171
5e8aec0
7d3bb10
946f261
19c1b3b
dcf97f2
03bc32b
f61faa6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,8 +110,21 @@ PyCField_new_impl(PyTypeObject *type, PyObject *name, PyObject *proto, | |
goto error; | ||
} | ||
|
||
Py_ssize_t bit_size = NUM_BITS(size); | ||
if (bit_size) { | ||
if (bit_size_obj != Py_None) { | ||
|
||
Py_ssize_t bit_size; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint is complaining about this. I'm assuming this just needs to get moved to before the |
||
|
||
if (PyLong_Check(bit_size_obj)) { | ||
bit_size = PyLong_AsSsize_t(bit_size_obj); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} else { | ||
PyErr_Format( | ||
PyExc_ValueError, | ||
"bit size of field %R must be an integer size for bit fields", | ||
self->name | ||
); | ||
goto error; | ||
} | ||
|
||
terryjreedy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
assert(bit_size > 0); | ||
assert(bit_size <= info->size * 8); | ||
switch(info->ffi_type_pointer.type) { | ||
|
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.
No need for a newline