Terry J. Reedy added the comment:
The docs for pwd and spwd modules specify that some items are strings and
others are ints. Null strings should be '' and 'null' ints must be negative
since 0 can be a valid item. It happens that all but 2 pwd items are strings
and all but 2 spwd items are
New submission from Alex Waite:
spwd uses -1 rather than '' for empty attributes. This is different from the
behaviour in the pwd module, and makes it more difficult to generate a new,
valid shadow entry.
In my opinion, simply doing a ':'.join(str(val) for val in rec) should result
in a