New submission from Eric Wieser <[email protected]>:
This behavior is pretty surprising:
```python
import ctypes
class Simple(ctypes.Structure):
_fields_ = [
('a', ctypes.c_uint8),
('b', ctypes.c_uint8),
]
class Bitfields(ctypes.Structure):
_fields_ = [
('a', ctypes.c_uint8, 8),
('b', ctypes.c_uint8, 8),
]
print(Simple.b.size) # 1
print(Bitfields.b.size) # 262148
```
The docstring for this field, from `help(type(Bitfields.b).size)`, is:
> Help on getset descriptor _ctypes.CField.size:
>
> size
> size in bytes of this field
So either the behavior or the docstring needs to change.
----------
assignee: docs@python
components: Documentation
messages: 344895
nosy: Eric Wieser, docs@python
priority: normal
severity: normal
status: open
title: CField.size from the ctypes module does not behave as documented on
bitfields
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37187>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com