Skip to content

gh-125942: Android: set stdout to errors="backslashreplace" #125943

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

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

mhsmith
Copy link
Member

@mhsmith mhsmith commented Oct 24, 2024

@mhsmith
Copy link
Member Author

mhsmith commented Oct 24, 2024

!buildbot android

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @mhsmith for commit 9f4d8e9 🤖

The command will test the builders whose names match following regular expression: android

The builders matched are:

  • aarch64 Android PR
  • AMD64 Android PR

@mhsmith mhsmith requested a review from freakboy3742 October 24, 2024 22:27
Copy link
Contributor

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

I think this mostly makes sense; one question about an aspect of the implementation inline.

sys.stderr = TextLogStream(
stderr_prio, "python.stderr", sys.stderr.fileno(),
errors=sys.stderr.errors)
stderr_prio, "python.stderr", sys.stderr.fileno())
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure I understand what is going on here - why is the errors kwarg no longer required?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because it's been added as a default in TextLogStream itself.

Copy link
Member Author

@mhsmith mhsmith Oct 25, 2024

Choose a reason for hiding this comment

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

The idea is that because of how the output is being logged, we want to explicitly use backslashreplace, rather than copying the existing errors setting.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it - I was misreading what sys.stdout.errors was passing in.

@bedevere-app
Copy link

bedevere-app bot commented Oct 24, 2024

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Copy link
Contributor

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

👍

sys.stderr = TextLogStream(
stderr_prio, "python.stderr", sys.stderr.fileno(),
errors=sys.stderr.errors)
stderr_prio, "python.stderr", sys.stderr.fileno())
Copy link
Contributor

Choose a reason for hiding this comment

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

Got it - I was misreading what sys.stdout.errors was passing in.

@freakboy3742 freakboy3742 merged commit b08570c into python:main Oct 25, 2024
41 of 43 checks passed
@miss-islington-app
Copy link

Thanks @mhsmith for the PR, and @freakboy3742 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 25, 2024
…ythonGH-125943)

Android stdout/err streams now use `backslashreplace` encoding to ensure readability of the Android log.
(cherry picked from commit b08570c)

Co-authored-by: Malcolm Smith <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Oct 25, 2024

GH-125950 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Oct 25, 2024
freakboy3742 pushed a commit that referenced this pull request Oct 25, 2024
…H-125943) (#125950)

gh-125942: Android: set stdout to `errors="backslashreplace"` (GH-125943)

Android stdout/err streams now use `backslashreplace` encoding to ensure readability of the Android log.
(cherry picked from commit b08570c)

Co-authored-by: Malcolm Smith <[email protected]>
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
…ython#125943)

Android stdout/err streams now use `backslashreplace` encoding to ensure readability of the Android log.
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.

Android: stdout is set to errors="surrogateescape"
3 participants