Skip to content

gh-116622: Redirect stdout and stderr to system log when embedded in an Android app - #118063

Merged
vstinner merged 19 commits into
python:mainfrom
mhsmith:android-log
Apr 30, 2024
Merged

gh-116622: Redirect stdout and stderr to system log when embedded in an Android app#118063
vstinner merged 19 commits into
python:mainfrom
mhsmith:android-log

Conversation

@mhsmith

@mhsmithmhsmith commented Apr 18, 2024

Copy link
Copy Markdown
Member

When embedded in an app on current versions of Android, there's no easy way to monitor the process's stdout and stderr. So, as specified in PEP 738, this PR redirects them to the system log, which can be viewed using the developer tools.

@mhsmith

Copy link
Copy Markdown
MemberAuthor

@serhiy-storchaka: This PR is connected to the io module, which I see you've been working on recently. Are you able to review it?

Comment threadLib/_android_support.py
Comment threadLib/_android_support.py Outdated
Comment threadLib/_android_support.py Outdated
Comment threadLib/_android_support.py Outdated
Comment threadLib/_android_support.py
Comment threadLib/_android_support.py Outdated
Comment threadPython/pylifecycle.c Outdated
Comment threadPython/pylifecycle.c
Comment threadPython/pylifecycle.c Outdated
Comment threadPython/pylifecycle.c Outdated
Comment threadPython/pylifecycle.c
Comment threadLib/_android_support.py
Comment threadconfigure.ac Outdated

@encukouencukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!
This looks good to me, modulo a few small nitpicks. I'll let @serhiy-storchaka resolve the conversations he started.

Comment threadLib/_android_support.py
Comment threadLib/test/test_android.py Outdated
Comment threadLib/test/test_android.py Outdated
Comment threadLib/_android_support.py
Comment threadLib/_android_support.py Outdated
Comment threadLib/_android_support.py Outdated
Comment threadLib/_android_support.py
Comment threadLib/_android_support.py Outdated
Comment threadPython/pylifecycle.c
Comment threadLib/test/test_android.py
Comment threadLib/test/test_android.py
Comment threadLib/test/test_android.py

@serhiy-storchakaserhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for addressing my comments. LGTM in general. I left several minor suggestions, but they are not mandatory, you can implement or reject them on case by case base.

In any case I'm going to merge this PR after your answer.

Comment threadLib/_android_support.py Outdated
Comment threadLib/test/test_android.py Outdated
Comment threadLib/test/test_android.py Outdated

@encukouencukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Using the tooling and instructions in #117878, I've confirmed that this works for the test suite:

image

@erlend-aasland
erlend-aasland removed their request for review April 30, 2024 07:34
Comment threadPython/pylifecycle.c
Comment threadconfigure.ac Outdated
mhsmithand others added 2 commits April 30, 2024 12:54
Co-authored-by: Victor Stinner <vstinner@python.org>
@vstinner
vstinner merged commit 3b268f4 into python:mainApr 30, 2024
@vstinner

Copy link
Copy Markdown
Member

Merged. Let's see how it goes. It can be adjusted later if needed.

Nice change @mhsmith.

SonicField pushed a commit to SonicField/cpython that referenced this pull request May 8, 2024
SonicField pushed a commit to SonicField/cpython that referenced this pull request May 8, 2024
Sign up for freeto 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.

5 participants

@mhsmith@vstinner@encukou@serhiy-storchaka@erlend-aasland