Superpath is not stable

Example code:

import inkex

path = inkex.Path("M 10 10 h 10 v 10 h -10 Z") # a simple rectangle

tempsub = path.to_superpath()
for i in range(10):
    tempsub = inkex.CubicSuperPath(tempsub[0])
    inkex.errormsg(tempsub)

Expected:

When I take the first subpath of a path with one subpath and convert it to a superpath again, I expect that the path doesn't change (or at least almost doesn't change).

Actual result:

M 10 10 C 20 10 20 10 20 10 C 20 20 20 20 20 20 C 10 20 10 20 10 20 C 10 10 10 10 10 10
M 20 10 C 20 10 20 10 20 20 C 20 20 20 20 10 20 C 10 20 10 20 10 10 L 10 10
M 20 10 L 20 20 L 10 20 L 10 10 L 10 10
M 20 10 C 20 20 20 20 20 20 C 10 20 10 20 10 20 C 10 10 10 10 10 10 L 10 10
M 20 20 C 20 20 20 20 10 20 C 10 20 10 20 10 10 L 10 10 L 10 10
M 20 20 L 10 20 L 10 10 L 10 10 L 10 10
M 20 20 C 10 20 10 20 10 20 C 10 10 10 10 10 10 L 10 10 L 10 10
M 10 20 C 10 20 10 20 10 10 L 10 10 L 10 10 L 10 10
M 10 20 L 10 10 L 10 10 L 10 10 L 10 10
M 10 20 C 10 10 10 10 10 10 L 10 10 L 10 10 L 10 10

By the tenth run, Inkex forgets that the path was a rectangle and just outputs a line from 10 20 to 10 10 (with three nodes at 10 10).

The problem lies here:

https://gitlab.com/inkscape/extensions/-/blob/master/inkex/paths.py#L1517-1521

This shift of coordinates is performed for every run. I don't see why this is done at all.

If I just replace this by

self[-1].append(item)

the output is stable. But it breaks about 20 unit tests.

Edit: This is the root cause of #209 (closed).

Edited by Jonathan Neuhauser