classification
Title: Unused variable in test_frame.py
Type: Stage: resolved
Components: Tests Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: pitrou, python-dev, vajrasky
Priority: normal Keywords: patch

Created on 2013-08-06 05:01 by vajrasky, last changed 2013-08-06 21:05 by pitrou. This issue is now closed.

Files
File name Uploaded Description Edit
test_frame.patch vajrasky, 2013-08-06 05:01 review
Messages (3)
msg194524 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-08-06 05:01
There is a unused variable in Lib/test/test_frame.py.

    def test_clear_executing_generator(self):
        # Attempting to clear an executing generator frame is forbidden.
        endly = False
        def g():
            nonlocal endly
            try:
                1/0
            except ZeroDivisionError as e:
                f = e.__traceback__.tb_frame
                with self.assertRaises(RuntimeError):
                    f.clear()
                with self.assertRaises(RuntimeError):
                    f.f_back.clear()
                yield f
            finally:
                endly = True
        gen = g()
        f = next(gen)
        self.assertFalse(endly)

The variable f is hanging without any purpose.

Attached the patch to give purpose to variable f.
msg194574 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-08-06 21:05
New changeset 34e1ecb8edd2 by Antoine Pitrou in branch 'default':
Issue #18666: improve test_frame a bit. Patch by Vajrasky Kok.
http://hg.python.org/cpython/rev/34e1ecb8edd2
msg194575 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-08-06 21:05
Good idea, thank you!
History
Date User Action Args
2013-08-06 21:05:51pitrousetstatus: open -> closed
resolution: fixed
messages: + msg194575

stage: resolved
2013-08-06 21:05:31python-devsetnosy: + python-dev
messages: + msg194574
2013-08-06 05:01:37vajraskycreate