Omnibus Python 3.4 compatibility fixes

This is a bunch of Python 3.4-related fixes rolled into one to see if we can get it all working together.

Includes #1969 (or a modified form of the same issue), #1972, #1971, #1970, and #1948.  To keep this easier, we should probably keep the discussion to those individual pull requests, and I'll keep this updated as things get improved and merged elsewhere.

EDIT: This also incorporates #1945