angr/claripy

Deprecation warning for `__truediv__` for `BV`s

zwimer opened this issue · 6 comments

Description

We currently support the syntax a / b for BVs, but we do not do true division, we do floor division; i.e. a // b.

We should mark the __truediv__ op for BVs as deprecated. It can continue to be supported, but it should be marked as deprecated and possibly print a deprecation warning.

Alternatives

No response

Additional context

No response

@ltfish Thoughts?

LGTM. PR please?

@ltfish Sure; how would you prefer a deprecation warning? import warnings; warnings.warn("abc", DeprecationWarning)? Or I can just print a message to the logger l.warning. Normally I'd do the former but I know angr has its own warning system so I'm not sure if there is pushback against using warnings in claripy

https://github.com/angr/angr/blob/master/angr/misc/ux.py#L16

You can copy the code and use it in claripy.

warnings.warn should already do that 'only once' thing, so I'll skip that.

That decorator used to use a print instead of a real warning message, so we can probably simplify that function if python's warning system already does the right thing