-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Override rich.console pipe handler for rich 13.8.0+ #13073
Conversation
8cfd050
to
3b87263
Compare
Explicitly override `rich.console.Console.on_broken_pipe()` to reraise the original exception, to bring the behavior of rich 13.8.0+ in line with older versions. The new versions instead close output fds and exit with error instead, which prevents pip's pipe handler from firing. This is the minimal change needed to make pip's test suite pass after upgrading vendored rich. Bug pypa#13006 Bug pypa#13072
3b87263
to
099ae97
Compare
There were a few pushes on this PR and I'm pretty sure the comment got out of sync with what is happening:
It looks to me that it's not reraising the original exception but instead raising a new BrokenPipeError exception to simulate the same functionality as existed before. |
Sorry about that. Ruff was unhappy with the bare |
Hmm, IMO this is one of those cases where general best practise linting is suggesting the wrong thing, a callback of an exception handler where you want to preserve the exception is exactly the time a bare raise makes sense. I would have put a |
I think the problem is that we'd be relying on |
That is not my plan. I don't want to take any risk with 24.3.2. |
Thank you @mgorny! I'll update the vendoring PR sometime tomorrow. |
Thanks! |
Explicitly override
rich.console.Console.on_broken_pipe()
to reraise the original exception, to bring the behavior of rich 13.8.0+ in line with older versions. The new versions instead close output fds and exit with error instead, which prevents pip's pipe handler from firing. This is the minimal change needed to make pip's test suite pass after upgrading vendored rich.Bug #13006
Bug #13072
(I'm assuming this doesn't need a news item, since vendored
rich
update itself will have one)