Fix file descriptor inheritance problem with python3.4 (#787)

Proposed fix for #787.

The added unit test will be skipped for python < 3.4.

Tox isn't configured for py34 yet, and adding it fails because of #768.