]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-130932: Fix incorrect exception handling in _PyModule_IsPossiblyShadowing...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 7 Mar 2025 09:28:47 +0000 (10:28 +0100)
committerGitHub <noreply@github.com>
Fri, 7 Mar 2025 09:28:47 +0000 (09:28 +0000)
commitd5eb490846d3deb76a8650e6f36e89aa074e11b5
tree0fe3ef4385fa4dba44163d1464db71bfb5c1e3a5
parent0c088e44428d74d701fe1fc80a4cb4fe124c43f0
[3.13] gh-130932: Fix incorrect exception handling in _PyModule_IsPossiblyShadowing (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 0a9ae5ed48e6ea078f67ba03635c1c26209b5def)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
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