Skip to content

gh-130932: Fix incorrect exception handling in _PyModule_IsPossiblyShadowing #130934

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

Conversation

hauntsaninja
Copy link
Contributor

@hauntsaninja hauntsaninja commented Mar 6, 2025

Without the change in moduleobject.c, we sometimes end up returning NULL from _Py_module_getattro_impl without an exception raised.

./python.exe -m unittest test.test_import.ImportTests.test_script_shadowing_stdlib_cwd_failure
...
Assertion failed: (PyErr_Occurred()), function _PyObject_SetAttributeErrorContext, file object.c, line 1253.

I chose to not raise an exception here because I think it would be confusing for module attribute access to start raising something other than AttributeError if e.g. the cwd goes away

…iblyShadowing

I chose to not raise an exception here because I think it would be
confusing for module attribute access to start raising something other
than AttributeError if e.g. the cwd goes away

Without the change in moduleobject.c
```
./python.exe -m unittest test.test_import.ImportTests.test_script_shadowing_stdlib_cwd_failure
...
Assertion failed: (PyErr_Occurred()), function _PyObject_SetAttributeErrorContext, file object.c, line 1253.
```
@colesbury
Copy link
Contributor

Looks like Windows is not happy with the test trying to delete the current working directory

Copy link
Contributor

@colesbury colesbury left a comment

Choose a reason for hiding this comment

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

LGTM, assuming the CI passes

@hauntsaninja hauntsaninja merged commit 0a9ae5e into python:main Mar 7, 2025
42 checks passed
@miss-islington-app
Copy link

Thanks @hauntsaninja for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 7, 2025
…iblyShadowing (pythonGH-130934)

I chose to not raise an exception here because I think it would be
confusing for module attribute access to start raising something other
than AttributeError if e.g. the cwd goes away

Without the change in moduleobject.c
```
./python.exe -m unittest test.test_import.ImportTests.test_script_shadowing_stdlib_cwd_failure
...
Assertion failed: (PyErr_Occurred()), function _PyObject_SetAttributeErrorContext, file object.c, line 1253.
```
(cherry picked from commit 0a9ae5e)

Co-authored-by: Shantanu <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Mar 7, 2025

GH-130939 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Mar 7, 2025
hauntsaninja added a commit that referenced this pull request Mar 7, 2025
…siblyShadowing (GH-130934) (#130939)

gh-130932: Fix incorrect exception handling in _PyModule_IsPossiblyShadowing (GH-130934)

I chose to not raise an exception here because I think it would be
confusing for module attribute access to start raising something other
than AttributeError if e.g. the cwd goes away

Without the change in moduleobject.c
```
./python.exe -m unittest test.test_import.ImportTests.test_script_shadowing_stdlib_cwd_failure
...
Assertion failed: (PyErr_Occurred()), function _PyObject_SetAttributeErrorContext, file object.c, line 1253.
```
(cherry picked from commit 0a9ae5e)

Co-authored-by: Shantanu <[email protected]>
@bedevere-bot
Copy link

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

Hi! The buildbot AMD64 Fedora Stable LTO 3.13 (tier-1) has failed when building commit d5eb490.

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

Failed tests:

  • test.test_multiprocessing_spawn.test_manager

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-fedora-stable-x86_64.lto/build/Lib/multiprocessing/process.py", line 313, in _bootstrap
    self.run()
    ~~~~~~~~^^
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/_test_multiprocessing.py", line 1581, in f
    cond.release()
    ~~~~~~~~~~~~^^
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/managers.py", line 1066, in release
    return self._callmethod('release')
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/managers.py", line 847, in _callmethod
    raise convert_to_error(kind, result)
multiprocessing.managers.RemoteError: 
---------------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/managers.py", line 263, in serve_client
    self.id_to_local_proxy_obj[ident]
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
KeyError: '7f307c4f9dd0'


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/managers.py", line 265, in serve_client
    raise ke
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/managers.py", line 259, in serve_client
    obj, exposed, gettypeid = id_to_obj[ident]
                              ~~~~~~~~~^^^^^^^
KeyError: '7fedb141fe10'
---------------------------------------------------------------------------
Timeout (0:20:00)!
Thread 0x00007f873b171740 (most recent call first):
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/popen_fork.py", line 28 in poll
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/popen_fork.py", line 44 in wait
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/process.py", line 149 in join
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/case.py", line 614 in _callCleanup
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/case.py", line 688 in doCleanups
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/case.py", line 655 in run
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/case.py", line 707 in __call__
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/runner.py", line 240 in run
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/single.py", line 57 in _run_suite
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/single.py", line 37 in run_unittest
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/single.py", line 135 in test_func
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/single.py", line 91 in regrtest_runner
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/single.py", line 138 in _load_run_test
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/single.py", line 181 in _runtest_env_changed_exc
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/single.py", line 281 in _runtest
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/single.py", line 310 in run_single_test
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/worker.py", line 77 in worker_process
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/worker.py", line 112 in main
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/worker.py", line 116 in <module>
  File "<frozen runpy>", line 88 in _run_code
  File "<frozen runpy>", line 198 in _run_module_as_main


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/managers.py", line 265, in serve_client
    raise ke
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/managers.py", line 259, in serve_client
    obj, exposed, gettypeid = id_to_obj[ident]
                              ~~~~~~~~~^^^^^^^
KeyError: '7f307c4f9dd0'
---------------------------------------------------------------------------
Timeout (0:20:00)!
Thread 0x00007fe439c67740 (most recent call first):
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/popen_fork.py", line 28 in poll
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/popen_fork.py", line 44 in wait
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/process.py", line 149 in join
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/case.py", line 614 in _callCleanup
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/case.py", line 688 in doCleanups
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/case.py", line 655 in run
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/case.py", line 707 in __call__
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/unittest/runner.py", line 240 in run
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/single.py", line 57 in _run_suite
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/single.py", line 37 in run_unittest
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/single.py", line 135 in test_func
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/single.py", line 91 in regrtest_runner
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/single.py", line 138 in _load_run_test
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/single.py", line 181 in _runtest_env_changed_exc
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/single.py", line 281 in _runtest
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/single.py", line 310 in run_single_test
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/worker.py", line 77 in worker_process
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/worker.py", line 112 in main
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/libregrtest/worker.py", line 116 in <module>
  File "<frozen runpy>", line 88 in _run_code
  File "<frozen runpy>", line 198 in _run_module_as_main


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/process.py", line 313, in _bootstrap
    self.run()
    ~~~~~~~~^^
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/test/_test_multiprocessing.py", line 1580, in f
    woken.release()
    ~~~~~~~~~~~~~^^
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/managers.py", line 1066, in release
    return self._callmethod('release')
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/managers.py", line 847, in _callmethod
    raise convert_to_error(kind, result)
multiprocessing.managers.RemoteError: 
---------------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.lto/build/Lib/multiprocessing/managers.py", line 263, in serve_client
    self.id_to_local_proxy_obj[ident]
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
KeyError: '7fedb141fe10'

@bedevere-bot
Copy link

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

Hi! The buildbot PPC64LE RHEL8 LTO 3.13 (tier-2) has failed when building commit d5eb490.

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

Failed tests:

  • test.test_multiprocessing_spawn.test_manager

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-ppc64le.lto/build/Lib/multiprocessing/process.py", line 313, in _bootstrap
    self.run()
    ~~~~~~~~^^
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/_test_multiprocessing.py", line 1580, in f
    woken.release()
    ~~~~~~~~~~~~~^^
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/managers.py", line 1066, in release
    return self._callmethod('release')
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/managers.py", line 847, in _callmethod
    raise convert_to_error(kind, result)
multiprocessing.managers.RemoteError: 
---------------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/managers.py", line 263, in serve_client
    self.id_to_local_proxy_obj[ident]
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
KeyError: '7fff83a2f9b0'


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/managers.py", line 265, in serve_client
    raise ke
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/managers.py", line 259, in serve_client
    obj, exposed, gettypeid = id_to_obj[ident]
                              ~~~~~~~~~^^^^^^^
KeyError: '7fff976c7e10'
---------------------------------------------------------------------------
Timeout (0:40:00)!
Thread 0x00007fffb25245e0 (most recent call first):
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/popen_fork.py", line 28 in poll
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/popen_fork.py", line 44 in wait
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/process.py", line 149 in join
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/case.py", line 614 in _callCleanup
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/case.py", line 688 in doCleanups
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/case.py", line 655 in run
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/case.py", line 707 in __call__
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/runner.py", line 240 in run
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/single.py", line 57 in _run_suite
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/single.py", line 37 in run_unittest
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/single.py", line 135 in test_func
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/single.py", line 91 in regrtest_runner
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/single.py", line 138 in _load_run_test
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/single.py", line 181 in _runtest_env_changed_exc
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/single.py", line 281 in _runtest
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/single.py", line 310 in run_single_test
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/worker.py", line 77 in worker_process
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/worker.py", line 112 in main
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/worker.py", line 116 in <module>
  File "<frozen runpy>", line 88 in _run_code
  File "<frozen runpy>", line 198 in _run_module_as_main


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/managers.py", line 265, in serve_client
    raise ke
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/managers.py", line 259, in serve_client
    obj, exposed, gettypeid = id_to_obj[ident]
                              ~~~~~~~~~^^^^^^^
KeyError: '7fff83a2f9b0'
---------------------------------------------------------------------------
Timeout (0:40:00)!
Thread 0x00007fff861245e0 (most recent call first):
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/popen_fork.py", line 28 in poll
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/popen_fork.py", line 44 in wait
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/process.py", line 149 in join
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/case.py", line 614 in _callCleanup
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/case.py", line 688 in doCleanups
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/case.py", line 655 in run
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/case.py", line 707 in __call__
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/suite.py", line 122 in run
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/suite.py", line 84 in __call__
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/unittest/runner.py", line 240 in run
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/single.py", line 57 in _run_suite
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/single.py", line 37 in run_unittest
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/single.py", line 135 in test_func
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/single.py", line 91 in regrtest_runner
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/single.py", line 138 in _load_run_test
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/single.py", line 181 in _runtest_env_changed_exc
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/single.py", line 281 in _runtest
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/single.py", line 310 in run_single_test
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/worker.py", line 77 in worker_process
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/worker.py", line 112 in main
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/libregrtest/worker.py", line 116 in <module>
  File "<frozen runpy>", line 88 in _run_code
  File "<frozen runpy>", line 198 in _run_module_as_main


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/process.py", line 313, in _bootstrap
    self.run()
    ~~~~~~~~^^
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/test/_test_multiprocessing.py", line 1580, in f
    woken.release()
    ~~~~~~~~~~~~~^^
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/managers.py", line 1066, in release
    return self._callmethod('release')
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/managers.py", line 847, in _callmethod
    raise convert_to_error(kind, result)
multiprocessing.managers.RemoteError: 
---------------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-RHEL8-ppc64le.lto/build/Lib/multiprocessing/managers.py", line 263, in serve_client
    self.id_to_local_proxy_obj[ident]
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
KeyError: '7fff976c7e10'

seehwan pushed a commit to seehwan/cpython that referenced this pull request Apr 16, 2025
…iblyShadowing (python#130934)

I chose to not raise an exception here because I think it would be
confusing for module attribute access to start raising something other
than AttributeError if e.g. the cwd goes away

Without the change in moduleobject.c
```
./python.exe -m unittest test.test_import.ImportTests.test_script_shadowing_stdlib_cwd_failure
...
Assertion failed: (PyErr_Occurred()), function _PyObject_SetAttributeErrorContext, file object.c, line 1253.
```
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.

3 participants