Skip to content

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Mar 7, 2025

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 12621235+hauntsaninja@users.noreply.github.com

…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 <12621235+hauntsaninja@users.noreply.github.com>
@hauntsaninja hauntsaninja merged commit d5eb490 into python:3.13 Mar 7, 2025
40 checks passed
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.

2 participants