Skip to content

gh-161996: Fix crash in Interpreter.exec() when the uncaught exception's __str__ raises - #162000

Merged
ZeroIntensity merged 3 commits into
python:mainfrom
aisk:fix-xi-excinfo-failure-crash
Nov 17, 2026
Merged

ZeroIntensity merged 3 commits into
python:mainfrom
aisk:fix-xi-excinfo-failure-crash

Conversation

@aisk

@aisk aisk commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

… raises

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@aisk aisk changed the title Fix crash in Interpreter.exec() when the uncaught exception's __str__ raises gh-161996: Fix crash in Interpreter.exec() when the uncaught exception's __str__ raises Nov 14, 2026
Comment thread Lib/test/test_interpreters/test_api.py Resolved
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Comment thread Lib/test/test_interpreters/test_api.py Resolved

@ZeroIntensity ZeroIntensity 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

@ZeroIntensity ZeroIntensity added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Nov 17, 2026
@ZeroIntensity
ZeroIntensity merged commit b90572a into python:main Nov 17, 2026
65 checks passed
@miss-islington-app

Copy link
Copy Markdown

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

@bedevere-app

bedevere-app Bot commented Nov 17, 2026

Copy link
Copy Markdown

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Nov 17, 2026
@bedevere-app

bedevere-app Bot commented Nov 17, 2026

Copy link
Copy Markdown

GH-162146 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Nov 17, 2026
ZeroIntensity pushed a commit that referenced this pull request Nov 17, 2026
…xception's `__str__` raises (GH-162000) (GH-162146)

(cherry picked from commit b90572a)

Co-authored-by: An Long <aisk@users.noreply.github.com>
ZeroIntensity pushed a commit that referenced this pull request Nov 17, 2026
…xception's `__str__` raises (GH-162000) (GH-162145)

(cherry picked from commit b90572a)

Co-authored-by: An Long <aisk@users.noreply.github.com>
@bedevere-bot

Copy link
Copy Markdown

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

Hi! The buildbot AMD64 Windows Server 2025 Refleaks 3.14 (tier-1) has failed when building commit 5893482.

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

Failed tests:

  • test_zipimport

Failed subtests:

  • test_overridden_unchecked_hash_based_pyc - test.test_importlib.source.test_file_loader.Source_SimpleTest.test_overridden_unchecked_hash_based_pyc
  • testZip64LargeFile - test.test_zipimport.UncompressedZipImportTestCase.testZip64LargeFile

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

==

Click to see traceback logs
Traceback (most recent call last):
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\test\support\os_helper.py", line 538, in temp_dir
    os.mkdir(path)
    ~~~~~~~~^^^^^^
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'B:\\uildarea\\3.14.ware-ws2025.refleak\\build\\build\\test_python_8980�'
Stack (most recent call last):
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\runpy.py", line 203, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\runpy.py", line 88, in _run_code
    exec(code, run_globals)
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\test\libregrtest\worker.py", line 141, in <module>
    main()
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\test\libregrtest\worker.py", line 136, in main
    with os_helper.temp_cwd(work_dir, quiet=True):
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\test\support\os_helper.py", line 611, in temp_cwd
    with temp_dir(path=name, quiet=quiet) as temp_path:


Traceback (most recent call last):
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\test\test_zipimport.py", line 1061, in testZip64LargeFile
    with open(TEMP_ZIP, "wb") as f:
         ~~~~^^^^^^^^^^^^^^^^
OSError: [Errno 28] No space left on device


Traceback (most recent call last):
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\test\test_zipimport.py", line 1064, in testZip64LargeFile
    f.seek(offset, os.SEEK_SET)
    ~~~~~~^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 28] No space left on device


Traceback (most recent call last):
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\test\test_importlib\util.py", line 299, in wrapper
    to_return = fxn(*args, **kwargs)
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\test\test_importlib\source\test_file_loader.py", line 334, in test_overridden_unchecked_hash_based_pyc
    py_compile.compile(
    ~~~~~~~~~~~~~~~~~~^
        source,
        ^^^^^^^
        invalidation_mode=py_compile.PycInvalidationMode.UNCHECKED_HASH,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\py_compile.py", line 172, in compile
    importlib._bootstrap_external._write_atomic(cfile, bytecode, mode)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap_external>", line 213, in _write_atomic
PermissionError: [WinError 5] Access is denied: 'B:\\tmpdir\\test_python_vs0v_h_4\\tmpquyc4mh0\\__pycache__\\_temp.cpython-314.pyc.2865176138880' -> 'B:\\tmpdir\\test_python_vs0v_h_4\\tmpquyc4mh0\\__pycache__\\_temp.cpython-314.pyc'


Traceback (test.test_zipimport.UncompressedZipImportTestCase.testTraceback) ... ok


Traceback (test.test_zipimport.CompressedZipImportTestCase.testTraceback) ... ok


Traceback (most recent call last):
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\test\support\os_helper.py", line 538, in temp_dir
    os.mkdir(path)
    ~~~~~~~~^^^^^^
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'B:\\uildarea\\3.14.ware-ws2025.refleak\\build\\build\\test_python_10716�'
Stack (most recent call last):
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\runpy.py", line 203, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\runpy.py", line 88, in _run_code
    exec(code, run_globals)
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\test\libregrtest\worker.py", line 141, in <module>
    main()
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\test\libregrtest\worker.py", line 136, in main
    with os_helper.temp_cwd(work_dir, quiet=True):
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "B:\uildarea\3.14.ware-ws2025.refleak\build\Lib\test\support\os_helper.py", line 611, in temp_cwd
    with temp_dir(path=name, quiet=quiet) as temp_path:

@aisk

aisk commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

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

Hi! The buildbot AMD64 Windows Server 2025 Refleaks 3.14 (tier-1) has failed when building commit 5893482.

What do you need to do:

1. Don't panic.

2. Check [the buildbot page in the devguide](https://devguide.python.org/buildbots/) 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/2268/builds/326) and take a look at the build logs.

4. Check if the failure is related to this commit ([5893482](https://github.com/python/cpython/commit/58934828d41c190fdb0463fba0a8cefd12694269)) 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/2268/builds/326

Failed tests:

* test_zipimport

Failed subtests:

* test_overridden_unchecked_hash_based_pyc - test.test_importlib.source.test_file_loader.Source_SimpleTest.test_overridden_unchecked_hash_based_pyc

* testZip64LargeFile - test.test_zipimport.UncompressedZipImportTestCase.testZip64LargeFile

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

==
Click to see traceback logs

I think this is not related to this change.

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.

4 participants