bpo-36817: Do not decrement reference for expr_text on fstring = parsing failure (GH-13256)
This commit is contained in:
parent
5833e94d86
commit
26f55c29f2
|
@ -1148,6 +1148,8 @@ non-important content
|
||||||
self.assertEqual(f'{C()=:x}', 'C()=FORMAT-x')
|
self.assertEqual(f'{C()=:x}', 'C()=FORMAT-x')
|
||||||
self.assertEqual(f'{C()=!r:*^20}', 'C()=********REPR********')
|
self.assertEqual(f'{C()=!r:*^20}', 'C()=********REPR********')
|
||||||
|
|
||||||
|
self.assertRaises(SyntaxError, eval, "f'{C=]'")
|
||||||
|
|
||||||
def test_walrus(self):
|
def test_walrus(self):
|
||||||
x = 20
|
x = 20
|
||||||
# This isn't an assignment expression, it's 'x', with a format
|
# This isn't an assignment expression, it's 'x', with a format
|
||||||
|
|
|
@ -5283,7 +5283,6 @@ unexpected_end_of_string:
|
||||||
/* Falls through to error. */
|
/* Falls through to error. */
|
||||||
|
|
||||||
error:
|
error:
|
||||||
Py_XDECREF(expr_text);
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue