Skip to content

Negative Integer values -x in tables cycle through +x, --x, x, -x, ... when multiplied by -1 #346

@JamesParrott

Description

@JamesParrott

The bug is in Tomlkit 0.12

>python -ic "import tomlkit as tk"
>>> import sys
>>> sys.version_info
sys.version_info(major=3, minor=12, micro=1, releaselevel='final', serial=0)
>>> tk.__version__
'0.12.0'
>>> d =  tk.parse('x=-3')
>>> for __ in range(12):
...   d['x'] *= -1; print(tk.dumps(d))
...
x=+3
x=--3
x=3
x=-3
x=+3
x=--3
x=3
x=-3
x=+3
x=--3
x=3
x=-3

Tomlkit 0.11.8 shows the expected behaviour (in Python 3.11):

>python -ic "import tomlkit as tk"
>>> import sys
>>> sys.version_info
sys.version_info(major=3, minor=11, micro=4, releaselevel='final', serial=0)
>>> tk.__version__
'0.11.8'
>>> d =  tk.parse('x=-3')
>>> for __ in range(12):
...   d['x'] *= -1; print(tk.dumps(d))
...
x=3
x=-3
x=3
x=-3
x=3
x=-3
x=3
x=-3
x=3
x=-3
x=3
x=-3

Both on Windows 11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions