mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Anonymous structure fields that have a bit-width specified did not work,
and they gave a strange error message from PyArg_ParseTuple: function takes exactly 2 arguments (3 given). With tests.
This commit is contained in:
parent
863f3d1fbf
commit
fdb62f0e5f
2 changed files with 11 additions and 2 deletions
|
@ -215,5 +215,14 @@ class BitFieldTest(unittest.TestCase):
|
|||
("b", c_ubyte, 4)]
|
||||
self.failUnlessEqual(sizeof(X), sizeof(c_byte))
|
||||
|
||||
def test_anon_bitfields(self):
|
||||
# anonymous bit-fields gave a strange error message
|
||||
class X(Structure):
|
||||
_fields_ = [("a", c_byte, 4),
|
||||
("b", c_ubyte, 4)]
|
||||
class Y(Structure):
|
||||
_anonymous_ = ["_"]
|
||||
_fields_ = [("_", X)]
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue