]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-130932: Fix incorrect exception handling in _PyModule_IsPossiblyShadowing (#130934)
authorShantanu <12621235+hauntsaninja@users.noreply.github.com>
Fri, 7 Mar 2025 07:41:28 +0000 (23:41 -0800)
committerGitHub <noreply@github.com>
Fri, 7 Mar 2025 07:41:28 +0000 (23:41 -0800)
commit0a9ae5ed48e6ea078f67ba03635c1c26209b5def
tree21bcadf86bbdd74e5c1d67b227bc3fe2a56954eb
parent8190571a75fc46278042e7fffbe8aeb1f71ab21d
gh-130932: Fix incorrect exception handling in _PyModule_IsPossiblyShadowing (#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.
```
Lib/test/test_import/__init__.py
Misc/NEWS.d/next/Core_and_Builtins/2025-03-06-22-56-02.gh-issue-130932.QVHaKT.rst [new file with mode: 0644]
Objects/moduleobject.c