/Users/lenny/repos/hwtypes/hwtypes/bit_vector.py:143: UserWarning: Truncating value from <class 'hwtypes.bit_vector.BitVector[32]'> to <class 'hwtypes.bit_vector.BitVector[21]'>
warnings.warn('Truncating value from {} to {}'.format(type(value), type(self)))
we now get something like this:
/Users/lenny/repos/magma_riscv_mini/tests/utils.py:11: UserWarning: Truncating value from <class 'hwtypes.bit_vector.BitVector[32]'> to <class 'hwtypes.bit_vector.BitVector[21]'>
return BitVector[21](x & ((1 << 20) - 1))
which is much more helpful. We set stacklevel to 3 instead of 2 because
we need to also ignore the metaclass call method, or else we get a
message like this:
/Users/lenny/repos/hwtypes/hwtypes/bit_vector_abc.py:28: UserWarning: Truncating value from <class 'hwtypes.bit_vector.BitVector[32]'> to <class 'hwtypes.bit_vector.BitVector[21]'>
return super().__call__(value, *args, **kwargs)
With this change, instead of a message like this:
we now get something like this:
which is much more helpful. We set stacklevel to 3 instead of 2 because we need to also ignore the metaclass call method, or else we get a message like this: