Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Error message says 'bytes', not bits when there aren't enough bits for BitsInteger #360
If you try to read
from construct import BitStruct, Bit, BitsInteger MY_MESSAGE = BitStruct( Bit, BitsInteger(17) ) MY_MESSAGE.parse(b'A')
While trying to parse a complicated object, I was confused as to what combination of my bit fields added to the number of bytes presented in the error message.
In the above example, it should report
That is not entirely a bug. You see, some classes are kind of agnostic with bits and bytes, so to make the story short, its just all called bytes. BitStream which is the class raising the exception does NOT know whether there are bits or bytes that are being processed. Despite the name of the class. Its a universal class that transforms bits->bytes and bytes->bits but can also do other transformations.
Other similar messages: