The current code is very broken with regards to the casting between
Python's integer type (either int in Py2 or the magic int/long in Py3)
and the uid_t/gid_t POSIX types. This means that the code is broken
outside "small" integer values.
By using uid_t/gid_t as appropriate, we can fix most of the problem
(at least as far as the new unittests are concerned). There's still no
automatic printf format modifier for them, so the code hardcodes
unsigned (which is what Linux/glibc defines them to), and also there's
a unittest that expects negative values to fail when set.