RUF032 fix can produce strings that are invalid for Decimal
#13258
Labels
bug
Something isn't working
fixes
Related to suggested fixes for violations
help wanted
Contributions especially welcome
preview
Related to preview mode features
RUF032 produces an invalid string argument when the existing argument is a float with multiple unary operators.
Decimal
’s string parser only accepts one sign character.RUF032 also stringifies the argument if it is a float with the
~
unary operator. Applying~
to a float raises aTypeError
and should never happen, but if someone does write that, it is probably not helpful to convert it to a string, which makes it raise a different error that the surrounding code might not be expecting.The text was updated successfully, but these errors were encountered: