in reply to bitmask check

Gotta watch out for precedence when dealing with the bitwise ops, but there's no precedence issue in the code you posted.

a & b == c # XXX, means a & (b == c) (a & b) == c # ok

Just trying to guess at your problem since the code you posted does not exhibit the problem you describe. (It exhibits a strict error.)