bpo-36817: Do not decrement reference for expr_text on fstring = parsing failure (GH-13256)

This commit is contained in:
Pablo Galindo 2019-05-12 01:43:04 +01:00 committed by GitHub
parent 5833e94d86
commit 26f55c29f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View 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

View File

@ -5283,7 +5283,6 @@ unexpected_end_of_string:
/* Falls through to error. */
error:
Py_XDECREF(expr_text);
return -1;
}