mirror of
https://github.com/python/cpython.git
synced 2026-04-13 23:31:02 +00:00
gh-143055: Fix crash in AST unparser when unparsing dict comprehension unpacking (#145556)
This commit is contained in:
parent
d76df75f51
commit
255e79fa95
6 changed files with 26 additions and 6 deletions
|
|
@ -464,9 +464,15 @@ static int
|
|||
append_ast_dictcomp(PyUnicodeWriter *writer, expr_ty e)
|
||||
{
|
||||
APPEND_CHAR('{');
|
||||
APPEND_EXPR(e->v.DictComp.key, PR_TEST);
|
||||
APPEND_STR(": ");
|
||||
APPEND_EXPR(e->v.DictComp.value, PR_TEST);
|
||||
if (e->v.DictComp.value) {
|
||||
APPEND_EXPR(e->v.DictComp.key, PR_TEST);
|
||||
APPEND_STR(": ");
|
||||
APPEND_EXPR(e->v.DictComp.value, PR_TEST);
|
||||
}
|
||||
else {
|
||||
APPEND_STR("**");
|
||||
APPEND_EXPR(e->v.DictComp.key, PR_TEST);
|
||||
}
|
||||
APPEND(comprehensions, e->v.DictComp.generators);
|
||||
APPEND_CHAR_FINISH('}');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue