Skip to content

[3.13] gh-130940: Remove PyConfig.use_system_logger #131129

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 2 commits into from
Mar 13, 2025

Conversation

freakboy3742
Copy link
Contributor

@freakboy3742 freakboy3742 commented Mar 12, 2025

Pull request #127754 is a backport of #127592 to the 3.13 branch. However, this PR included a new attribute (use_system_logger) in PyConfig, which broke ABI compatibility on Apple platforms (macOS and iOS).

This was not detected because ABI compatibility checks are only performed on Linux, and the inclusion of the flag was gated with __APPLE__ preprocessor handling.

On macOS, removing the flag is no problem - it's a new feature, but an entirely optional one that would only be enabled by someone that has built (or updated) an app that embeds Python 3.13.2.

However, on iOS, the behavior enabled by this flag is required on iOS so that the logs generated by the simulator can be observed at all. More generally, there's very little reason that you'd not want stdout and stderr routed to the system log - every BeeWare app, for example, includes std-nslog, which implements effectively the same behavior.

This PR:

  • Removes the use_system_logger attribute from PyConfig.
  • Hard-codes the use of the system logger on iOS only.

This is, strictly, a change of behavior for 3.13 on iOS, unless you view "the output of Python's stdout/stderr is now visible in the app logs" as a bug that is resolved by this PR. My inclination is that this is such a signficant quality of life for iOS developers that it warrants being treated as a bugfix/improvement - but I wanted to flag the change in the strictest interpretation.

In an upcoming PR, I'll rework the introduction of the flag on the 3.14 branch to use the new PyInitConfig API (avoiding the ABI incompatibility), making the default value "enabled" on iOS, and "disabled" on macOS.


📚 Documentation preview 📚: https://cpython-previews--131129.org.readthedocs.build/

@freakboy3742
Copy link
Contributor Author

!buildbot iOS

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @freakboy3742 for commit 98b0415 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F131129%2Fmerge

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

The builders matched are:

  • iOS ARM64 Simulator PR

@@ -0,0 +1,4 @@
The ``PyConfig.use_system_logger`` attribute, introduced in Python 3.12.2, has
Copy link
Member

Choose a reason for hiding this comment

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

This change is for Python 3.13. Do you mean Python 3.13.2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦 I did.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@freakboy3742
Copy link
Contributor Author

@ned-deily Although @vstinner has approved this, I'm holding off merging until I get your signoff as a macOS/iOS platform delegate, because of the implications on iOS stdout logging.

@ned-deily
Copy link
Member

I’ll review it tomorrow.

Copy link
Member

@ned-deily ned-deily left a comment

Choose a reason for hiding this comment

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

LGTM, and all tests pass in the simulator. Thanks for taking this on.

@freakboy3742 freakboy3742 merged commit 589f422 into python:3.13 Mar 13, 2025
39 checks passed
@freakboy3742 freakboy3742 deleted the remove-system-log branch March 13, 2025 03:53
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot aarch64 Android 3.13 (tier-3) has failed when building commit 589f422.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1590/builds/504) and take a look at the build logs.
  4. Check if the failure is related to this commit (589f422) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1590/builds/504

Failed tests:

  • test_os

Failed subtests:

  • test_fpathconf - test.test_os.TestInvalidFD.test_fpathconf

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/data/user/0/org.python.testbed/files/python/lib/python3.13/test/test_os.py", line 2402, in test_fpathconf
    self.check(os.pathconf, "PC_NAME_MAX")
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/user/0/org.python.testbed/files/python/lib/python3.13/test/test_os.py", line 2325, in check
    f(os_helper.make_bad_fd(), *args, **kwargs)
    ~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: unrecognized configuration name

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot aarch64 RHEL8 LTO 3.13 (tier-2) has failed when building commit 589f422.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1393/builds/601) and take a look at the build logs.
  4. Check if the failure is related to this commit (589f422) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1393/builds/601

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-aarch64.lto/build/Lib/threading.py", line 1041, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-aarch64.lto/build/Lib/threading.py", line 992, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-aarch64.lto/build/Lib/test/test_interpreters/test_stress.py", line 47, in run
    interp = interpreters.create()
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-aarch64.lto/build/Lib/test/support/interpreters/__init__.py", line 76, in create
    id = _interpreters.create(reqrefs=True)
interpreters.InterpreterError: interpreter creation failed
k


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-aarch64.lto/build/Lib/threading.py", line 1041, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-aarch64.lto/build/Lib/threading.py", line 992, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-aarch64.lto/build/Lib/test/test_interpreters/test_stress.py", line 30, in task
    interp = interpreters.create()
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-aarch64.lto/build/Lib/test/support/interpreters/__init__.py", line 76, in create
    id = _interpreters.create(reqrefs=True)
interpreters.InterpreterError: interpreter creation failed
k

@freakboy3742
Copy link
Contributor Author

Both CI failures appear to be unrelated. The Android test has passed on a re-run.

freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Mar 14, 2025
)

Removes ``PyConfig.use_system_logger``, resolving an ABI incompatibility introduced in
3.13.2.

Changes the default behavior of iOS to *always* direct stdout/stderr to the system log.
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Mar 16, 2025
)

Removes ``PyConfig.use_system_logger``, resolving an ABI incompatibility introduced in
3.13.2.

Changes the default behavior of iOS to *always* direct stdout/stderr to the system log.
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Mar 16, 2025
)

Removes ``PyConfig.use_system_logger``, resolving an ABI incompatibility introduced in
3.13.2.

Changes the default behavior of iOS to *always* direct stdout/stderr to the system log.
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Mar 16, 2025
)

Removes ``PyConfig.use_system_logger``, resolving an ABI incompatibility introduced in
3.13.2.

Changes the default behavior of iOS to *always* direct stdout/stderr to the system log.
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Mar 16, 2025
Removes ``PyConfig.use_system_logger``, resolving an ABI incompatibility introduced in
3.13.2.

Changes the default behavior of iOS to *always* direct stdout/stderr to the system log.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants