]> granicus.if.org Git - python/commitdiff
bpo-36817: Do not decrement reference for expr_text on fstring = parsing failure...
authorPablo Galindo <Pablogsal@gmail.com>
Sun, 12 May 2019 00:43:04 +0000 (01:43 +0100)
committerGitHub <noreply@github.com>
Sun, 12 May 2019 00:43:04 +0000 (01:43 +0100)
Lib/test/test_fstring.py
Python/ast.c

index a0fae50d1720745d0848166d8a8eabb3f531ca0a..3484fcecf1c5e2b00d58f5209afcc3e4faa04f70 100644 (file)
@@ -1148,6 +1148,8 @@ non-important content
         self.assertEqual(f'{C()=:x}', 'C()=FORMAT-x')
         self.assertEqual(f'{C()=!r:*^20}', 'C()=********REPR********')
 
+        self.assertRaises(SyntaxError, eval, "f'{C=]'")
+
     def test_walrus(self):
         x = 20
         # This isn't an assignment expression, it's 'x', with a format
index 585f8b3fba4cdce67b424bee1f85ba85ddf306f7..03da4e7f7f9affe0ba3d9b4a9bbf7d08d8a3a268 100644 (file)
@@ -5283,7 +5283,6 @@ unexpected_end_of_string:
     /* Falls through to error. */
 
 error:
-    Py_XDECREF(expr_text);
     return -1;
 
 }