[pydotorg-www] Bug in code example on wiki page about BitManipulation

Felix Widmaier felix.widmaier at web.de
Thu Sep 1 04:39:31 EDT 2016


Hi all,

I just noticed a small bug in the code example for bit fields on this 
page: https://wiki.python.org/moin/BitManipulation

There is a ctypes.Union defined as follows:

     class Flags( ctypes.Union ):
         _fields_ = [
                     ("b",      Flags_bits ),
                     ("asByte", c_uint8    )
                    ]
         _anonymous_ = ("b")

However, the `_anonymous_` attribute should be a tuple, i.e. the 
following would be correct:

     _anonymous_ = ("b",)

I guess in the given example it works without the comma since the name 
"b" consists of only one character and therefore "b"[0] == ("b",)[0] but 
for names with more than one char it does not work like this.

It would be great if someone with permission to edit the page could fix 
this (I don't have an account and I think it would not be worth the 
effort to create one for such a tiny edit).

Best regards,
Felix

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the pydotorg-www mailing list