Fix numerous compatibility issues with IronPython

This fixes a number of compatibility issues with IronPython, bringing the numbers of test errors and failures from 78 and 28 to 5 and 4, respectively.