New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore POSIX support to fdpexpect. #359
Conversation
while True: | ||
try: | ||
return select.select(iwtd, owtd, ewtd, timeout) | ||
except select.error: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we have python3 coverage here, in python 3 this raises InterruptedError exception, not select.error,
https://github.com/jquast/blessed/blob/master/blessed/terminal.py#L40
https://github.com/jquast/blessed/blob/master/blessed/terminal.py#L926
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't write the code, I just moved it:
https://github.com/pexpect/pexpect/blob/master/pexpect/pty_spawn.py#L805
If it has problems on Python3 they were there before I moved it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I am only just making note of it for ourselves. Better in writing than back of my mind!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. I followed the same pattern in the links you gave. We should now have Python3 coverage.
@MountainRider would you be interested in co-maintaining Pexpect? You seem to care about it and have a good handle on how it works. It's up to @jquast as well whether we add another co-maintainer, but I think it would be good to have another person on it. |
@takluyver: Yes, I would be interested. You folks have done a wonderful job of maintaining Pexpect, and I have been a free-rider user for a long time. It would be more than fair for me to donate some of my time to the project. |
Cool! @jquast, is that OK by you? I'll ask for your real identity, because I'm not quite comfortable giving push access to an pseudonymous Github handle. It needn't be publicly visible if you prefer to go by the pseudonym: drop me an email (address on my profile) if you're more comfortable that way. On Pexpect and all the shared-maintainership projects I work on, we try to work in pull requests for any non-trivial changes, giving each other a chance to review things. Pushing to master is OK for things like correcting simple typos. |
@takluyver I approve, agree also with everything @takluyver says. Keep in mind that the project is in maintenance mode, only making new releases for bugfixes or performance. When we do our job well, we're making very few and very careful releases! Thanks for joining |
My name is David Cullen. I work for Technicolor in Lawrenceville, GA, USA. You can reach me at david.cullen@technicolor.com. If you want to talk on the phone, we can exchange numbers and I can arrange to pay the bill. I updated my profile so that it shows my real name and work e-mail. |
Thanks, that's good enough for me :-) You should be getting an invitation to join the team. |
Something seems broken with my pull request. The Python3 tests are failing on Travis CI, but they pass when I run them locally. |
Certain operations are unusually slow on Travis, so it can expose race conditions that it's very hard to hit normally. |
I see the tests are passing now. :-) |
ok. Everything finally passed. However, I would like some help getting coverage on this line: |
I think that line can only be reached with a race condition - the select would have to be interrupted just before it times out, so that by the time |
ok. I rigged up a harness to try to force the race condition, but I was unsuccessful. I guess @takluyver and @jquast need to review my latest changes. |
|
||
def read_nonblocking(self, size=1, timeout=-1): | ||
'''The read_nonblocking method of fdspawn assumes that the file | ||
will never block. This is not the case for all file like objects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This docstring is a bit confusing - it would assume that if we weren't overriding it, but we are (on POSIX).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this change fix the confusion:
'''The read_nonblocking method of SpawnBase assumes that the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better, but ideally the docstring should start by describing what this method does, rather than the method on the parent class. I like docstrings to follow the format:
One line overview of functionality
<blank line>
If necessary, more detailed description of options, return value, and rationale.
This looks OK to me, though I haven't reviewed the new tests. |
This line look unreachable. Is this a copy-paste error? |
It does. I guess I overlooked it when separating ptyprocess out of pexpect. Feel free to remove it, since it clearly can't be reached. |
ok. What next? |
ok. I saw some more docstring feedback from you when I checked my email. I have updated the docstring for the |
Thanks, this is looking good. I'll give @jquast a chance to have another look, and then I think it can be merged. |
Looks great. I'll add a changelog entry and prepare it for a version bump before merge to master in a bit after dinner. Thanks again @MountainRider we appreciate the help! |
Factor out uninterruptible select and put the code in utils as
select_ignore_interrupts
. Modifyfdpexpect
to useselect_ignore_interrupts
ifos.name
isposix
. This should restore POSIX support without affecting Windows support.