Skip to content

Commit

Permalink
fix: redundant minus sign added to negative integers when multiplie b…
Browse files Browse the repository at this point in the history
…y -1

Fix #346

Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed May 7, 2024
1 parent e5e09e9 commit 990e325
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tomlkit/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,9 +619,8 @@ def as_string(self) -> str:

def _new(self, result):
raw = str(result)
if self._sign:
sign = "+" if result >= 0 else "-"
raw = sign + raw
if self._sign and result >= 0:
raw = f"+{raw}"

return Integer(result, self._trivia, raw)

Expand Down

0 comments on commit 990e325

Please sign in to comment.