Closed
Description
BPO | 25858 |
---|---|
Files |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = None
created_at = <Date 2015-12-14.02:52:09.933>
labels = ['ctypes', 'type-bug', '3.8', '3.9', '3.10']
title = 'Structure field size/ofs __str__ wrong with large size fields'
updated_at = <Date 2020-11-08.18:15:58.491>
user = 'https://bugs.python.org/CharlesMachalow'
bugs.python.org fields:
activity = <Date 2020-11-08.18:15:58.491>
actor = 'iritkatriel'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['ctypes']
creation = <Date 2015-12-14.02:52:09.933>
creator = 'Charles Machalow'
dependencies = []
files = ['41299']
hgrepos = []
issue_num = 25858
keywords = []
message_count = 2.0
messages = ['256359', '256361']
nosy_count = 1.0
nosy_names = ['Charles Machalow']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue25858'
versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']
Activity
CharlesMachalow commentedon Dec 14, 2015
Large sized fields in Structures lead to incorrect string representations because it is assuming that because the size is so large, it must be a bit field instead of a byte field.
To get the math for this do the following on an incorrect size/offset:
size = (bits << 16) + ofs.split(":")[1]
ofs = ofs.split(":")[0]
Though this isn't really safe because the field may actually be bit-sized
CharlesMachalow commentedon Dec 14, 2015
Adding file with code to reproduce.
encukou commentedon May 13, 2025
Fixed in #97702: [edit: fixed number]