Skip to content
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

Don't break due to our handles getting closed by FD redirection #131

Merged
merged 1 commit into from Oct 9, 2018

Conversation

segevfiner
Copy link
Contributor

The fix is to simply not cache the std handles returned by GetStdHandle

This happens in Pytest on at least Python 3.5 and 3.6.
Please check pytest-dev/pytest#2465 for more information about this before merging.

The fix is to simply not cache the std handles returned by `GetStdHandle`

This happens in Pytest on at least Python 3.5 and 3.6.
Please check pytest-dev/pytest#2465 for more
information about this.
@wiggin15
Copy link
Collaborator

wiggin15 commented Jun 3, 2017

This could be related to #114 and maybe #104 (comment) is also slightly related

@segevfiner
Copy link
Contributor Author

segevfiner commented Sep 21, 2018

Arghhhh, I started seeing this on Python 2.7 too. Who knows what changed that it's now triggered there too. Be it Pytest version, Windows version, or what not... This PR seems to fix it for that instance too, anyhow.

I still find the fact that this is random completely baffling... 😕

@Victorious3
Copy link

I would love to see this one fixed as well, ran into it when using pytest.

@nicoddemus
Copy link

I would love to see this one fixed as well, ran into it when using pytest.

I second that. @wiggin15 anything missing here? Anything else we can help with to get this merged and a new PyPI release?

@wiggin15 wiggin15 merged commit 855937f into tartley:master Oct 9, 2018
@nicoddemus
Copy link

Great, thanks a lot @wiggin15!

@wiggin15
Copy link
Collaborator

wiggin15 commented Oct 9, 2018

Just to make sure - is the problem in pytest related to stream redirection?
Any chance you can summarize the problem in one sentence for the changelog - something like "don't cache the std handles to avoid problems where/with ..."
Thanks.

@segevfiner
Copy link
Contributor Author

Just to make sure - is the problem in pytest related to stream redirection?
Any chance you can summarize the problem in one sentence for the changelog - something like "don't cache the std handles to avoid problems where/with ..."
Thanks.

Yes. It is caused by FD redirection (dup2). Windows is closing the underlying handle and they don't always end up with the same number when reopened. Maybe something like: "Don't cache stdio HANDLEs, since they might be closed/changed by fd redirection".

@wiggin15
Copy link
Collaborator

Thanks. There's a new release, 0.4.0, with this change.

@nicoddemus
Copy link

Awesome, thanks @wiggin15 for the prompt merge and release! 🙇

@segevfiner segevfiner deleted the dont-break-on-fd-redirection branch October 10, 2018 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants