Pull in pexpect issue#39

See discussion in https://github.com/pexpect/pexpect/issues/39