#17064: fix sporadic permission errors in test_mailbox on windows.

Backported from patch by Jeremy Kloth.
#17171: backport behavior-confirming test from python3.
Issue #17111: Prevent test_surrogates (test_fileio) failure on OS X 10.4.

An odd bug in OS X 10.4 causes open(2) on a non-existent,
invalid-encoded filename to return errno 22, EINVAL: Invalid argument,
instead of the expected errno 2, ENOENT: No such file or directory,
*if* the containing directory is not empty.  That caused frequent
failures when running the buildbot tests on 10.4 depending on the state
of the test working directory.  The failure is easy to reproduce on
10.4 by running the test directly (not with regrtest), first in an empty
directory, then after adding a file to it.  The fix is to check for and
pass if either errno is returned.
Clean trailing whitespaces in Makefile.pre.in and grpmodule.c.
Issue #4591: Uid and gid values larger than 2**31 are supported now.