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
testExceptionCleanupNames doesn't test anything? #90600
Comments
testExceptionCleanupNames() is supposed to test that the local variable bound to the exception instance is only visible inside the except block, and tests that by checking whether the name is in locals(), but it actually deletes the name before that, so it appears it isn't testing what it's supposed to be testing.
|
I don't know for sure, but maybe it's trying to test "del" interacting with the fact that the "as e" part doesn't escape the "except" clause, unlike normal assignments: >>> try:
... raise Exception
... except Exception as e:
... print('exception raised')
... foo = 1
...
exception raised
>>> foo
1
>>> e
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'e' is not defined |
Perhaps it's testing that the implicit |
Great point, it's indeed a good thing to test. So I guess the test is just incomplete. |
Thanks, @yellowdusk1590! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: