Skip to content

gh-151510: Fix __lazy_import__ without frame - #151511

Merged
pablogsal merged 4 commits into
python:mainfrom
aisk:fix-lazy-import-no-frame
Jun 17, 2026
Merged

gh-151510: Fix __lazy_import__ without frame#151511
pablogsal merged 4 commits into
python:mainfrom
aisk:fix-lazy-import-no-frame

Conversation

@aisk

@aiskaisk commented Jun 15, 2026

Copy link
Copy Markdown
Member

I did not add a test because the fix is a straightforward, and exercising this would require extra _testcapi scaffolding to call __lazy_import__ without a Python frame.

Test added.

@sobolevnsobolevn 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.

Can we test this?

@sobolevnsobolevn 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.

LGTM! Thanks!

@pablogsalpablogsal added the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 17, 2026
@pablogsal

Copy link
Copy Markdown
Member

Thanks for the fix @aisk !

@pablogsal
pablogsal merged commit eff805b into python:mainJun 17, 2026
60 checks passed
@miss-islington-app

Copy link
Copy Markdown

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

@bedevere-app

Copy link
Copy Markdown

GH-151610 is a backport of this pull request to the 3.15 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 17, 2026
pablogsal pushed a commit that referenced this pull request Jun 17, 2026
)
gh-151510: Fix __lazy_import__ without frame (GH-151511)
(cherry picked from commit eff805b)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
@bedevere-bot

Copy link
Copy Markdown

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

Hi! The buildbot AMD64 Debian root 3.x (tier-1) has failed when building commit eff805b.

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/345/builds/14521) and take a look at the build logs.
  4. Check if the failure is related to this commit (eff805b) 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/345/builds/14521

Failed tests:

  • test.test_multiprocessing_fork.test_misc

Failed subtests:

  • test_large_pool - test.test_multiprocessing_fork.test_misc.MiscTestCase.test_large_pool

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

==

Click to see traceback logs
Traceback (most recent call last):
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/_test_multiprocessing.py", line 7311, in test_large_pool
rc, out, err = script_helper.assert_python_ok(testfn)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/support/script_helper.py", line 182, in assert_python_okreturn _assert_python(True, *args, **env_vars)
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/support/script_helper.py", line 167, in _assert_python
res.fail(cmd_line)
~~~~~~~~^^^^^^^^^^
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/support/script_helper.py", line 80, in failraiseAssertionError(f"Process return code is {exitcode}\n"...<10 lines>...f"---")
AssertionError: Process return code is 1
command line: ['/root/buildarea/3.x.angelico-debian-amd64/build/python', '-X', 'faulthandler', '-I', '@test_1237050_tmpæ']
Traceback (most recent call last):
File "<string>", line 1, in <module>import sys; from multiprocessing.forkserver import main; main(10, 11, ['__main__'], sys_argv=sys.argv[1:], **{'sys_path': ['/root/buildarea/3.x.angelico-debian-amd64/build/target/lib/python316.zip', '/root/buildarea/3.x.angelico-debian-amd64/build/Lib', '/root/buildarea/3.x.angelico-debian-amd64/build/build/lib.linux-x86_64-3.16'], 'main_path': '/root/buildarea/3.x.angelico-debian-amd64/build/build/test_python_1237050æ/@test_1237050_tmpæ', 'authkey_r': 13})
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/multiprocessing/forkserver.py", line 406, in main
pid = os.fork()
OSError: [Errno 12] Cannot allocate memory
Traceback (most recent call last):
File "/root/buildarea/3.x.angelico-debian-amd64/build/build/test_python_1237050æ/@test_1237050_tmpæ", line 4, in <module>with multiprocessing.Pool(200) as p:
~~~~~~~~~~~~~~~~~~~~^^^^^
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/multiprocessing/context.py", line 119, in Poolreturn Pool(processes, initializer, initargs, maxtasksperchild,
context=self.get_context())
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/multiprocessing/pool.py", line 215, in __init__self._repopulate_pool()
~~~~~~~~~~~~~~~~~~~~~^^
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/multiprocessing/pool.py", line 306, in _repopulate_poolreturnself._repopulate_pool_static(self._ctx, self.Process,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^self._processes,
^^^^^^^^^^^^^^^^...<3 lines>...self._maxtasksperchild,
^^^^^^^^^^^^^^^^^^^^^^^self._wrap_exception)
^^^^^^^^^^^^^^^^^^^^^
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/multiprocessing/pool.py", line 329, in _repopulate_pool_static
w.start()
~~~~~~~^^
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/multiprocessing/process.py", line 121, in startself._popen =self._Popen(self)
~~~~~~~~~~~^^^^^^
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/multiprocessing/context.py", line 309, in _Popenreturn Popen(process_obj)
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/multiprocessing/popen_forkserver.py", line 35, in __init__super().__init__(process_obj)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/multiprocessing/popen_fork.py", line 20, in __init__self._launch(process_obj)
~~~~~~~~~~~~^^^^^^^^^^^^^
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/multiprocessing/popen_forkserver.py", line 59, in _launchself.pid = forkserver.read_signed(self.sentinel)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/multiprocessing/forkserver.py", line 472, in read_signedraiseEOFError('unexpected EOF')
EOFError: unexpected EOF
---

@aisk
aisk deleted the fix-lazy-import-no-frame branch June 18, 2026 01:24
@aisk

aisk commented Jun 18, 2026

Copy link
Copy Markdown
MemberAuthor

The buildbot failure should be unrelated.

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.

4 participants

@aisk@pablogsal@bedevere-bot@sobolevn