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