]> granicus.if.org Git - python/commitdiff
Fix BytecodeTestCase.assertNotInBytecode()
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 19 Jan 2016 07:48:48 +0000 (08:48 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 19 Jan 2016 07:48:48 +0000 (08:48 +0100)
Issue #11816: Fix bytecode_helper to handle correctly errors. Don't use
unassigned variables.

Lib/test/bytecode_helper.py

index 58b4209f5543bcb19a2d9d90102e283282936a4d..347d60337d763b5fe1da073eef269a52d5f55b6e 100644 (file)
@@ -32,8 +32,8 @@ class BytecodeTestCase(unittest.TestCase):
         """Throws AssertionError if op is found"""
         for instr in dis.get_instructions(x):
             if instr.opname == opname:
-                disassembly = self.get_disassembly_as_string(co)
-                if opargval is _UNSPECIFIED:
+                disassembly = self.get_disassembly_as_string(x)
+                if argval is _UNSPECIFIED:
                     msg = '%s occurs in bytecode:\n%s' % (opname, disassembly)
                 elif instr.argval == argval:
                     msg = '(%s,%r) occurs in bytecode:\n%s'