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

faulthandler: avoid accessing sys.stderr.encoding #10979

Merged
merged 1 commit into from
May 10, 2023

Conversation

bluetech
Copy link
Member

Fixes a pytest-xdist regression after 762bb61 (not yet released).

pytest-xdist patches sys.stderr with an object which doesn't have encoding. Strictly speaking, this should be fixed there (or more precisely, in execnet), but it will drop support for older versions which don't want.

But in any case, the fix turns out to simplify the code, using FD support added in Python 3.5, so it's good anyway!

Refs: pytest-dev/pytest-xdist#900

Fixes a pytest-xdist regression after
762bb61 (not yet released).

pytest-xdist patches sys.stderr with an object which doesn't have
`encoding`. Strictly speaking, this should be fixed there (or more
precisely, in execnet), but it will drop support for older versions
which don't want.

But in any case, the fix turns out to simplify the code, using FD
support added in Python 3.5, so it's good anyway!

Refs: pytest-dev/pytest-xdist#900
Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

As this seems to be only added for closing, i wonder if we could use a exitstack

@nicoddemus
Copy link
Member

Thanks @bluetech!

@bluetech
Copy link
Member Author

The coverage is 75% because the timeout code is not covered; there is a test for it but it's skipped due to sometimes crashing in CI:

True, marks=pytest.mark.skip(reason="sometimes crashes on CI (#7022)")
I did verify that it still passes locally.

@bluetech
Copy link
Member Author

As this seems to be only added for closing, i wonder if we could use a exitstack

It's used in the dump_traceback_later call.

@bluetech bluetech merged commit 271bdf6 into pytest-dev:main May 10, 2023
24 of 25 checks passed
@bluetech bluetech deleted the faulthandler-no-encoding branch May 10, 2023 11:17
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

3 participants