[New-bugs-announce] [issue46442] testExceptionCleanupNames doesn't test anything?

Yellow Dusk report at bugs.python.org
Wed Jan 19 19:33:05 EST 2022


New submission from Yellow Dusk <yellow.dusk1590 at fastmail.com>:

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.

```
        try:
            raise Exception()
        except Exception as e:
            self.assertTrue(e)
            del e
        self.assertNotIn('e', locals())
```

----------
components: Tests
messages: 410997
nosy: yellowdusk1590
priority: normal
severity: normal
status: open
title: testExceptionCleanupNames doesn't test anything?
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46442>
_______________________________________


More information about the New-bugs-announce mailing list