Commit c02b769
committed
widen bitfields whose declared width exceeds their base type
clang2py can emit a bitfield typed as a smaller ctype than its own
declared width (e.g. a 15-bit field typed ctypes.c_ubyte, which only
has 8 bits) - ctypes rejects these with 'ValueError: number of bits
invalid for bit field'. Surfaced by struct_vmbus_channel_offer_channel
on a kernel with Hyper-V support enabled (not present locally, but
present on GitHub Actions' Azure-hosted runners).
Generalizes the existing c_bool-specific workaround to all integer
ctypes, widening to the smallest standard type that fits.1 parent 559d057 commit c02b769
1 file changed
Lines changed: 48 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
256 | 283 | | |
257 | | - | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
258 | 299 | | |
259 | 300 | | |
260 | 301 | | |
| |||
0 commit comments