We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 862451b commit 3042d03Copy full SHA for 3042d03
1 file changed
Lib/test/test_ctypes/test_struct_fields.py
@@ -130,6 +130,21 @@ class S(Structure):
130
self.check_struct(S)
131
self.assertEqual(S.largeField.bit_size, size * 8)
132
133
+ def test_bitfield_overflow_error_message_gh143164(self):
134
+ with self.assertRaisesRegex(
135
+ ValueError,
136
+ r"bit field 'x' overflows its type \(0 \+ 9 > 8\)",
137
+ ):
138
+ CField(
139
+ name="x",
140
+ type=c_byte,
141
+ byte_size=1,
142
+ byte_offset=0,
143
+ index=0,
144
+ _internal_use=True,
145
+ bit_size=9,
146
+ bit_offset=0,
147
+ )
148
149
# __set__ and __get__ should raise a TypeError in case their self
150
# argument is not a ctype instance.
0 commit comments