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

gh-76785: Add PyInterpreterConfig Helpers #117170

Merged

Conversation

ericsnowcurrently
Copy link
Member

@ericsnowcurrently ericsnowcurrently commented Mar 23, 2024

These helpers make it easier to customize and inspect the config used to initialize interpreters. This is especially helpful in our tests. I found inspiration from the PyConfig API for the PyInterpreterConfig dict conversion stuff. One motivation is that, later, we may end up exposing the config via the PEP 734 module.

As part of this PR I've also added a bunch of tests.

@ericsnowcurrently ericsnowcurrently enabled auto-merge (squash) April 2, 2024 20:29
@ericsnowcurrently ericsnowcurrently merged commit f341d60 into python:main Apr 2, 2024
34 checks passed
@ericsnowcurrently ericsnowcurrently deleted the interpreter-config-helpers branch April 2, 2024 20:38
@bedevere-bot
Copy link

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

Hi! The buildbot AMD64 Ubuntu NoGIL 3.x has failed when building commit f341d60.

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/all/#builders/1225/builds/1921) and take a look at the build logs.
  4. Check if the failure is related to this commit (f341d60) 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/all/#builders/1225/builds/1921

Failed tests:

  • test_tools
  • test_math

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

==

Click to see traceback logs
Note: switching to 'f341d6017dd4e80509b69b5a9e2625b71b70f205'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at f341d6017d gh-76785: Add PyInterpreterConfig Helpers (gh-117170)
Switched to and reset branch 'main'

make: *** [Makefile:2230: buildbottest] Error 2

@bedevere-bot
Copy link

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

Hi! The buildbot AMD64 Ubuntu NoGIL Refleaks 3.x has failed when building commit f341d60.

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/all/#builders/1226/builds/1600) and take a look at the build logs.
  4. Check if the failure is related to this commit (f341d60) 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/all/#builders/1226/builds/1600

Failed tests:

  • test_eintr
  • test_import
  • test_capi

Failed subtests:

  • test_mymanager_context_prestarted - test.test_multiprocessing_spawn.test_manager.WithManagerTestMyManager.test_mymanager_context_prestarted
  • test_flock - main.FNTLEINTRTest.test_flock
  • test_all - test.test_eintr.EINTRTests.test_all

Test leaking resources:

  • test_import: references
  • test_capi: memory blocks
  • test_capi: references
  • test_import: memory blocks

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

==

Click to see traceback logs
TracebackTests.test_broken_from) ... ok


TracebackTests.test_exec_failure_nested) ... ok


TracebackTests.test_exec_failure) ... ok


TracebackTests.test_unencodable_filename) ... ok


Traceback (most recent call last):
  File "/home/ubuntu/buildarea/3.x.itamaro-ubuntu-aws.refleak.nogil/build/Lib/test/_test_eintr.py", line 535, in test_flock
    self._lock(fcntl.flock, "flock")
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/buildarea/3.x.itamaro-ubuntu-aws.refleak.nogil/build/Lib/test/_test_eintr.py", line 517, in _lock
    raise Exception("failed to sync child in %.1f sec" % dt)
Exception: failed to sync child in 300.7 sec


TracebackTests.test_nonexistent_module) ... ok


TracebackTests.test_broken_parent_from) ... ok


TracebackTests.test_nonexistent_module_nested) ... ok


TracebackTests.test_syntax_error) ... ok


TracebackTests.test_broken_submodule) ... ok


Traceback (most recent call last):
  File "/home/ubuntu/buildarea/3.x.itamaro-ubuntu-aws.refleak.nogil/build/Lib/test/_test_multiprocessing.py", line 3030, in test_mymanager_context_prestarted
    self.assertEqual(manager._process.exitcode, 0)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: -15 != 0


TracebackTests.test_import_bug) ... ok


Traceback (most recent call last):
  File "/home/ubuntu/buildarea/3.x.itamaro-ubuntu-aws.refleak.nogil/build/Lib/test/test_eintr.py", line 17, in test_all
    script_helper.run_test_script(script)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/home/ubuntu/buildarea/3.x.itamaro-ubuntu-aws.refleak.nogil/build/Lib/test/support/script_helper.py", line 316, in run_test_script
    raise AssertionError(f"{name} failed")
AssertionError: script _test_eintr.py failed


TracebackTests.test_broken_parent) ... ok


Traceback (most recent call last):
  File "/home/ubuntu/buildarea/3.x.itamaro-ubuntu-aws.refleak.nogil/build/Lib/test/_test_eintr.py", line 535, in test_flock
    self._lock(fcntl.flock, "flock")
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/buildarea/3.x.itamaro-ubuntu-aws.refleak.nogil/build/Lib/test/_test_eintr.py", line 517, in _lock
    raise Exception("failed to sync child in %.1f sec" % dt)
Exception: failed to sync child in 300.3 sec

@ericsnowcurrently
Copy link
Member Author

I'm taking care of the refleaks.

ericsnowcurrently added a commit that referenced this pull request Apr 3, 2024
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
These helpers make it easier to customize and inspect the config used to initialize interpreters.  This is especially valuable in our tests.  I found inspiration from the PyConfig API for the PyInterpreterConfig dict conversion stuff.  As part of this PR I've also added a bunch of tests.
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
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.

2 participants