diff options
author | Eric V. Smith <eric@trueblade.com> | 2016-02-05 18:23:08 -0500 |
---|---|---|
committer | Eric V. Smith <eric@trueblade.com> | 2016-02-05 18:23:08 -0500 |
commit | 265edce9784c4e47eb1c5533dd958185e124dc49 (patch) | |
tree | ed64907323943dfa4adcf072606002e5ccbb95ef /Lib/test/test_fstring.py | |
parent | e09d90ce157a738adbe05f513efd60d676da7333 (diff) | |
download | cpython-265edce9784c4e47eb1c5533dd958185e124dc49.tar.gz |
Fix issue 26287: While handling FORMAT_VALUE opcode, the top of stack was being corrupted if an error occurred in PyObject_Format().
Diffstat (limited to 'Lib/test/test_fstring.py')
-rw-r--r-- | Lib/test/test_fstring.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py index d6f781c846..a82dedffe4 100644 --- a/Lib/test/test_fstring.py +++ b/Lib/test/test_fstring.py @@ -692,6 +692,17 @@ f'{a * x()}'""" r"f'{a(4]}'", ]) + def test_errors(self): + # see issue 26287 + self.assertAllRaise(TypeError, 'non-empty', + [r"f'{(lambda: 0):x}'", + r"f'{(0,):x}'", + ]) + self.assertAllRaise(ValueError, 'Unknown format code', + [r"f'{1000:j}'", + r"f'{1000:j}'", + ]) + def test_loop(self): for i in range(1000): self.assertEqual(f'i:{i}', 'i:' + str(i)) |