[pydotorg-www] Bug in code example on wiki page about BitManipulation
felix.widmaier at web.de
Thu Sep 1 11:06:07 EDT 2016
Ah, I remember reading that as well. I did not think about it anymore,
since it works for me even with defining _fields_ first. Nonetheless I
agree that it would be better to fix this in the example as well (maybe
it is an platform dependent thing?).
I can take care of it. I just created an account with username
Am 01/09/2016 um 16:37 schrieb Mats Wichmann:
> On 09/01/2016 02:39 AM, Felix Widmaier wrote:
>> 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" == ("b",) 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).
> hmmm, not only are you right about that, but according to the
> documentation, "_anonymous_ must be already defined when _fields_ is
> assigned, otherwise it will have no effect" so there seems to be an
> additional problem in the example.
> perhaps you could file an issue in the tracker, if you don't want to get
> an account and fix it yourself (we would give you edit permission)
This email has been checked for viruses by Avast antivirus software.
More information about the pydotorg-www